xen: fix is_xen_pmu()
[linux-2.6-microblaze.git] / arch / x86 / xen / pmu.c
index 89dd6b1..21ecbe7 100644 (file)
@@ -506,10 +506,7 @@ irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id)
        return ret;
 }
 
-bool is_xen_pmu(int cpu)
-{
-       return (get_xenpmu_data() != NULL);
-}
+bool is_xen_pmu;
 
 void xen_pmu_init(int cpu)
 {
@@ -520,7 +517,7 @@ void xen_pmu_init(int cpu)
 
        BUILD_BUG_ON(sizeof(struct xen_pmu_data) > PAGE_SIZE);
 
-       if (xen_hvm_domain())
+       if (xen_hvm_domain() || (cpu != 0 && !is_xen_pmu))
                return;
 
        xenpmu_data = (struct xen_pmu_data *)get_zeroed_page(GFP_KERNEL);
@@ -541,7 +538,8 @@ void xen_pmu_init(int cpu)
        per_cpu(xenpmu_shared, cpu).xenpmu_data = xenpmu_data;
        per_cpu(xenpmu_shared, cpu).flags = 0;
 
-       if (cpu == 0) {
+       if (!is_xen_pmu) {
+               is_xen_pmu = true;
                perf_register_guest_info_callbacks(&xen_guest_cbs);
                xen_pmu_arch_init();
        }