Re: [tip:x86/idle] x86, idle: Use static_cpu_has() for CLFLUSHworkaround, add barriers

From: Peter Zijlstra
Date: Thu Dec 19 2013 - 16:56:20 EST


On Thu, Dec 19, 2013 at 09:40:51PM +0100, Ingo Molnar wrote:
> > + if (static_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) {
> > + mb();
> > clflush((void *)&current_thread_info()->flags);
> > + mb();
> > + }

> if (!current_set_polling_and_test()) {
> if (static_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) {
> - mb();
> + /*
> + * There's no need for an extra barrier here: current_set_polling_and_test()
> + * already has an smp_mb() after ->flags gets modified, see sched.h.
> + */
> clflush((void *)&current_thread_info()->flags);
> mb();
> }

So almost, except that smp_mb() will disappear on an UP kernel whereas
this errata might just always need the MFENCE.

Then again, you'd be a pretty big nutter to run an UP kernel on an EX
part.
--
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/