linux/drivers/infiniband
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
..
core IB core: Add port_xmit_wait counter 2016-07-12 10:46:24 -04:00
hw IB/hfi1: Consistently call ops->remove outside spinlock 2016-08-02 22:46:21 -04:00
sw IB/rdmavt: Eliminate redundant opcode test in mr ref clear 2016-08-02 22:46:21 -04:00
ulp IB/srpt: Reduce QP buffer size 2016-06-23 12:04:09 -04:00
Kconfig IB/hfi1: Move driver out of staging 2016-05-26 11:35:14 -04:00
Makefile IB/rdmavt: Create module framework and handle driver registration 2016-03-10 20:37:04 -05:00