lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7a52a818c1ae49ad7e44bb82fcea53d7f53d6e0.camel@siemens.com>
Date: Tue, 17 Sep 2024 08:25:19 +0000
From: "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
To: "gur.stavi@...wei.com" <gur.stavi@...wei.com>
CC: "Mark-MC.Lee@...iatek.com" <Mark-MC.Lee@...iatek.com>, "andrew@...n.ch"
	<andrew@...n.ch>, "bridge@...ts.linux.dev" <bridge@...ts.linux.dev>,
	"claudiu.manoil@....com" <claudiu.manoil@....com>, "dqfext@...il.com"
	<dqfext@...il.com>, "nbd@....name" <nbd@....name>, "davem@...emloft.net"
	<davem@...emloft.net>, "stable@...r.kernel.org" <stable@...r.kernel.org>,
	"angelogioacchino.delregno@...labora.com"
	<angelogioacchino.delregno@...labora.com>, "olteanv@...il.com"
	<olteanv@...il.com>, "linux-mediatek@...ts.infradead.org"
	<linux-mediatek@...ts.infradead.org>, "UNGLinuxDriver@...rochip.com"
	<UNGLinuxDriver@...rochip.com>, "bcm-kernel-feedback-list@...adcom.com"
	<bcm-kernel-feedback-list@...adcom.com>, "arinc.unal@...nc9.com"
	<arinc.unal@...nc9.com>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>,
	"daniel@...rotopia.org" <daniel@...rotopia.org>, "razor@...ckwall.org"
	<razor@...ckwall.org>, "kuba@...nel.org" <kuba@...nel.org>,
	"pabeni@...hat.com" <pabeni@...hat.com>, "roopa@...dia.com"
	<roopa@...dia.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"matthias.bgg@...il.com" <matthias.bgg@...il.com>, "f.fainelli@...il.com"
	<f.fainelli@...il.com>, "lorenzo@...nel.org" <lorenzo@...nel.org>,
	"sean.wang@...iatek.com" <sean.wang@...iatek.com>
Subject: Re: [PATCH 1/2] net: dsa: RCU-protect dsa_ptr in struct net_device

Hello Gur!

On Tue, 2024-09-17 at 11:10 +0300, Gur Stavi wrote:
> > @@ -1594,10 +1592,11 @@ void dsa_switch_shutdown(struct dsa_switch *ds)
> >   	}
> > 
> >   	/* Disconnect from further netdevice notifiers on the conduit,
> > -	 * since netdev_uses_dsa() will now return false.
> > +	 * from now on, netdev_uses_dsa_currently() will return false.
> >   	 */
> >   	dsa_switch_for_each_cpu_port(dp, ds)
> > -		dp->conduit->dsa_ptr = NULL;
> > +		rcu_assign_pointer(dp->conduit->dsa_ptr, NULL);
> > +	synchronize_rcu();
> > 
> >   	rtnl_unlock();
> >   out:
> 
> Hi, I am a newbie here. Thanks for the opportunity for learning more
> about rcu.
> Wouldn't it make more sense to call synchronize_rcu after rtnl_unlock?

This is indeed a question which is usually resolved other way around
(making locked section shorter), but in this particular case I thought that:
- we actually don't need giving rtnl lock sooner, which would potentially
  make synchronize_rcu() call longer (if another thread manages to wake up
  and claim the rtnl lock before synchronize_rcu())
- we are in shutdown phase, we don't need to minimize lock contention, we
  need to minimize the overall shutdown time

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ