Re: [PATCH -mm] oprofile: BUG: using smp_processor_id() inpreemptible code

From: Ingo Molnar
Date: Mon Sep 22 2008 - 06:27:33 EST



* Andrea Righi <righi.andrea@xxxxxxxxx> wrote:

> Add local_irq_save() / local_irq_restore() before setting per cpu
> variable switch_index, to avoid the following BUG:

that just papers over the bug:

> + local_irq_save(flags);
> __get_cpu_var(switch_index) = 0;
> + local_irq_restore(flags);

either use __raw_get_cpu_var() if we are for sure not preemptible here,
or fix the preemption status of this codepath.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/