diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 20:37:02 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 20:37:02 +0100 |
commit | 7f01473211b2586130c653d3b1ac15acc082d4df (patch) | |
tree | 48cda4464ba8a8ff424e5c3d7dd9d0aa3a9fa9c3 /xen/common/timer.c | |
parent | f9ffb1134c8be2f6bffd14578c179d3f12371abd (diff) | |
download | xen-7f01473211b2586130c653d3b1ac15acc082d4df.tar.gz xen-7f01473211b2586130c653d3b1ac15acc082d4df.tar.bz2 xen-7f01473211b2586130c653d3b1ac15acc082d4df.zip |
Remove many uses of cpu_possible_map and iterators over NR_CPUS.
The significant remaining culprits for x86 are credit2, hpet, and
percpu-area subsystems. To be dealt with in a separate patch.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/timer.c')
-rw-r--r-- | xen/common/timer.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/xen/common/timer.c b/xen/common/timer.c index 7a84bac671..0759df818f 100644 --- a/xen/common/timer.c +++ b/xen/common/timer.c @@ -18,6 +18,7 @@ #include <xen/timer.h> #include <xen/keyhandler.h> #include <xen/percpu.h> +#include <xen/cpu.h> #include <asm/system.h> #include <asm/desc.h> @@ -514,10 +515,29 @@ static struct keyhandler dump_timerq_keyhandler = { .desc = "dump timer queues" }; +static struct timer *dummy_heap; + +static int cpu_callback( + struct notifier_block *nfb, unsigned long action, void *hcpu) +{ + unsigned int cpu = (unsigned long)hcpu; + + if ( action == CPU_UP_PREPARE ) + { + spin_lock_init(&per_cpu(timers, cpu).lock); + per_cpu(timers, cpu).heap = &dummy_heap; + } + + return NOTIFY_DONE; +} + +static struct notifier_block cpu_nfb = { + .notifier_call = cpu_callback +}; + void __init timer_init(void) { - static struct timer *dummy_heap; - int i; + void *cpu = (void *)(long)smp_processor_id(); open_softirq(TIMER_SOFTIRQ, timer_softirq_action); @@ -528,11 +548,8 @@ void __init timer_init(void) SET_HEAP_SIZE(&dummy_heap, 0); SET_HEAP_LIMIT(&dummy_heap, 0); - for_each_possible_cpu ( i ) - { - spin_lock_init(&per_cpu(timers, i).lock); - per_cpu(timers, i).heap = &dummy_heap; - } + cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); + register_cpu_notifier(&cpu_nfb); register_keyhandler('a', &dump_timerq_keyhandler); } |