On Fri 15 Feb 2019 at 22:35, Cong Wang <xiyou.wangc...@gmail.com> wrote: > On Mon, Feb 11, 2019 at 12:56 AM Vlad Buslov <vla...@mellanox.com> wrote: >> +#ifdef CONFIG_PROVE_LOCKING >> +static inline bool lockdep_tcf_chain_is_locked(struct tcf_chain *chain) >> +{ >> + return lockdep_is_held(&chain->filter_chain_lock); >> +} >> +#else >> +static inline bool lockdep_tcf_chain_is_locked(struct tcf_block *chain) >> +{ >> + return true; >> +} >> +#endif /* #ifdef CONFIG_PROVE_LOCKING */ >> + >> +#define tcf_chain_dereference(p, chain) >> \ >> + rcu_dereference_protected(p, lockdep_tcf_chain_is_locked(chain)) > > > Are you sure you need this #ifdef CONFIG_PROVE_LOCKING? > rcu_dereference_protected() should already test CONFIG_PROVE_RCU. > > Ditto for tcf_proto_dereference().
I implemented these macro same way as rtnl_dereference() is implemented, which they are intended to substitute. After removing them I get following compilation error with CONFIG_PROVE_LOCKING disabled: ./include/net/sch_generic.h: In function ‘lockdep_tcf_chain_is_locked’: ./include/net/sch_generic.h:404:9: error: implicit declaration of function ‘lockdep_is_held’; did you mean ‘lockdep_rtnl_is_held’? [-Werror=implicit-function-declaration] return lockdep_is_held(&chain->filter_chain_lock); ^~~~~~~~~~~~~~~ lockdep_rtnl_is_held