From: yangsheng Date: Thu, 12 Mar 2009 15:05:23 +0000 (+0000) Subject: Branch b1_8 X-Git-Tag: GIT_EPOCH_B_RELEASE_1_8_1~2^4~11 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=1e64ddb4cd30c9bda88cf0c3987da1423146d567;p=fs%2Flustre-release.git Branch b1_8 b=18033 i=adilger, johann Audit code for CONFIG_PREEMPT interaction. --- diff --git a/lnet/include/libcfs/linux/kp30.h b/lnet/include/libcfs/linux/kp30.h index ac90aa0..b1e1226 100644 --- a/lnet/include/libcfs/linux/kp30.h +++ b/lnet/include/libcfs/linux/kp30.h @@ -412,4 +412,17 @@ extern int lwt_snapshot (cycles_t *now, int *ncpu, int *total_size, #undef _LWORDSIZE +#ifndef get_cpu +# ifdef CONFIG_PREEMPT +# define cfs_get_cpu() ({ preempt_disable(); smp_processor_id(); }) +# define cfs_put_cpu() preempt_enable() +# else +# define cfs_get_cpu() smp_processor_id() +# define cfs_put_cpu() +# endif +#else +# define cfs_get_cpu() get_cpu() +# define cfs_put_cpu() put_cpu() +#endif /* get_cpu & put_cpu */ + #endif diff --git a/lnet/libcfs/linux/linux-tracefile.c b/lnet/libcfs/linux/linux-tracefile.c index ada5b8f..1096cf4 100644 --- a/lnet/libcfs/linux/linux-tracefile.c +++ b/lnet/libcfs/linux/linux-tracefile.c @@ -41,11 +41,6 @@ #include #include "tracefile.h" -#ifndef get_cpu -#define get_cpu() smp_processor_id() -#define put_cpu() do { } while (0) -#endif - /* three types of trace_data in linux */ enum { TCD_TYPE_PROC = 0, @@ -151,7 +146,7 @@ void tracefile_write_unlock() char * trace_get_console_buffer(void) { - int cpu = get_cpu(); + int cpu = cfs_get_cpu(); int idx; if (in_irq()) { @@ -168,7 +163,7 @@ trace_get_console_buffer(void) void trace_put_console_buffer(char *buffer) { - put_cpu(); + cfs_put_cpu(); } struct trace_cpu_data * @@ -177,7 +172,7 @@ trace_get_tcd(void) struct trace_cpu_data *tcd; int cpu; - cpu = get_cpu(); + cpu = cfs_get_cpu(); if (in_irq()) tcd = &(*trace_data[TCD_TYPE_IRQ])[cpu].tcd; else if (in_softirq()) @@ -195,7 +190,7 @@ trace_put_tcd (struct trace_cpu_data *tcd) { trace_unlock_tcd(tcd); - put_cpu(); + cfs_put_cpu(); } int trace_lock_tcd(struct trace_cpu_data *tcd)