Skip to content

Commit 2612028

Browse files
Robert RichterAK
authored andcommitted
arch/x86/oprofile/op_model_amd.c: Perform initialisation on a single CPU
commit c7c2580 upstream. Disable preemption in init_ibs(). The function only checks the ibs capabilities and sets up pci devices (if necessary). It runs only on one cpu but operates with the local APIC and some MSRs, thus it is better to disable preemption. [ 7.034377] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/483 [ 7.034385] caller is setup_APIC_eilvt+0x155/0x180 [ 7.034389] Pid: 483, comm: modprobe Not tainted 2.6.37-rc1-20101110+ coolya#1 [ 7.034392] Call Trace: [ 7.034400] [<ffffffff812a2b72>] debug_smp_processor_id+0xd2/0xf0 [ 7.034404] [<ffffffff8101e985>] setup_APIC_eilvt+0x155/0x180 [ ... ] Addresses https://bugzilla.kernel.org/show_bug.cgi?id=22812 Reported-by: <atswartz@gmail.com> Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: oprofile-list@lists.sourceforge.net <oprofile-list@lists.sourceforge.net> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: Dan Carpenter <error27@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> LKML-Reference: <20110103111514.GM4739@erda.amd.com> [ small cleanups ] Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent c28dd25 commit 2612028

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

arch/x86/oprofile/op_model_amd.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -484,21 +484,29 @@ static int __init_ibs_nmi(void)
484484
return 0;
485485
}
486486

487-
/* initialize the APIC for the IBS interrupts if available */
487+
/*
488+
* check and reserve APIC extended interrupt LVT offset for IBS if
489+
* available
490+
*
491+
* init_ibs() preforms implicitly cpu-local operations, so pin this
492+
* thread to its current CPU
493+
*/
494+
488495
static void init_ibs(void)
489496
{
490-
ibs_caps = get_ibs_caps();
497+
preempt_disable();
491498

499+
ibs_caps = get_ibs_caps();
492500
if (!ibs_caps)
493-
return;
501+
goto out;
494502

495-
if (__init_ibs_nmi()) {
503+
if (__init_ibs_nmi() < 0)
496504
ibs_caps = 0;
497-
return;
498-
}
505+
else
506+
printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps);
499507

500-
printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n",
501-
(unsigned)ibs_caps);
508+
out:
509+
preempt_enable();
502510
}
503511

504512
static int (*create_arch_files)(struct super_block *sb, struct dentry *root);

0 commit comments

Comments
 (0)