diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 18:39:02 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 18:39:02 +0100 |
commit | f9ffb1134c8be2f6bffd14578c179d3f12371abd (patch) | |
tree | 945ba74314ddc2471de86e70348427fd9db37b6c /xen/common/trace.c | |
parent | 06111bb25b5ca1c3c18f3af9fcc13bb4e0e10174 (diff) | |
download | xen-f9ffb1134c8be2f6bffd14578c179d3f12371abd.tar.gz xen-f9ffb1134c8be2f6bffd14578c179d3f12371abd.tar.bz2 xen-f9ffb1134c8be2f6bffd14578c179d3f12371abd.zip |
trace: Do not touch percpu data for "impossible" cpus.
While here, in fact only touch per-cpu data for online cpus. Use cpu
notifier chain to initialise per-cpu spinlock dynamically.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/trace.c')
-rw-r--r-- | xen/common/trace.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/xen/common/trace.c b/xen/common/trace.c index 8b2b42183f..132849ac96 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -29,6 +29,7 @@ #include <xen/init.h> #include <xen/mm.h> #include <xen/percpu.h> +#include <xen/cpu.h> #include <asm/atomic.h> #include <public/sysctl.h> @@ -214,8 +215,6 @@ static int tb_set_size(int size) */ int ret = 0; - - if ( (opt_tbuf_size != 0) ) { if ( size != opt_tbuf_size ) @@ -269,6 +268,20 @@ int trace_will_trace_event(u32 event) return 1; } +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(t_lock, cpu)); + + return NOTIFY_DONE; +} + +static struct notifier_block cpu_nfb = { + .notifier_call = cpu_callback +}; /** * init_trace_bufs - performs initialization of the per-cpu trace buffers. * @@ -289,8 +302,9 @@ void __init init_trace_bufs(void) return; } - for(i = 0; i < NR_CPUS; i++) + for_each_online_cpu ( i ) spin_lock_init(&per_cpu(t_lock, i)); + register_cpu_notifier(&cpu_nfb); for(i=0; i<T_INFO_PAGES; i++) share_xen_page_with_privileged_guests( |