Fixed this bug on P4 HT machine: [ 474.968698] BUG: using smp_processor_id() in preemptible [00000000] code: oprofiled/3319 [ 474.968711] caller is get_stagger+0xe/0x2c [ 474.968716] Pid: 3319, comm: oprofiled Not tainted 2.6.29 #8 [ 474.968720] Call Trace: [ 474.968730] [] ? printk+0x14/0x16 [ 474.968737] [] debug_smp_processor_id+0xa4/0xb8 [ 474.968742] [] get_stagger+0xe/0x2c [ 474.968747] [] p4_fill_in_addresses+0x33/0x2d4 [ 474.968751] [] nmi_setup+0xce/0x194 [ 474.968756] [] oprofile_setup+0x35/0x90 [ 474.968760] [] event_buffer_open+0x47/0x63 [ 474.968766] [] __dentry_open+0x148/0x237 [ 474.968770] [] nameidata_to_filp+0x31/0x48 [ 474.968775] [] ? event_buffer_open+0x0/0x63 [ 474.968780] [] do_filp_open+0x335/0x660 [ 474.968786] [] ? lru_cache_add_lru+0x2c/0x2e [ 474.968792] [] ? page_add_new_anon_rmap+0x5d/0x6a [ 474.968797] [] do_sys_open+0x47/0xc1 [ 474.968801] [] sys_open+0x23/0x2b [ 474.968806] [] sysenter_do_call+0x12/0x26 Signed-off-by: Jaswinder Singh Rajput --- arch/x86/oprofile/op_model_p4.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c index 4c4a51c..d51c116 100644 --- a/arch/x86/oprofile/op_model_p4.c +++ b/arch/x86/oprofile/op_model_p4.c @@ -379,8 +379,11 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = { static unsigned int get_stagger(void) { #ifdef CONFIG_SMP - int cpu = smp_processor_id(); - return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu))); + int cpu = get_cpu(); + int cpu0 = first_cpu(per_cpu(cpu_sibling_map, cpu)); + put_cpu(); + if (cpu != cpu0) + return 1; #endif return 0; } -- 1.6.0.6