[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YiuSvkjcYL15TGru@unreal>
Date: Fri, 11 Mar 2022 20:19:42 +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 10:06:11AM -0800, Jakub Kicinski wrote:
> On Fri, 11 Mar 2022 19:49:36 +0200 Leon Romanovsky wrote:
> > > 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);
>
> I think you missed my first sentence. Anyway, this is what I'll do in
> v1:
>
> #ifdef CONFIG_LOCKDEP
> /* For use in conjunction with LOCKDEP only e.g. rcu_dereference_protected() */
> bool devl_lock_is_held(struct devlink *devlink)
> {
> return lockdep_is_held(&devlink->lock);
> }
> EXPORT_SYMBOL_GPL(devl_lock_is_held);
> #endif
Because you put EXPORT_SYMBOL_GPL, this function will be used by drivers
too, which will need to write something like this:
if (IS_ENABLED(CONFIG_LOCKDEP))
devl_lock_is_held(devlink)
Otherwise, they will get linkage error in systems without LOCKDEP.
Thanks
Powered by blists - more mailing lists