1. 28 Oct, 2019 1 commit
    • Jason Gunthorpe's avatar
      RDMA/mlx5: Use irq xarray locking for mkey_table · 1524b12a
      Jason Gunthorpe authored
      The mkey_table xarray is touched by the reg_mr_callback() function which
      is called from a hard irq. Thus all other uses of xa_lock must use the
      _irq variants.
      
        WARNING: inconsistent lock state
        5.4.0-rc1 #12 Not tainted
        --------------------------------
        inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
        python3/343 [HC0[0]:SC0[0]:HE1:SE1] takes:
        ffff888182be1d40 (&(&xa->xa_lock)->rlock#3){?.-.}, at: xa_erase+0x12/0x30
        {IN-HARDIRQ-W} state was registered at:
          lock_acquire+0xe1/0x200
          _raw_spin_lock_irqsave+0x35/0x50
          reg_mr_callback+0x2dd/0x450 [mlx5_ib]
          mlx5_cmd_exec_cb_handler+0x2c/0x70 [mlx5_core]
          mlx5_cmd_comp_handler+0x355/0x840 [mlx5_core]
         [..]
      
         Possible unsafe locking scenario:
      
               CPU0
               ----
          lock(&(&xa->xa_lock)->rlock#3);
          <Interrupt>
            lock(&(&xa->xa_lock)->rlock#3);
      
         *** DEADLOCK ***
      
        2 locks held by python3/343:
         #0: ffff88818eb4bd38 (&uverbs_dev->disassociate_srcu){....}, at: ib_uverbs_ioctl+0xe5/0x1e0 [ib_uverbs]
         #1: ffff888176c76d38 (&file->hw_destroy_rwsem){++++}, at: uobj_destroy+0x2d/0x90 [ib_uverbs]
      
        stack backtrace:
        CPU: 3 PID: 343 Comm: python3 Not tainted 5.4.0-rc1 #12
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x86/0xca
         print_usage_bug.cold.50+0x2e5/0x355
         mark_lock+0x871/0xb50
         ? match_held_lock+0x20/0x250
         ? check_usage_forwards+0x240/0x240
         __lock_acquire+0x7de/0x23a0
         ? __kasan_check_read+0x11/0x20
         ? mark_lock+0xae/0xb50
         ? mark_held_locks+0xb0/0xb0
         ? find_held_lock+0xca/0xf0
         lock_acquire+0xe1/0x200
         ? xa_erase+0x12/0x30
         _raw_spin_lock+0x2a/0x40
         ? xa_erase+0x12/0x30
         xa_erase+0x12/0x30
         mlx5_ib_dealloc_mw+0x55/0xa0 [mlx5_ib]
         uverbs_dealloc_mw+0x3c/0x70 [ib_uverbs]
         uverbs_free_mw+0x1a/0x20 [ib_uverbs]
         destroy_hw_idr_uobject+0x49/0xa0 [ib_uverbs]
         [..]
      
      Fixes: 04177915 ("RDMA/mlx5: Add missing synchronize_srcu() for MW cases")
      Link: https://lore.kernel.org/r/20191024234910.GA9038@ziepe.caAcked-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      1524b12a
  2. 24 Oct, 2019 2 commits
    • Parav Pandit's avatar
      IB/core: Avoid deadlock during netlink message handling · 549af008
      Parav Pandit authored
      When rdmacm module is not loaded, and when netlink message is received to
      get char device info, it results into a deadlock due to recursive locking
      of rdma_nl_mutex with the below call sequence.
      
      [..]
        rdma_nl_rcv()
        mutex_lock()
         [..]
         rdma_nl_rcv_msg()
            ib_get_client_nl_info()
               request_module()
                 iw_cm_init()
                   rdma_nl_register()
                     mutex_lock(); <- Deadlock, acquiring mutex again
      
      Due to above call sequence, following call trace and deadlock is observed.
      
        kernel: __mutex_lock+0x35e/0x860
        kernel: ? __mutex_lock+0x129/0x860
        kernel: ? rdma_nl_register+0x1a/0x90 [ib_core]
        kernel: rdma_nl_register+0x1a/0x90 [ib_core]
        kernel: ? 0xffffffffc029b000
        kernel: iw_cm_init+0x34/0x1000 [iw_cm]
        kernel: do_one_initcall+0x67/0x2d4
        kernel: ? kmem_cache_alloc_trace+0x1ec/0x2a0
        kernel: do_init_module+0x5a/0x223
        kernel: load_module+0x1998/0x1e10
        kernel: ? __symbol_put+0x60/0x60
        kernel: __do_sys_finit_module+0x94/0xe0
        kernel: do_syscall_64+0x5a/0x270
        kernel: entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        process stack trace:
        [<0>] __request_module+0x1c9/0x460
        [<0>] ib_get_client_nl_info+0x5e/0xb0 [ib_core]
        [<0>] nldev_get_chardev+0x1ac/0x320 [ib_core]
        [<0>] rdma_nl_rcv_msg+0xeb/0x1d0 [ib_core]
        [<0>] rdma_nl_rcv+0xcd/0x120 [ib_core]
        [<0>] netlink_unicast+0x179/0x220
        [<0>] netlink_sendmsg+0x2f6/0x3f0
        [<0>] sock_sendmsg+0x30/0x40
        [<0>] ___sys_sendmsg+0x27a/0x290
        [<0>] __sys_sendmsg+0x58/0xa0
        [<0>] do_syscall_64+0x5a/0x270
        [<0>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      To overcome this deadlock and to allow multiple netlink messages to
      progress in parallel, following scheme is implemented.
      
      1. Split the lock protecting the cb_table into a per-index lock, and make
         it a rwlock. This lock is used to ensure no callbacks are running after
         unregistration returns. Since a module will not be registered once it
         is already running callbacks, this avoids the deadlock.
      
      2. Use smp_store_release() to update the cb_table during registration so
         that no lock is required. This avoids lockdep problems with thinking
         all the rwsems are the same lock class.
      
      Fixes: 0e2d00eb ("RDMA: Add NLDEV_GET_CHARDEV to allow char dev discovery and autoload")
      Link: https://lore.kernel.org/r/20191015080733.18625-1-leon@kernel.orgSigned-off-by: default avatarParav Pandit <parav@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      549af008
    • Mark Zhang's avatar
      RDMA/nldev: Skip counter if port doesn't match · a15542bb
      Mark Zhang authored
      The counter resource should return -EAGAIN if it was requested for a
      different port, this is similar to how QP works if the users provides a
      port filter.
      
      Otherwise port filtering in netlink will return broken counter nests.
      
      Fixes: c4ffee7c ("RDMA/netlink: Implement counter dumpit calback")
      Link: https://lore.kernel.org/r/20191020062800.8065-1-leon@kernel.orgSigned-off-by: default avatarMark Zhang <markz@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      a15542bb
  3. 22 Oct, 2019 1 commit
  4. 18 Oct, 2019 5 commits
  5. 17 Oct, 2019 3 commits
  6. 04 Oct, 2019 12 commits
  7. 01 Oct, 2019 6 commits
  8. 30 Sep, 2019 10 commits
    • Linus Torvalds's avatar
      Linux 5.4-rc1 · 54ecb8f7
      Linus Torvalds authored
      54ecb8f7
    • Linus Torvalds's avatar
      Merge tag 'for-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · bb48a591
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A bunch of fixes that accumulated in recent weeks, mostly material for
        stable.
      
        Summary:
      
         - fix for regression from 5.3 that prevents to use balance convert
           with single profile
      
         - qgroup fixes: rescan race, accounting leak with multiple writers,
           potential leak after io failure recovery
      
         - fix for use after free in relocation (reported by KASAN)
      
         - other error handling fixups"
      
      * tag 'for-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: qgroup: Fix reserved data space leak if we have multiple reserve calls
        btrfs: qgroup: Fix the wrong target io_tree when freeing reserved data space
        btrfs: Fix a regression which we can't convert to SINGLE profile
        btrfs: relocation: fix use-after-free on dead relocation roots
        Btrfs: fix race setting up and completing qgroup rescan workers
        Btrfs: fix missing error return if writeback for extent buffer never started
        btrfs: adjust dirty_metadata_bytes after writeback failure of extent buffer
        Btrfs: fix selftests failure due to uninitialized i_mode in test inodes
      bb48a591
    • Linus Torvalds's avatar
      Merge tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linux · 80b29b6b
      Linus Torvalds authored
      Pull csky updates from Guo Ren:
       "This round of csky subsystem just some fixups:
      
         - Fix mb() synchronization problem
      
         - Fix dma_alloc_coherent with PAGE_SO attribute
      
         - Fix cache_op failed when cross memory ZONEs
      
         - Optimize arch_sync_dma_for_cpu/device with dma_inv_range
      
         - Fix ioremap function losing
      
         - Fix arch_get_unmapped_area() implementation
      
         - Fix defer cache flush for 610
      
         - Support kernel non-aligned access
      
         - Fix 610 vipt cache flush mechanism
      
         - Fix add zero_fp fixup perf backtrace panic
      
         - Move static keyword to the front of declaration
      
         - Fix csky_pmu.max_period assignment
      
         - Use generic free_initrd_mem()
      
         - entry: Remove unneeded need_resched() loop"
      
      * tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linux:
        csky: Move static keyword to the front of declaration
        csky: entry: Remove unneeded need_resched() loop
        csky: Fixup csky_pmu.max_period assignment
        csky: Fixup add zero_fp fixup perf backtrace panic
        csky: Use generic free_initrd_mem()
        csky: Fixup 610 vipt cache flush mechanism
        csky: Support kernel non-aligned access
        csky: Fixup defer cache flush for 610
        csky: Fixup arch_get_unmapped_area() implementation
        csky: Fixup ioremap function losing
        csky: Optimize arch_sync_dma_for_cpu/device with dma_inv_range
        csky/dma: Fixup cache_op failed when cross memory ZONEs
        csky: Fixup dma_alloc_coherent with PAGE_SO attribute
        csky: Fixup mb() synchronization problem
      80b29b6b
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · cef0aa0c
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A few fixes that have trickled in through the merge window:
      
         - Video fixes for OMAP due to panel-dpi driver removal
      
         - Clock fixes for OMAP that broke no-idle quirks + nfsroot on DRA7
      
         - Fixing arch version on ASpeed ast2500
      
         - Two fixes for reset handling on ARM SCMI"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        ARM: aspeed: ast2500 is ARMv6K
        reset: reset-scmi: add missing handle initialisation
        firmware: arm_scmi: reset: fix reset_state assignment in scmi_domain_reset
        bus: ti-sysc: Remove unpaired sysc_clkdm_deny_idle()
        ARM: dts: logicpd-som-lv: Fix i2c2 and i2c3 Pin mux
        ARM: dts: am3517-evm: Fix missing video
        ARM: dts: logicpd-torpedo-baseboard: Fix missing video
        ARM: omap2plus_defconfig: Fix missing video
        bus: ti-sysc: Fix handling of invalid clocks
        bus: ti-sysc: Fix clock handling for no-idle quirks
      cef0aa0c
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · cf4f493b
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "A few more tracing fixes:
      
         - Fix a buffer overflow by checking nr_args correctly in probes
      
         - Fix a warning that is reported by clang
      
         - Fix a possible memory leak in error path of filter processing
      
         - Fix the selftest that checks for failures, but wasn't failing
      
         - Minor clean up on call site output of a memory trace event"
      
      * tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        selftests/ftrace: Fix same probe error test
        mm, tracing: Print symbol name for call_site in trace events
        tracing: Have error path in predicate_parse() free its allocated memory
        tracing: Fix clang -Wint-in-bool-context warnings in IF_ASSIGN macro
        tracing/probe: Fix to check the difference of nr_args before adding probe
      cf4f493b
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · c710364f
      Linus Torvalds authored
      Pull more MMC updates from Ulf Hansson:
       "A couple more updates/fixes for MMC:
      
         - sdhci-pci: Add Genesys Logic GL975x support
      
         - sdhci-tegra: Recover loss in throughput for DMA
      
         - sdhci-of-esdhc: Fix DMA bug"
      
      * tag 'mmc-v5.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: host: sdhci-pci: Add Genesys Logic GL975x support
        mmc: tegra: Implement ->set_dma_mask()
        mmc: sdhci: Let drivers define their DMA mask
        mmc: sdhci-of-esdhc: set DMA snooping based on DMA coherence
        mmc: sdhci: improve ADMA error reporting
      c710364f
    • Krzysztof Wilczynski's avatar
      csky: Move static keyword to the front of declaration · 9af032a3
      Krzysztof Wilczynski authored
      Move the static keyword to the front of declaration of
      csky_pmu_of_device_ids, and resolve the following compiler
      warning that can be seen when building with warnings
      enabled (W=1):
      
      arch/csky/kernel/perf_event.c:1340:1: warning:
        ‘static’ is not at beginning of declaration [-Wold-style-declaration]
      Signed-off-by: default avatarKrzysztof Wilczynski <kw@linux.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      9af032a3
    • Valentin Schneider's avatar
      csky: entry: Remove unneeded need_resched() loop · a2139d3b
      Valentin Schneider authored
      Since the enabling and disabling of IRQs within preempt_schedule_irq()
      is contained in a need_resched() loop, we don't need the outer arch
      code loop.
      Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      a2139d3b
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 97f9a3c4
      Linus Torvalds authored
      Pull Documentation/process update from Greg KH:
       "Here are two small Documentation/process/embargoed-hardware-issues.rst
        file updates that missed my previous char/misc pull request.
      
        The first one adds an Intel representative for the process, and the
        second one cleans up the text a bit more when it comes to how the
        disclosure rules work, as it was a bit confusing to some companies"
      
      * tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        Documentation/process: Clarify disclosure rules
        Documentation/process: Volunteer as the ambassador for Intel
      97f9a3c4
    • Linus Torvalds's avatar
      Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 1eb80d6f
      Linus Torvalds authored
      Pull more vfs updates from Al Viro:
       "A couple of misc patches"
      
      * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        afs dynroot: switch to simple_dir_operations
        fs/handle.c - fix up kerneldoc
      1eb80d6f