[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM5PR03MB2538FDC44BA03431F1D8272CCA1E0@DM5PR03MB2538.namprd03.prod.outlook.com>
Date: Thu, 11 Aug 2016 15:38:41 +0000
From: Haiyang Zhang <haiyangz@...rosoft.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
KY Srinivasan <kys@...rosoft.com>
Subject: RE: [PATCH net 4/4] hv_netvsc: avoid deadlocks between rtnl lock and
netvsc_inject_disable()
> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuznets@...hat.com]
> Sent: Thursday, August 11, 2016 6:59 AM
> To: netdev@...r.kernel.org
> Cc: devel@...uxdriverproject.org; linux-kernel@...r.kernel.org; Haiyang
> Zhang <haiyangz@...rosoft.com>; KY Srinivasan <kys@...rosoft.com>
> Subject: [PATCH net 4/4] hv_netvsc: avoid deadlocks between rtnl lock and
> netvsc_inject_disable()
>
> Here is a deadlock scenario:
> - netvsc_vf_up() schedules netvsc_notify_peers() work and quits.
> - netvsc_vf_down() runs before netvsc_notify_peers() gets executed. As it
> is being executed from netdev notifier chain we hold rtnl lock when we
> get here.
> - we enter netvsc_inject_disable() and loop and wait till
> netvsc_notify_peers() drops vf_use_cnt.
> - netvsc_notify_peers() starts on some other CPU but netdev_notify_peers()
> will hang on rtnl_lock().
> - deadlock!
>
> Similar deadlocks are possible between netvsc_vf_{up,down}() and
> netvsc_unregister_vf() as it also waits till vf_use_cnt drops to zero.
> Instead of introducing additional synchronization I suggest we drop
> gwrk.dwrk completely and call NETDEV_NOTIFY_PEERS directly. As we're
> acting under rtnl lock this is legitimate.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
Acked-by: Haiyang Zhang <haiyangz@...rosoft.com>
Powered by blists - more mailing lists