The patch titled spinlock-debug: all cpu backtrace has been added to the -mm tree. Its filename is spinlock-debug-all-cpu-backtrace.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: spinlock-debug: all cpu backtrace From: Andrew Morton <akpm@xxxxxxxx> When a spinlock lockup occurs, arrange for the NMI code to emit an all-cpu backtrace, so we get to see which CPU is holding the lock, and where. Cc: Andi Kleen <ak@xxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Badari Pulavarty <pbadari@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/kernel/nmi.c | 14 ++++++++++++++ arch/x86_64/kernel/nmi.c | 17 ++++++++++++++++- include/asm-i386/nmi.h | 3 +++ include/asm-x86_64/nmi.h | 3 +++ include/linux/nmi.h | 5 +++++ lib/spinlock_debug.c | 4 ++++ 6 files changed, 45 insertions(+), 1 deletion(-) diff -puN lib/spinlock_debug.c~spinlock-debug-all-cpu-backtrace lib/spinlock_debug.c --- a/lib/spinlock_debug.c~spinlock-debug-all-cpu-backtrace +++ a/lib/spinlock_debug.c @@ -7,6 +7,7 @@ */ #include <linux/spinlock.h> +#include <linux/nmi.h> #include <linux/interrupt.h> #include <linux/debug_locks.h> #include <linux/delay.h> @@ -117,6 +118,9 @@ static void __spin_lock_debug(spinlock_t raw_smp_processor_id(), current->comm, current->pid, lock); dump_stack(); +#ifdef CONFIG_SMP + trigger_all_cpu_backtrace(); +#endif } } } diff -puN arch/i386/kernel/nmi.c~spinlock-debug-all-cpu-backtrace arch/i386/kernel/nmi.c --- a/arch/i386/kernel/nmi.c~spinlock-debug-all-cpu-backtrace +++ a/arch/i386/kernel/nmi.c @@ -23,6 +23,7 @@ #include <linux/percpu.h> #include <linux/dmi.h> #include <linux/kprobes.h> +#include <linux/cpumask.h> #include <asm/smp.h> #include <asm/nmi.h> @@ -43,6 +44,8 @@ int nmi_watchdog_enabled; static DEFINE_PER_CPU(unsigned long, perfctr_nmi_owner); static DEFINE_PER_CPU(unsigned long, evntsel_nmi_owner[3]); +static cpumask_t backtrace_mask = CPU_MASK_NONE; + /* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) */ @@ -908,6 +911,12 @@ __kprobes int nmi_watchdog_tick(struct p touched = 1; } + if (cpu_isset(cpu, backtrace_mask)) { + cpu_clear(cpu, backtrace_mask); + printk("NMI backtrace for cpu %d\n", cpu); + dump_stack(); + } + sum = per_cpu(irq_stat, cpu).apic_timer_irqs; /* if the apic timer isn't firing, this cpu isn't doing much */ @@ -1034,6 +1043,11 @@ int proc_nmi_enabled(struct ctl_table *t #endif +void __trigger_all_cpu_backtrace(void) +{ + backtrace_mask = CPU_MASK_ALL; +} + EXPORT_SYMBOL(nmi_active); EXPORT_SYMBOL(nmi_watchdog); EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi); diff -puN arch/x86_64/kernel/nmi.c~spinlock-debug-all-cpu-backtrace arch/x86_64/kernel/nmi.c --- a/arch/x86_64/kernel/nmi.c~spinlock-debug-all-cpu-backtrace +++ a/arch/x86_64/kernel/nmi.c @@ -12,14 +12,15 @@ * Mikael Pettersson : PM converted to driver model. Disable/enable API. */ +#include <linux/nmi.h> #include <linux/mm.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/sysdev.h> -#include <linux/nmi.h> #include <linux/sysctl.h> #include <linux/kprobes.h> +#include <linux/cpumask.h> #include <asm/smp.h> #include <asm/nmi.h> @@ -41,6 +42,8 @@ int panic_on_unrecovered_nmi; static DEFINE_PER_CPU(unsigned, perfctr_nmi_owner); static DEFINE_PER_CPU(unsigned, evntsel_nmi_owner[2]); +static cpumask_t backtrace_mask = CPU_MASK_NONE; + /* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) */ @@ -782,6 +785,7 @@ int __kprobes nmi_watchdog_tick(struct p { int sum; int touched = 0; + int cpu = smp_processor_id(); struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); u64 dummy; int rc=0; @@ -799,6 +803,12 @@ int __kprobes nmi_watchdog_tick(struct p touched = 1; } + if (cpu_isset(cpu, backtrace_mask)) { + cpu_clear(cpu, backtrace_mask); + printk("NMI backtrace for cpu %d\n", cpu); + dump_stack(); + } + #ifdef CONFIG_X86_MCE /* Could check oops_in_progress here too, but it's safer not too */ @@ -931,6 +941,11 @@ int proc_nmi_enabled(struct ctl_table *t #endif +void __trigger_all_cpu_backtrace(void) +{ + backtrace_mask = CPU_MASK_ALL; +} + EXPORT_SYMBOL(nmi_active); EXPORT_SYMBOL(nmi_watchdog); EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi); diff -puN include/linux/nmi.h~spinlock-debug-all-cpu-backtrace include/linux/nmi.h --- a/include/linux/nmi.h~spinlock-debug-all-cpu-backtrace +++ a/include/linux/nmi.h @@ -15,9 +15,14 @@ * disables interrupts for a long time. This call is stateless. */ #ifdef ARCH_HAS_NMI_WATCHDOG +#include <asm/nmi.h> extern void touch_nmi_watchdog(void); #else # define touch_nmi_watchdog() touch_softlockup_watchdog() #endif +#ifndef trigger_all_cpu_backtrace +#define trigger_all_cpu_backtrace() do { } while (0) +#endif + #endif diff -puN include/asm-i386/nmi.h~spinlock-debug-all-cpu-backtrace include/asm-i386/nmi.h --- a/include/asm-i386/nmi.h~spinlock-debug-all-cpu-backtrace +++ a/include/asm-i386/nmi.h @@ -42,4 +42,7 @@ extern int proc_nmi_enabled(struct ctl_t void __user *, size_t *, loff_t *); extern int unknown_nmi_panic; +void __trigger_all_cpu_backtrace(void); +#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() + #endif /* ASM_NMI_H */ diff -puN include/asm-x86_64/nmi.h~spinlock-debug-all-cpu-backtrace include/asm-x86_64/nmi.h --- a/include/asm-x86_64/nmi.h~spinlock-debug-all-cpu-backtrace +++ a/include/asm-x86_64/nmi.h @@ -77,4 +77,7 @@ extern int proc_nmi_enabled(struct ctl_t extern int unknown_nmi_panic; +void __trigger_all_cpu_backtrace(void); +#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() + #endif /* ASM_NMI_H */ _ Patches currently in -mm which might be from akpm@xxxxxxxx are origin.patch git-acpi.patch acpi-preserve-correct-battery-state-through-suspend-resume-cycles-tidy.patch acpi-asus-s3-resume-fix.patch sony_apci-resume.patch kauditd_thread-warning-fix.patch git-block.patch git-block-fixup.patch git-block-hack.patch git-drm.patch git-dvb.patch git-geode-fixup.patch git-gfs2.patch git-ia64.patch git-ieee1394.patch git-input.patch git-intelfb-fixup.patch hdrcheck-permission-fix.patch git-libata-all.patch libata-return-sense-data-in-hdio_drive_cmd-ioctl-tidy.patch mmc-driver-for-ti-flashmedia-card-reader-source.patch git-mtd-fixup.patch git-netdev-all.patch forcedeth-power-management-support-tidy.patch drivers-net-ns83820c-add-paramter-to-disable-auto.patch revert-genirq-core-fix-handle_level_irq.patch git-parisc-fixup.patch git-parisc-powerpc-fix.patch git-pcmcia-fixup.patch git-serial.patch git-serial-fixup.patch serial-fix-uart_bug_txen-test.patch git-scsi-misc.patch git-block-vs-git-sas.patch git-scsi-target-fixup.patch git-scsi-target-vs-git-block.patch xpad-dance-pad-support-tidy.patch git-watchdog.patch revert-insert-ioapics-and-local-apic-into-resource-map.patch x86_64-dump_trace-atomicity-fix.patch spinlock-debug-all-cpu-backtrace.patch arch-i386-pci-mmconfigc-tlb-flush-fix-tweaks.patch xfs-rename-uio_read.patch get-rid-of-zone_table-fix.patch radix-tree-rcu-lockless-readside.patch acx1xx-wireless-driver.patch tiacx-pci-build-fix.patch tiacx-ia64-fix.patch tiacx-build-fix.patch swsusp-add-resume_offset-command-line-parameter-rev-2-fix.patch deprecate-smbfs-in-favour-of-cifs.patch edac-new-opteron-athlon64-memory-controller-driver-tidy.patch add-address_space_operationsbatch_write-fix.patch maximum-latency-tracking-infrastructure-tidy.patch add-config_headers_check-option-to-automatically-run-make-headers_check-nobble.patch submit-checklist-mention-headers_check.patch generic-bug-handling.patch use-generic-bug-for-i386.patch use-generic-bug-for-x86-64.patch use-generic-bug-for-powerpc.patch use-generic-bug-for-powerpc-fix-2.patch use-generic-bug-for-powerpc-fix-infinite-loop-on-bug.patch bug-test-1.patch list-module-taint-flags-in-oops-panic-tidy.patch ntp-move-all-the-ntp-related-code-to-ntpc-fix.patch reiserfs-on-demand-bitmap-loading.patch streamline-generic_file_-interfaces-and-filemap-gfs-fix.patch add-vector-aio-support-fix.patch csa-basic-accounting-over-taskstats-fix.patch fs-cache-make-kafs-use-fs-cache-fix.patch fs-cache-make-kafs-use-fs-cache-vs-streamline-generic_file_-interfaces-and-filemap.patch nfs-use-local-caching-12-fix.patch stack-overflow-safe-kdump-crash_use_safe_smp_processor_id-fix.patch generic-ioremap_page_range-x86_64-conversion-fix.patch vfs-make-filldir_t-and-struct-kstat-deal-in-64-bit-inode-numbers-alpha-fix.patch some-cleanup-in-the-pipe-code-tidy.patch support-piping-into-commands-in-proc-sys-kernel-core_pattern-fix.patch move-pidmap-to-pspaceh-fix.patch kprobes-handle-symbol-resolution-when-modulesymbol-is-specified-tidy.patch isdn-work-around-excessive-udelay.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-tidy.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-fix.patch knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers-tweaks.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-tidy.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-fix.patch knfsd-drop-serv-option-to-svc_recv-and-svc_process-nfs-callback-fix-nfs-callback-fix.patch knfsd-move-tempsock-aging-to-a-timer-tidy.patch knfsd-nfsd4-fslocations-data-structures-fix.patch sched-remove-unnecessary-sched-group-allocations-fix.patch swap_prefetch-vs-zoned-counters.patch ecryptfs-mmap-operations.patch ecryptfs-alpha-build-fix.patch ecryptfs-more-elegant-aes-key-size-manipulation.patch ecryptfs-get_sb_dev-fix.patch make-kmem_cache_destroy-return-void-ecryptfs.patch ecryptfs-versioning-fixes-tidy.patch namespaces-add-nsproxy.patch namespaces-utsname-switch-to-using-uts-namespaces.patch namespaces-utsname-switch-to-using-uts-namespaces-klibc-bit-sparc.patch namespaces-utsname-use-init_utsname-when-appropriate.patch namespaces-utsname-implement-utsname-namespaces.patch namespaces-utsname-sysctl-hack.patch ipc-namespace-core.patch rename-the-provided-execve-functions-to-kernel_execve-headers-fix.patch replace-cad_pid-by-a-struct-pid-fixes.patch readahead-sysctl-parameters-fix.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch make-kmem_cache_destroy-return-void-reiser4.patch reiser4-hardirq-include-fix.patch reiser4-run-truncate_inode_pages-in-reiser4_delete_inode.patch reiser4-get_sb_dev-fix.patch reiser4-vs-zoned-allocator.patch reiser4-rename-generic_sounding_globalspatch-fix.patch hpt3xx-rework-rate-filtering-tidy.patch genirq-convert-the-i386-architecture-to-irq-chips.patch genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch genirq-msi-simplify-msi-enable-and-disable.patch genirq-ia64-irq-dynamic-irq-support.patch genirq-msi-only-build-msi-apicc-on-ia64-fix.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-x86_64-irq-make-vector_irq-per-cpu-fix.patch genirq-x86_64-irq-make-vector_irq-per-cpu-warning-fix.patch add-hypertransport-capability-defines-fix.patch initial-generic-hypertransport-interrupt-support-Kconfig-fix.patch srcu-report-out-of-memory-errors-fixlet.patch isdn-debug-build-fix.patch isdn-more-pr_debug-fixes.patch nr_blockdev_pages-in_interrupt-warning.patch device-suspend-debug.patch slab-leaks3-default-y.patch x86-kmap_atomic-debugging.patch restore-rogue-readahead-printk.patch put_bh-debug.patch acpi_format_exception-debug.patch jmicron-warning-fix.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html