[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRy+vc6nAZadagxT@unreal>
Date: Wed, 18 Aug 2021 11:03:09 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>,
Guangbin Huang <huangguangbin2@...wei.com>,
Jacob Keller <jacob.e.keller@...el.com>,
Jiri Pirko <jiri@...dia.com>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Salil Mehta <salil.mehta@...wei.com>,
Shannon Nelson <snelson@...sando.io>,
Yisen Zhuang <yisen.zhuang@...wei.com>,
Yufeng Mo <moyufeng@...wei.com>
Subject: Re: [PATCH net-next 3/6] devlink: Count struct devlink consumers
On Mon, Aug 16, 2021 at 09:07:00AM -0700, Jakub Kicinski wrote:
> On Mon, 16 Aug 2021 18:53:45 +0300 Leon Romanovsky wrote:
> > On Mon, Aug 16, 2021 at 08:47:41AM -0700, Jakub Kicinski wrote:
> > > On Sat, 14 Aug 2021 12:57:28 +0300 Leon Romanovsky wrote:
> > > > From: Leon Romanovsky <leonro@...dia.com>
> > > >
> > > > The struct devlink itself is protected by internal lock and doesn't
> > > > need global lock during operation. That global lock is used to protect
> > > > addition/removal new devlink instances from the global list in use by
> > > > all devlink consumers in the system.
> > > >
> > > > The future conversion of linked list to be xarray will allow us to
> > > > actually delete that lock, but first we need to count all struct devlink
> > > > users.
> > >
> > > Not a problem with this set but to state the obvious the global devlink
> > > lock also protects from concurrent execution of all the ops which don't
> > > take the instance lock (DEVLINK_NL_FLAG_NO_LOCK). You most likely know
> > > this but I thought I'd comment on an off chance it helps.
> >
> > The end goal will be something like that:
> > 1. Delete devlink lock
> > 2. Rely on xa_lock() while grabbing devlink instance (past devlink_try_get)
> > 3. Convert devlink->lock to be read/write lock to make sure that we can run
> > get query in parallel.
> > 4. Open devlink netlink to parallel ops, ".parallel_ops = true".
>
> IIUC that'd mean setting eswitch mode would hold write lock on
> the dl instance. What locks does e.g. registering a dl port take
> then?
write lock, because we are adding port to devlink->port_list.
9099 int devlink_port_register(struct devlink *devlink,
9100 struct devlink_port *devlink_port,
9101 unsigned int port_index)
9102 {
...
9115 list_add_tail(&devlink_port->list, &devlink->port_list);
Powered by blists - more mailing lists