[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<PH0PR18MB4734B9F8B2219DF15294F014C7112@PH0PR18MB4734.namprd18.prod.outlook.com>
Date: Tue, 7 Jan 2025 06:11:59 +0000
From: Shinas Rasheed <srasheed@...vell.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Haseeb Gani
<hgani@...vell.com>, Sathesh B Edara <sedara@...vell.com>,
Vimlesh Kumar
<vimleshk@...vell.com>,
"thaller@...hat.com" <thaller@...hat.com>,
"wizhao@...hat.com" <wizhao@...hat.com>,
"kheib@...hat.com"
<kheib@...hat.com>,
"konguyen@...hat.com" <konguyen@...hat.com>,
"horms@...nel.org" <horms@...nel.org>,
"einstein.xue@...axg.com"
<einstein.xue@...axg.com>,
Veerasenareddy Burru <vburru@...vell.com>,
Andrew
Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Abhijit
Ayarekar <aayarekar@...vell.com>,
Satananda Burla <sburla@...vell.com>
Subject: RE: [EXTERNAL] Re: [PATCH net v4 1/4] octeon_ep: fix race conditions
in ndo_get_stats64
Hi Jakub,
Thanks for the reply, will revert
> -----Original Message-----
> From: Jakub Kicinski <kuba@...nel.org>
> Sent: Tuesday, January 7, 2025 2:27 AM
> To: Shinas Rasheed <srasheed@...vell.com>
> Cc: netdev@...r.kernel.org; linux-kernel@...r.kernel.org; Haseeb Gani
> <hgani@...vell.com>; Sathesh B Edara <sedara@...vell.com>; Vimlesh
> Kumar <vimleshk@...vell.com>; thaller@...hat.com; wizhao@...hat.com;
> kheib@...hat.com; konguyen@...hat.com; horms@...nel.org;
> einstein.xue@...axg.com; Veerasenareddy Burru <vburru@...vell.com>;
> Andrew Lunn <andrew+netdev@...n.ch>; David S. Miller
> <davem@...emloft.net>; Eric Dumazet <edumazet@...gle.com>; Paolo
> Abeni <pabeni@...hat.com>; Abhijit Ayarekar <aayarekar@...vell.com>;
> Satananda Burla <sburla@...vell.com>
> Subject: Re: [EXTERNAL] Re: [PATCH net v4 1/4] octeon_ep: fix race conditions
> in ndo_get_stats64
>
> On Mon, 6 Jan 2025 05: 57: 09 +0000 Shinas Rasheed wrote: > > > struct
> octep_device *oct = netdev_priv(netdev); > > > int q; > > > > > > - if
> (netif_running(netdev)) > > > - octep_ctrl_net_get_if_stats(oct,
> On Mon, 6 Jan 2025 05:57:09 +0000 Shinas Rasheed wrote:
> > > > struct octep_device *oct = netdev_priv(netdev);
> > > > int q;
> > > >
> > > > - if (netif_running(netdev))
> > > > - octep_ctrl_net_get_if_stats(oct,
> > > > - OCTEP_CTRL_NET_INVALID_VFID,
> > > > - &oct->iface_rx_stats,
> > > > - &oct->iface_tx_stats);
> > > > -
> > > > tx_packets = 0;
> > > > tx_bytes = 0;
> > > > rx_packets = 0;
> > > > rx_bytes = 0;
> > > > +
> > > > + if (!netif_running(netdev))
> > > > + return;
> > >
> > > So we'll provide no stats when the device is down? That's not correct.
> > > The driver should save the stats from the freed queues (somewhere in
> > > the oct structure). Also please mention how this is synchronized
> > > against netif_running() changing its state, device may get closed while
> > > we're running..
> >
> > I ACK the 'save stats from freed queues and emit out stats when device is
> down'.
> >
> > About the synchronization, the reason I changed to simple netif_running
> check was to avoid
> > locks (as per previous patch version comments). Please do correct me if I'm
> wrong, but isn't the case
> > you mentioned protected by the rtnl_lock held by the netdev stack when it
> calls the ndo_op ?
>
> I don't see rtnl_lock being taken in the procfs path.
>
> FWIW I posted a test for the problem you're fixing in octeon,
> since it's relatively common among drivers:
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_20250105011525.1718380-2D1-2Dkuba-
> 40kernel.org&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=1OxLD4y-
> oxrlgQ1rjXgWtmLz1pnaDjD96sDq-
> cKUwK4&m=9gsH3cuOJoFpbgNiQc2gqY6_Cugh5GeBCKFU9mmblsBxpslPW2q
> VVBa1LG7w8qmb&s=-9Gao3oSw4wAp6L8V86hli4Bmqu3Po8jfOqNOtYwL-
> o&e=
> see also:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_linux-
> 2Dnetdev_nipa_wiki_Running-2Ddriver-
> 2Dtests&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=1OxLD4y-
> oxrlgQ1rjXgWtmLz1pnaDjD96sDq-
> cKUwK4&m=9gsH3cuOJoFpbgNiQc2gqY6_Cugh5GeBCKFU9mmblsBxpslPW2q
> VVBa1LG7w8qmb&s=q8uPNNae_-
> 4ps18BT6XOel9HsYApsxh4IN01HF2_ARw&e=
Powered by blists - more mailing lists