b=18033
i=adilger, johann
Audit code for CONFIG_PREEMPT interaction.
#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
#include <libcfs/kp30.h>
#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,
char *
trace_get_console_buffer(void)
{
- int cpu = get_cpu();
+ int cpu = cfs_get_cpu();
int idx;
if (in_irq()) {
void
trace_put_console_buffer(char *buffer)
{
- put_cpu();
+ cfs_put_cpu();
}
struct trace_cpu_data *
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())
{
trace_unlock_tcd(tcd);
- put_cpu();
+ cfs_put_cpu();
}
int trace_lock_tcd(struct trace_cpu_data *tcd)