[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250311081418.12713-1-kuniyu@amazon.com>
Date: Tue, 11 Mar 2025 01:12:50 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <amcohen@...dia.com>
CC: <horms@...nel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
<idosch@...dia.com>, <ivecera@...hat.com>, <jiri@...nulli.us>,
<kuba@...nel.org>, <netdev@...r.kernel.org>, <olteanv@...il.com>,
<pabeni@...hat.com>, <petrm@...dia.com>, <tobias@...dekranz.com>
Subject: Re: [PATCH net] net: switchdev: Convert blocking notification chain to a raw one
From: Simon Horman <horms@...nel.org>
Date: Mon, 10 Mar 2025 06:17:37 +0000
> On Wed, Mar 05, 2025 at 02:15:09PM +0200, Amit Cohen wrote:
> > A blocking notification chain uses a read-write semaphore to protect the
> > integrity of the chain. The semaphore is acquired for writing when
> > adding / removing notifiers to / from the chain and acquired for reading
> > when traversing the chain and informing notifiers about an event.
> >
> > In case of the blocking switchdev notification chain, recursive
> > notifications are possible which leads to the semaphore being acquired
> > twice for reading and to lockdep warnings being generated [1].
> >
> > Specifically, this can happen when the bridge driver processes a
> > SWITCHDEV_BRPORT_UNOFFLOADED event which causes it to emit notifications
> > about deferred events when calling switchdev_deferred_process().
> >
> > Fix this by converting the notification chain to a raw notification
> > chain in a similar fashion to the netdev notification chain. Protect
> > the chain using the RTNL mutex by acquiring it when modifying the chain.
> > Events are always informed under the RTNL mutex, but add an assertion in
> > call_switchdev_blocking_notifiers() to make sure this is not violated in
> > the future.
>
> Hi Amit,
>
> As you may be aware there is quite some activity to reduce the reliance on
> RTNL. However, as the events in question are already protected by RTNL
> I think the approach you have taken here is entirely reasonable.
It would be appreicated if Amit you can post a follow-up patch against
net-next.git to convert the rtnl_lock() to another lock or rtnl_net_lock().
Thanks!
p.s. thanks for ccing me, Vladimir!
Powered by blists - more mailing lists