Subject: Re: [RFC PATCH net-next 0/4] net-sysfs: remove rtnl_trylock/restart_syscall use

From: Stephen Hemminger <[email-masked]>
Date: Wed, 18 Oct 2023 08:57:17 -0700

On Wed, 18 Oct 2023 17:47:42 +0200
Antoine Tenart <[email-masked]> wrote:

> Hi,
> 
> This is sent as an RFC because I believe this should be discussed (and
> some might want to do additional testing), but the code itself is ready.
> 
> Some time ago we tried to improve the rtnl_trylock/restart_syscall
> situation[1]. What happens is when there is rtnl contention, userspace
> accessing net sysfs attributes will spin and experience delays. This can
> happen in different situations, when sysfs attributes are accessed
> (networking daemon, configuration, monitoring) while operations under
> rtnl are performed (veth creation, driver configuration, etc). A few
> improvements can be done in userspace to ease things, like using the
> netlink interface instead, or polling less (or more selectively) the
> attributes; but in the end the root cause is always there and this keeps
> happening from time to time.
> 
> That initial effort however wasn't successful, although I think there
> was an interest, mostly because we found technical flaws and didn't find
> a working solution at the time. Some time later, we gave it a new try
> and found something more promising, but the patches fell off my radar. I
> recently had another look at this series, made more tests and cleaned it
> up.
> 
> The technical aspect is described in patch 1 directly in the code
> comments, with an additional important comment in patch 3. This was
> mostly tested by stress-testing net sysfs attributes (read/write ops)
> while adding/removing queues and adding/removing veths, all in parallel.
> 
> All comments are welcomed.

The trylock was introduced to deal with lock inversion.
It is not clear how this more complex solution prevents that.