[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YiuLsDa4jej7bVEz@unreal>
Date: Fri, 11 Mar 2022 19:49:36 +0200
From: Leon Romanovsky <leonro@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <idosch@...dia.com>, <petrm@...dia.com>,
<simon.horman@...igine.com>, <netdev@...r.kernel.org>,
<jiri@...nulli.us>
Subject: Re: [RFT net-next 1/6] devlink: expose instance locking and add
locked port registering
On Fri, Mar 11, 2022 at 09:39:13AM -0800, Jakub Kicinski wrote:
> On Fri, 11 Mar 2022 18:57:35 +0200 Leon Romanovsky wrote:
> > On Fri, Mar 11, 2022 at 08:26:11AM -0800, Jakub Kicinski wrote:
> > > On Fri, 11 Mar 2022 18:09:36 +0200 Leon Romanovsky wrote:
> > > > What about this?
> > >
> > > Is it better?
> >
> > I think so. It doesn't create shadow dependency on LOCKDEP.
> > In your variant, all users of this call will generate WARN
> > in production systems that run without lockdep.
>
> No, no, that function is mostly for rcu dereference checking.
> The calls should be eliminated as dead code on production systems.
On systems without LOCKDEP, the devl_lock_is_held function will be
generated to be like this:
bool devl_lock_is_held(struct devlink *devlink)
{
return WARN_ON_ONCE(true);
}
EXPORT_SYMBOL_GPL(devl_lock_is_held);
>
> > So if you want the "eliminate" thing like you wrote in the comment,
> > the ifdef is a common solution.
>
> I think these days people try to use IS_ENABLED() whenever possible.
I'm one of such people, but here you put always WARN if LOCKDEP is not
enabled.
>
> > > Can do it you prefer, but I'd lean towards a version
> > > without an ifdef myself.
> >
> > So you need to add CONFIG_LOCKDEP dependency in devlink Kconfig.
>
> I don't see why.
Because of WARN_ON_ONCE.
Thanks
Powered by blists - more mailing lists