Add TRACE_IRQFLAGS_SUPPORT, LOCKDEP_SUPPORT then enable ftrace for ia64
Subsystems (2)
RFC PATCH 1/1 Add TRACE_IRQFLAGS_SUPPORT, LOCKDEP_SUPPORT then enable ftrace for ia64
Hi there,
The following rfc patch is to add lockdep support and IRQ-flags state tracing support for ia64 architecture based on instructions described in irqflags-tracing.
The next step is to fix issues. I plan to target it for -32 or -33.
Ps. Bob Picco had done similar things before.
Ps. The patch is enclosed in attachment. The inlined one is c&p of it for reading.
Thanks,
Luming
arch/ia64/Kconfig | 7 +++ arch/ia64/Kconfig.debug | 4 + arch/ia64/include/asm/page.h | 2 arch/ia64/include/asm/rwsem.h | 3 + arch/ia64/include/asm/system.h | 84 ------------------------------------- arch/ia64/kernel/Makefile | 1 arch/ia64/kernel/ivt.S | 5 ++ arch/ia64/kernel/smpboot.c | 2 arch/ia64/kernel/stacktrace.c | 23 ++++++++++ include/asm-ia64/irqflags.h | 92 +++++++++++++++++++++++++++++++++++++++++ include/asm-ia64/stacktrace.h | 7 +++ include/linux/lockdep.h | 2 lib/Kconfig.debug | 2 13 files changed, 147 insertions(+), 87 deletions(-)
diff -BruN linux-2.6.31-rc6/arch/ia64/include/asm/page.h linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h
--- linux-2.6.31-rc6/arch/ia64/include/asm/page.h 2009-08-13
15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h 2009-08-23
18:59:00.000000000 -0700
@@ -41,7 +41,7 @@
#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE - 1))
-#define PERCPU_PAGE_SHIFT 16 /* log2() of max. size of per-CPU area */
+#define PERCPU_PAGE_SHIFT 20 /*16 log2() of max. size of per-CPU area */
#define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
diff -BruN linux-2.6.31-rc6/arch/ia64/include/asm/rwsem.h linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/rwsem.h
--- linux-2.6.31-rc6/arch/ia64/include/asm/rwsem.h 2009-08-13
15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/rwsem.h 2009-08-23
18:59:00.000000000 -0700
@@ -37,6 +37,9 @@
signed long count;
spinlock_t wait_lock;
struct list_head wait_list;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ struct lockdep_map dep_map;
+#endif
};
#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)
diff -BruN linux-2.6.31-rc6/arch/ia64/include/asm/system.h linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/system.h
--- linux-2.6.31-rc6/arch/ia64/include/asm/system.h 2009-08-13
15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/system.h 2009-08-23
18:59:00.000000000 -0700
@@ -107,88 +107,6 @@
*/
#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
-#define safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */
-
-/*
- * The group barrier in front of the rsm & ssm are necessary to ensure
- * that none of the previous instructions in the same group are
- * affected by the rsm/ssm.
- */
-/* For spinlocks etc */
-
-/*
- * - clearing psr.i is implicitly serialized (visible by next insn)
- * - setting psr.i requires data serialization
- * - we need a stop-bit before reading PSR because we sometimes
- * write a floating-point register right before reading the PSR
- * and that writes to PSR.mfl
- */
-#ifdef CONFIG_PARAVIRT
-#define __local_save_flags() ia64_get_psr_i()
-#else
-#define __local_save_flags() ia64_getreg(_IA64_REG_PSR)
-#endif
-
-#define __local_irq_save(x) \
-do { \
- ia64_stop(); \
- (x) = __local_save_flags(); \
- ia64_stop(); \
- ia64_rsm(IA64_PSR_I); \
-} while (0)
-
-#define __local_irq_disable() \
-do { \
- ia64_stop(); \
- ia64_rsm(IA64_PSR_I); \
-} while (0)
-
-#define __local_irq_restore(x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I)
-
-#ifdef CONFIG_IA64_DEBUG_IRQ
-
- extern unsigned long last_cli_ip;
-
-# define __save_ip() last_cli_ip = ia64_getreg(_IA64_REG_IP)
-
-# define local_irq_save(x) \
-do { \
- unsigned long __psr; \
- \
- __local_irq_save(__psr); \
- if (__psr & IA64_PSR_I) \
- __save_ip(); \
- (x) = __psr; \
-} while (0)
-
-# define local_irq_disable() do { unsigned long __x;local_irq_save(__x); } while (0)
-
-# define local_irq_restore(x) \
-do { \
- unsigned long __old_psr, __psr = (x); \
- \
- local_save_flags(__old_psr); \
- __local_irq_restore(__psr); \
- if ((__old_psr & IA64_PSR_I) && !(__psr & IA64_PSR_I)) \
- __save_ip(); \
-} while (0)
-
-#else /* !CONFIG_IA64_DEBUG_IRQ */
-# define local_irq_save(x) __local_irq_save(x)
-# define local_irq_disable() __local_irq_disable()
-# define local_irq_restore(x) __local_irq_restore(x)
-#endif /* !CONFIG_IA64_DEBUG_IRQ */
-
-#define local_irq_enable() ({ ia64_stop(); ia64_ssm(IA64_PSR_I);ia64_srlz_d(); })
-#define local_save_flags(flags) ({ ia64_stop(); (flags) =__local_save_flags(); })
-
-#define irqs_disabled() \
-({ \
- unsigned long __ia64_id_flags; \
- local_save_flags(__ia64_id_flags); \
- (__ia64_id_flags & IA64_PSR_I) == 0; \
-})
-
#ifdef __KERNEL__
#ifdef CONFIG_IA32_SUPPORT
@@ -274,7 +192,7 @@
#define __ARCH_WANT_UNLOCKED_CTXSW
#define ARCH_HAS_PREFETCH_SWITCH_STACK
#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
-
+#include <linux/irqflags.h>
void cpu_idle_wait(void);
#define arch_align_stack(x) (x)
diff -BruN linux-2.6.31-rc6/arch/ia64/Kconfig
linux-2.6.31-rc6-lockdep/arch/ia64/Kconfig
--- linux-2.6.31-rc6/arch/ia64/Kconfig 2009-08-13 15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/Kconfig 2009-08-23
18:59:00.000000000 -0700
@@ -143,6 +143,13 @@
endif
+config LOCKDEP_SUPPORT
+ bool
+ default y
+
+config STACKTRACE_SUPPORT
+ bool
+ default y
choice
prompt "System type"
default IA64_GENERIC
diff -BruN linux-2.6.31-rc6/arch/ia64/Kconfig.debug linux-2.6.31-rc6-lockdep/arch/ia64/Kconfig.debug
--- linux-2.6.31-rc6/arch/ia64/Kconfig.debug 2009-08-13 15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/Kconfig.debug 2009-08-23
18:58:59.000000000 -0700
@@ -2,6 +2,10 @@
source "lib/Kconfig.debug"
+config TRACE_IRQFLAGS_SUPPORT
+ bool
+ default y
+
choice
prompt "Physical memory granularity"
default IA64_GRANULE_64MB
diff -BruN linux-2.6.31-rc6/arch/ia64/kernel/ivt.S linux-2.6.31-rc6-lockdep/arch/ia64/kernel/ivt.S
--- linux-2.6.31-rc6/arch/ia64/kernel/ivt.S 2009-08-13 15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/kernel/ivt.S 2009-08-23
18:58:59.000000000 -0700
@@ -1603,6 +1603,11 @@
SAVE_REST
;;
MCA_RECOVER_RANGE(interrupt)
+#ifdef CONFIG_TRACE_IRQFLAGS
+ ;;
+ br.call.sptk.many rp=trace_hardirqs_off
+ ;;
+#endif
alloc r14=ar.pfs,0,0,2,0 // must be first in an insn group
MOV_FROM_IVR(out0, r8) // pass cr.ivr as first arg
add out1=16,sp // pass pointer to pt_regs as second arg
diff -BruN linux-2.6.31-rc6/arch/ia64/kernel/Makefile linux-2.6.31-rc6-lockdep/arch/ia64/kernel/Makefile
--- linux-2.6.31-rc6/arch/ia64/kernel/Makefile 2009-08-13
15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/kernel/Makefile 2009-08-23
18:58:59.000000000 -0700
@@ -40,6 +40,7 @@
obj-$(CONFIG_PCI_MSI) += msi_ia64.o
mca_recovery-y += mca_drv.o mca_drv_asm.o
obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o
+obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o \
paravirt_patch.o
diff -BruN linux-2.6.31-rc6/arch/ia64/kernel/smpboot.c linux-2.6.31-rc6-lockdep/arch/ia64/kernel/smpboot.c
--- linux-2.6.31-rc6/arch/ia64/kernel/smpboot.c 2009-08-13
15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/kernel/smpboot.c 2009-08-23
18:58:59.000000000 -0700
@@ -504,7 +504,7 @@
struct create_idle c_idle = {
.work = __WORK_INITIALIZER(c_idle.work, do_fork_idle),
.cpu = cpu,
- .done = COMPLETION_INITIALIZER(c_idle.done),
+ .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
};
c_idle.idle = get_idle_for_cpu(cpu);
diff -BruN linux-2.6.31-rc6/arch/ia64/kernel/stacktrace.c linux-2.6.31-rc6-lockdep/arch/ia64/kernel/stacktrace.c
--- linux-2.6.31-rc6/arch/ia64/kernel/stacktrace.c 1969-12-31
16:00:00.000000000 -0800
+++ linux-2.6.31-rc6-lockdep/arch/ia64/kernel/stacktrace.c 2009-08-23
18:58:59.000000000 -0700
@@ -0,0 +1,23 @@
+/*
+ * arch/x86_64/kernel/stacktrace.c
+ *
+ * Stack trace management functions
+ *
+ * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <[email protected]>
+ */
+#include <linux/sched.h>
+#include <linux/stacktrace.h>
+#include <linux/module.h>
+#include <asm/stacktrace.h>
+
+/*
+ * Save stack-backtrace addresses into a stack_trace buffer.
+ */
+void save_stack_trace(struct stack_trace *trace)
+{
+}
+EXPORT_SYMBOL(save_stack_trace);
+void __ia64_save_stack_nonlocal(struct stack_trace *trace) +{
+}
+EXPORT_SYMBOL(__ia64_save_stack_nonlocal);
diff -BruN linux-2.6.31-rc6/include/asm-ia64/irqflags.h linux-2.6.31-rc6-lockdep/include/asm-ia64/irqflags.h
--- linux-2.6.31-rc6/include/asm-ia64/irqflags.h 1969-12-31
16:00:00.000000000 -0800
+++ linux-2.6.31-rc6-lockdep/include/asm-ia64/irqflags.h 2009-08-23
18:59:14.000000000 -0700
@@ -0,0 +1,92 @@
+#ifndef _ASM_IRQFLAGS_H
+#define _ASM_IRQFLAGS_H
+#include <asm/kregs.h>
+#include <asm/pal.h>
+/*
+ * The group barrier in front of the rsm & ssm are necessary to ensure
+ * that none of the previous instructions in the same group are
+ * affected by the rsm/ssm.
+ */
+/* For spinlocks etc */
+
+/*
+ * - clearing psr.i is implicitly serialized (visible by next insn)
+ * - setting psr.i requires data serialization
+ * - we need a stop-bit before reading PSR because we sometimes
+ * write a floating-point register right before reading the PSR
+ * and that writes to PSR.mfl
+ */
+#define __local_irq_save(x) \
+do { \
+ ia64_stop(); \
+ (x) = ia64_getreg(_IA64_REG_PSR); \
+ ia64_stop(); \
+ ia64_rsm(IA64_PSR_I); \
+} while (0)
+
+#define __local_irq_disable() \
+do { \
+ ia64_stop(); \
+ ia64_rsm(IA64_PSR_I); \
+} while (0)
+
+#define __local_irq_restore(x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I)
+
+#ifdef CONFIG_IA64_DEBUG_IRQ
+
+ extern unsigned long last_cli_ip;
+
+# define __save_ip() last_cli_ip = ia64_getreg(_IA64_REG_IP)
+
+# define raw_local_irq_save(x) \
+do { \
+ unsigned long psr; \
+ \
+ __local_irq_save(psr); \
+ if (psr & IA64_PSR_I) \
+ __save_ip(); \
+ (x) = psr; \
+} while (0)
+
+# define raw_local_irq_disable() do { unsigned long x;raw_local_irq_save(x); } while (0)
+
+# define raw_local_irq_restore(x) \
+do { \
+ unsigned long old_psr, psr = (x); \
+ \
+ local_save_flags(old_psr); \
+ __local_irq_restore(psr); \
+ if ((old_psr & IA64_PSR_I) && !(psr & IA64_PSR_I)) \
+ __save_ip(); \
+} while (0)
+
+#else /* !CONFIG_IA64_DEBUG_IRQ */
+# define raw_local_irq_save(x) __local_irq_save(x)
+# define raw_local_irq_disable() __local_irq_disable()
+# define raw_local_irq_restore(x) __local_irq_restore(x)
+#endif /* !CONFIG_IA64_DEBUG_IRQ */
+
+#define raw_local_irq_enable() ({ ia64_stop(); ia64_ssm(IA64_PSR_I);ia64_srlz_d(); })
+#define raw_local_save_flags(flags) ({ ia64_stop(); (flags) =ia64_getreg(_IA64_REG_PSR); })
+
+#define raw_irqs_disabled() \
+({ \
+ unsigned long __ia64_id_flags; \
+ raw_local_save_flags(__ia64_id_flags); \
+ (__ia64_id_flags & IA64_PSR_I) == 0; \
+})
+
+#define raw_safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */
+#define raw_irqs_disabled_flags(flags) \
+({ \
+ (int)((flags) & IA64_PSR_I) == 0; \
+})
+
+#ifdef CONFIG_TRACE_IRQFLAGS
+#define TRACE_IRQS_ON br.call.sptk.many b0=trace_hardirqs_on +#define TRACE_IRQS_OFF br.call.sptk.many b0=trace_hardirqs_off +#else
+#define TRACE_IRQS_ON
+#define TRACE_IRQS_OFF
+#endif
+#endif
diff -BruN linux-2.6.31-rc6/include/asm-ia64/stacktrace.h linux-2.6.31-rc6-lockdep/include/asm-ia64/stacktrace.h
--- linux-2.6.31-rc6/include/asm-ia64/stacktrace.h 1969-12-31
16:00:00.000000000 -0800
+++ linux-2.6.31-rc6-lockdep/include/asm-ia64/stacktrace.h 2009-08-23
18:59:14.000000000 -0700
@@ -0,0 +1,7 @@
+#ifndef _ASM_STACKTRACE_H
+#define _ASM_STACKTRACE_H 1
+
+/* Generic stack tracer with callbacks */
+
+
+#endif
diff -BruN linux-2.6.31-rc6/include/linux/lockdep.h linux-2.6.31-rc6-lockdep/include/linux/lockdep.h
--- linux-2.6.31-rc6/include/linux/lockdep.h 2009-08-13 15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/include/linux/lockdep.h 2009-08-23
18:59:20.000000000 -0700
@@ -162,7 +162,7 @@
u64 chain_key;
};
-#define MAX_LOCKDEP_KEYS_BITS 13
+#define MAX_LOCKDEP_KEYS_BITS 10
/*
* Subtract one because we offset hlock->class_idx by 1 in order
* to make 0 mean no class. This avoids overflowing the class_idx
diff -BruN linux-2.6.31-rc6/lib/Kconfig.debug linux-2.6.31-rc6-lockdep/lib/Kconfig.debug
--- linux-2.6.31-rc6/lib/Kconfig.debug 2009-08-13 15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/lib/Kconfig.debug 2009-08-23
18:59:06.000000000 -0700
@@ -504,7 +504,7 @@
config DEBUG_LOCKDEP
bool "Lock dependency engine debugging"
- depends on DEBUG_KERNEL && LOCKDEP
+ depends on DEBUG_KERNEL && LOCKDEP && !IA64
help
If you say Y here, the lock dependency engine will do additional runtime checks to debug itself, at the price
arch/ia64/include/asm/page.h +1 -1
@@ -41,7 +41,7 @@#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE - 1)) -#define PERCPU_PAGE_SHIFT 16/* log2() of max. size of per-CPU area */ +#define PERCPU_PAGE_SHIFT 20/*16 log2() of max. size of per-CPU area */ #define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
arch/ia64/include/asm/rwsem.h +3 -0
@@ -37,6 +37,9 @@signed long count;spinlock_t wait_lock;struct list_head wait_list; +#ifdef CONFIG_DEBUG_LOCK_ALLOC +struct lockdep_map dep_map; +#endif };#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)
arch/ia64/include/asm/system.h +1 -83
96 lines not on this page · raw message
arch/ia64/Kconfig +7 -0
@@ -143,6 +143,13 @@ endif +config LOCKDEP_SUPPORT + bool + default y + +config STACKTRACE_SUPPORT + bool + default y choice prompt "System type" default IA64_GENERIC
arch/ia64/Kconfig.debug +4 -0
@@ -2,6 +2,10 @@ source "lib/Kconfig.debug" +config TRACE_IRQFLAGS_SUPPORT + bool + default y + choice prompt "Physical memory granularity" default IA64_GRANULE_64MB
arch/ia64/kernel/ivt.S +5 -0
@@ -1603,6 +1603,11 @@ SAVE_REST ;; MCA_RECOVER_RANGE(interrupt) +#ifdef CONFIG_TRACE_IRQFLAGS + ;; + br.call.sptk.many rp=trace_hardirqs_off + ;; +#endif alloc r14=ar.pfs,0,0,2,0 // must be first in an insn group MOV_FROM_IVR(out0, r8) // pass cr.ivr as first arg add out1=16,sp // pass pointer to pt_regs as second arg
arch/ia64/kernel/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_PCI_MSI) += msi_ia64.o mca_recovery-y += mca_drv.o mca_drv_asm.o obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o +obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o \ paravirt_patch.o
arch/ia64/kernel/smpboot.c +1 -1
@@ -504,7 +504,7 @@struct create_idle c_idle = { .work =__WORK_INITIALIZER (c_idle.work, do_fork_idle), .cpu = cpu, - .done =COMPLETION_INITIALIZER (c_idle.done), + .done =COMPLETION_INITIALIZER_ONSTACK (c_idle.done), }; c_idle.idle =get_idle_for_cpu (cpu);
arch/ia64/kernel/stacktrace.c +23 -0
@@ -0,0 +1,23 @@ +/* +* arch/x86_64/kernel/stacktrace.c +* +* Stack trace management functions +* +* Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <[email protected]> +*/ +#include <linux/sched.h> +#include <linux/stacktrace.h> +#include <linux/module.h> +#include <asm/stacktrace.h> + +/* +* Save stack-backtrace addresses into a stack_trace buffer. +*/ +void save_stack_trace (struct stack_trace *trace) +{ +} +EXPORT_SYMBOL (save_stack_trace); +void __ia64_save_stack_nonlocal (struct stack_trace *trace) +{ +} +EXPORT_SYMBOL (__ia64_save_stack_nonlocal);
include/asm-ia64/irqflags.h +92 -0
92 lines not on this page · raw message
include/asm-ia64/stacktrace.h +7 -0
@@ -0,0 +1,7 @@ +#ifndef _ASM_STACKTRACE_H +#define _ASM_STACKTRACE_H 1 + +/* Generic stack tracer with callbacks */ + + +#endif
include/linux/lockdep.h +1 -1
@@ -162,7 +162,7 @@u64 chain_key; }; -#define MAX_LOCKDEP_KEYS_BITS 13 +#define MAX_LOCKDEP_KEYS_BITS 10/* * Subtract one because we offset hlock->class_idx by 1 in order * to make 0 mean no class. This avoids overflowing the class_idx
lib/Kconfig.debug +1 -1
@@ -504,7 +504,7 @@ config DEBUG_LOCKDEP bool "Lock dependency engine debugging" - depends on DEBUG_KERNEL && LOCKDEP + depends on DEBUG_KERNEL && LOCKDEP && !IA64 help If you say Y here, the lock dependency engine will do additional runtime checks to debug itself, at the price
Quoted 28 lines · Luming Yu
Hi there,
The following rfc patch is to add lockdep support and IRQ-flags state tracing support for ia64 architecture based on instructions described in irqflags-tracing.
The next step is to fix issues. I plan to target it for -32 or -33.
Ps. Bob Picco had done similar things before.
Ps. The patch is enclosed in attachment. The inlined one is c&p of it for reading.
Thanks,
LumingSigned-off-by Bob Picco <[email protected]>Signed-off-by Yu Luming <[email protected]>diff -BruN
linux-2.6.31-rc6/arch/ia64/include/asm/page.hlinux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h
---linux-2.6.31-rc6/arch/ia64/include/asm/page.h2009-08-13
15:43:34.000000000 -0700
+++linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h2009-08-23
18:59:00.000000000 -0700
arch/ia64/include/asm/page.h line 45
Quoted 6 lines
arch/ia64/include/asm/page.h +1
-1@@ -41,7 +41,7 @@#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE - 1)) -#define PERCPU_PAGE_SHIFT 16/* log2() of max. size of per-CPU area */ +#define PERCPU_PAGE_SHIFT 20/*16 log2() of max. size of per-CPU area */ #define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
Why was this seemingly unrelated change done in a lockdep patch?
Quoted 128 lines
diff -BruN
linux-2.6.31-rc6/arch/ia64/include/asm/rwsem.hlinux-2.6.31-rc6-lockdep/arch/ia64/include/asm/rwsem.h
---linux-2.6.31-rc6/arch/ia64/include/asm/rwsem.h2009-08-13
15:43:34.000000000 -0700
+++linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/rwsem.h2009-08-23
18:59:00.000000000 -0700arch/ia64/include/asm/rwsem.h +3
-0@@ -37,6 +37,9 @@signed long count;spinlock_t wait_lock;struct list_head wait_list; +#ifdef CONFIG_DEBUG_LOCK_ALLOC +struct lockdep_map dep_map; +#endif };#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)diff -BruN
linux-2.6.31-rc6/arch/ia64/include/asm/system.hlinux-2.6.31-rc6-lockdep/arch/ia64/include/asm/system.h
---linux-2.6.31-rc6/arch/ia64/include/asm/system.h2009-08-13
15:43:34.000000000 -0700
+++linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/system.h2009-08-23
18:59:00.000000000 -0700arch/ia64/include/asm/system.h +0
-82@@ -107,88 +107,6 @@*/ #define set_mb (var, value) do { (var) = (value); mb(); } while (0) -#define safe_halt () ia64_pal_halt_light()/* PAL_HALT_LIGHT */ - -/* -* The group barrier in front of the rsm & ssm are necessary to ensure -* that none of the previous instructions in the same group are -* affected by the rsm/ssm. -*/ -/* For spinlocks etc */ - -/* -* - clearing psr.i is implicitly serialized (visible by next insn) -* - setting psr.i requires data serialization -* - we need a stop-bit before reading PSR because we sometimes -* write a floating-point register right before reading the PSR -* and that writes to PSR.mfl -*/ -#ifdef CONFIG_PARAVIRT -#define __local_save_flags () ia64_get_psr_i() -#else -#define __local_save_flags () ia64_getreg(_IA64_REG_PSR) -#endif - -#define __local_irq_save (x) \ -do { \ - ia64_stop(); \ - (x) = __local_save_flags(); \ - ia64_stop(); \ - ia64_rsm(IA64_PSR_I); \ -} while (0) - -#define __local_irq_disable () \ -do { \ - ia64_stop(); \ - ia64_rsm(IA64_PSR_I); \ -} while (0) - -#define __local_irq_restore (x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I) - -#ifdef CONFIG_IA64_DEBUG_IRQ - -extern unsigned long last_cli_ip; - -# define __save_ip () last_cli_ip = ia64_getreg(_IA64_REG_IP) - -# define local_irq_save (x) \ -do { \ - unsigned long __psr; \ - \ - __local_irq_save(__psr); \ - if (__psr & IA64_PSR_I) \ - __save_ip(); \ - (x) = __psr; \ -} while (0) - -# define local_irq_disable () do { unsigned long __x;local_irq_save (__x); }while (0 ) - -# define local_irq_restore (x) \ -do { \ - unsigned long __old_psr, __psr = (x); \ - \ - local_save_flags(__old_psr); \ - __local_irq_restore(__psr); \ - if ((__old_psr & IA64_PSR_I) && !(__psr & IA64_PSR_I)) \ - __save_ip(); \ -} while (0) - -#else /* !CONFIG_IA64_DEBUG_IRQ */ -# define local_irq_save (x) __local_irq_save(x) -# define local_irq_disable () __local_irq_disable() -# define local_irq_restore (x) __local_irq_restore(x) -#endif /* !CONFIG_IA64_DEBUG_IRQ */ - -#define local_irq_enable () ({ ia64_stop(); ia64_ssm(IA64_PSR_I); ia64_srlz_d(); }) -#define local_save_flags (flags) ({ ia64_stop(); (flags) > __local_save_flags(); }) - -#define irqs_disabled () \ -({ \ - unsigned long __ia64_id_flags; \ - local_save_flags(__ia64_id_flags); \ - (__ia64_id_flags & IA64_PSR_I) = 0; \ -}) -#ifdef __KERNEL__#ifdef
CONFIG_IA32_SUPPORTarch/ia64/include/asm/system.h +1
-1@@ -274,7 +192,7 @@#define __ARCH_WANT_UNLOCKED_CTXSW#define ARCH_HAS_PREFETCH_SWITCH_STACK #define ia64_platform_is (x) (strcmp(x, platform_name) = 0) - +#include <linux/irqflags.h> void cpu_idle_wait (void );#define arch_align_stack (x) (x)diff -BruN linux-2.6.31-rc6/arch/ia64/Kconfig
linux-2.6.31-rc6-lockdep/arch/ia64/Kconfigarch/ia64/Kconfig +0
-018:59:00.000000000 -0700
arch/ia64/Kconfig line 152
Quoted 10 lines
arch/ia64/Kconfig +7
-0@@ -143,6 +143,13 @@ endif +config LOCKDEP_SUPPORT + bool + default y + +config STACKTRACE_SUPPORT + bool + default y
The (shorter) form we generally use when architectures enable a feature is:
config LOCKDEP_SUPPORT
def_bool y
config STACKTRACE_SUPPORT
def_bool y
( Separate cleanup patch: it might make sense to offer this in
generic code and just select a HAVE_LOCKDEP_SUPPORT flag. This affects all lockdep architectures so should be handled separately. )
Quoted 9 lines
arch/ia64/Kconfig +0
-0choice prompt "System type" default IA64_GENERICdiff -BruN linux-2.6.31-rc6/arch/ia64/Kconfig.debug linux-2.6.31-rc6-lockdep/arch/ia64/Kconfig.debug
arch/ia64/Kconfig.debug +0
-018:58:59.000000000 -0700
arch/ia64/Kconfig.debug line 7
Quoted 6 lines
arch/ia64/Kconfig.debug +3
-0@@ -2,6 +2,10 @@ source "lib/Kconfig.debug" +config TRACE_IRQFLAGS_SUPPORT + bool + default y
(same comment as above.)
Quoted 67 lines
arch/ia64/Kconfig.debug +1
-0+ choice prompt "Physical memory granularity" default IA64_GRANULE_64MBdiff -BruN
linux-2.6.31-rc6/arch/ia64/kernel/ivt.Slinux-2.6.31-rc6-lockdep/arch/ia64/kernel/ivt.Sarch/ia64/kernel/ivt.S +0
-018:58:59.000000000 -0700
arch/ia64/kernel/ivt.S +5
-0@@ -1603,6 +1603,11 @@ SAVE_REST ;; MCA_RECOVER_RANGE(interrupt) +#ifdef CONFIG_TRACE_IRQFLAGS + ;; + br.call.sptk.many rp=trace_hardirqs_off + ;; +#endif alloc r14=ar.pfs,0,0,2,0 // must be first in an insn group MOV_FROM_IVR(out0, r8) // pass cr.ivr as first arg add out1,sp // pass pointer to pt_regs as second argdiff -BruN linux-2.6.31-rc6/arch/ia64/kernel/Makefile linux-2.6.31-rc6-lockdep/arch/ia64/kernel/Makefile
--- linux-2.6.31-rc6/arch/ia64/kernel/Makefile 2009-08-13
15:43:34.000000000 -0700
+++ linux-2.6.31-rc6-lockdep/arch/ia64/kernel/Makefile 2009-08-23
18:58:59.000000000 -0700arch/ia64/kernel/ivt.S +1
-0@@ -40,6 +40,7 @@ obj-$(CONFIG_PCI_MSI) += msi_ia64.o mca_recovery-y += mca_drv.o mca_drv_asm.o obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o + obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o \ paravirt_patch.odiff -BruN
linux-2.6.31-rc6/arch/ia64/kernel/smpboot.clinux-2.6.31-rc6-lockdep/arch/ia64/kernel/smpboot.c
---linux-2.6.31-rc6/arch/ia64/kernel/smpboot.c2009-08-13
15:43:34.000000000 -0700
+++linux-2.6.31-rc6-lockdep/arch/ia64/kernel/smpboot.c2009-08-23
18:58:59.000000000 -0700arch/ia64/kernel/ivt.S +1
-1@@ -504,7 +504,7 @@ struct create_idle c_idle = { .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle), .cpu = cpu, - .done = COMPLETION_INITIALIZER(c_idle.done), + .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), }; c_idle.idle = get_idle_for_cpu(cpu);diff -BruN
linux-2.6.31-rc6/arch/ia64/kernel/stacktrace.clinux-2.6.31-rc6-lockdep/arch/ia64/kernel/stacktrace.c
---linux-2.6.31-rc6/arch/ia64/kernel/stacktrace.c1969-12-31
16:00:00.000000000 -0800
+++linux-2.6.31-rc6-lockdep/arch/ia64/kernel/stacktrace.c2009-08-23
18:58:59.000000000 -0700arch/ia64/kernel/ivt.S +10
-0@@ -0,0 +1,23 @@ +/* + * arch/x86_64/kernel/stacktrace.c + * + * Stack trace management functions + * + * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <[email protected]> + */ +#include <linux/sched.h> +#include <linux/stacktrace.h> +#include <linux/module.h>
arch/ia64/kernel/ivt.S line 20
Quoted 10 lines
arch/ia64/kernel/ivt.S +10
-0+#include <asm/stacktrace.h> + +/* + * Save stack-backtrace addresses into a stack_trace buffer. + */ +void save_stack_trace(struct stack_trace *trace) +{ +} +EXPORT_SYMBOL(save_stack_trace); +void __ia64_save_stack_nonlocal(struct stack_trace *trace)
(nit: missing newline)
arch/ia64/kernel/ivt.S line 23
Quoted 3 lines
arch/ia64/kernel/ivt.S +3
-0+{ +} +EXPORT_SYMBOL(__ia64_save_stack_nonlocal);
also, these functions should be implemented, for lockdep reports to be readable. Generally this is done by librarizing the dump_stack() et al architecture code into stacktrace.c.
Quoted 8 lines
diff -BruN
linux-2.6.31-rc6/include/asm-ia64/irqflags.hlinux-2.6.31-rc6-lockdep/include/asm-ia64/irqflags.h
---linux-2.6.31-rc6/include/asm-ia64/irqflags.h1969-12-31
16:00:00.000000000 -0800
+++linux-2.6.31-rc6-lockdep/include/asm-ia64/irqflags.h2009-08-23
18:59:14.000000000 -0700arch/ia64/kernel/ivt.S +1
-0@@ -0,0 +1,92 @@ +#ifndef _ASM_IRQFLAGS_H
arch/ia64/kernel/ivt.S line 11
Quoted 10 lines
arch/ia64/kernel/ivt.S +10
-0+#define _ASM_IRQFLAGS_H +#include <asm/kregs.h> +#include <asm/pal.h> +/* + * The group barrier in front of the rsm & ssm are necessary to ensure + * that none of the previous instructions in the same group are + * affected by the rsm/ssm. + */ +/* For spinlocks etc */ +
( nit: looks a bit disorganized - could be merged into a single
comment block? )
Quoted 4 lines
arch/ia64/kernel/ivt.S +4
-0+/* + * - clearing psr.i is implicitly serialized (visible by next insn) + * - setting psr.i requires data serialization + * - we need a stop-bit before reading PSR because we sometimes
arch/ia64/kernel/ivt.S line 25
Quoted 10 lines
arch/ia64/kernel/ivt.S +10
-0+ * write a floating-point register right before reading the PSR + * and that writes to PSR.mfl + */ +#define __local_irq_save(x) \ +do { \ + ia64_stop(); \ + (x) = ia64_getreg(_IA64_REG_PSR); \ + ia64_stop(); \ + ia64_rsm(IA64_PSR_I); \ +} while (0)
please use C inline functions for all of irqflags.h (x86 does that too). Macros have all sorts of disadvantages: they are harder to read and also double evaluation side-effects are harder to keep under control.
Quoted 26 lines
arch/ia64/kernel/ivt.S +26
-0+ +#define __local_irq_disable() \ +do { \ + ia64_stop(); \ + ia64_rsm(IA64_PSR_I); \ +} while (0) + +#define __local_irq_restore(x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I) + +#ifdef CONFIG_IA64_DEBUG_IRQ + + extern unsigned long last_cli_ip; + +# define __save_ip() last_cli_ip = ia64_getreg(_IA64_REG_IP) + +# define raw_local_irq_save(x) \ +do { \ + unsigned long psr; \ + \ + __local_irq_save(psr); \ + if (psr & IA64_PSR_I) \ + __save_ip(); \ + (x) = psr; \ +} while (0) + +# define raw_local_irq_disable() do { unsigned long x;
Quoted 1 line
raw_local_irq_save(x); } while (0)
( the patch seems line-wrapped, see Documentation/email-clients.txt
about how to send plain-text patches. )
Quoted 62 lines
arch/ia64/kernel/ivt.S +18
-0+ +# define raw_local_irq_restore(x) \ +do { \ + unsigned long old_psr, psr = (x); \ + \ + local_save_flags(old_psr); \ + __local_irq_restore(psr); \ + if ((old_psr & IA64_PSR_I) && !(psr & IA64_PSR_I)) \ + __save_ip(); \ +} while (0) + +#else /* !CONFIG_IA64_DEBUG_IRQ */ +# define raw_local_irq_save(x) __local_irq_save(x) +# define raw_local_irq_disable() __local_irq_disable() +# define raw_local_irq_restore(x) __local_irq_restore(x) +#endif /* !CONFIG_IA64_DEBUG_IRQ */ + +#define raw_local_irq_enable() ({ ia64_stop(); ia64_ssm(IA64_PSR_I);
ia64_srlz_d(); })arch/ia64/kernel/ivt.S +23
-0+#define raw_local_save_flags(flags) ({ ia64_stop(); (flags) > ia64_getreg(_IA64_REG_PSR); }) + +#define raw_irqs_disabled() \ +({ \ + unsigned long __ia64_id_flags; \ + raw_local_save_flags(__ia64_id_flags); \ + (__ia64_id_flags & IA64_PSR_I) = 0; \ +}) + +#define raw_safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */ +#define raw_irqs_disabled_flags(flags) \ +({ \ + (int)((flags) & IA64_PSR_I) = 0; \ +}) + +#ifdef CONFIG_TRACE_IRQFLAGS +#define TRACE_IRQS_ON br.call.sptk.many b0=trace_hardirqs_on +#define TRACE_IRQS_OFF br.call.sptk.many b0=trace_hardirqs_off +#else +#define TRACE_IRQS_ON +#define TRACE_IRQS_OFF +#endif +#endifdiff -BruN
linux-2.6.31-rc6/include/asm-ia64/stacktrace.hlinux-2.6.31-rc6-lockdep/include/asm-ia64/stacktrace.h
---linux-2.6.31-rc6/include/asm-ia64/stacktrace.h1969-12-31
16:00:00.000000000 -0800
+++linux-2.6.31-rc6-lockdep/include/asm-ia64/stacktrace.h2009-08-23
18:59:14.000000000 -0700arch/ia64/kernel/ivt.S +7
-0@@ -0,0 +1,7 @@ +#ifndef _ASM_STACKTRACE_H +#define _ASM_STACKTRACE_H 1 + +/* Generic stack tracer with callbacks */ + + +#endif
linux-2.6.31-rc6-lockdep/include/linux/lockdep.hinclude/linux/lockdep.h +0
-018:59:20.000000000 -0700
include/linux/lockdep.h line 165
Quoted 5 lines
include/linux/lockdep.h +1
-1@@ -162,7 +162,7 @@u64 chain_key; }; -#define MAX_LOCKDEP_KEYS_BITS 13 +#define MAX_LOCKDEP_KEYS_BITS 10
Why did you have to do this bit?
lib/Kconfig.debug line 508
Quoted 11 lines
linux-2.6.31-rc6-lockdep/lib/Kconfig.debug
lib/Kconfig.debug +0
-018:59:06.000000000 -0700
lib/Kconfig.debug +1
-1@@ -504,7 +504,7 @@ config DEBUG_LOCKDEP bool "Lock dependency engine debugging" - depends on DEBUG_KERNEL && LOCKDEP + depends on DEBUG_KERNEL && LOCKDEP && !IA64 help
That should be fixed (and this chunk will then not be needed) before this is merged.
Also, a few general comments:
- There's no lockdep_sys_exit support implemented. (This callback is needed to detect lock counts leaking to user-space. Just call it in the return-from-syscall codepath(s).)
- There's no changes to exception code assembly AFAICS - such as debug traps, special exceptions, etc. You should review all places in the IA64 code where there's open-coded or hardware-implicit enable-irqs or disable-irqs instructions, not just the main local_irq_*() functions. A starting point would be:
git grep IA64_PSR_I arch/ia64/ | grep .S:
but there may be instructions and trap entries where there's implicit irq-flags behavior - those need to be examined too.
- Do kprobes work with this patch?
- No NMI support AFAICS - all NMI codepaths should be exempted from irqflags coverage.
Thanks,
Ingo
Quoted 10 lines
Quoted 10 lines
diff -BruN
linux-2.6.31-rc6/arch/ia64/include/asm/page.hlinux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h
---linux-2.6.31-rc6/arch/ia64/include/asm/page.h2009-08-13
15:43:34.000000000 -0700
+++linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h2009-08-23
18:59:00.000000000 -0700arch/ia64/include/asm/page.h +0
-0@@ -41,7 +41,7 @@#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE - 1))
Quoted 5 lines
arch/ia64/include/asm/page.h line 45
Quoted 3 lines
arch/ia64/include/asm/page.h +1
-1-#define PERCPU_PAGE_SHIFT 16/* log2() of max. size of per-CPU area */ +#define PERCPU_PAGE_SHIFT 20/*16 log2() of max. size of per-CPU area */ #define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)Why was this seemingly unrelated change done in a lockdep patch?
IIRC it is because the lockdep code needs a lot more percpu memory than the 64K that ia64 allocates.
But I think that I'd prefer to only allocate the extra space when it is needed:
#ifdef CONFIG_LOCKDEP
#define PERCPU_PAGE_SHIFT 20 /* Need a Megabyte for lockdep */ #else
#define PERCPU_PAGE_SHIFT 16 /* 64K should be enough for normal use */ #endif
-Tony
Quoted 19 lines · Tony
Quoted 10 lines
Quoted 10 lines
diff -BruN
linux-2.6.31-rc6/arch/ia64/include/asm/page.hlinux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h
---linux-2.6.31-rc6/arch/ia64/include/asm/page.h2009-08-13
15:43:34.000000000 -0700
+++linux-2.6.31-rc6-lockdep/arch/ia64/include/asm/page.h2009-08-23
18:59:00.000000000 -0700arch/ia64/include/asm/page.h +0
-0@@ -41,7 +41,7 @@#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE - 1))Quoted 5 lines
arch/ia64/include/asm/page.h line 45
Quoted 3 lines
arch/ia64/include/asm/page.h +1
-1-#define PERCPU_PAGE_SHIFT 16/* log2() of max. size of per-CPU area */ +#define PERCPU_PAGE_SHIFT 20/*16 log2() of max. size of per-CPU area */ #define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)Why was this seemingly unrelated change done in a lockdep patch?
IIRC it is because the lockdep code needs a lot more percpu memory than the 64K that ia64 allocates.
Quoted 8 lines
But I think that I'd prefer to only allocate the extra space when it is needed:
#ifdef
CONFIG_LOCKDEP
#definePERCPU_PAGE_SHIFT20 /* Need a Megabyte for lockdep */ #else
#definePERCPU_PAGE_SHIFT16 /* 64K should be enough for normal use */ #endif
Hmm, isn't all that percpu stuff in a special section, who's size you can query at boot time and set-up accordingly?
Quoted 8 lines
Quoted 5 lines
#ifdef
CONFIG_LOCKDEP
#definePERCPU_PAGE_SHIFT20 /* Need a Megabyte for lockdep */ #else
#definePERCPU_PAGE_SHIFT16 /* 64K should be enough for normal use */ #endifHmm, isn't all that percpu stuff in a special section, who's size you can query at boot time and set-up accordingly?
The size is a build time parameter (must match with a supported TLB page size for ia64 ... i.e. even power of two ... so 64K, 256K, 1M, 4M are all possible, but 128K, 512K, 2M, ... are not).
Any code that includes the right header files can look at PERCPU_PAGE_SHIFT (or PERCPU_PAGE_SIZE) and make decisions about things. But in the lockdep case the extra percpu space is statically allocated, so the special section overflows and results in a build failure.
-Tony
Sorry for later response, hope we can make it in -33-rc I just have time update the patch based on your comments and known issues not fixed in previous patch.
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-#define PERCPU_PAGE_SHIFT 16 /* log2() of max. size of per-CPU area */ +#define PERCPU_PAGE_SHIFT 20 /*16 log2() of max. size of per-CPU area */Why was this seemingly unrelated change done in a lockdep patch?
Tony has answered it.
Quoted 12 lines
Review
Quoted 8 lines
(quoted diff) +7
-0+config LOCKDEP_SUPPORT + bool + default y + +config STACKTRACE_SUPPORT + bool + default yThe (shorter) form we generally use when architectures enable a feature is:
Quoted 2 lines
config
LOCKDEP_SUPPORT
def_booly
Updated in new patch.
Quoted 8 lines
config
STACKTRACE_SUPPORT
def_booly( Separate cleanup patch: it might make sense to offer this in generic code and just select a
HAVE_LOCKDEP_SUPPORTflag. This affects all lockdep architectures so should be handled separately. )
Will update in an incremental patch
once this patch is in.
Quoted 5 lines
Quoted 3 lines
+config
TRACE_IRQFLAGS_SUPPORT
+ bool
+ default y(same comment as above.)
Updated in new patch.
Quoted 7 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+void save_stack_trace(struct stack_trace *trace) +{ +} +EXPORT_SYMBOL(save_stack_trace); +void __ia64_save_stack_nonlocal(struct stack_trace *trace)(nit: missing newline)
Updated in new patch
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +3
-0+{ +} +EXPORT_SYMBOL(__ia64_save_stack_nonlocal);also, these functions should be implemented, for lockdep reports to be readable. Generally this is done by librarizing the
dump_stack()et al architecture code intostacktrace.c.
Yes, Will update in an incremental patch once this patch is in.
Quoted 14 lines
Quoted 14 lines
diff -BruN
linux-2.6.31-rc6/include/asm-ia64/irqflags.hlinux-2.6.31-rc6-lockdep/include/asm-ia64/irqflags.h
---linux-2.6.31-rc6/include/asm-ia64/irqflags.h1969-12-31 16:00:00.000000000 -0800
+++linux-2.6.31-rc6-lockdep/include/asm-ia64/irqflags.h2009-08-23 18:59:14.000000000 -0700(quoted diff) +6
-0@@ -0,0 +1,92 @@ +#ifndef _ASM_IRQFLAGS_H +#define _ASM_IRQFLAGS_H +#include <asm/kregs.h> +#include <asm/pal.h> +/* + * The group barrier in front of the rsm & ssm are necessary to ensure
Quoted 8 lines
Review line 11
Quoted 5 lines
(quoted diff) +5
-0+ * that none of the previous instructions in the same group are + * affected by the rsm/ssm. + */ +/* For spinlocks etc */ +( nit: looks a bit disorganized - could be merged into a single comment block? )
Updated in new patch
Quoted 12 lines
Quoted 12 lines
(quoted diff) +11
-0+/* + * - clearing psr.i is implicitly serialized (visible by next insn) + * - setting psr.i requires data serialization + * - we need a stop-bit before reading PSR because we sometimes + * write a floating-point register right before reading the PSR + * and that writes to PSR.mfl + */ +#define __local_irq_save(x) \ +do { \ + ia64_stop(); \ + (x) = ia64_getreg(_IA64_REG_PSR); \
Quoted 8 lines
Review line 25
Quoted 3 lines
(quoted diff) +3
-0+ ia64_stop(); \ + ia64_rsm(IA64_PSR_I); \ +} while (0)please use C inline functions for all of
irqflags.h(x86 does that too). Macros have all sorts of disadvantages: they are harder to read and also double evaluation side-effects are harder to keep under control.
Good point. There are a lot of such kind of Macros in IA64 architecture waiting thoroughly clean up. May I update this part later?
Quoted 6 lines
Quoted 3 lines
(quoted diff) +2
-0+ +# define raw_local_irq_disable() do { unsigned long x;
raw_local_irq_save(x); } while (0)( the patch seems line-wrapped, see
Documentation/email-clients.txtabout how to send plain-text patches. )
I'm sorry for this. Please apply attached patch.
I use web gmail since it is the most convenient way to me.
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-#define MAX_LOCKDEP_KEYS_BITS 13 +#define MAX_LOCKDEP_KEYS_BITS 10Why did you have to do this bit?
Without dynamic allocation both in Lockdep code and ia64 architecture in place, 13 bits requires far moe size than ia64 can support in Per CPU area (1M)
Tony, is it correct?
Quoted 9 lines
Quoted 6 lines
config
DEBUG_LOCKDEP
bool "Lock dependency engine debugging"
- depends onDEBUG_KERNEL&& LOCKDEP
+ depends onDEBUG_KERNEL&& LOCKDEP && !IA64
helpThat should be fixed (and this chunk will then not be needed) before this is merged.
Updated in new patch
Quoted 6 lines
Also, a few general comments:
- There's no
lockdep_sys_exitsupport implemented. (This callback is needed to detect lock counts leaking to user-space. Just call it in the return-from-syscall codepath(s).)
Updated in new patch. But Temporarily commented out in call site. I tested it, but there is lock held before leaving kernel... Will root cause, and fix the problem later.
Quoted 11 lines
- There's no changes to exception code assembly AFAICS - such as debug traps, special exceptions, etc. You should review all places in the IA64 code where there's open-coded or hardware-implicit enable-irqs or disable-irqs instructions, not just the main local_irq_*() functions. A starting point would be:
git grep
IA64_PSR_Iarch/ia64/| grep .S:but there may be instructions and trap entries where there's implicit irq-flags behavior - those need to be examined too.
Updated some in assembly code that modify PSR.I bit. But not all, because not all modifications of PSR.i bit would be interesting to lockdep code..
Quoted 2 lines
- Do kprobes work with this patch?
Tested, yes.
Quoted 3 lines
- No NMI support AFAICS - all NMI codepaths should be exempted from irqflags coverage.
Good point, I need to find out place to insertnmi_enter and nmi_exit., and do some testing.
Not done yet.
Will update in an incremental patch after the patch is accepted.
Quoted 4 lines
Thanks,
Ingo
Thanks for review.
Quoted 1 line
The following is some results with the new patch.
[root@localhost ~]# dmesg | head -2
Linux version 2.6.31 ([email protected]) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Thu Dec 3 16:35:07 PST 2009
[root@localhost ~]# dmesg | grep Kprobe
Kprobe smoke test started
Kprobe smoke test passed successfully
[root@localhost ~]# dmesg
.....
Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
... MAX_LOCKDEP_SUBCLASSES: 8 ... MAX_LOCK_DEPTH: 48 ... MAX_LOCKDEP_KEYS: 1023 ... CLASSHASH_SIZE: 512 ... MAX_LOCKDEP_ENTRIES: 16384 ... MAX_LOCKDEP_CHAINS: 32768 ... CHAINHASH_SIZE: 16384
memory used by lock dependency info: 2679 kB
per task-struct memory footprint: 2688 bytes
------------------------
| Locking API testsuite:
----------------------------------------------------------------------------
| spin |wlock |rlock |mutex | wsem | rsem |
--------------------------------------------------------------------------
A-A deadlock: ok | ok | ok | ok | ok | ok |
A-B-B-A deadlock: ok | ok | ok | ok | ok | ok |
A-B-B-C-C-A deadlock: ok | ok | ok | ok | ok | ok |
A-B-C-A-B-C deadlock: ok | ok | ok | ok | ok | ok |
A-B-B-C-C-D-D-A deadlock: ok | ok | ok | ok | ok | ok |
A-B-C-D-B-D-D-A deadlock: ok | ok | ok | ok | ok | ok |
A-B-C-D-B-C-D-A deadlock: ok | ok | ok | ok | ok | ok |
double unlock: ok | ok | ok | ok | ok | ok |
initialize held: ok | ok | ok | ok | ok | ok |
bad unlock order: ok | ok | ok | ok | ok | ok |
--------------------------------------------------------------------------
recursive read-lock: | ok | | ok |
recursive read-lock #2: | ok | | ok |
mixed read-write-lock: | ok | | ok |
mixed write-read-lock: | ok | | ok |
--------------------------------------------------------------------------
hard-irqs-on + irq-safe-A/12: ok | ok | ok |
soft-irqs-on + irq-safe-A/12: ok | ok | ok |
hard-irqs-on + irq-safe-A/21: ok | ok | ok |
soft-irqs-on + irq-safe-A/21: ok | ok | ok |
sirq-safe-A => hirqs-on/12: ok | ok | ok |
sirq-safe-A => hirqs-on/21: ok | ok | ok |
hard-safe-A + irqs-on/12: ok | ok | ok |
soft-safe-A + irqs-on/12: ok | ok | ok |
hard-safe-A + irqs-on/21: ok | ok | ok |
soft-safe-A + irqs-on/21: ok | ok | ok |
hard-safe-A + unsafe-B #1/123: ok | ok | ok |
soft-safe-A + unsafe-B #1/123: ok | ok | ok |
hard-safe-A + unsafe-B #1/132: ok | ok | ok |
soft-safe-A + unsafe-B #1/132: ok | ok | ok |
hard-safe-A + unsafe-B #1/213: ok | ok | ok |
soft-safe-A + unsafe-B #1/213: ok | ok | ok |
hard-safe-A + unsafe-B #1/231: ok | ok | ok |
soft-safe-A + unsafe-B #1/231: ok | ok | ok |
hard-safe-A + unsafe-B #1/312: ok | ok | ok |
soft-safe-A + unsafe-B #1/312: ok | ok | ok |
hard-safe-A + unsafe-B #1/321: ok | ok | ok |
soft-safe-A + unsafe-B #1/321: ok | ok | ok |
hard-safe-A + unsafe-B #2/123: ok | ok | ok |
soft-safe-A + unsafe-B #2/123: ok | ok | ok |
hard-safe-A + unsafe-B #2/132: ok | ok | ok |
soft-safe-A + unsafe-B #2/132: ok | ok | ok |
hard-safe-A + unsafe-B #2/213: ok | ok | ok |
soft-safe-A + unsafe-B #2/213: ok | ok | ok |
hard-safe-A + unsafe-B #2/231: ok | ok | ok |
soft-safe-A + unsafe-B #2/231: ok | ok | ok |
hard-safe-A + unsafe-B #2/312: ok | ok | ok |
soft-safe-A + unsafe-B #2/312: ok | ok | ok |
hard-safe-A + unsafe-B #2/321: ok | ok | ok |
soft-safe-A + unsafe-B #2/321: ok | ok | ok |
hard-irq lock-inversion/123: ok | ok | ok |
soft-irq lock-inversion/123: ok | ok | ok |
hard-irq lock-inversion/132: ok | ok | ok |
soft-irq lock-inversion/132: ok | ok | ok |
hard-irq lock-inversion/213: ok | ok | ok |
soft-irq lock-inversion/213: ok | ok | ok |
hard-irq lock-inversion/231: ok | ok | ok |
soft-irq lock-inversion/231: ok | ok | ok |
hard-irq lock-inversion/312: ok | ok | ok |
soft-irq lock-inversion/312: ok | ok | ok |
hard-irq lock-inversion/321: ok | ok | ok |
soft-irq lock-inversion/321: ok | ok | ok |
hard-irq read-recursion/123: ok |
soft-irq read-recursion/123: ok |
hard-irq read-recursion/132: ok |
soft-irq read-recursion/132: ok |
hard-irq read-recursion/213: ok |
soft-irq read-recursion/213: ok |
hard-irq read-recursion/231: ok |
soft-irq read-recursion/231: ok |
hard-irq read-recursion/312: ok |
soft-irq read-recursion/312: ok |
hard-irq read-recursion/321: ok |
soft-irq read-recursion/321: ok |-------------------------------------------------------
Good, all 218 testcases passed! |
[root@localhost ~]# cat /proc/lockdep_stats
lock-classes: 546 [max: 1023] direct dependencies: 572 [max: 16384] indirect dependencies: 455 all direct dependencies: 2132 dependency chains: 1194 [max: 32768] dependency chain hlocks: 1928 [max: 163840] in-hardirq chains: 7 in-softirq chains: 3 in-process chains: 317 stack-trace entries: 0 [max: 262144] combined max dependencies: 10176 hardirq-safe locks: 8 hardirq-unsafe locks: 65 softirq-safe locks: 10 softirq-unsafe locks: 64 irq-safe locks: 16 irq-unsafe locks: 65 hardirq-read-safe locks: 0 hardirq-read-unsafe locks: 5 softirq-read-safe locks: 0 softirq-read-unsafe locks: 5 irq-read-safe locks: 0 irq-read-unsafe locks: 5 uncategorized locks: 41 unused locks: 0 max locking depth: 5 max recursion depth: 4 debug_locks: 0
Known issues:
0. dynamic allocate per CPU area in lockdep.
1. lock held in leave kernel.
2. enabling CONFIG_DEBUG_LOCKDEP triggers the lockdep warning.
WARNING: at kernel/lockdep.c:2901 check_flags+0x1c0/0x480()
Modules linked in:
Call Trace:
[<a000000100017310>] show_stack+0x70/0xc0
sp=a000000100be7c40 bsp=a000000100be1e00
[<a0000001000173b0>] dump_stack+0x50/0x80
sp=a000000100be7e10 bsp=a000000100be1dd8
[<a000000100095750>] warn_slowpath_common+0xf0/0x140
sp=a000000100be7e10 bsp=a000000100be1d98
[<a000000100095800>] warn_slowpath_null+0x60/0x80
sp=a000000100be7e10 bsp=a000000100be1d68
[<a0000001000ecf00>] check_flags+0x1c0/0x480
sp=a000000100be7e10 bsp=a000000100be1d40
[<a0000001000f34a0>] lockdep_trace_alloc+0x60/0x160
sp=a000000100be7e10 bsp=a000000100be1d10
[<a0000001001ec2d0>] kmem_cache_alloc_node+0x70/0x440
sp=a000000100be7e10 bsp=a000000100be1cb8
[<a0000001001ec740>] __kmalloc_node+0xa0/0x1a0
sp=a000000100be7e10 bsp=a000000100be1c68
[<a0000001001ee7e0>] alloc_arraycache+0x60/0xe0
sp=a000000100be7e20 bsp=a000000100be1c28
[<a0000001001f02c0>] alloc_alien_cache+0x160/0x280
sp=a000000100be7e20 bsp=a000000100be1bd0
[<a0000001001f0960>] do_tune_cpucache+0x580/0xba0
sp=a000000100be7e20 bsp=a000000100be1b58
[<a0000001001f1470>] enable_cpucache+0x130/0x200
sp=a000000100be7e20 bsp=a000000100be1b20
[<a000000100b06c20>] kmem_cache_init_late+0x60/0x3e0
sp=a000000100be7e20 bsp=a000000100be1ae0
[<a000000100ae12b0>] start_kernel+0x550/0x940
sp=a000000100be7e20 bsp=a000000100be1a60
[<a000000100841a60>] _start+0x760/0x780
sp=a000000100be7e30 bsp=a000000100be19c0
---[ end trace 4eaa2a86a8e2da22 ]---possible reason: unannotated irqs-on.
Please review patch update. If make sense, please apply.
Ps. The patch is enclosed in attachment. The inline one is c&p of it for reading.
Thanks,
Luming
arch/ia64/Kconfig | 6 ++ arch/ia64/Kconfig.debug | 3 + arch/ia64/include/asm/irqflags.h | 101 +++++++++++++++++++++++++++++++++++++ arch/ia64/include/asm/page.h | 2 arch/ia64/include/asm/rwsem.h | 27 ++++++--- arch/ia64/include/asm/stacktrace.h | 7 ++ arch/ia64/include/asm/system.h | 84 ------------------------------ arch/ia64/kernel/Makefile | 1 arch/ia64/kernel/entry.S | 6 ++ arch/ia64/kernel/ivt.S | 29 ++++++++++ arch/ia64/kernel/process.c | 6 +- arch/ia64/kernel/setup.c | 4 + arch/ia64/kernel/smpboot.c | 2 arch/ia64/kernel/stacktrace.c | 24 ++++++++ arch/ia64/kernel/time.c | 4 - include/linux/lockdep.h | 2
diff -BruN linux-2.6.31/arch/ia64/include/asm/irqflags.h testing/arch/ia64/include/asm/irqflags.h
--- linux-2.6.31/arch/ia64/include/asm/irqflags.h 1969-12-31
16:00:00.000000000 -0800
+++ testing/arch/ia64/include/asm/irqflags.h 2009-12-03 15:40:45.000000000 -0800
@@ -0,0 +1,101 @@
+#ifndef _ASM_IRQFLAGS_H
+#define _ASM_IRQFLAGS_H
+#include <asm/kregs.h>
+#include <asm/pal.h>
+/*
+ * The group barrier in front of the rsm & ssm are necessary to ensure
+ * that none of the previous instructions in the same group are
+ * affected by the rsm/ssm.
+ *
+ * For spinlocks etc
+ * - clearing psr.i is implicitly serialized (visible by next insn)
+ * - setting psr.i requires data serialization
+ * - we need a stop-bit before reading PSR because we sometimes
+ * write a floating-point register right before reading the PSR
+ * and that writes to PSR.mfl
+ */
+#define __local_irq_save(x) \
+do { \
+ ia64_stop(); \
+ (x) = ia64_getreg(_IA64_REG_PSR); \
+ ia64_stop(); \
+ ia64_rsm(IA64_PSR_I); \
+} while (0)
+
+#define __local_irq_disable() \
+do { \
+ ia64_stop(); \
+ ia64_rsm(IA64_PSR_I); \
+} while (0)
+
+#define __local_irq_restore(x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I)
+
+#ifdef CONFIG_IA64_DEBUG_IRQ
+
+ extern unsigned long last_cli_ip;
+
+# define __save_ip() last_cli_ip = ia64_getreg(_IA64_REG_IP)
+
+# define raw_local_irq_save(x) \
+do { \
+ unsigned long psr; \
+ \
+ __local_irq_save(psr); \
+ if (psr & IA64_PSR_I) \
+ __save_ip(); \
+ (x) = psr; \
+} while (0)
+
+# define raw_local_irq_disable() do { unsigned long x;raw_local_irq_save(x); } while (0)
+
+# define raw_local_irq_restore(x) \
+do { \
+ unsigned long old_psr, psr = (x); \
+ \
+ local_save_flags(old_psr); \
+ __local_irq_restore(psr); \
+ if ((old_psr & IA64_PSR_I) && !(psr & IA64_PSR_I)) \
+ __save_ip(); \
+} while (0)
+
+#else /* !CONFIG_IA64_DEBUG_IRQ */
+# define raw_local_irq_save(x) __local_irq_save(x)
+# define raw_local_irq_disable() __local_irq_disable()
+# define raw_local_irq_restore(x) __local_irq_restore(x)
+#endif /* !CONFIG_IA64_DEBUG_IRQ */
+
+#define raw_local_irq_enable() ({ ia64_stop(); ia64_ssm(IA64_PSR_I);ia64_srlz_d(); })
+#define raw_local_save_flags(flags) ({ ia64_stop(); (flags) =ia64_getreg(_IA64_REG_PSR); })
+
+#define raw_irqs_disabled() \
+({ \
+ unsigned long __ia64_id_flags; \
+ raw_local_save_flags(__ia64_id_flags); \
+ (__ia64_id_flags & IA64_PSR_I) == 0; \
+})
+
+#define raw_safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */
+#define raw_irqs_disabled_flags(flags) \
+({ \
+ (int)((flags) & IA64_PSR_I) == 0; \
+})
+
+#ifdef CONFIG_TRACE_IRQFLAGS
+#define TRACE_IRQS_ON br.call.sptk.many b0=trace_hardirqs_on +#define TRACE_IRQS_OFF br.call.sptk.many b0=trace_hardirqs_off +#else
+#define TRACE_IRQS_ON
+#define TRACE_IRQS_OFF
+#endif
+
+#define ARCH_LOCKDEP_SYS_EXIT br.call.sptk.many rp=lockdep_sys_exit +
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#define LOCKDEP_SYS_EXIT ARCH_LOCKDEP_SYS_EXIT
+#else
+#define LOCKDEP_SYS_EXIT
+#endif
+
+#endif
+
+
diff -BruN linux-2.6.31/arch/ia64/include/asm/page.h testing/arch/ia64/include/asm/page.h
--- linux-2.6.31/arch/ia64/include/asm/page.h 2009-09-09
15:13:59.000000000 -0700
+++ testing/arch/ia64/include/asm/page.h 2009-12-03 12:01:50.000000000 -0800
@@ -41,7 +41,7 @@
#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE - 1))
-#define PERCPU_PAGE_SHIFT 16 /* log2() of max. size of per-CPU area */
+#define PERCPU_PAGE_SHIFT 20 /*20 log2() of max. size of per-CPU area */
#define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
diff -BruN linux-2.6.31/arch/ia64/include/asm/rwsem.h testing/arch/ia64/include/asm/rwsem.h
--- linux-2.6.31/arch/ia64/include/asm/rwsem.h 2009-09-09
15:13:59.000000000 -0700
+++ testing/arch/ia64/include/asm/rwsem.h 2009-12-03 11:39:27.000000000 -0800
@@ -37,6 +37,9 @@
signed long count;
spinlock_t wait_lock;
struct list_head wait_list;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ struct lockdep_map dep_map;
+#endif
};
#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)
@@ -46,9 +49,15 @@
#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } +#else
+# define __RWSEM_DEP_MAP_INIT(lockname)
+#endif
+
#define __RWSEM_INITIALIZER(name) \
{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
- LIST_HEAD_INIT((name).wait_list) }
+ LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name)}
#define DECLARE_RWSEM(name) \
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -58,13 +67,15 @@
extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
-static inline void
-init_rwsem (struct rw_semaphore *sem)
-{
- sem->count = RWSEM_UNLOCKED_VALUE;
- spin_lock_init(&sem->wait_lock);
- INIT_LIST_HEAD(&sem->wait_list);
-}
+extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
+ struct lock_class_key *key);
+
+#define init_rwsem(sem) \
+do { \
+ static struct lock_class_key __key; \
+ \
+ __init_rwsem((sem), #sem, &__key); \
+} while (0)
/*
* lock for reading
diff -BruN linux-2.6.31/arch/ia64/include/asm/stacktrace.h testing/arch/ia64/include/asm/stacktrace.h
--- linux-2.6.31/arch/ia64/include/asm/stacktrace.h 1969-12-31
16:00:00.000000000 -0800
+++ testing/arch/ia64/include/asm/stacktrace.h 2009-12-03
12:32:58.000000000 -0800
@@ -0,0 +1,7 @@
+#ifndef _ASM_STACKTRACE_H
+#define _ASM_STACKTRACE_H 1
+
+/* Generic stack tracer with callbacks */
+
+
+#endif
diff -BruN linux-2.6.31/arch/ia64/include/asm/system.h testing/arch/ia64/include/asm/system.h
--- linux-2.6.31/arch/ia64/include/asm/system.h 2009-09-09
15:13:59.000000000 -0700
+++ testing/arch/ia64/include/asm/system.h 2009-12-02 21:56:56.000000000 -0800
@@ -107,88 +107,6 @@
*/
#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
-#define safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */
-
-/*
- * The group barrier in front of the rsm & ssm are necessary to ensure
- * that none of the previous instructions in the same group are
- * affected by the rsm/ssm.
- */
-/* For spinlocks etc */
-
-/*
- * - clearing psr.i is implicitly serialized (visible by next insn)
- * - setting psr.i requires data serialization
- * - we need a stop-bit before reading PSR because we sometimes
- * write a floating-point register right before reading the PSR
- * and that writes to PSR.mfl
- */
-#ifdef CONFIG_PARAVIRT
-#define __local_save_flags() ia64_get_psr_i()
-#else
-#define __local_save_flags() ia64_getreg(_IA64_REG_PSR)
-#endif
-
-#define __local_irq_save(x) \
-do { \
- ia64_stop(); \
- (x) = __local_save_flags(); \
- ia64_stop(); \
- ia64_rsm(IA64_PSR_I); \
-} while (0)
-
-#define __local_irq_disable() \
-do { \
- ia64_stop(); \
- ia64_rsm(IA64_PSR_I); \
-} while (0)
-
-#define __local_irq_restore(x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I)
-
-#ifdef CONFIG_IA64_DEBUG_IRQ
-
- extern unsigned long last_cli_ip;
-
-# define __save_ip() last_cli_ip = ia64_getreg(_IA64_REG_IP)
-
-# define local_irq_save(x) \
-do { \
- unsigned long __psr; \
- \
- __local_irq_save(__psr); \
- if (__psr & IA64_PSR_I) \
- __save_ip(); \
- (x) = __psr; \
-} while (0)
-
-# define local_irq_disable() do { unsigned long __x;local_irq_save(__x); } while (0)
-
-# define local_irq_restore(x) \
-do { \
- unsigned long __old_psr, __psr = (x); \
- \
- local_save_flags(__old_psr); \
- __local_irq_restore(__psr); \
- if ((__old_psr & IA64_PSR_I) && !(__psr & IA64_PSR_I)) \
- __save_ip(); \
-} while (0)
-
-#else /* !CONFIG_IA64_DEBUG_IRQ */
-# define local_irq_save(x) __local_irq_save(x)
-# define local_irq_disable() __local_irq_disable()
-# define local_irq_restore(x) __local_irq_restore(x)
-#endif /* !CONFIG_IA64_DEBUG_IRQ */
-
-#define local_irq_enable() ({ ia64_stop(); ia64_ssm(IA64_PSR_I);ia64_srlz_d(); })
-#define local_save_flags(flags) ({ ia64_stop(); (flags) =__local_save_flags(); })
-
-#define irqs_disabled() \
-({ \
- unsigned long __ia64_id_flags; \
- local_save_flags(__ia64_id_flags); \
- (__ia64_id_flags & IA64_PSR_I) == 0; \
-})
-
#ifdef __KERNEL__
#ifdef CONFIG_IA32_SUPPORT
@@ -274,7 +192,7 @@
#define __ARCH_WANT_UNLOCKED_CTXSW
#define ARCH_HAS_PREFETCH_SWITCH_STACK
#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
-
+#include <linux/irqflags.h>
void cpu_idle_wait(void);
#define arch_align_stack(x) (x)
arch/ia64/Kconfig +6 -0
@@ -143,6 +143,12 @@ endif +config LOCKDEP_SUPPORT + def_bool y + +config STACKTRACE_SUPPORT + def_bool y + choice prompt "System type" default IA64_GENERIC
arch/ia64/Kconfig.debug +3 -0
@@ -2,6 +2,9 @@ source "lib/Kconfig.debug" +config TRACE_IRQFLAGS_SUPPORT + def_bool y + choice prompt "Physical memory granularity" default IA64_GRANULE_64MB
diff -BruN linux-2.6.31/arch/ia64/kernel/entry.Stesting/arch/ia64/kernel/entry.S
arch/ia64/kernel/entry.S +6 -0
@@ -48,6 +48,7 @@ #include <asm/thread_info.h> #include <asm/unistd.h> #include <asm/ftrace.h> +#include <asm/irqflags.h> #include "minstate.h"
@@ -897,6 +899,11 @@ cmp.eq p6,p0=r21,r0 // p6 <- pUStk || (preempt_count == 0) #else RSM_PSR_I(pUStk, r17, r31) +#if 0 //Todo: fix lock held when returning to user space + ;; + LOCKDEP_SYS_EXIT + ;; +#endif cmp.eq p0,pLvSys=r0,r0 // pLvSys=0: leave from kernel (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk #endif
arch/ia64/kernel/ivt.S +0 -0
@@ -855,6 +855,11 @@ mov rp=r3 // I0 set the real return addr (p10) br.cond.spnt.many ia64_ret_from_syscall // B return if bad
call-frame or r15 is a NaT
+#ifdef TRACE_IRQFLAGS_SUPPORT
+ ;;
+(p15) br.call.sptk.many rp=trace_hardirqs_on
+ ;;
+#endif
SSM_PSR_I(p15, p15, r16) // M2 restore psr.i
(p14) br.call.sptk.many b6=b6 // B invoke syscall-handker
(ignore return addr)
br.cond.spnt.many ia64_trace_syscall // B do syscall-tracing thingamagic
@@ -1555,6 +1560,11 @@
MOV_FROM_ISR(out1) SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r14, r3)
adds r3=8,r2 // set up second base pointer
+#ifdef TRACE_IRQFLAGS_SUPPORT
+ ;;
+(p15) br.call.sptk.many rp=trace_hardirqs_on
+ ;;
+#endif
SSM_PSR_I(p15, p15, r14) // restore psr.i
movl r14=ia64_leave_kernel
;;
@@ -1582,6 +1592,11 @@
SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r15, r24)
// guarantee that interruption collection is on
+#ifdef TRACE_IRQFLAGS_SUPPORT
+ ;;
+(p15) br.call.sptk.many rp=trace_hardirqs_on
+ ;;
+#endif
SSM_PSR_I(p15, p15, r15) // restore psr.i
movl r15=ia64_leave_kernel
;;
@@ -1630,6 +1645,11 @@
SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r3, r24)
// guarantee that interruption collection is on
+#ifdef TRACE_IRQFLAGS_SUPPORT
+ ;;
+(p15) br.call.sptk.many rp=trace_hardirqs_on
+ ;;
+#endif
SSM_PSR_I(p15, p15, r3) // restore psr.i
adds r3=8,r2 // set up second base pointer
;;
@@ -1665,6 +1685,11 @@
// guarantee that interruption collection is on
mov out0=r15
;;
+#ifdef TRACE_IRQFLAGS_SUPPORT
+ ;;
+(p15) br.call.sptk.many rp=trace_hardirqs_on
+ ;;
+#endif
SSM_PSR_I(p15, p15, r3) // restore psr.i
adds r3=8,r2 // set up second base pointer for SAVE_REST
;;
@@ -1733,7 +1758,11 @@
MOV_FROM_ISR(r14)
SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r3, r24)
// guarantee that interruption collection is on
+#ifdef TRACE_IRQFLAGS_SUPPORT
;;
+(p15) br.call.sptk.many rp=trace_hardirqs_on
+ ;;
+#endif
SSM_PSR_I(p15, p15, r3)
adds r3=8,r2 // Base pointer for SAVE_REST
;;
diff -BruN linux-2.6.31/arch/ia64/kernel/Makefile testing/arch/ia64/kernel/Makefile
arch/ia64/kernel/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_PCI_MSI) += msi_ia64.o mca_recovery-y += mca_drv.o mca_drv_asm.o obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o +obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o \ paravirt_patch.o
diff -BruN linux-2.6.31/arch/ia64/kernel/process.c testing/arch/ia64/kernel/process.c
arch/ia64/kernel/process.c +3 -3
@@ -225,14 +225,14 @@void default_idle (void ) { -local_irq_enable (); +raw_local_irq_enable ();while (!need_resched ()) {if (can_do_pal_halt) { -local_irq_disable (); +raw_local_irq_disable ();if (!need_resched ()) {safe_halt (); } -local_irq_enable (); +raw_local_irq_enable (); }else cpu_relax (); }
diff -BruN linux-2.6.31/arch/ia64/kernel/setup.ctesting/arch/ia64/kernel/setup.c
arch/ia64/kernel/setup.c +4 -0
@@ -1021,7 +1021,11 @@BUG_ON (current->mm);ia64_mmu_init (ia64_imva (cpu_data)); + +/* Temporarily suppress lockdep WARN_ON irqs disabled*/ +lockdep_off ();ia64_mca_cpu_init (ia64_imva (cpu_data)); +lockdep_on ();#ifdef CONFIG_IA32_SUPPORT ia32_cpu_init ();
diff -BruN linux-2.6.31/arch/ia64/kernel/smpboot.c testing/arch/ia64/kernel/smpboot.c
arch/ia64/kernel/smpboot.c +1 -1
@@ -504,7 +504,7 @@struct create_idle c_idle = { .work =__WORK_INITIALIZER (c_idle.work, do_fork_idle), .cpu = cpu, - .done =COMPLETION_INITIALIZER (c_idle.done), + .done =COMPLETION_INITIALIZER_ONSTACK (c_idle.done), }; c_idle.idle =get_idle_for_cpu (cpu);
diff -BruN linux-2.6.31/arch/ia64/kernel/stacktrace.c testing/arch/ia64/kernel/stacktrace.c
--- linux-2.6.31/arch/ia64/kernel/stacktrace.c 1969-12-31
16:00:00.000000000 -0800
+++ testing/arch/ia64/kernel/stacktrace.c 2009-12-03 12:33:55.000000000 -0800
@@ -0,0 +1,24 @@
+/*
+ * arch/x86_64/kernel/stacktrace.c
+ *
+ * Stack trace management functions
+ *
+ * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <[email protected]>
+ */
+#include <linux/sched.h>
+#include <linux/stacktrace.h>
+#include <linux/module.h>
+#include <asm/stacktrace.h>
+
+/*
+ * Save stack-backtrace addresses into a stack_trace buffer.
+ */
+void save_stack_trace(struct stack_trace *trace)
+{
+}
+EXPORT_SYMBOL(save_stack_trace);
+
+void __ia64_save_stack_nonlocal(struct stack_trace *trace) +{
+}
+EXPORT_SYMBOL(__ia64_save_stack_nonlocal);
arch/ia64/kernel/time.c +2 -2
@@ -210,8 +210,8 @@/* * Allow IPIs to interrupt the timer loop. */ -local_irq_enable (); -local_irq_disable (); +raw_local_irq_enable (); +raw_local_irq_disable (); } skip_process_time_accounting:
include/linux/lockdep.h +1 -1
@@ -162,7 +162,7 @@u64 chain_key; }; -#define MAX_LOCKDEP_KEYS_BITS 13 +#define MAX_LOCKDEP_KEYS_BITS 10/* * Subtract one because we offset hlock->class_idx by 1 in order * to make 0 mean no class. This avoids overflowing the class_idx
arch/ia64/include/asm/irqflags.h +101 -0
101 lines not on this page · raw message
arch/ia64/include/asm/page.h +1 -1
@@ -41,7 +41,7 @@#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE - 1)) -#define PERCPU_PAGE_SHIFT 16/* log2() of max. size of per-CPU area */ +#define PERCPU_PAGE_SHIFT 20/*20 log2() of max. size of per-CPU area */ #define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
arch/ia64/include/asm/rwsem.h +19 -8
@@ -37,6 +37,9 @@signed long count;spinlock_t wait_lock;struct list_head wait_list; +#ifdef CONFIG_DEBUG_LOCK_ALLOC +struct lockdep_map dep_map; +#endif };#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)
@@ -46,9 +49,15 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) +#ifdef CONFIG_DEBUG_LOCK_ALLOC +# define __RWSEM_DEP_MAP_INIT (lockname) , .dep_map = { .name = #lockname } +#else +# define __RWSEM_DEP_MAP_INIT (lockname) +#endif +#define __RWSEM_INITIALIZER (name) \ { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ - LIST_HEAD_INIT((name).wait_list) } + LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name)}#define DECLARE_RWSEM (name) \ struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -58,13 +67,15 @@extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -static inline void -init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} +extern void __init_rwsem (struct rw_semaphore *sem,const char *name, +struct lock_class_key *key); + +#define init_rwsem (sem) \ +do { \ + static struct lock_class_key __key; \ + \ + __init_rwsem((sem), #sem, &__key); \ +} while (0)/* * lock for reading
arch/ia64/include/asm/stacktrace.h +7 -0
@@ -0,0 +1,7 @@ +#ifndef _ASM_STACKTRACE_H +#define _ASM_STACKTRACE_H 1 + +/* Generic stack tracer with callbacks */ + + +#endif
arch/ia64/include/asm/system.h +1 -83
96 lines not on this page · raw message
arch/ia64/Kconfig +6 -0
@@ -143,6 +143,12 @@ endif +config LOCKDEP_SUPPORT + def_bool y + +config STACKTRACE_SUPPORT + def_bool y + choice prompt "System type" default IA64_GENERIC
arch/ia64/Kconfig.debug +3 -0
@@ -2,6 +2,9 @@ source "lib/Kconfig.debug" +config TRACE_IRQFLAGS_SUPPORT + def_bool y + choice prompt "Physical memory granularity" default IA64_GRANULE_64MB
arch/ia64/kernel/entry.S +6 -0
@@ -48,6 +48,7 @@ #include <asm/thread_info.h> #include <asm/unistd.h> #include <asm/ftrace.h> +#include <asm/irqflags.h> #include "minstate.h"
@@ -897,6 +899,11 @@ cmp.eq p6,p0=r21,r0 // p6 <- pUStk || (preempt_count == 0) #else RSM_PSR_I(pUStk, r17, r31) +#if 0 //Todo: fix lock held when returning to user space + ;; + LOCKDEP_SYS_EXIT + ;; +#endif cmp.eq p0,pLvSys=r0,r0 // pLvSys=0: leave from kernel (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk #endif
arch/ia64/kernel/ivt.S +29 -0
@@ -855,6 +855,11 @@ mov rp=r3 // I0 set the real return addr (p10) br.cond.spnt.many ia64_ret_from_syscall // B return if bad call-frame or r15 is a NaT +#ifdef TRACE_IRQFLAGS_SUPPORT + ;; +(p15) br.call.sptk.many rp=trace_hardirqs_on + ;; +#endif SSM_PSR_I(p15, p15, r16) // M2 restore psr.i (p14) br.call.sptk.many b6=b6 // B invoke syscall-handker (ignore return addr) br.cond.spnt.many ia64_trace_syscall // B do syscall-tracing thingamagic
@@ -1555,6 +1560,11 @@ MOV_FROM_ISR(out1) SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r14, r3) adds r3=8,r2 // set up second base pointer +#ifdef TRACE_IRQFLAGS_SUPPORT + ;; +(p15) br.call.sptk.many rp=trace_hardirqs_on + ;; +#endif SSM_PSR_I(p15, p15, r14) // restore psr.i movl r14=ia64_leave_kernel ;;
@@ -1582,6 +1592,11 @@ SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r15, r24) // guarantee that interruption collection is on +#ifdef TRACE_IRQFLAGS_SUPPORT + ;; +(p15) br.call.sptk.many rp=trace_hardirqs_on + ;; +#endif SSM_PSR_I(p15, p15, r15) // restore psr.i movl r15=ia64_leave_kernel ;;
@@ -1630,6 +1645,11 @@ SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r3, r24) // guarantee that interruption collection is on +#ifdef TRACE_IRQFLAGS_SUPPORT + ;; +(p15) br.call.sptk.many rp=trace_hardirqs_on + ;; +#endif SSM_PSR_I(p15, p15, r3) // restore psr.i adds r3=8,r2 // set up second base pointer ;;
@@ -1665,6 +1685,11 @@ // guarantee that interruption collection is on mov out0=r15 ;; +#ifdef TRACE_IRQFLAGS_SUPPORT + ;; +(p15) br.call.sptk.many rp=trace_hardirqs_on + ;; +#endif SSM_PSR_I(p15, p15, r3) // restore psr.i adds r3=8,r2 // set up second base pointer for SAVE_REST ;;
@@ -1733,7 +1758,11 @@ MOV_FROM_ISR(r14) SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r3, r24) // guarantee that interruption collection is on +#ifdef TRACE_IRQFLAGS_SUPPORT ;; +(p15) br.call.sptk.many rp=trace_hardirqs_on + ;; +#endif SSM_PSR_I(p15, p15, r3) adds r3=8,r2 // Base pointer for SAVE_REST ;;
arch/ia64/kernel/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_PCI_MSI) += msi_ia64.o mca_recovery-y += mca_drv.o mca_drv_asm.o obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o +obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o \ paravirt_patch.o
arch/ia64/kernel/process.c +3 -3
@@ -225,14 +225,14 @@void default_idle (void ) { -local_irq_enable (); +raw_local_irq_enable ();while (!need_resched ()) {if (can_do_pal_halt) { -local_irq_disable (); +raw_local_irq_disable ();if (!need_resched ()) {safe_halt (); } -local_irq_enable (); +raw_local_irq_enable (); }else cpu_relax (); }
arch/ia64/kernel/setup.c +4 -0
@@ -1021,7 +1021,11 @@BUG_ON (current->mm);ia64_mmu_init (ia64_imva (cpu_data)); + +/* Temporarily suppress lockdep WARN_ON irqs disabled*/ +lockdep_off ();ia64_mca_cpu_init (ia64_imva (cpu_data)); +lockdep_on ();#ifdef CONFIG_IA32_SUPPORT ia32_cpu_init ();
arch/ia64/kernel/smpboot.c +1 -1
@@ -504,7 +504,7 @@struct create_idle c_idle = { .work =__WORK_INITIALIZER (c_idle.work, do_fork_idle), .cpu = cpu, - .done =COMPLETION_INITIALIZER (c_idle.done), + .done =COMPLETION_INITIALIZER_ONSTACK (c_idle.done), }; c_idle.idle =get_idle_for_cpu (cpu);
arch/ia64/kernel/stacktrace.c +24 -0
@@ -0,0 +1,24 @@ +/* +* arch/x86_64/kernel/stacktrace.c +* +* Stack trace management functions +* +* Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <[email protected]> +*/ +#include <linux/sched.h> +#include <linux/stacktrace.h> +#include <linux/module.h> +#include <asm/stacktrace.h> + +/* +* Save stack-backtrace addresses into a stack_trace buffer. +*/ +void save_stack_trace (struct stack_trace *trace) +{ +} +EXPORT_SYMBOL (save_stack_trace); + +void __ia64_save_stack_nonlocal (struct stack_trace *trace) +{ +} +EXPORT_SYMBOL (__ia64_save_stack_nonlocal);
arch/ia64/kernel/time.c +2 -2
@@ -210,8 +210,8 @@/* * Allow IPIs to interrupt the timer loop. */ -local_irq_enable (); -local_irq_disable (); +raw_local_irq_enable (); +raw_local_irq_disable (); } skip_process_time_accounting:
include/linux/lockdep.h +1 -1
@@ -162,7 +162,7 @@u64 chain_key; }; -#define MAX_LOCKDEP_KEYS_BITS 13 +#define MAX_LOCKDEP_KEYS_BITS 10/* * Subtract one because we offset hlock->class_idx by 1 in order * to make 0 mean no class. This avoids overflowing the class_idx
Luming,
Can you send the config file that you used to test this.
I turned on a bunch of LOCKDEP related things, but I may have stumbled into areas that aren't working yet because my kernel didn't boot (or say anything on the console, even with early serial uart console enabled).
I'd like to take this patch so we can fix it up with incremental patches ... but I'd like a better idea of what works now and what doesn't.
Thanks
-Tony
Quoted 3 lines · Tony
Luming,
Can you send the config file that you used to test this.
yes, will send my config later when back to office.
Quoted 5 lines
I turned on a bunch of LOCKDEP related things, but I may have stumbled into areas that aren't working yet because my kernel didn't boot (or say anything on the console, even with early serial uart console enabled).
Please also send your config to me, let me check
what could make that happen.
Quoted 8 lines
I'd like to take this patch so we can fix it up with incremental patches ... but I'd like a better idea of what works now and what doesn't.
Thanks
-Tony
Thanks.
Luming
Quoted 6 lines · Luming Yu
Quoted 3 lines · Tony
Luming,
Can you send the config file that you used to test this.
yes, will send my config later when back to office.
please check out the attached config.
Quoted 1 line
please check out the attached config.
Your config fails for me too (same way, blank screen, nothing on serial console).
Essentially I applied your patch to 2.6.32 (patch only gave a few
"offset" warnings). Kernel
builds ok, and boots on tiger (using tiger_defconfig).
When I turned on some LOCKDEP bits (see attached config) it fails. Nothing on the
early uart console to say why. Screen just blanks right away.
-Tony
Quoted 5 lines · Tony Luck
Quoted 1 line
please check out the attached config.
Your config fails for me too (same way, blank screen, nothing on serial console).
Quoted 7 lines
Essentially I applied your patch to 2.6.32 (patch only gave a few "offset" warnings). Kernel
builds ok, and boots on tiger (usingtiger_defconfig).When I turned on some LOCKDEP bits (see attached config) it fails. Nothing on the
early uart console to say why. Screen just blanks right away.
Hmm, I changed the bad config a bit as below.
Nothing seems to be lockdep releated.
And the resutling 2.6.31 with LOCKDEP bits enabled still can boot on my system.
But let me try more on other ia64 boxes that I can get access.
Stay tuned.
[root@localhost linux-2.6.31]# diff ../bad.lockdep.config good.config 3,4c3,4
< # Linux kernel version: 2.6.32
< # Mon Dec 7 11:05:28 2009
---
Quoted 2 lines
# Linux kernel version: 2.6.31
# Tue Dec 8 05:41:56 2009
28a29
Quoted 1 line
#
CONFIG_CLASSIC_RCUis not set
30c31
< # CONFIG_TREE_PREEMPT_RCU is not set
---
Quoted 1 line
#
CONFIG_PREEMPT_RCUis not set
34a36
Quoted 1 line
#
CONFIG_PREEMPT_RCU_TRACEis not set
77c79
< # Kernel Performance Events And Counters
---
Quoted 1 line
# Performance Counters
81a84
Quoted 1 line
#
CONFIG_STRIP_ASM_SYMSis not set
86a90
Quoted 1 line
#
CONFIG_MARKERSis not set
99c103
< CONFIG_SLOW_WORK=y
---
Quoted 1 line
#
CONFIG_SLOW_WORKis not set
139d142
< # CONFIG_GENERIC_LOCKBREAK is not set
146d148
< CONFIG_HAVE_LEGACY_PER_CPU_AREA=y
212d213
< # CONFIG_KSM is not set
222d222
< CONFIG_ARCH_PROC_KCORE_TEXT=y
251d250
< # CONFIG_PM_RUNTIME is not set
255d253
< # CONFIG_ACPI_POWER_METER is not set
260c258
< # CONFIG_ACPI_DOCK is not set
---
Quoted 1 line
CONFIG_ACPI_DOCK=y
339d336
< # CONFIG_RDS is not set
369d365
< CONFIG_CFG80211_DEFAULT_PS_VALUE=0
376a373
Quoted 1 line
CONFIG_MAC80211_DEFAULT_PS_VALUE=0
389d385
< # CONFIG_DEVTMPFS is not set
544d539
< # CONFIG_BE2ISCSI is not set
575a571
Quoted 1 line
#
CONFIG_SCSI_IPRis not set
583d578
< # CONFIG_SCSI_PMCRAID is not set
585d579
< # CONFIG_SCSI_BFA_FC is not set
588c582,642
< # CONFIG_ATA is not set
---
Quoted 53 lines
CONFIG_ATA=mCONFIG_ATA_NONSTANDARD=yCONFIG_ATA_ACPI=yCONFIG_SATA_PMP=y
#CONFIG_SATA_AHCIis not set
#CONFIG_SATA_SIL24is not setCONFIG_ATA_SFF=y
#CONFIG_SATA_SVWis not setCONFIG_ATA_PIIX=m
#CONFIG_SATA_MVis not set
#CONFIG_SATA_NVis not set
#CONFIG_PDC_ADMAis not set
#CONFIG_SATA_QSTORis not set
#CONFIG_SATA_PROMISEis not set
#CONFIG_SATA_SX4is not set
#CONFIG_SATA_SILis not set
#CONFIG_SATA_SISis not set
#CONFIG_SATA_ULIis not set
#CONFIG_SATA_VIAis not set
#CONFIG_SATA_VITESSEis not set
#CONFIG_SATA_INIC162Xis not set
#CONFIG_PATA_ACPIis not set
#CONFIG_PATA_ALIis not set
#CONFIG_PATA_AMDis not set
#CONFIG_PATA_ARTOPis not set
#CONFIG_PATA_ATIIXPis not set
#CONFIG_PATA_CMD640_PCIis not set
#CONFIG_PATA_CMD64Xis not set
#CONFIG_PATA_CS5520is not set
#CONFIG_PATA_CS5530is not set
#CONFIG_PATA_CYPRESSis not set
#CONFIG_PATA_EFARis not set
#CONFIG_ATA_GENERICis not set
#CONFIG_PATA_HPT366is not set
#CONFIG_PATA_HPT37Xis not set
#CONFIG_PATA_HPT3X2Nis not set
#CONFIG_PATA_HPT3X3is not set
#CONFIG_PATA_IT821Xis not set
#CONFIG_PATA_IT8213is not set
#CONFIG_PATA_JMICRONis not set
#CONFIG_PATA_TRIFLEXis not set
#CONFIG_PATA_MARVELLis not set
#CONFIG_PATA_MPIIXis not set
#CONFIG_PATA_OLDPIIXis not set
#CONFIG_PATA_NETCELLis not set
#CONFIG_PATA_NINJA32is not set
#CONFIG_PATA_NS87410is not set
#CONFIG_PATA_NS87415is not set
#CONFIG_PATA_OPTIis not set
#CONFIG_PATA_OPTIDMAis not set
#CONFIG_PATA_PDC_OLDis not set
#CONFIG_PATA_RADISYSis not set
#CONFIG_PATA_RZ1000is not set
Quoted 8 lines
#
CONFIG_PATA_SC1200is not set
#CONFIG_PATA_SERVERWORKSis not set
#CONFIG_PATA_PDC2027Xis not set
#CONFIG_PATA_SIL680is not set
#CONFIG_PATA_SISis not set
#CONFIG_PATA_VIAis not set
#CONFIG_PATA_WINBONDis not set
#CONFIG_PATA_SCHis not set
704d757
< # CONFIG_KS8851_MLL is not set
714c767
< # CONFIG_IGB is not set
---
Quoted 1 line
CONFIG_IGB=m
752c805,808
< CONFIG_WLAN=y
---
Quoted 4 lines
#
# Wireless LAN
#
804d859
< # CONFIG_KEYBOARD_ADP5588 is not set
806d860
< # CONFIG_QT2160 is not set
808d861
< # CONFIG_KEYBOARD_MAX7359 is not set
810d862
< # CONFIG_KEYBOARD_OPENCORES is not set
821d872
< # CONFIG_MOUSE_PS2_SENTELIC is not set
869a921,922
Quoted 2 lines
#
CONFIG_SXis not set
#CONFIG_RIOis not set
911d963
< CONFIG_I2C_COMPAT=y
939,943d990
< # ACPI drivers
< #
< # CONFIG_I2C_SCMI is not set
<
< #
970a1018,1020
Quoted 3 lines
#
CONFIG_SENSORS_PCF8574is not set
#CONFIG_PCF8575is not set
#CONFIG_SENSORS_PCA9539is not set
992,996d1041
< # CONFIG_HWMON_DEBUG_CHIP is not set
<
< #
< # Native drivers
< #1046d1090
< # CONFIG_SENSORS_TMP421 is not set
1058,1061d1101
<
< #
< # ACPI drivers
< #1062a1103
Quoted 1 line
#
CONFIG_HWMON_DEBUG_CHIPis not set
1081d1121
< # CONFIG_MFD_WM831X is not set1093d1132
< CONFIG_VGA_ARB=y
1095,1096d1133
< CONFIG_DRM_KMS_HELPER=m
< CONFIG_DRM_TTM=m1177a1215
Quoted 1 line
CONFIG_HID_DEBUG=y
1201d1238
< CONFIG_HID_TWINHAN=y1255d1291
< # CONFIG_USB_ISP1362_HCD is not set1386d1421
< # CONFIG_NILFS2_FS is not set1453a1489
Quoted 1 line
#
CONFIG_NILFS2_FSis not set
1556d1591
< # CONFIG_STRIP_ASM_SYMS is not set1595d1629
< # CONFIG_DEBUG_CREDENTIALS is not set1602d1635
< # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set1646c1679
< # CONFIG_CRYPTO_FIPS is not set
---
Quoted 1 line
CONFIG_CRYPTO_FIPS=y
1689d1721
< # CONFIG_CRYPTO_VMAC is not set1695d1726
< # CONFIG_CRYPTO_GHASH is not set1741a1773
Quoted 1 line
CONFIG_HAVE_KVM_IRQCHIP=y
Quoted 4 lines
But let me try more on other ia64 boxes that I can get access.
Stay tuned.
I might have reproduced the problem on a HP ia64 system with -32 kernel as the following info. But -31 kernel with lockdep code enabled just works. ....debugging...
CPI: SSDT 000000003fdf66c8 000E0 (v01 HP BL870c 00000006 INTL 20050309)
ACPI: SSDT 000000003fdf67b8 0013C (v01 HP BL870c 00000006 INTL 20050309)
ACPI: SSDT 000000003fdf68f8 000E0 (v01 HP BL870c 00000006 INTL 20050309)
ACPI: SSDT 000000003fdf69e8 0013C (v01 HP BL870c 00000006 INTL 20050309)
ACPI: SSDT 000000003fdf6b28 000E0 (v01 HP BL870c 00000006 INTL 20050309)
ACPI: SSDT 000000003fdf6c18 0013C (v01 HP BL870c 00000006 INTL 20050309)
ACPI: SSDT 000000003fdf6d58 000E0 (v01 HP BL870c 00000006 INTL 20050309)
ACPI: Local APIC address c0000000fee00000
SMP: Allowing 16 CPUs, 8 hotplug CPUs
Initial ramdisk at: 0xe0000100fe9d8000 (5607915 bytes) SAL 3.20: HP version 3.11
SAL Platform features: None
SAL: AP wakeup using external interrupt vector 0xff
ACPI: Local APIC address c0000000fee00000
Unable to handle kernel paging request at virtual address a0000009019b0328 swapper[0]: Oops 8813272891392 [1] Modules linked in:
Pid: 0, CPU 0, comm: swapper
psr : 00001010084a2018 ifs : 8000000000000409 ip :
[<a0000001000e8ff0>] Not tainted (2.6.32)
ip is at save_trace+0xb0/0x1e0
unat: 0000000000000000 pfs : 0000000000000409 rsc : 0000000000000003
rnat: 000000001ad27480 bsps: 000000000001003e pr : 656960155aa6a559
ldrs: 0000000000000000 ccv : 0000000001e600f3 fpsr: 0009804c8a70433f csd : 0000000000000000 ssd : 0000000000000000
b0 : a0000001000e8fc0 b6 : a000000100a6c440 b7 : e00000003f81f3a0 f6 : 000000000000000000000 f7 : 1003e0000000000000000 f8 : 1003e0000000000000000 f9 : 1003e0000000000000001 f10 : 10004c3ffffffff3c0000 f11 : 1003e0000000000000031 r1 : a00000010132c4b0 r2 : a000000100e07d60 r3 : 000000000000007c r8 : a0000001018f2520 r9 : a0000009019b0328 r10 : 00000000ffffffff r11 : a0000001019b0330 r12 : a000000100e07d60 r13 : a000000100e00000 r14 : a0000001018f2af0 r15 : 000000000003fffe r16 : ffffffffffffffff r17 : 0000000000000001 r18 : 0000000000000000 r19 : 0000000000000000 r20 : a0000001019b0330 r21 : a000000101130a00 r22 : a0000001018f2c58 r23 : 0000000000000003 r24 : 0000000000040000 r25 : 0000000000040000 r26 : 0000000000000000 r27 : a0000001018f2b20 r28 : 0000000000001000 r29 : 0000000000000000 r30 : a000000100e00e00 r31 : a000000100e00dd8
Unable to handle kernel NULL pointer dereference (address 0000000000000000) swapper[0]: Oops 8813272891392 [2] Modules linked in:
Pid: 0, CPU 0, comm: swapper
psr : 0000101008022018 ifs : 800000000000048e ip :
[<a0000001001e1a60>] Not tainted (2.6.32)
ip is at kmem_cache_alloc+0xe0/0x3c0
unat: 0000000000000000 pfs : 000000000000048e rsc : 0000000000000003
rnat: 0000000000000000 bsps: 0000000000000000 pr : 656960155aa65965
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c0270033f csd : 0000000000000000 ssd : 0000000000000000
b0 : a0000001001e19f0 b6 : a000000100042420 b7 : a00000010000c9b0 f6 : 1003ea877512c4d0b873a f7 : 1003e9e3779b97f4a7c16 f8 : 1003e0a000000100015f7 f9 : 1003e0000000000000001 f10 : 10004c3ffffffff3c0000 f11 : 1003e0000000000000031 r1 : a00000010132c4b0 r2 : 0000000012000000 r3 : a000000100e00014 r8 : 0000000000000002 r9 : 00000000003fff2f r10 : a000000101151a60 r11 : a000000101151a60 r12 : a000000100e07230 r13 : a000000100e00000 r14 : 0000000000000000 r15 : 0000000000200000 r16 : 0000000000000000 r17 : 0000000000000000 r18 : a000000100e01984 r19 : a000000100e072ac r20 : a000000100e072a4 r21 : 0000000000000000 r22 : a000000100e072a0 r23 : a000000100e072a4 r24 : 0000000000000001 r25 : 0000000000000000 r26 : a000000100e072a0 r27 : 0000000000000000 r28 : a000000100e072a8 r29 : 000000007fffffff r30 : a00000010110a030 r31 : 0000000000000002
Quoted 8 lines · Luming Yu
Quoted 4 lines
But let me try more on other ia64 boxes that I can get access.
Stay tuned.
I might have reproduced the problem on a HP ia64 system with -32 kernel as the following info. But -31 kernel with lockdep code enabled just works. ....debugging...
ah, I seem to have found the change in -32 against -31 that causes the trouble.
Commenting out the change make -32 Lockdep kernel boot.
Tony, please let me know whether you can reproduce..
kernel/lockdep.c
static int save_trace(struct stack_trace *trace)
{
trace->nr_entries = 0;
trace->max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries;
trace->entries = stack_trace + nr_stack_trace_entries;
trace->skip = 3;
save_stack_trace(trace);#if 0
/*
* Some daft arches put -1 at the end to indicate its a full trace.
*
* <rant> this is buggy anyway, since it takes a whole extra entry so a
* complete trace that maxes out the entries provided will be reported
* as incomplete, friggin useless </rant>
*/
if (trace->entries[trace->nr_entries-1] = ULONG_MAX)
trace->nr_entries--;#endif
Quoted 3 lines · Luming Yu
Commenting out the change make -32 Lockdep kernel boot.
Tony, please let me know whether you can reproduce..
Yes. Commenting this out makes the system bootable for me.
Quoted 12 lines
kernel/lockdep.c
static intsave_trace(struct stack_trace *trace)
{
trace->nr_entries = 0;
trace->max_entries =MAX_STACK_TRACE_ENTRIES-nr_stack_trace_entries;trace->entries=stack_trace+nr_stack_trace_entries;trace->skip = 3;
save_stack_trace(trace);
#if 0
Quoted 10 lines
/*
* Some daft arches put -1 at the end to indicate its a full trace. *
* <rant> this is buggy anyway, since it takes a whole extra entry so a
* complete trace that maxes out the entries provided will be reported
* as incomplete, friggin useless </rant>
*/
if (trace->entries[trace->nr_entries-1] =ULONG_MAX) trace->nr_entries--;
#endif
This happens because ia64 save_stack_trace() is currently an empty stub, so it doesn't set trace->nr_entries.
Options:
1) Add trace->nr_entries = 1; to ia64 stub.
2) Change the generic code to defend against an unexpected failure in save_stack_trace()
if (trace->nr_entries > 0 &&
trace->entries[trace->nr_entries-1] = ULONG_MAX)
trace->nr_entries--;3) Delete the code in the "daft"[1] architectures, and drop this hunk from the generic code.
-Tony
[1] arm, parisc, s390, sh, x86
Peter Zijlstra
maintainerQuoted 38 lines · Tony Luck
Quoted 3 lines · Luming Yu
Commenting out the change make -32 Lockdep kernel boot.
Tony, please let me know whether you can reproduce..
Yes. Commenting this out makes the system bootable for me.
Quoted 21 lines
kernel/lockdep.c
static intsave_trace(struct stack_trace *trace){ trace->nr_entries = 0; trace->max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries; trace->entries = stack_trace + nr_stack_trace_entries; trace->skip = 3; save_stack_trace(trace);#if 0
/* * Some daft arches put -1 at the end to indicate its a full trace. * * <rant> this is buggy anyway, since it takes a whole extra entry so a * complete trace that maxes out the entries provided will be reported * as incomplete, friggin useless </rant> */ if (trace->entries[trace->nr_entries-1] = ULONG_MAX) trace->nr_entries--;Quoted 1 line
#endif
This happens because ia64
save_stack_trace()is currently an empty stub, so it doesn't settrace->nr_entries.Options:
1) Addtrace->nr_entries= 1; to ia64 stub.
2) Change the generic code to defend against an unexpected failure insave_stack_trace()
Quoted 5 lines
if (trace->nr_entries > 0 && trace->entries[trace->nr_entries-1] = ULONG_MAX) trace->nr_entries--;3) Delete the code in the "daft"[1] architectures, and drop this hunk from the generic code.
I'm thinking 2 and 3 together sound like a plan :-)