public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: john.hubbard@gmail.com
Cc: LKML <linux-kernel@vger.kernel.org>,
	John Hubbard <jhubbard@nvidia.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH v2] lockdep: fix warning: print_lock_trace defined but not used
Date: Tue, 18 Jun 2019 09:00:14 -0700	[thread overview]
Message-ID: <20190618160014.GP26519@linux.ibm.com> (raw)
In-Reply-To: <20190610000933.29578-1-jhubbard@nvidia.com>

On Sun, Jun 09, 2019 at 05:09:33PM -0700, john.hubbard@gmail.com wrote:
> From: John Hubbard <jhubbard@nvidia.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@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>

Tested-by: Paul E. McKenney <paulmck@linux.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
> 

      reply	other threads:[~2019-06-18 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21  7:08 [PATCH 0/1] lockdep: fix warning: print_lock_trace defined but not used john.hubbard
2019-05-21  7:08 ` [PATCH 1/1] " john.hubbard
2019-06-09 13:51   ` Paul E. McKenney
2019-06-09 23:38     ` John Hubbard
2019-06-10  0:09     ` [PATCH v2] " john.hubbard
2019-06-18 16:00       ` Paul E. McKenney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190618160014.GP26519@linux.ibm.com \
    --to=paulmck@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=frederic@kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=john.hubbard@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox