[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190618160014.GP26519@linux.ibm.com>
Date: Tue, 18 Jun 2019 09:00:14 -0700
From: "Paul E. McKenney" <paulmck@...ux.ibm.com>
To: john.hubbard@...il.com
Cc: LKML <linux-kernel@...r.kernel.org>,
John Hubbard <jhubbard@...dia.com>,
Frederic Weisbecker <frederic@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will.deacon@....com>
Subject: Re: [PATCH v2] lockdep: fix warning: print_lock_trace defined but
not used
On Sun, Jun 09, 2019 at 05:09:33PM -0700, john.hubbard@...il.com wrote:
> From: John Hubbard <jhubbard@...dia.com>
>
> Commit 0d2cc3b34532 ("locking/lockdep: Move valid_state() inside
> CONFIG_TRACE_IRQFLAGS && CONFIG_PROVE_LOCKING") moved the only usage of
> print_lock_trace() that was originally outside of the CONFIG_PROVE_LOCKING
> case. It moved that usage into a different case: CONFIG_PROVE_LOCKING &&
> CONFIG_TRACE_IRQFLAGS. That leaves things not symmetrical, and as a result,
> the following warning fires on my build, when I have
>
> !CONFIG_TRACE_IRQFLAGS && !CONFIG_PROVE_LOCKING
>
> set:
>
> kernel/locking/lockdep.c:2821:13: warning: ‘print_lock_trace’ defined
> but not used [-Wunused-function]
>
> Fix this by annotating print_lock_trace() with "__maybe_unused".
> Thanks to Paul E. McKenney for suggesting this less intrusive fix,
> as compared to adding more ifdef noise.
>
> Fixes: 0d2cc3b34532 ("locking/lockdep: Move valid_state() inside CONFIG_TRACE_IRQFLAGS && CONFIG_PROVE_LOCKING")
>
> Cc: Frederic Weisbecker <frederic@...nel.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Will Deacon <will.deacon@....com>
> Signed-off-by: John Hubbard <jhubbard@...dia.com>
Tested-by: Paul E. McKenney <paulmck@...ux.ibm.com>
> ---
> kernel/locking/lockdep.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index c47788fa85f9..2726dafdb29b 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -2818,7 +2818,8 @@ static inline int validate_chain(struct task_struct *curr,
> return 1;
> }
>
> -static void print_lock_trace(struct lock_trace *trace, unsigned int spaces)
> +static void __maybe_unused print_lock_trace(struct lock_trace *trace,
> + unsigned int spaces)
> {
> }
> #endif
> --
> 2.21.0
>
Powered by blists - more mailing lists