[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241004204526.68765-1-kuniyu@amazon.com>
Date: Fri, 4 Oct 2024 13:45:26 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <kuba@...nel.org>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuni1840@...il.com>,
<kuniyu@...zon.com>, <netdev@...r.kernel.org>, <pabeni@...hat.com>
Subject: Re: [PATCH v2 net-next 2/4] rtnetlink: Add per-netns RTNL.
From: Jakub Kicinski <kuba@...nel.org>
Date: Fri, 4 Oct 2024 13:21:45 -0700
> On Wed, 2 Oct 2024 08:12:38 -0700 Kuniyuki Iwashima wrote:
> > +#ifdef CONFIG_DEBUG_NET_SMALL_RTNL
> > +void __rtnl_net_lock(struct net *net);
> > +void __rtnl_net_unlock(struct net *net);
> > +void rtnl_net_lock(struct net *net);
> > +void rtnl_net_unlock(struct net *net);
> > +int rtnl_net_lock_cmp_fn(const struct lockdep_map *a, const struct lockdep_map *b);
> > +#else
> > +#define __rtnl_net_lock(net)
> > +#define __rtnl_net_unlock(net)
> > +#define rtnl_net_lock(net) rtnl_lock()
> > +#define rtnl_net_unlock(net) rtnl_unlock()
>
> Let's make sure net is always evaluated?
> At the very least make sure the preprocessor doesn't eat it completely
> otherwise we may end up with config-dependent "unused variable"
> warnings down the line.
Sure, what comes to mind is void casting, which I guess is old-school
style ? Do you have any other idea or is this acceptable ?
#define __rtnl_net_lock(net) (void)(net)
#define __rtnl_net_unlock(net) (void)(net)
#define rtnl_net_lock(net) \
do { \
(void)(net); \
rtnl_lock(); \
} while (0)
#define rtnl_net_unlock(net) \
do { \
(void)(net); \
rtnl_unlock(); \
} while (0)
Powered by blists - more mailing lists