[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB508996B0D00B5FE6187AF085D63E9@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Wed, 9 Nov 2022 20:11:55 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Leon Romanovsky <leon@...nel.org>, ivecera <ivecera@...hat.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"sassmann@...hat.com" <sassmann@...hat.com>,
"Piotrowski, Patryk" <patryk.piotrowski@...el.com>,
SlawomirX Laba <slawomirx.laba@...el.com>,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>,
"David S. Miller" <davem@...emloft.net>,
"Eric Dumazet" <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"moderated list:INTEL ETHERNET DRIVERS"
<intel-wired-lan@...ts.osuosl.org>,
open list <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net] iavf: Do not restart Tx queues after reset task
failure
> -----Original Message-----
> From: Leon Romanovsky <leon@...nel.org>
> Sent: Wednesday, November 9, 2022 10:21 AM
> To: ivecera <ivecera@...hat.com>
> Cc: netdev@...r.kernel.org; sassmann@...hat.com; Keller, Jacob E
> <jacob.e.keller@...el.com>; Piotrowski, Patryk <patryk.piotrowski@...el.com>;
> SlawomirX Laba <slawomirx.laba@...el.com>; Brandeburg, Jesse
> <jesse.brandeburg@...el.com>; Nguyen, Anthony L
> <anthony.l.nguyen@...el.com>; David S. Miller <davem@...emloft.net>; Eric
> Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo
> Abeni <pabeni@...hat.com>; moderated list:INTEL ETHERNET DRIVERS <intel-
> wired-lan@...ts.osuosl.org>; open list <linux-kernel@...r.kernel.org>
> Subject: Re: [PATCH net] iavf: Do not restart Tx queues after reset task failure
>
> On Tue, Nov 08, 2022 at 11:25:02AM +0100, Ivan Vecera wrote:
> > After commit aa626da947e9 ("iavf: Detach device during reset task")
> > the device is detached during reset task and re-attached at its end.
> > The problem occurs when reset task fails because Tx queues are
> > restarted during device re-attach and this leads later to a crash.
>
> <...>
>
> > + if (netif_running(netdev)) {
> > + /* Close device to ensure that Tx queues will not be started
> > + * during netif_device_attach() at the end of the reset task.
> > + */
> > + rtnl_lock();
> > + dev_close(netdev);
> > + rtnl_unlock();
> > + }
>
> Sorry for my naive question, I see this pattern a lot (including RDMA),
> so curious. Everyone checks netif_running() outside of rtnl_lock, while
> dev_close() changes state bit __LINK_STATE_START. Shouldn't rtnl_lock()
> placed before netif_running()?
Yes I think you're right. A ton of people check it without the lock but I think thats not strictly safe. Is dev_close safe to call when netif_running is false? Why not just remove the check and always call dev_close then.
Thanks,
Jake
>
> Thanks
>
> > +
> > dev_err(&adapter->pdev->dev, "failed to allocate resources during
> reinit\n");
> > reset_finish:
> > rtnl_lock();
> > --
> > 2.37.4
> >
Powered by blists - more mailing lists