1
0
Fork 0
alistair23-linux/drivers/infiniband/hw/hfi1
Dean Luick b85ced9151 IB/hfi1: Consistently call ops->remove outside spinlock
The ops->remove() callback was called by hfi1_mmu_unregister() with a
NULL mm argument while holding a spinlock.  In the case of sdma_rb_remove()
this caused it to pass current->mm to hfi1_release_user_pages()

This had 2 problems.  First this would attempt to acquire the mmap_sem
under a spin lock.  Second the use of current->mm is not always guaranteed
to be the proper mm when the fd is being closed.

Rather than depend on this implicit behavior we move all calls to
ops->remove outside of the spinlock.  This also allows the correct
mm to be used in the remove callback without fear of deadlock.

Because the MMU notifier is not guaranteed to hold mm->mmap_sem, but
usually does, we must delay all remove callbacks until out of the notifier,
when the callbacks can take the mmap_sem if they need to.

Code comments were added to clarify what the expectations are for the
users of the mmu rb tree.

Suggested-by: Jim Foraker <foraker1@llnl.gov>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-08-02 22:46:21 -04:00
..
Kconfig IB/hfi1: Use built-in i2c bit-shift bus adapter 2016-08-02 15:47:42 -04:00
Makefile IB/hfi1: Remove TWSI references 2016-08-02 15:47:42 -04:00
affinity.c IB/hfi1: Add sysfs entry to override SDMA interrupt affinity 2016-08-02 16:00:58 -04:00
affinity.h IB/hfi1: Add sysfs entry to override SDMA interrupt affinity 2016-08-02 16:00:58 -04:00
aspm.h
chip.c IB/hfi1: Use the same capability state for all shared contexts 2016-08-02 22:46:21 -04:00
chip.h IB/hfi1: Use the same capability state for all shared contexts 2016-08-02 22:46:21 -04:00
chip_registers.h IB/hfi1: Read all firmware versions 2016-08-02 16:00:58 -04:00
common.h
debugfs.c
debugfs.h
device.c
device.h
dma.c
driver.c IB/hfi1: Use hdr2sc function to calculate 5-bit SC 2016-08-02 16:00:58 -04:00
efivar.c
efivar.h
eprom.c
eprom.h
file_ops.c IB/hfi1: Fix TID caching actions 2016-08-02 22:46:21 -04:00
firmware.c IB/hfi1: Read all firmware versions 2016-08-02 16:00:58 -04:00
hfi.h IB/hfi1: Make the cache handler own its rb tree root 2016-08-02 22:46:21 -04:00
init.c IB/hfi1: Fix trace message units 2016-08-02 16:00:58 -04:00
intr.c
iowait.h
mad.c IB/hfi1: Fix "suspicious rcu_dereference_check() usage" warnings 2016-08-02 16:00:58 -04:00
mad.h IB/hfi1: Clean up port state structure definition 2016-08-02 12:00:54 -04:00
mmu_rb.c IB/hfi1: Consistently call ops->remove outside spinlock 2016-08-02 22:46:21 -04:00
mmu_rb.h IB/hfi1: Consistently call ops->remove outside spinlock 2016-08-02 22:46:21 -04:00
opa_compat.h
pcie.c IB/hfi1: Add static PCIe Gen3 CTLE tuning 2016-08-02 16:00:58 -04:00
pio.c IB/hfi1: Handle kzalloc failure in init_pervl_scs 2016-08-02 22:46:21 -04:00
pio.h
pio_copy.c
platform.c IB/hfi1: Reset QSFP on every run through channel tuning 2016-08-02 16:00:58 -04:00
platform.h
qp.c IB/hfi1: Rename struct ahg_ib_header to struct hfi1_ahg_info 2016-08-02 16:00:58 -04:00
qp.h IB/hfi1: Rename struct ahg_ib_header to struct hfi1_ahg_info 2016-08-02 16:00:58 -04:00
qsfp.c IB/hfi1: Use built-in i2c bit-shift bus adapter 2016-08-02 15:47:42 -04:00
qsfp.h IB/hfi1: Use built-in i2c bit-shift bus adapter 2016-08-02 15:47:42 -04:00
rc.c IB/rdmavt, hfi1: Fix NFSoRDMA failure with FRMR enabled 2016-08-02 16:00:58 -04:00
ruc.c IB/hfi1: Rename hfi1_pio_header to hfi1_sdma_header. 2016-08-02 16:00:58 -04:00
sdma.c
sdma.h
sdma_txreq.h
sysfs.c IB/hfi1: Add sysfs entry to override SDMA interrupt affinity 2016-08-02 16:00:58 -04:00
trace.c IB/hfi1: Suppress sparse warnings 2016-06-06 19:37:23 -04:00
trace.h IB/hfi1: Separate tracepoints into specific headers 2016-08-02 12:00:54 -04:00
trace_ctxts.h IB/hfi1: Fix trace sparse errors 2016-08-02 12:00:54 -04:00
trace_dbg.h IB/hfi1: Separate tracepoints into specific headers 2016-08-02 12:00:54 -04:00
trace_ibhdrs.h IB/hfi1: Separate tracepoints into specific headers 2016-08-02 12:00:54 -04:00
trace_misc.h IB/hfi1: Separate tracepoints into specific headers 2016-08-02 12:00:54 -04:00
trace_rc.h IB/hfi1: Separate tracepoints into specific headers 2016-08-02 12:00:54 -04:00
trace_rx.h IB/hfi1: Separate tracepoints into specific headers 2016-08-02 12:00:54 -04:00
trace_tx.h IB/hfi1: Fix trace sparse errors 2016-08-02 12:00:54 -04:00
uc.c IB/rdmavt, hfi1: Fix NFSoRDMA failure with FRMR enabled 2016-08-02 16:00:58 -04:00
ud.c IB/qib, IB/hfi1: Fix grh creation in ud loopback 2016-08-02 16:00:58 -04:00
user_exp_rcv.c IB/hfi1: Consistently call ops->remove outside spinlock 2016-08-02 22:46:21 -04:00
user_exp_rcv.h
user_pages.c IB/hfi1: Make use of mm consistent 2016-08-02 22:46:21 -04:00
user_sdma.c IB/hfi1: Consistently call ops->remove outside spinlock 2016-08-02 22:46:21 -04:00
user_sdma.h IB/hfi1: Use evict mmu rb operation 2016-08-02 22:46:21 -04:00
verbs.c IB/hfi1: Use hdr2sc function to calculate 5-bit SC 2016-08-02 16:00:58 -04:00
verbs.h IB/hfi1: Rename hfi1_pio_header to hfi1_sdma_header. 2016-08-02 16:00:58 -04:00
verbs_txreq.c IB/hfi1: Fix deadlock with txreq allocation slow path 2016-06-23 10:16:15 -04:00
verbs_txreq.h IB/hfi1: Rename hfi1_pio_header to hfi1_sdma_header. 2016-08-02 16:00:58 -04:00