On Mon, Apr 30, 2018 at 06:42:01PM -0700, Joel Fernandes wrote:
> In this series, we are making lockdep use an rcuidle tracepoint. For
> this reason we need a notrace variant of srcu_dereference since
> otherwise we get lockdep splats since lockdep hooks may not have run
> yet. This patch adds the needed variant.
> 
> Cc: Steven Rostedt <rost...@goodmis.org>
> Cc: Peter Zilstra <pet...@infradead.org>
> Cc: Ingo Molnar <mi...@redhat.com>
> Cc: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
> Cc: Tom Zanussi <tom.zanu...@linux.intel.com>
> Cc: Namhyung Kim <namhy...@kernel.org>
> Cc: Thomas Glexiner <t...@linutronix.de>
> Cc: Boqun Feng <boqun.f...@gmail.com>
> Cc: Paul McKenney <paul...@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweis...@gmail.com>
> Cc: Randy Dunlap <rdun...@infradead.org>
> Cc: Masami Hiramatsu <mhira...@kernel.org>
> Cc: Fenguang Wu <fengguang...@intel.com>
> Cc: Baohong Liu <baohong....@intel.com>
> Cc: Vedang Patel <vedang.pa...@intel.com>
> Cc: kernel-t...@android.com
> Signed-off-by: Joel Fernandes <joe...@google.com>
> ---
>  include/linux/srcu.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/srcu.h b/include/linux/srcu.h
> index 2ec618979b20..a1c4947be877 100644
> --- a/include/linux/srcu.h
> +++ b/include/linux/srcu.h
> @@ -135,6 +135,11 @@ static inline int srcu_read_lock_held(const struct 
> srcu_struct *sp)
>   */
>  #define srcu_dereference(p, sp) srcu_dereference_check((p), (sp), 0)
> 
> +/**
> + * srcu_dereference_notrace - no tracing and no lockdep calls from here
> + */
> +#define srcu_dereference_notrace(p, sp) srcu_dereference_check((p), (sp), 1)

Given that this is a one-liner, why not just use srcu_dereference_check()
directly, with 1 as you do above to disable lockdep?

                                                        Thanx, Paul

> +
>  /**
>   * srcu_read_lock - register a new reader for an SRCU-protected structure.
>   * @sp: srcu_struct in which to register the new reader.
> -- 
> 2.17.0.441.gb46fe60e1d-goog
> 

Reply via email to