Commit f5e31c2f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] more ia32 profiler cleanups

Make the prof_counter and prof_old_counter arrays use per-cpu data, and give
them static scope.

Also fix a signedness bug in the voyager implementation (from James)
parent 489d9599
...@@ -50,9 +50,9 @@ void __init apic_intr_init(void) ...@@ -50,9 +50,9 @@ void __init apic_intr_init(void)
/* Using APIC to generate smp_local_timer_interrupt? */ /* Using APIC to generate smp_local_timer_interrupt? */
int using_apic_timer = 0; int using_apic_timer = 0;
int prof_multiplier[NR_CPUS] = { 1, }; static DEFINE_PER_CPU(int, prof_multiplier) = 1;
int prof_old_multiplier[NR_CPUS] = { 1, }; static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
DEFINE_PER_CPU(int, prof_counter) = 1; static DEFINE_PER_CPU(int, prof_counter) = 1;
void enable_NMI_through_LVT0 (void * dummy) void enable_NMI_through_LVT0 (void * dummy)
{ {
...@@ -986,7 +986,7 @@ int setup_profiling_timer(unsigned int multiplier) ...@@ -986,7 +986,7 @@ int setup_profiling_timer(unsigned int multiplier)
* accordingly. * accordingly.
*/ */
for (i = 0; i < NR_CPUS; ++i) for (i = 0; i < NR_CPUS; ++i)
prof_multiplier[i] = multiplier; per_cpu(prof_multiplier, i) = multiplier;
return 0; return 0;
} }
...@@ -1018,12 +1018,14 @@ inline void smp_local_timer_interrupt(struct pt_regs * regs) ...@@ -1018,12 +1018,14 @@ inline void smp_local_timer_interrupt(struct pt_regs * regs)
* *
* Interrupts are already masked off at this point. * Interrupts are already masked off at this point.
*/ */
per_cpu(prof_counter, cpu) = prof_multiplier[cpu]; per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
if (per_cpu(prof_counter, cpu) != prof_old_multiplier[cpu]) { if (per_cpu(prof_counter, cpu) !=
per_cpu(prof_old_multiplier, cpu)) {
__setup_APIC_LVTT( __setup_APIC_LVTT(
calibration_result/ calibration_result/
per_cpu(prof_counter, cpu)); per_cpu(prof_counter, cpu));
prof_old_multiplier[cpu] = per_cpu(prof_counter, cpu); per_cpu(prof_old_multiplier, cpu) =
per_cpu(prof_counter, cpu);
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -234,9 +234,9 @@ static int cpucount = 0; ...@@ -234,9 +234,9 @@ static int cpucount = 0;
static __u32 trampoline_base; static __u32 trampoline_base;
/* The per cpu profile stuff - used in smp_local_timer_interrupt */ /* The per cpu profile stuff - used in smp_local_timer_interrupt */
static unsigned int prof_multiplier[NR_CPUS] __cacheline_aligned = { 1, }; static DEFINE_PER_CPU(int, prof_multiplier) = 1;
static unsigned int prof_old_multiplier[NR_CPUS] __cacheline_aligned = { 1, }; static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
static DEFINE_PER_CPU(unsigned int, prof_counter) = 1; static DEFINE_PER_CPU(int, prof_counter) = 1;
/* the map used to check if a CPU has booted */ /* the map used to check if a CPU has booted */
static __u32 cpu_booted_map; static __u32 cpu_booted_map;
...@@ -1318,10 +1318,12 @@ smp_local_timer_interrupt(struct pt_regs * regs) ...@@ -1318,10 +1318,12 @@ smp_local_timer_interrupt(struct pt_regs * regs)
* *
* Interrupts are already masked off at this point. * Interrupts are already masked off at this point.
*/ */
per_cpu(prof_counter,cpu) = prof_multiplier[cpu]; per_cpu(prof_counter,cpu) = per_cpu(prof_multiplier, cpu);
if (per_cpu(prof_counter, cpu) != prof_old_multiplier[cpu]) { if (per_cpu(prof_counter, cpu) !=
per_cpu(prof_old_multiplier, cpu)) {
/* FIXME: need to update the vic timer tick here */ /* FIXME: need to update the vic timer tick here */
prof_old_multiplier[cpu] = per_cpu(prof_counter, cpu); per_cpu(prof_old_multiplier, cpu) =
per_cpu(prof_counter, cpu);
} }
update_process_times(user_mode(regs)); update_process_times(user_mode(regs));
...@@ -1406,7 +1408,7 @@ setup_profiling_timer(unsigned int multiplier) ...@@ -1406,7 +1408,7 @@ setup_profiling_timer(unsigned int multiplier)
* accounting. * accounting.
*/ */
for (i = 0; i < NR_CPUS; ++i) for (i = 0; i < NR_CPUS; ++i)
prof_multiplier[i] = multiplier; per_cpu(prof_multiplier, i) = multiplier;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment