diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 15:22:48 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 15:22:48 +0100 |
commit | 2e4146ddc277d2ddd861646b8b1ba83182eb84bb (patch) | |
tree | b89c9a44b6681359974a281096dc16f29dc6d304 /xen/common/rcupdate.c | |
parent | 2a814aeaaf1e2fe258ab72fc60bb86b7ca4cb102 (diff) | |
download | xen-2e4146ddc277d2ddd861646b8b1ba83182eb84bb.tar.gz xen-2e4146ddc277d2ddd861646b8b1ba83182eb84bb.tar.bz2 xen-2e4146ddc277d2ddd861646b8b1ba83182eb84bb.zip |
x86: Implement cpu hotplug notifiers. Use them.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/rcupdate.c')
-rw-r--r-- | xen/common/rcupdate.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/xen/common/rcupdate.c b/xen/common/rcupdate.c index 676da1efe5..31c5f6f39b 100644 --- a/xen/common/rcupdate.c +++ b/xen/common/rcupdate.c @@ -43,6 +43,7 @@ #include <xen/bitops.h> #include <xen/percpu.h> #include <xen/softirq.h> +#include <xen/cpu.h> /* Definition for rcupdate control block. */ struct rcu_ctrlblk rcu_ctrlblk = { @@ -334,15 +335,33 @@ static void rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp, rdp->blimit = blimit; } -void __devinit rcu_online_cpu(int cpu) +static int cpu_callback( + struct notifier_block *nfb, unsigned long action, void *hcpu) { - struct rcu_data *rdp = &per_cpu(rcu_data, cpu); + unsigned int cpu = (unsigned long)hcpu; + + switch ( action ) + { + case CPU_UP_PREPARE: { + struct rcu_data *rdp = &per_cpu(rcu_data, cpu); + rcu_init_percpu_data(cpu, &rcu_ctrlblk, rdp); + break; + } + default: + break; + } - rcu_init_percpu_data(cpu, &rcu_ctrlblk, rdp); + return NOTIFY_DONE; } +static struct notifier_block cpu_nfb = { + .notifier_call = cpu_callback +}; + void __init rcu_init(void) { - rcu_online_cpu(smp_processor_id()); + void *cpu = (void *)(long)smp_processor_id(); + cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); + register_cpu_notifier(&cpu_nfb); open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); } |