Re: [PATCH for-next v4] IB/usnic: fix deadlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes, I was testing on top of commits in https://github.com/jgunthorpe/linux/commits/device_locking_cleanup
I have tested the latest (with the updated patch) on branch wip/jgg-for-next

Thanks,
Parvi

> On Feb 18, 2019, at 8:38 PM, Jason Gunthorpe <jgg@xxxxxxxx> wrote:
> 
> On Sat, Feb 09, 2019 at 09:28:30AM -0800, Parvi Kaustubhi wrote:
>> There is a dead lock in usnic ib_register and netdev_notify
>> path.
>> 
>> 	usnic_ib_discover_pf()
>> 	| mutex_lock(&usnic_ib_ibdev_list_lock);
>> 	 | usnic_ib_device_add();
>> 	  | ib_register_device()
>> 	   | usnic_ib_query_port()
>> 	    | mutex_lock(&us_ibdev->usdev_lock);
>> 	     | ib_get_eth_speed()
>> 	      | rtnl_lock()
>> 
>> order of lock: &usnic_ib_ibdev_list_lock -> usdev_lock -> rtnl_lock
>> 
>> 	rtnl_lock()
>> 	 | usnic_ib_netdevice_event()
>> 	  | mutex_lock(&usnic_ib_ibdev_list_lock);
>> 
>> order of lock: rtnl_lock -> &usnic_ib_ibdev_list_lock
>> 
>> Solution is to use ib_device_get_by_netdev() to lookup ib_dev while
>> handling netdev/ inet events.
>> 
>> Signed-off-by: Parvi Kaustubhi <pkaustub@xxxxxxxxx>
>> Reviewed-by: Govindarajulu Varadarajan <gvaradar@xxxxxxxxx>
>> Reviewed-by: Tanmay Inamdar <tinamdar@xxxxxxxxx>
>> Changelog:
>> 
>> v3->v4
>> * Added missing ib_device_put*  calls.
>> * Fixed wonky control flow
>> 
>> v2->v3:
>> * Jason: drivers should not hold any locks while calling ib_unregister_device()
>> * Jason: use https://github.com/jgunthorpe/linux/commits/device_locking_cleanup
>> 
>> v1->v2:
>> * Have notifier blocks in usnic_ib_dev instead of using workqueue to defer
>> event handling.
>> drivers/infiniband/hw/usnic/usnic_ib_main.c | 30 ++++++++++++++---------------
>> 1 file changed, 14 insertions(+), 16 deletions(-)
> 
> I added the hunks to use setnedev from my as-yet-unsent patch and
> applies this to for-next. I assume you tested on top of that. You
> should probably test the final result.
> 
> Thanks,
> Jason





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux