All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT pull] locking fix for 4.9
@ 2016-10-08 12:47 Thomas Gleixner
  2016-10-10 17:29 ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2016-10-08 12:47 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: LKML, Andrew Morton, Ingo Molnar, H. Peter Anvin

Linus,

please pull the latest locking-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-for-linus

A single fix which prevents newer GCCs from spamming the build output with
overly eager warnings about __builtin_return_address() uses which are
correct.

Thanks,

	tglx

------------------>
Steven Rostedt (1):
      locking/lockdep: Quiet GCC about dangerous __builtin_return_address() operations


 include/linux/ftrace.h |  2 ++
 kernel/Makefile        |  7 +++++++
 kernel/trace/Kconfig   |  1 +
 lib/Kconfig.debug      | 10 ++++++++++
 4 files changed, 20 insertions(+)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 6f93ac46e7f0..1218b150a6b3 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -714,6 +714,7 @@ static inline void __ftrace_enabled_restore(int enabled)
 #define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5))
 #define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6))
 
+#ifdef CONFIG_USING_GET_LOCK_PARENT_IP
 static inline unsigned long get_lock_parent_ip(void)
 {
 	unsigned long addr = CALLER_ADDR0;
@@ -725,6 +726,7 @@ static inline unsigned long get_lock_parent_ip(void)
 		return addr;
 	return CALLER_ADDR2;
 }
+#endif
 
 #ifdef CONFIG_IRQSOFF_TRACER
   extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
diff --git a/kernel/Makefile b/kernel/Makefile
index e2ec54e2b952..bff8214bf5f6 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -11,6 +11,13 @@ obj-y     = fork.o exec_domain.o panic.o \
 	    notifier.o ksysfs.o cred.o reboot.o \
 	    async.o range.o smpboot.o
 
+# Tracing may do some dangerous __builtin_return_address() operations
+# We know they are dangerous, we don't need gcc telling us that.
+ifdef CONFIG_USING_GET_LOCK_PARENT_IP
+FRAME_CFLAGS := $(call cc-disable-warning,frame-address)
+KBUILD_CFLAGS += $(FRAME_CFLAGS)
+endif
+
 obj-$(CONFIG_MULTIUSER) += groups.o
 
 ifdef CONFIG_FUNCTION_TRACER
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index ba3326785ca4..ecc0bbc2ca30 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -192,6 +192,7 @@ config PREEMPT_TRACER
 	select RING_BUFFER_ALLOW_SWAP
 	select TRACER_SNAPSHOT
 	select TRACER_SNAPSHOT_PER_CPU_SWAP
+	select USING_GET_LOCK_PARENT_IP
 	help
 	  This option measures the time spent in preemption-off critical
 	  sections, with microsecond accuracy.
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index cab7405f48d2..dbc49c48ff53 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -977,6 +977,7 @@ config TIMER_STATS
 config DEBUG_PREEMPT
 	bool "Debug preemptible kernel"
 	depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT
+	select USING_GET_LOCK_PARENT_IP
 	default y
 	help
 	  If you say Y here then the kernel will use a debug variant of the
@@ -1159,8 +1160,17 @@ config LOCK_TORTURE_TEST
 
 endmenu # lock debugging
 
+config USING_GET_LOCK_PARENT_IP
+        bool
+	help
+	  Enables the use of the function get_lock_parent_ip() that
+	  will use __builtin_return_address(n) with n > 0 causing
+	  some gcc warnings. When this is selected, those warnings
+	  will be suppressed.
+
 config TRACE_IRQFLAGS
 	bool
+	select USING_GET_LOCK_PARENT_IP
 	help
 	  Enables hooks to interrupt enabling and disabling for
 	  either tracing or lock debugging.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [GIT pull] locking fix for 4.9
  2016-10-08 12:47 [GIT pull] locking fix for 4.9 Thomas Gleixner
@ 2016-10-10 17:29 ` Linus Torvalds
  2016-10-12  8:28   ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2016-10-10 17:29 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Andrew Morton, Ingo Molnar, H. Peter Anvin

On Sat, Oct 8, 2016 at 5:47 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
>
> A single fix which prevents newer GCCs from spamming the build output with
> overly eager warnings about __builtin_return_address() uses which are
> correct.

Ugh. This feels over-engineered to me.

We already disable that warning unconditionally for the trace
subdirectory, and for mm/usercopy.c.

I feel that the simpler solution is to just disable the warning
globally, and not worry about "when this config option is enabled we
need to disable it".

Basically, we disable the warning every time we ever use
__builtin_return_address(), so maybe we should just disable it once
and for all.

It's not like the __builtin_return_address() warning is so incredibly
useful anyway.

Hmm?

                Linus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT pull] locking fix for 4.9
  2016-10-10 17:29 ` Linus Torvalds
@ 2016-10-12  8:28   ` Steven Rostedt
  2016-10-12 17:22     ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2016-10-12  8:28 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, LKML, Andrew Morton, Ingo Molnar, H. Peter Anvin

On Mon, 10 Oct 2016 10:29:27 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Sat, Oct 8, 2016 at 5:47 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> >
> > A single fix which prevents newer GCCs from spamming the build output with
> > overly eager warnings about __builtin_return_address() uses which are
> > correct.  
> 
> Ugh. This feels over-engineered to me.
> 
> We already disable that warning unconditionally for the trace
> subdirectory, and for mm/usercopy.c.
> 
> I feel that the simpler solution is to just disable the warning
> globally, and not worry about "when this config option is enabled we
> need to disable it".
> 
> Basically, we disable the warning every time we ever use
> __builtin_return_address(), so maybe we should just disable it once
> and for all.

The only advantage of doing this is to make it a pain to use
__builtin_return_address(n) with n > 0, so that we don't accidentally
use it without knowing what we are doing.

> 
> It's not like the __builtin_return_address() warning is so incredibly
> useful anyway.
> 

But I agree. We have lived a long time without the need for this
warning. I'm not strongly advocating keeping the warning around and
just disabling it totally. But it all comes down to how much we
trust those that inherit this after we are gone ;-)

/me is feeling his age.

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT pull] locking fix for 4.9
  2016-10-12  8:28   ` Steven Rostedt
@ 2016-10-12 17:22     ` Linus Torvalds
  2016-10-13  0:10       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2016-10-12 17:22 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Thomas Gleixner, LKML, Andrew Morton, Ingo Molnar, H. Peter Anvin

On Wed, Oct 12, 2016 at 1:28 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> But I agree. We have lived a long time without the need for this
> warning. I'm not strongly advocating keeping the warning around and
> just disabling it totally. But it all comes down to how much we
> trust those that inherit this after we are gone ;-)

I'll take that as an ack for just moving it back to being globally
disabled, and will do a commit doing that.

                      Linus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT pull] locking fix for 4.9
  2016-10-12 17:22     ` Linus Torvalds
@ 2016-10-13  0:10       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2016-10-13  0:10 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, LKML, Andrew Morton, Ingo Molnar, H. Peter Anvin

On Wed, 12 Oct 2016 10:22:59 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Wed, Oct 12, 2016 at 1:28 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > But I agree. We have lived a long time without the need for this
> > warning. I'm not strongly advocating keeping the warning around and
> > just disabling it totally. But it all comes down to how much we
> > trust those that inherit this after we are gone ;-)  
> 
> I'll take that as an ack for just moving it back to being globally
> disabled, and will do a commit doing that.
> 

Fine with me:

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-13  0:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-08 12:47 [GIT pull] locking fix for 4.9 Thomas Gleixner
2016-10-10 17:29 ` Linus Torvalds
2016-10-12  8:28   ` Steven Rostedt
2016-10-12 17:22     ` Linus Torvalds
2016-10-13  0:10       ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.