Re: [PATCH net] u64_stats: fix u64_stats_init() for lockdep when used repeatedly in one file

From: Eric Dumazet
Date: Fri Apr 05 2024 - 17:09:21 EST


On Thu, Apr 4, 2024 at 9:58 AM Petr Tesarik <petr@xxxxxxxxxxx> wrote:
>
> Fix bogus lockdep warnings if multiple u64_stats_sync variables are
> initialized in the same file.
>
> With CONFIG_LOCKDEP, seqcount_init() is a macro which declares:
>
> static struct lock_class_key __key;
>
> Since u64_stats_init() is a function (albeit an inline one), all calls
> within the same file end up using the same instance, effectively treating
> them all as a single lock-class.
>
> Fixes: 9464ca650008 ("net: make u64_stats_init() a function")
> Closes: https://lore.kernel.org/netdev/ea1567d9-ce66-45e6-8168-ac40a47d1821@xxxxxxxxxxxx/
> Signed-off-by: Petr Tesarik <petr@xxxxxxxxxxx>

I thought I gave a Reviewed-by: tag already...

Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>