x86, perf events: Check if we have APIC enabled
authorCyrill Gorcunov <gorcunov@openvz.org>
Thu, 10 Dec 2009 16:56:34 +0000 (19:56 +0300)
committerIngo Molnar <mingo@elte.hu>
Thu, 10 Dec 2009 17:00:30 +0000 (18:00 +0100)
Ralf Hildebrandt reported this boot warning:

| Running a vanilla 2.6.32 as Xen DomU, I'm getting:
|
| [    0.000999] CPU: Physical Processor ID: 0
| [    0.000999] CPU: Processor Core ID: 1
| [    0.000999] Performance Events: AMD PMU driver.
| [    0.000999] ------------[ cut here ]------------
| [    0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

So we need to check if APIC functionality is available, and
not just in the P6 driver but elsewhere as well.

Reported-by: Ralf Hildebrandt <Ralf.Hildebrandt@charite.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091210165634.GF5086@lenovo>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/cpu/perf_event.c

index 1342f236e32ab2f2be53be2ff6ee839ff8a22b94..18f05eccbb62b79359a04753d016bb9f77b0b923 100644 (file)
@@ -2066,12 +2066,6 @@ static __init int p6_pmu_init(void)
 
        x86_pmu = p6_pmu;
 
-       if (!cpu_has_apic) {
-               pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
-               pr_info("no hardware sampling interrupt available.\n");
-               x86_pmu.apic = 0;
-       }
-
        return 0;
 }
 
@@ -2163,6 +2157,16 @@ static __init int amd_pmu_init(void)
        return 0;
 }
 
+static void __init pmu_check_apic(void)
+{
+       if (cpu_has_apic)
+               return;
+
+       x86_pmu.apic = 0;
+       pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
+       pr_info("no hardware sampling interrupt available.\n");
+}
+
 void __init init_hw_perf_events(void)
 {
        int err;
@@ -2184,6 +2188,8 @@ void __init init_hw_perf_events(void)
                return;
        }
 
+       pmu_check_apic();
+
        pr_cont("%s PMU driver.\n", x86_pmu.name);
 
        if (x86_pmu.num_events > X86_PMC_MAX_GENERIC) {