[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFyr5VcONQKp_yDRDy+BFpMy9=P--+U8d1uYeDVNWcAM8Q@mail.gmail.com>
Date: Fri, 20 Dec 2013 05:46:37 +0900
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: Peter Anvin <hpa@...or.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Anvin <hpa@...ux.intel.com>,
Len Brown <len.brown@...el.com>,
linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/idle] x86, idle: Use static_cpu_has() for CLFLUSH
workaround, add barriers
On Fri, Dec 20, 2013 at 5:40 AM, Ingo Molnar <mingo@...nel.org> wrote:
>
> The first mb() looks superfluous, because see
> current_set_polling_and_test():
>
> static inline bool __must_check current_set_polling_and_test(void)
> {
> __current_set_polling();
>
> /*
> * Polling state must be visible before we test NEED_RESCHED,
> * paired by resched_task()
> */
> smp_mb();
>
> return unlikely(tif_need_resched());
> }
>
> So it already has a (MFENCE) barrier after ->flags is modified.
So what?
The mb() isn't necessarily against the *write*, it is also against the *read*.
If the cflush is needed before the monitor, it's likely because the
monitor instruction has some bug with already-existing cachelines in
shared state or whatever.
Which means that we want to make sure that the cflush is ordered wrt
*reads* from that cacheline too.
cflush has nothing specifically to do with writes.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists