]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] i386: Fix K8/core2 oprofile on multiple CPUs
authorAndi Kleen <ak@suse.de>
Mon, 21 May 2007 12:31:45 +0000 (14:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 15 Aug 2007 08:02:20 +0000 (10:02 +0200)
Only try to allocate MSRs once instead of for every CPU.

This assumes the MSRs are the same on all CPUs which is currently
true. P4-HT is a special case for different SMT threads, but the code
always saves/restores all MSRs so it works identical.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/i386/oprofile/nmi_int.c

index 3700eef78743160787de152444c95eeaa03d93a9..be4a9a8377a709ec821aa7ab786e3d1669ec5d5d 100644 (file)
@@ -131,7 +131,6 @@ static void nmi_save_registers(void * dummy)
 {
        int cpu = smp_processor_id();
        struct op_msrs * msrs = &cpu_msrs[cpu];
-       model->fill_in_addresses(msrs);
        nmi_cpu_save_registers(msrs);
 }
 
@@ -195,6 +194,7 @@ static struct notifier_block profile_exceptions_nb = {
 static int nmi_setup(void)
 {
        int err=0;
+       int cpu;
 
        if (!allocate_msrs())
                return -ENOMEM;
@@ -207,6 +207,13 @@ static int nmi_setup(void)
        /* We need to serialize save and setup for HT because the subset
         * of msrs are distinct for save and setup operations
         */
+
+       /* Assume saved/restored counters are the same on all CPUs */
+       model->fill_in_addresses(&cpu_msrs[0]);
+       for_each_possible_cpu (cpu) {
+               if (cpu != 0)
+                       cpu_msrs[cpu] = cpu_msrs[0];
+       }
        on_each_cpu(nmi_save_registers, NULL, 0, 1);
        on_each_cpu(nmi_cpu_setup, NULL, 0, 1);
        nmi_enabled = 1;