Re: [PATCH net] net: add inline annotation to fix the build warning

From: Eric Dumazet
Date: Thu Oct 03 2024 - 10:20:05 EST


On Thu, Oct 3, 2024 at 3:57 PM Moon Yeounsu <yyyynoom@xxxxxxxxx> wrote:
>
> On Wed, Oct 2, 2024 at 11:41 PM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
> >
> > On Wed, Oct 2, 2024 at 3:47 PM Moon Yeounsu <yyyynoom@xxxxxxxxx> wrote:
> > >
> > > Moon is stupid. He doesn't understand what's going on. It makes me upset.
> > >
> > > https://lore.kernel.org/netdev/20240919145609.GF1571683@xxxxxxxxxx/
> > >
> > > Simon did the best effort for him, but he didn't remember that.
> > >
> > > Please don't reply to this careless patch.
> > >
> > > Replies to me to remember all the maintainer's dedication and thoughtfulness and to take this to heart.
> > >
> > > Before I send the patch, I'll check it again and again. And fix the subject `net` to `net-next`.
> > >
> > > I'm very very disappointed to myself :(
> >
> > LOCKDEP is more powerful than sparse, I would not bother with this at all.
>
> Totally agree with that. `Sparse` has a lot of problems derived from its nature.
> And It is too annoying to silence the warning message. I know that
> this patch just fixes for a fix. (What a trivial?)
> But, even though `LOCKDEP` is more powerful than `Sparse`, that can't
> be the reason to ignore the warning message.
>
> It is only my opinion and this topic may be outside of the net
> subsystem. Please don't be offended by my words and ignorance. I don't
> want to make a problem, rather want to fix a problem.
> If there's no reason to use `Sparse`, then, how about just removing it
> from the kernel? If It can't, we have to make Sparse more useful at
> least make to have to care about this warning message.

sparse is not in the kernel. Feel free to remove it from your hosts.

Anyway, the __acquires(XXX) annotations means nothing, XXX is
completely ignored.

$ diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 09e31757e96c7472af2a9dfff7a731d4d076aa11..50fc48c6d0c99d91f5a8eb15c4e3dd0304a83e0b
100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2888,7 +2888,7 @@ static struct key_vector
*fib_route_get_idx(struct fib_route_iter *iter,
}

static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos)
- __acquires(RCU)
+ __acquires(some_random_stuff)
{
struct fib_route_iter *iter = seq->private;
struct fib_table *tb;


$ make C=1 net/ipv4/fib_trie.o
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
DESCEND bpf/resolve_btfids
INSTALL libsubcmd_headers
CC net/ipv4/fib_trie.o
CHECK net/ipv4/fib_trie.c

No error at all.

It also does not know about conditional locking, it is quite useless.