From: Keir Fraser Date: Fri, 14 May 2010 17:39:02 +0000 (+0100) Subject: trace: Do not touch percpu data for "impossible" cpus. X-Git-Tag: 4.1.0-rc1~1227 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f9ffb1134c8be2f6bffd14578c179d3f12371abd;p=xen.git 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 --- 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 #include #include +#include #include #include @@ -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