[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <410f016d-2ea6-45ae-895c-96fc34fdd1a3@redhat.com>
Date: Thu, 13 Feb 2025 12:03:51 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Simon Horman <horms@...nel.org>
Cc: Andy Whitcroft <apw@...onical.com>, Joe Perches <joe@...ches.com>,
Dwaipayan Ray <dwaipayanray1@...il.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v1 net-next] checkpatch: Discourage a new use of
rtnl_lock() variants.
On 2/11/25 8:04 AM, Kuniyuki Iwashima wrote:
> rtnl_lock() is a "Big Kernel Lock" in the networking slow path
> and still serialises most of RTM_(NEW|DEL|SET)* rtnetlink requests.
>
> Commit 76aed95319da ("rtnetlink: Add per-netns RTNL.") started a
> very large, in-progress, effort to make the RTNL lock scope per
> network namespace.
>
> However, there are still some patches that newly use rtnl_lock(),
> which is now discouraged, and we need to revisit it later.
>
> Let's warn about the case by checkpatch.
>
> The target functions are as follows:
>
> * rtnl_lock()
> * rtnl_trylock()
> * rtnl_lock_interruptible()
> * rtnl_lock_killable()
>
> and the warning will be like:
>
> WARNING: A new use of rtnl_lock() variants is discouraged, try to use rtnl_net_lock(net) variants
> #18: FILE: net/core/rtnetlink.c:79:
> + rtnl_lock();
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> It would be nice if this patch goes through net-next.git to catch
> new rtnl_lock() users by netdev CI.
> ---
> scripts/checkpatch.pl | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 7b28ad331742..09d5420436cc 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6995,6 +6995,12 @@ sub process {
> # }
> # }
>
> +# A new use of rtnl_lock() is discouraged as it's being converted to rtnl_net_lock(net).
> + if ($line =~ /^\+.*\brtnl_(try)?lock(_interruptible|_killable)?\(\)/) {
I think you need to add '\s*' just before '\(' to avoid the test being
fooled by some bad formatting.
Also I'm unsure if the '^\+.*' header is strictly required - it should
but some/most existing tests don't use it, do you know why?
Thanks,
Paolo
Powered by blists - more mailing lists