Message ID | 1460068652.6473.423.camel@edumazet-glaptop3.roam.corp.google.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On 08.04.2016 00:37, Eric Dumazet wrote: > On Thu, 2016-04-07 at 15:30 -0700, Eric Dumazet wrote: > >> But... this wont solve the compiler error ? >> >> include/net/sock.h: In function 'lockdep_sock_is_held': >> include/net/sock.h:1367:2: error: implicit declaration of function >> 'lockdep_is_held' [-Werror=implicit-function-declaration] >> In file included from security/lsm_audit.c:20:0: >> include/net/sock.h: In function 'lockdep_sock_is_held': >> include/net/sock.h:1367:2: error: implicit declaration of function >> 'lockdep_is_held' [-Werror=implicit-function-declaration] >> >> $ egrep "LOCKDEP|PROVE" .config >> CONFIG_LOCKDEP_SUPPORT=y >> # CONFIG_PROVE_LOCKING is not set >> # CONFIG_PROVE_RCU is not set >> > > Better use something like : > > diff --git a/include/net/sock.h b/include/net/sock.h > index eb2d7c3e120b..ab6b6b9469ad 100644 > --- a/include/net/sock.h > +++ b/include/net/sock.h > @@ -1360,13 +1360,15 @@ do { \ > lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ > } while (0) > > -static bool lockdep_sock_is_held(const struct sock *csk) > +#ifdef CONFIG_PROVE_RCU > +static inline bool lockdep_sock_is_held(const struct sock *csk) > { > struct sock *sk = (struct sock *)csk; > > return lockdep_is_held(&sk->sk_lock) || > lockdep_is_held(&sk->sk_lock.slock); > } > +#endif I see... hmpf. Wouldn't it be nicer if I include a helper a la: #define lockdep_is_held(lock) 1 in lockdep.h in case lockdep is globally not enabled? I do actually have already another user for this outside of PROVE_RCU. Thanks, Hannes
On Fri, 2016-04-08 at 00:47 +0200, Hannes Frederic Sowa wrote: > I see... hmpf. > > Wouldn't it be nicer if I include a helper a la: > > #define lockdep_is_held(lock) 1 > > in lockdep.h in case lockdep is globally not enabled? I do actually have > already another user for this outside of PROVE_RCU. It probably had been discussed on lkml a long time ago. My guess is that you can not do that, but am too lazy to tell you why ;)
On 08.04.2016 01:08, Eric Dumazet wrote: > On Fri, 2016-04-08 at 00:47 +0200, Hannes Frederic Sowa wrote: > >> I see... hmpf. >> >> Wouldn't it be nicer if I include a helper a la: >> >> #define lockdep_is_held(lock) 1 >> >> in lockdep.h in case lockdep is globally not enabled? I do actually have >> already another user for this outside of PROVE_RCU. > > It probably had been discussed on lkml a long time ago. > > My guess is that you can not do that, but am too lazy to tell you why ;) I will simply try it and otherwise go with your solution. My other cases would need to be ifdefed then as well, but also possible. Patch is send out and I will now research after your tip that it was already tried. Thanks, Hannes
diff --git a/include/net/sock.h b/include/net/sock.h index eb2d7c3e120b..ab6b6b9469ad 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1360,13 +1360,15 @@ do { \ lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ } while (0) -static bool lockdep_sock_is_held(const struct sock *csk) +#ifdef CONFIG_PROVE_RCU +static inline bool lockdep_sock_is_held(const struct sock *csk) { struct sock *sk = (struct sock *)csk; return lockdep_is_held(&sk->sk_lock) || lockdep_is_held(&sk->sk_lock.slock); } +#endif void lock_sock_nested(struct sock *sk, int subclass);