linux-next: build failure after merge of the final tree
Subsystems (3)
Hi all,
After merging the final tree, today's linux-next build (sparc64 defconfig) failed like this:
kernel/built-in.o: In function `touch_nmi_watchdog':
(.text+0x449bc): multiple definition of `touch_nmi_watchdog' arch/sparc/kernel/built-in.o:(.text+0x11b28): first defined here
Probably caused by commit 58687acba59266735adb8ccd9b5b9aa2c7cd205b ("lockup_detector: Combine nmi_watchdog and softlockup detector").
The one in kernel/ used to only be built when CONFIG_NMI_WATCHDOG was set which depended on CONFIG_PERF_EVENTS_NMI which was only ever set for ARCH=x86. This probably breaks mn10300 and blackfin as well, at least. We also have ARCH_HAS_NMI_WATCHDOG to determine this ...
I tried protecting the definition of touch_nmi_watchdog with ARCH_HAS_NMI_WATCHDOG, but that broke the x86_64 allmodconfig build (which defines ARCH_HAS_NMI_WATCHDOG if CONFIG_X86_LOCAL_APIC is defined but only builds its version if CONFIG_LOCKUP_DETECTOR is not 'y').
So I have left is as it is for today. Please see if someone can come up with a solution.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Quoted 17 lines · Stephen Rothwell
Hi all,
After merging the final tree, today's linux-next build (sparc64 defconfig) failed like this:
kernel/built-in.o: In function `touch_nmi_watchdog':
(.text+0x449bc): multiple definition of `touch_nmi_watchdog' arch/sparc/kernel/built-in.o:(.text+0x11b28): first defined hereProbably caused by commit
58687acba59266735adb8ccd9b5b9aa2c7cd205b("lockup_detector: Combinenmi_watchdogand softlockup detector").The one in
kernel/used to only be built whenCONFIG_NMI_WATCHDOGwas set which depended onCONFIG_PERF_EVENTS_NMIwhich was only ever set for ARCH=x86. This probably breaks mn10300 and blackfin as well, at least. We also haveARCH_HAS_NMI_WATCHDOGto determine this ...
Quoted 7 lines
I tried protecting the definition of
touch_nmi_watchdogwithARCH_HAS_NMI_WATCHDOG, but that broke thex86_64allmodconfig build (which definesARCH_HAS_NMI_WATCHDOGifCONFIG_X86_LOCAL_APICis defined but only builds its version ifCONFIG_LOCKUP_DETECTORis not 'y').So I have left is as it is for today. Please see if someone can come up with a solution.
I realized I was lazy and different provide a formal patch (and I had a couple of warnings too). Here is something better.
Cheers,
Don
---
commit 578178d5133403e469543bfff8a4e404d878563b
Author: Don Zickus <[email protected]> Date: Fri May 14 11:04:52 2010 -0400
[watchdog] nmi: cross arch compile fixes
Combining the softlockup and hardlockup code causes watchdog.c to always be compiled. Surround some code which prevents the hardlockup stuff from being compiled if other arches have a different NMI handler.
arch/x86/kernel/apic/Makefile +2 -2
@@ -3,10 +3,10 @@ # obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o -ifneq ($(CONFIG_LOCKUP_DETECTOR),y) +ifneq ($(CONFIG_PERF_EVENTS_NMI),y) obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o endif -obj-$(CONFIG_LOCKUP_DETECTOR) += hw_nmi.o +obj-$(CONFIG_PERF_EVENTS_NMI) += hw_nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o obj-$(CONFIG_SMP) += ipi.o
include/linux/nmi.h +1 -1
@@ -20,7 +20,7 @@ extern void touch_nmi_watchdog(void); extern void acpi_nmi_disable(void); extern void acpi_nmi_enable(void); #else -#ifndef CONFIG_LOCKUP_DETECTOR +#ifndef CONFIG_PERF_EVENTS_NMI static inline void touch_nmi_watchdog(void) { touch_softlockup_watchdog();
kernel/watchdog.c +5 -2
@@ -31,13 +31,13 @@ int watchdog_enabled;int __read_mostly softlockup_thresh =60 ; static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); -static DEFINE_PER_CPU(bool, watchdog_nmi_touch); static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); static DEFINE_PER_CPU(struct hrtimer, watchdog_hrtimer); static DEFINE_PER_CPU(bool, softlockup_touch_sync); -static DEFINE_PER_CPU(bool, hard_watchdog_warn); static DEFINE_PER_CPU(bool, soft_watchdog_warn);#ifdef CONFIG_PERF_EVENTS_NMI +static DEFINE_PER_CPU(bool, hard_watchdog_warn); +static DEFINE_PER_CPU(bool, watchdog_nmi_touch); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
@@ -139,6 +139,7 @@ void touch_all_softlockup_watchdogs(void)per_cpu (watchdog_touch_ts, cpu) =0 ; } +#ifdef CONFIG_PERF_EVENTS_NMI void touch_nmi_watchdog (void ) {__get_cpu_var (watchdog_nmi_touch) = true;
@@ -146,6 +147,8 @@ void touch_nmi_watchdog(void) }EXPORT_SYMBOL (touch_nmi_watchdog); +#endif +void touch_softlockup_watchdog_sync (void ) {__raw_get_cpu_var (softlockup_touch_sync) = true;
[tip:perf/nmi] lockup_detector: Cross arch compile fixes
Commit-ID: cafcd80d216bc2136b8edbb794327e495792c666 Gitweb: http://git.kernel.org/tip/cafcd80d216bc2136b8edbb794327e495792c666 Author: Don Zickus <[email protected]> AuthorDate: Fri, 14 May 2010 11:11:21 -0400 Committer: Frederic Weisbecker <[email protected]> CommitDate: Sun, 16 May 2010 04:25:14 +0200
lockup_detector: Cross arch compile fixes
Combining the softlockup and hardlockup code causes watchdog.c to build even without the hardlockup detection support.
So if an arch, that has the previous and the new nmi watchdog implementations cohabiting, wants to know if the generic one is in use, CONFIG_LOCKUP_DETECTOR is not a reliable check. We need to use CONFIG_HARDLOCKUP_DETECTOR instead.
Fixes:
kernel/built-in.o: In function `touch_nmi_watchdog': (.text+0x449bc): multiple definition of `touch_nmi_watchdog' arch/sparc/kernel/built-in.o:(.text+0x11b28): first defined here
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/Makefile | 4 ++-- include/linux/nmi.h | 2 +- kernel/watchdog.c | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/Makefile +2 -2
@@ -3,10 +3,10 @@ # obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o -ifneq ($(CONFIG_LOCKUP_DETECTOR),y) +ifneq ($(CONFIG_HARDLOCKUP_DETECTOR),y) obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o endif -obj-$(CONFIG_LOCKUP_DETECTOR) += hw_nmi.o +obj-$(CONFIG_HARDLOCKUP_DETECTOR) += hw_nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o obj-$(CONFIG_SMP) += ipi.o
include/linux/nmi.h +1 -1
@@ -20,7 +20,7 @@ extern void touch_nmi_watchdog(void); extern void acpi_nmi_disable(void); extern void acpi_nmi_enable(void); #else -#ifndef CONFIG_LOCKUP_DETECTOR +#ifndef CONFIG_HARDLOCKUP_DETECTOR static inline void touch_nmi_watchdog(void) { touch_softlockup_watchdog();
kernel/watchdog.c +5 -2
@@ -31,13 +31,13 @@ int watchdog_enabled;int __read_mostly softlockup_thresh =60 ; static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); -static DEFINE_PER_CPU(bool, watchdog_nmi_touch); static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); static DEFINE_PER_CPU(struct hrtimer, watchdog_hrtimer); static DEFINE_PER_CPU(bool, softlockup_touch_sync); -static DEFINE_PER_CPU(bool, hard_watchdog_warn); static DEFINE_PER_CPU(bool, soft_watchdog_warn);#ifdef CONFIG_HARDLOCKUP_DETECTOR +static DEFINE_PER_CPU(bool, hard_watchdog_warn); +static DEFINE_PER_CPU(bool, watchdog_nmi_touch); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
@@ -139,6 +139,7 @@ void touch_all_softlockup_watchdogs(void)per_cpu (watchdog_touch_ts, cpu) =0 ; } +#ifdef CONFIG_HARDLOCKUP_DETECTOR void touch_nmi_watchdog (void ) {__get_cpu_var (watchdog_nmi_touch) = true;
@@ -146,6 +147,8 @@ void touch_nmi_watchdog(void) }EXPORT_SYMBOL (touch_nmi_watchdog); +#endif +void touch_softlockup_watchdog_sync (void ) {__raw_get_cpu_var (softlockup_touch_sync) = true;
Quoted 17 lines · Stephen Rothwell
Hi all,
After merging the final tree, today's linux-next build (sparc64 defconfig) failed like this:
kernel/built-in.o: In function `touch_nmi_watchdog':
(.text+0x449bc): multiple definition of `touch_nmi_watchdog' arch/sparc/kernel/built-in.o:(.text+0x11b28): first defined hereProbably caused by commit
58687acba59266735adb8ccd9b5b9aa2c7cd205b("lockup_detector: Combinenmi_watchdogand softlockup detector").The one in
kernel/used to only be built whenCONFIG_NMI_WATCHDOGwas set which depended onCONFIG_PERF_EVENTS_NMIwhich was only ever set for ARCH=x86. This probably breaks mn10300 and blackfin as well, at least. We also haveARCH_HAS_NMI_WATCHDOGto determine this ...
Quoted 7 lines
I tried protecting the definition of
touch_nmi_watchdogwithARCH_HAS_NMI_WATCHDOG, but that broke thex86_64allmodconfig build (which definesARCH_HAS_NMI_WATCHDOGifCONFIG_X86_LOCAL_APICis defined but only builds its version ifCONFIG_LOCKUP_DETECTORis not 'y').So I have left is as it is for today. Please see if someone can come up with a solution.
Sorry for the mess. I think the following patch cleans it up. The last piece deals with the sparc mess, the other two pieces should deal with the x86 fallout.
Cheers,
Don
arch/x86/kernel/apic/Makefile +2 -2
@@ -3,10 +3,10 @@ # obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o -ifneq ($(CONFIG_LOCKUP_DETECTOR),y) +ifneq ($(CONFIG_PERF_EVENTS_NMI),y) obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o endif -obj-$(CONFIG_LOCKUP_DETECTOR) += hw_nmi.o +obj-$(CONFIG_PERF_EVENTS_NMI) += hw_nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o obj-$(CONFIG_SMP) += ipi.o
include/linux/nmi.h +1 -1
@@ -20,7 +20,7 @@ extern void touch_nmi_watchdog(void); extern void acpi_nmi_disable(void); extern void acpi_nmi_enable(void); #else -#ifndef CONFIG_LOCKUP_DETECTOR +#ifndef CONFIG_PERF_EVENTS_NMI static inline void touch_nmi_watchdog(void) { touch_softlockup_watchdog();
kernel/watchdog.c +2 -0
@@ -139,12 +139,14 @@ void touch_all_softlockup_watchdogs(void)per_cpu (watchdog_touch_ts, cpu) =0 ; } +#ifdef CONFIG_PERF_EVENTS_NMI void touch_nmi_watchdog (void ) {__get_cpu_var (watchdog_nmi_touch) = true;touch_softlockup_watchdog (); }EXPORT_SYMBOL (touch_nmi_watchdog); +#endif void touch_softlockup_watchdog_sync (void ) {
Quoted 4 lines · Don Zickus
Sorry for the mess. I think the following patch cleans it up. The last piece deals with the sparc mess, the other two pieces should deal with the x86 fallout.
This patch breaks x86:
arch/x86/built-in.o: In function `show_stack_log_lvl':
(.text+0xc2c0): undefined reference to touch_nmi_watchdog' arch/x86/built-in.o: In function print_trace_address':
dumpstack.c:(.text+0xd893): undefined reference to touch_nmi_watchdog' arch/x86/built-in.o: In function mce_timed_out':
mce.c:(.text+0x20008): undefined reference to touch_nmi_watchdog' arch/x86/built-in.o: In function enable_lapic_nmi_watchdog':
(.text+0x261f2): undefined reference to `touch_nmi_watchdog'
CONFIG_CLOCKSOURCE_WATCHDOG=yCONFIG_PERF_EVENTS_NMI=yCONFIG_IPMI_WATCHDOG=mCONFIG_WATCHDOG=yCONFIG_WATCHDOG_NOWAYOUT=y
# CONFIG_SOFT_WATCHDOG is not setCONFIG_HP_WATCHDOG=yCONFIG_SBC_EPX_C3_WATCHDOG=m
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_USBPCWATCHDOG is not setCONFIG_HAVE_FTRACE_NMI_ENTER=yCONFIG_FTRACE_NMI_ENTER=y
I'd _strongly_ suggest to simplify the code. There's a few things that could be done to that end:
- just have a single watchdog option and dont split the soft-dog from the hard-dog.
- use config options to define default behavior: i.e. whether the soft-dog and hard-dog is enabled by default, but otherwise keep them both included.
- provide a smooth pathway for architectures that have an NMI watchdog right now. Dont overlap their symbols for example.
... and similar measures.
Thanks,
Ingo
Quoted 32 lines · Ingo Molnar
Quoted 4 lines · Don Zickus
Sorry for the mess. I think the following patch cleans it up. The last piece deals with the sparc mess, the other two pieces should deal with the x86 fallout.
This patch breaks x86:
arch/x86/built-in.o: In function `show_stack_log_lvl':
(.text+0xc2c0): undefined reference totouch_nmi_watchdog' arch/x86/built-in.o: In functionprint_trace_address':
dumpstack.c:(.text+0xd893): undefined reference totouch_nmi_watchdog' arch/x86/built-in.o: In functionmce_timed_out':
mce.c:(.text+0x20008): undefined reference totouch_nmi_watchdog' arch/x86/built-in.o: In functionenable_lapic_nmi_watchdog':
(.text+0x261f2): undefined reference to `touch_nmi_watchdog'
CONFIG_CLOCKSOURCE_WATCHDOG=yCONFIG_PERF_EVENTS_NMI=yCONFIG_IPMI_WATCHDOG=mCONFIG_WATCHDOG=yCONFIG_WATCHDOG_NOWAYOUT=y
#CONFIG_SOFT_WATCHDOGis not setCONFIG_HP_WATCHDOG=yCONFIG_SBC_EPX_C3_WATCHDOG=m
#CONFIG_PCIPCWATCHDOGis not set
#CONFIG_USBPCWATCHDOGis not setCONFIG_HAVE_FTRACE_NMI_ENTER=yCONFIG_FTRACE_NMI_ENTER=y
Quoted 5 lines
I'd _strongly_ suggest to simplify the code. There's a few things that could be done to that end:
- just have a single watchdog option and dont split the soft-dog from the hard-dog.
This is what we have, ie: CONFIG_LOCKUP_DETECTOR
But we need to keep the softlockup detection out of the perf dependency. This is what we had previously. And more especially softlockup detection doesn't need perf.
Quoted 3 lines
- provide a smooth pathway for architectures that have an NMI watchdog right now. Dont overlap their symbols for example.
Agreed.
Quoted 1 line
... and similar measures.
And I add: remove the old nmi watchdog code from x86, for good.
I'm working on it.
[GIT PULL] Lockup detector build fixes
In reply to Ingo MolnarIngo,
Please pull the perf/nmi branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
perf/nmi
Thanks,
Frederic
---
Frederic Weisbecker (3):
lockup_detector: Update some config
lockup_detector: Adapt CONFIG_PERF_EVENT_NMI to other archs
lockup_detector: Introduce CONFIG_HARDLOCKUP_DETECTOR
Don Zickus (1):
lockup_detector: Cross arch compile fixes
arch/Kconfig | 7 +++++++ arch/x86/Kconfig | 2 +- arch/x86/kernel/apic/Makefile | 4 ++-- include/linux/nmi.h | 2 +- init/Kconfig | 8 -------- kernel/watchdog.c | 21 ++++++++++++--------- lib/Kconfig.debug | 28 ++++++---------------------- 7 files changed, 29 insertions(+), 43 deletions(-)
Re: [GIT PULL] Lockup detector build fixes
Quoted 9 lines · Frederic Weisbecker
Ingo,
Please pull the perf/nmi branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
perf/nmiThanks,
Frederic
Tested on x86 and Sparc 64 with and without CONFIG_LOCKUP_DETECTOR. No problem so far. Tell me if you find any.
Re: [GIT PULL] Lockup detector build fixes
Quoted 8 lines · Frederic Weisbecker
Quoted 7 lines · Frederic Weisbecker
Ingo,
Please pull the perf/nmi branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
perf/nmi
Quoted 7 lines
Quoted 2 lines
Thanks,
FredericTested on x86 and Sparc 64 with and without
CONFIG_LOCKUP_DETECTOR. No problem so far. Tell me if you find any.
Looks good so far. Pulled, thanks Frederic!
Ingo
Re: [GIT PULL] Lockup detector build fixes
Quoted 15 lines · Ingo Molnar
Quoted 12 lines · Frederic Weisbecker
Quoted 9 lines · Frederic Weisbecker
Ingo,
Please pull the perf/nmi branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
perf/nmiThanks,
Frederic
Quoted 5 lines
Quoted 3 lines
Tested on x86 and Sparc 64 with and without
CONFIG_LOCKUP_DETECTOR. No problem so far. Tell me if you find any.Looks good so far. Pulled, thanks Frederic!
Thanks Frederic!
Cheers,
Don
PATCH 1/4 lockup_detector: Update some config
In reply to Ingo MolnarWe kept CONFIG_DETECT_SOFTLOCKUP around for compatibility with older configs. But it was enabled by default if CONFIG_DEBUG_KERNEL.
So if we want to enable CONFIG_LOCKUP_DETECTOR on configs that had CONFIG_DETECT_SOFTLOCKUP, all we need is to have the same enabling by default if CONFIG_DEBUG_KERNEL. We can then remove CONFIG_DETECT_SOFTLOCKUP directly.
So tag CONFIG_LOCKUP_DETECTOR as default y. This is what we want for most serious kernel debugging anyway.
And also forbid the lockup detector in S390 as it was for the previous softlockup detector, event though the true reason for that is not outlined.
--- lib/Kconfig.debug | 25 +++---------------------- 1 files changed, 3 insertions(+), 22 deletions(-)
lib/Kconfig.debug +3 -22
@@ -152,29 +152,10 @@ config DEBUG_SHIRQ Drivers ought to be able to handle interrupts coming in at those points; some don't and need to be caught. -config DETECT_SOFTLOCKUP - bool - depends on DEBUG_KERNEL && !S390 - default y - help - Say Y here to enable the kernel to detect "soft lockups", - which are bugs that cause the kernel to loop in kernel - mode for more than 60 seconds, without giving other tasks a - chance to run. - - When a soft-lockup is detected, the kernel will print the - current stack trace (which you should report), but the - system will stay locked up. This feature has negligible - overhead. - - (Note that "hard lockups" are separate type of bugs that - can be detected via the NMI-watchdog, on platforms that - support it.) - config LOCKUP_DETECTOR bool "Detect Hard and Soft Lockups" - depends on DEBUG_KERNEL - default DETECT_SOFTLOCKUP + depends on DEBUG_KERNEL && !S390 + default y help Say Y here to enable the kernel to act as a watchdog to detect hard and soft lockups.
@@ -212,7 +193,7 @@ config BOOTPARAM_SOFTLOCKUP_PANIC config BOOTPARAM_SOFTLOCKUP_PANIC_VALUE int - depends on DETECT_SOFTLOCKUP + depends on LOCKUP_DETECTOR range 0 1 default 0 if !BOOTPARAM_SOFTLOCKUP_PANIC default 1 if BOOTPARAM_SOFTLOCKUP_PANIC
Signature · 1 line
1.6.2.3
PATCH 2/4 lockup_detector: Adapt CONFIG_PERF_EVENT_NMI to other archs
In reply to Ingo MolnarCONFIG_PERF_EVENT_NMI is something that need to be enabled from the arch. This is fine on x86 as PERF_EVENTS is builtin but if other archs select it, they will need to handle the PERF_EVENTS dependency.
Instead, handle the dependency in the generic layer:
- archs need to tell what they support through HAVE_PERF_EVENTS_NMI
- Enable magically PERF_EVENTS_NMI if we have PERF_EVENTS and HAVE_PERF_EVENTS_NMI.
--- arch/Kconfig | 3 +++ arch/x86/Kconfig | 2 +- init/Kconfig | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-)
arch/Kconfig +3 -0
@@ -145,4 +145,7 @@ config HAVE_HW_BREAKPOINT config HAVE_USER_RETURN_NOTIFIER bool +config HAVE_PERF_EVENTS_NMI + bool + source "kernel/gcov/Kconfig"
arch/x86/Kconfig +1 -1
@@ -54,7 +54,7 @@ config X86 select HAVE_KERNEL_LZO select HAVE_HW_BREAKPOINT select PERF_EVENTS - select PERF_EVENTS_NMI + select HAVE_PERF_EVENTS_NMI select ANON_INODES select HAVE_ARCH_KMEMCHECK select HAVE_USER_RETURN_NOTIFIER
init/Kconfig +1 -2
@@ -943,8 +943,7 @@ config PERF_USE_VMALLOC See tools/perf/design.txt for details config PERF_EVENTS_NMI - bool - depends on PERF_EVENTS + def_bool PERF_EVENTS && HAVE_PERF_EVENTS_NMI help System hardware can generate an NMI using the perf event subsystem. Also has support for calculating CPU cycle events
Signature · 1 line
1.6.2.3
PATCH 3/4 lockup_detector: Introduce CONFIG_HARDLOCKUP_DETECTOR
In reply to Ingo MolnarThis new config is deemed to simplify even more the lockup detector dependencies and can make it easier to bring a smooth sorting between archs that support the new generic lockup detector and those that still have their own, especially for those that are in the middle of this migration.
Instead of checking whether we have CONFIG_LOCKUP_DETECTOR + CONFIG_PERF_EVENTS_NMI each time an arch wants to know if it needs to build its own lockup detector, take a shortcut with this new config. It is enabled only if the hardlockup detection part of the whole lockup detector is on.
--- arch/Kconfig | 4 ++++ init/Kconfig | 7 ------- kernel/watchdog.c | 14 +++++++------- lib/Kconfig.debug | 3 +++ 4 files changed, 14 insertions(+), 14 deletions(-)
arch/Kconfig +4 -0
@@ -147,5 +147,9 @@ config HAVE_USER_RETURN_NOTIFIER config HAVE_PERF_EVENTS_NMI bool + help + System hardware can generate an NMI using the perf event + subsystem. Also has support for calculating CPU cycle events + to determine how many clock cycles in a given period. source "kernel/gcov/Kconfig"
init/Kconfig +0 -7
@@ -942,13 +942,6 @@ config PERF_USE_VMALLOC help See tools/perf/design.txt for details -config PERF_EVENTS_NMI - def_bool PERF_EVENTS && HAVE_PERF_EVENTS_NMI - help - System hardware can generate an NMI using the perf event - subsystem. Also has support for calculating CPU cycle events - to determine how many clock cycles in a given period. - menu "Kernel Performance Events And Counters" config PERF_EVENTS
kernel/watchdog.c +7 -7
@@ -37,7 +37,7 @@ static DEFINE_PER_CPU(struct hrtimer, watchdog_hrtimer); static DEFINE_PER_CPU(bool, softlockup_touch_sync); static DEFINE_PER_CPU(bool, hard_watchdog_warn); static DEFINE_PER_CPU(bool, soft_watchdog_warn); -#ifdef CONFIG_PERF_EVENTS_NMI +#ifdef CONFIG_HARDLOCKUP_DETECTOR static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
@@ -51,7 +51,7 @@ static int __initdata no_watchdog;/* * Should we panic when a soft-lockup or hard-lockup occurs: */ -#ifdef CONFIG_PERF_EVENTS_NMI +#ifdef CONFIG_HARDLOCKUP_DETECTOR static int hardlockup_panic;static int __init hardlockup_panic_setup (char *str)
@@ -152,7 +152,7 @@ void touch_softlockup_watchdog_sync(void)__raw_get_cpu_var (watchdog_touch_ts) =0 ; } -#ifdef CONFIG_PERF_EVENTS_NMI +#ifdef CONFIG_HARDLOCKUP_DETECTOR /* watchdog detector functions */ static int is_hardlockup (int cpu) {
@@ -189,7 +189,7 @@ static struct notifier_block panic_block = { .notifier_call = watchdog_panic, }; -#ifdef CONFIG_PERF_EVENTS_NMI +#ifdef CONFIG_HARDLOCKUP_DETECTOR static struct perf_event_attr wd_hw_attr = { .type =PERF_TYPE_HARDWARE , .config = PERF_COUNT_HW_CPU_CYCLES,
@@ -239,7 +239,7 @@ static void watchdog_interrupt_count(void) }#else static inline void watchdog_interrupt_count (void ) {return ; } -#endif /* CONFIG_PERF_EVENTS_NMI */ +#endif /* CONFIG_HARDLOCKUP_DETECTOR */ /* watchdog kicker functions */ static enum hrtimer_restart watchdog_timer_fn (struct hrtimer *hrtimer)
@@ -342,7 +342,7 @@ static int watchdog(void *__bind_cpu) } -#ifdef CONFIG_PERF_EVENTS_NMI +#ifdef CONFIG_HARDLOCKUP_DETECTOR static int watchdog_nmi_enable (int cpu) {struct perf_event_attr *wd_attr;
@@ -393,7 +393,7 @@ static void watchdog_nmi_disable(int cpu)#else static int watchdog_nmi_enable (int cpu) {return 0 ; }static void watchdog_nmi_disable (int cpu) {return ; } -#endif /* CONFIG_PERF_EVENTS_NMI */ +#endif /* CONFIG_HARDLOCKUP_DETECTOR */ /* prepare/enable/disable routines */ static int watchdog_prepare_cpu (int cpu)
lib/Kconfig.debug +3 -0
@@ -174,6 +174,9 @@ config LOCKUP_DETECTOR generate interrupts and kick the watchdog task every 10-12 seconds. An NMI is generated every 60 seconds or so to check for hardlockups. +config HARDLOCKUP_DETECTOR + def_bool LOCKUP_DETECTOR && PERF_EVENTS && HAVE_PERF_EVENTS_NMI + config BOOTPARAM_SOFTLOCKUP_PANIC bool "Panic (Reboot) On Soft Lockups" depends on LOCKUP_DETECTOR
Signature · 1 line
1.6.2.3
PATCH 4/4 lockup_detector: Cross arch compile fixes
In reply to Ingo MolnarFrom: Don Zickus <[email protected]>
Combining the softlockup and hardlockup code causes watchdog.c to build even without the hardlockup detection support.
So if an arch, that has the previous and the new nmi watchdog implementations cohabiting, wants to know if the generic one is in use, CONFIG_LOCKUP_DETECTOR is not a reliable check. We need to use CONFIG_HARDLOCKUP_DETECTOR instead.
Fixes:
kernel/built-in.o: In function `touch_nmi_watchdog': (.text+0x449bc): multiple definition of `touch_nmi_watchdog' arch/sparc/kernel/built-in.o:(.text+0x11b28): first defined here
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/Makefile | 4 ++-- include/linux/nmi.h | 2 +- kernel/watchdog.c | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/Makefile +2 -2
@@ -3,10 +3,10 @@ # obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o -ifneq ($(CONFIG_LOCKUP_DETECTOR),y) +ifneq ($(CONFIG_HARDLOCKUP_DETECTOR),y) obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o endif -obj-$(CONFIG_LOCKUP_DETECTOR) += hw_nmi.o +obj-$(CONFIG_HARDLOCKUP_DETECTOR) += hw_nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o obj-$(CONFIG_SMP) += ipi.o
include/linux/nmi.h +1 -1
@@ -20,7 +20,7 @@ extern void touch_nmi_watchdog(void); extern void acpi_nmi_disable(void); extern void acpi_nmi_enable(void); #else -#ifndef CONFIG_LOCKUP_DETECTOR +#ifndef CONFIG_HARDLOCKUP_DETECTOR static inline void touch_nmi_watchdog(void) { touch_softlockup_watchdog();
kernel/watchdog.c +5 -2
@@ -31,13 +31,13 @@ int watchdog_enabled;int __read_mostly softlockup_thresh =60 ; static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); -static DEFINE_PER_CPU(bool, watchdog_nmi_touch); static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); static DEFINE_PER_CPU(struct hrtimer, watchdog_hrtimer); static DEFINE_PER_CPU(bool, softlockup_touch_sync); -static DEFINE_PER_CPU(bool, hard_watchdog_warn); static DEFINE_PER_CPU(bool, soft_watchdog_warn);#ifdef CONFIG_HARDLOCKUP_DETECTOR +static DEFINE_PER_CPU(bool, hard_watchdog_warn); +static DEFINE_PER_CPU(bool, watchdog_nmi_touch); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
@@ -139,6 +139,7 @@ void touch_all_softlockup_watchdogs(void)per_cpu (watchdog_touch_ts, cpu) =0 ; } +#ifdef CONFIG_HARDLOCKUP_DETECTOR void touch_nmi_watchdog (void ) {__get_cpu_var (watchdog_nmi_touch) = true;
@@ -146,6 +147,8 @@ void touch_nmi_watchdog(void) }EXPORT_SYMBOL (touch_nmi_watchdog); +#endif +void touch_softlockup_watchdog_sync (void ) {__raw_get_cpu_var (softlockup_touch_sync) = true;
Signature · 1 line
1.6.2.3