1 From c7c25802b39c443b3745cfa973dc49a97a3491f8 Mon Sep 17 00:00:00 2001
2 From: Robert Richter <robert.richter@amd.com>
3 Date: Mon, 3 Jan 2011 12:15:14 +0100
4 Subject: [PATCH 53/66] arch/x86/oprofile/op_model_amd.c: Perform initialisation on a single CPU
6 Disable preemption in init_ibs(). The function only checks the
7 ibs capabilities and sets up pci devices (if necessary). It runs
8 only on one cpu but operates with the local APIC and some MSRs,
9 thus it is better to disable preemption.
11 [ 7.034377] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/483
12 [ 7.034385] caller is setup_APIC_eilvt+0x155/0x180
13 [ 7.034389] Pid: 483, comm: modprobe Not tainted 2.6.37-rc1-20101110+ #1
14 [ 7.034392] Call Trace:
15 [ 7.034400] [<ffffffff812a2b72>] debug_smp_processor_id+0xd2/0xf0
16 [ 7.034404] [<ffffffff8101e985>] setup_APIC_eilvt+0x155/0x180
19 Addresses https://bugzilla.kernel.org/show_bug.cgi?id=22812
21 Reported-by: <atswartz@gmail.com>
22 Signed-off-by: Robert Richter <robert.richter@amd.com>
23 Cc: oprofile-list@lists.sourceforge.net <oprofile-list@lists.sourceforge.net>
24 Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
25 Cc: Frederic Weisbecker <fweisbec@gmail.com>
26 Cc: Rafael J. Wysocki <rjw@sisk.pl>
27 Cc: Dan Carpenter <error27@gmail.com>
28 Cc: Andrew Morton <akpm@linux-foundation.org>
29 Cc: <stable@kernel.org> [2.6.37.x]
30 LKML-Reference: <20110103111514.GM4739@erda.amd.com>
32 Signed-off-by: Ingo Molnar <mingo@elte.hu>
34 arch/x86/oprofile/op_model_amd.c | 24 ++++++++++++++++--------
35 1 files changed, 16 insertions(+), 8 deletions(-)
37 diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
38 index a011bcc..7d90d47 100644
39 --- a/arch/x86/oprofile/op_model_amd.c
40 +++ b/arch/x86/oprofile/op_model_amd.c
41 @@ -630,21 +630,29 @@ static int __init_ibs_nmi(void)
45 -/* initialize the APIC for the IBS interrupts if available */
47 + * check and reserve APIC extended interrupt LVT offset for IBS if
50 + * init_ibs() preforms implicitly cpu-local operations, so pin this
51 + * thread to its current CPU
54 static void init_ibs(void)
56 - ibs_caps = get_ibs_caps();
59 + ibs_caps = get_ibs_caps();
64 - if (__init_ibs_nmi()) {
65 + if (__init_ibs_nmi() < 0)
70 + printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps);
72 - printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n",
73 - (unsigned)ibs_caps);
78 static int (*create_arch_files)(struct super_block *sb, struct dentry *root);