[PATCH 1/4] nmi_watchdog: use a boolean config flag for compiling

Previous thread: [PATCH 4/4] [RFC][powerpc] nmi_watchdog: support for powerpc by Don Zickus on Friday, February 12, 2010 - 3:19 pm. (1 message)

Next thread: [PATCH 01/28] Move kernel/kgdb.c to kernel/debug/debug_core.c by Jason Wessel on Friday, February 12, 2010 - 3:35 pm. (1 message)
From: Don Zickus
Date: Friday, February 12, 2010 - 3:19 pm

Determines if an arch has setup arch specific perf_events and nmi_watchdog
code.  This should restrict compiles to only those arches ready.

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 arch/x86/Kconfig  |    1 +
 init/Kconfig      |    5 +++++
 lib/Kconfig.debug |    3 +--
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index cbcbfde..4f9685f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -52,6 +52,7 @@ config X86
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
 	select PERF_EVENTS
+	select PERF_EVENTS_NMI
 	select ANON_INODES
 	select HAVE_ARCH_KMEMCHECK
 	select HAVE_USER_RETURN_NOTIFIER
diff --git a/init/Kconfig b/init/Kconfig
index ada4844..7331a16 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -946,6 +946,11 @@ config PERF_USE_VMALLOC
 	help
 	  See tools/perf/design.txt for details
 
+config PERF_EVENTS_NMI
+	bool
+	help
+	  Arch has support for nmi_watchdog
+
 menu "Kernel Performance Events And Counters"
 
 config PERF_EVENTS
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index acef882..01a4d85 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -172,8 +172,7 @@ config DETECT_SOFTLOCKUP
 
 config NMI_WATCHDOG
 	bool "Detect Hard Lockups with an NMI Watchdog"
-	depends on DEBUG_KERNEL && PERF_EVENTS
-	depends on X86
+	depends on DEBUG_KERNEL && PERF_EVENTS && PERF_EVENTS_NMI
 	default y
 	help
 	  Say Y here to enable the kernel to use the NMI as a watchdog
-- 
1.6.6.83.gc9a2

--

From: tip-bot for Don Zickus
Date: Sunday, February 14, 2010 - 2:12 am

Commit-ID:  c3128fb6ad39b0edda6675d20585a64846cf89ea
Gitweb:     http://git.kernel.org/tip/c3128fb6ad39b0edda6675d20585a64846cf89ea
Author:     Don Zickus <dzickus@redhat.com>
AuthorDate: Fri, 12 Feb 2010 17:19:18 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 14 Feb 2010 09:19:43 +0100

nmi_watchdog: Use a boolean config flag for compiling

Determines if an arch has setup arch specific perf_events and
nmi_watchdog code.  This should restrict compiles to only those
arches ready.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: peterz@infradead.org
Cc: gorcunov@gmail.com
Cc: aris@redhat.com
LKML-Reference: <1266013161-31197-1-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/Kconfig  |    1 +
 init/Kconfig      |    5 +++++
 lib/Kconfig.debug |    3 +--
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index cbcbfde..4f9685f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -52,6 +52,7 @@ config X86
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
 	select PERF_EVENTS
+	select PERF_EVENTS_NMI
 	select ANON_INODES
 	select HAVE_ARCH_KMEMCHECK
 	select HAVE_USER_RETURN_NOTIFIER
diff --git a/init/Kconfig b/init/Kconfig
index ada4844..7331a16 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -946,6 +946,11 @@ config PERF_USE_VMALLOC
 	help
 	  See tools/perf/design.txt for details
 
+config PERF_EVENTS_NMI
+	bool
+	help
+	  Arch has support for nmi_watchdog
+
 menu "Kernel Performance Events And Counters"
 
 config PERF_EVENTS
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index acef882..01a4d85 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -172,8 +172,7 @@ config DETECT_SOFTLOCKUP
 
 config NMI_WATCHDOG
 	bool "Detect Hard Lockups with an NMI Watchdog"
-	depends on DEBUG_KERNEL && PERF_EVENTS
-	depends on X86
+	depends on DEBUG_KERNEL && PERF_EVENTS && PERF_EVENTS_NMI
 	default y
 	help
 	  Say Y here to enable the ...
From: Ingo Molnar
Date: Sunday, February 14, 2010 - 9:59 am

i'm still getting build failures:

arch/x86/built-in.o: In function `arch_trigger_all_cpu_backtrace':
(.text+0x151f5): undefined reference to `apic'

config attached.

	Ingo
From: Ingo Molnar
Date: Sunday, February 14, 2010 - 11:12 am

i'm also getting this:

[   11.101892] NET: Registered protocol family 5
[   19.293996] INFO: RCU detected CPU stalls: 1 (detected by 0, t=10002 jiffies)
[   19.293996] sending NMI to all CPUs:
[   19.294339] NMI backtrace for cpu 0
[   19.294339] CPU 0 
[   19.294339] Pid: 0, comm: swapper Not tainted 2.6.33-rc8-tip+ #16697 A8N-E/System Product Name
[   19.294339] RIP: 0010:[<ffffffff81009f3f>]  [<ffffffff81009f3f>] native_read_tsc+0x6/0x16
[   19.294339] RSP: 0018:ffff880003a03df8  EFLAGS: 00000046
[   19.294339] RAX: 0000000082d602a7 RBX: ffffffff82c1aeae RCX: 0000000082d60282
[   19.294339] RDX: 0000000000000017 RSI: 0000000000000002 RDI: 00000000001eadb1
[   19.294339] RBP: ffff880003a03df8 R08: 0000000000000000 R09: 0000000000000003
[   19.294339] R10: ffffffff824a65a0 R11: 0000000000000000 R12: 00000000001eadb1
[   19.294339] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000093c70
[   19.294339] FS:  0000000000000000(0000) GS:ffff880003a00000(0000) knlGS:0000000000000000
[   19.294339] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[   19.294339] CR2: 0000000000000000 CR3: 0000000002494000 CR4: 00000000000006f0
[   19.294339] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   19.294339] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[   19.294339] Process swapper (pid: 0, threadinfo ffffffff82400000, task ffffffff8249c020)
[   19.294339] Stack:
[   19.294339]  ffff880003a03e28 ffffffff813e9039 00000000000004a6 ffffffff824f2000
[   19.294339] <0> 0000000000000000 ffffffff824f2000 ffff880003a03e38 ffffffff813e8fa5
[   19.294339] <0> ffff880003a03e48 ffffffff813e8fe4 ffff880003a03e68 ffffffff8101a1a7
[   19.294339] Call Trace:
[   19.294339]  <IRQ> 
[   19.294339]  [<ffffffff813e9039>] delay_tsc+0x32/0x79
[   19.294339]  [<ffffffff813e8fa5>] __delay+0xa/0xc
[   19.294339]  [<ffffffff813e8fe4>] __const_udelay+0x3d/0x3f
[   19.294339]  [<ffffffff8101a1a7>] arch_trigger_all_cpu_backtrace+0x73/0x7f
[   19.294339]  ...
From: Don Zickus
Date: Monday, February 15, 2010 - 4:02 pm

I guess part of the problem I am having trouble reproducing this is
because I am not sure where you are getting the config from that you send
me.  Above clearly shows RCU has stall detetion on but the config you
provided me has:

# CONFIG_RCU_CPU_STALL_DETECTOR is not set

I guess I assumed I could just plug the config files you gave me into the
source tree.  Perhaps I misunderstood your intentions?

Cheers,
Don
--

From: Don Zickus
Date: Monday, February 15, 2010 - 10:51 am

Hmm, I can't get the config to match up properly when I run 'make
oldconfig', even though I am using the HEAD of perf/nmi.  I took the
defaults anyway and used 'ARCH=i386 make all' but couldn't reproduce your
build failure.

Looking through the code, is there ever case where 'apic' is undefined?
The arch_trigger_all_cpu_backtrace should match identically to the old nmi
code, so I am stuck on how to fix this.

Thoughts?

Cheers,
Don
--

From: Cyrill Gorcunov
Date: Monday, February 15, 2010 - 11:13 am

It looks familiar to one problem with HW breakpoints "Kconfig select"
issue Frederic fixed once not that long ago, if I recall correctly.

So due to select we choose to compile hw_nmi.c, but CONFIG_LOCAL_APIC
(or APIC on UP) is turned off. So apic.c is not compiled. And at stage
of linking we get unresolved symbol.

I don't remember the details how Frederic fixed HW breakpoints "select"

n.b.: i remember about p4 pmu, still out of time :(

	-- Cyrill
--

From: Cyrill Gorcunov
Date: Monday, February 15, 2010 - 11:21 am

On Mon, Feb 15, 2010 at 09:13:01PM +0300, Cyrill Gorcunov wrote:

Here is what I mean http://patchwork.kernel.org/patch/67973/
 
	-- Cyrill
--

From: Don Zickus
Date: Monday, February 15, 2010 - 11:45 am

Hmm thanks for the feedback.  The code can handle CONFIG_LOCAL_APIC being

I don't believe I have the same issue.  Thanks for the pointer.

Cheers,
Don
--

From: Ingo Molnar
Date: Tuesday, February 16, 2010 - 7:30 am

Hm, neither can i reproduce it with the config i sent. Maybe i sent the wrong 
config, or it somehow got solved meanwhile. I'll re-add perf/nmi to 
tip:master and we'll see it shortly whether there are any build failures 
left.

Thanks,

	Ingo
--

From: Ingo Molnar
Date: Thursday, February 18, 2010 - 12:27 pm

i reproduced it again on tip-bb22c6d:

  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
arch/x86/built-in.o: In function `arch_trigger_all_cpu_backtrace':
(.text+0x18778): undefined reference to `apic'
make: *** [.tmp_vmlinux1] Error 1

config attached.

Thanks,

	Ingo
Previous thread: [PATCH 4/4] [RFC][powerpc] nmi_watchdog: support for powerpc by Don Zickus on Friday, February 12, 2010 - 3:19 pm. (1 message)

Next thread: [PATCH 01/28] Move kernel/kgdb.c to kernel/debug/debug_core.c by Jason Wessel on Friday, February 12, 2010 - 3:35 pm. (1 message)