[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52967E27.3070906@zytor.com>
Date: Wed, 27 Nov 2013 15:20:07 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Borislav Petkov <bp@...en8.de>
CC: Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...capital.net>,
Andi Kleen <andi@...stfloor.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] Add a text_poke syscall v2
On 11/27/2013 03:10 PM, Borislav Petkov wrote:
> On Wed, Nov 27, 2013 at 02:40:04PM -0800, H. Peter Anvin wrote:
>> Also don't forget we need the IPIs, too...
>
> Yeah, I was simply looking at whether we could get away with executing
> an empty syscall, i.e. save us the CPUID and rely only on the IPIs and
> IRET.
>
> But we don't IPI ourselves in smp_call_function; actually we remove
> ourselves from the cpumask because of deadlocking scenarios. So on
> this_cpu we only execute the function with IRQs disabled and CLI/STI is
> not serializing.
>
Although as Linus correctly pointed out, on the modifying CPU itself we
only need a branch. For the standalone system call that doesn't work,
because you can't assume that the modifying CPU and the syscall CPU are
the same CPU.
> I wonder if we could use MFENCE instead of CPUID, though, and save us
> the clobbering of e*x, maybe even save us some cycles since MFENCE
> should be faster than hundred-ish cycles of microcoded CPUID.
>
No. MFENCE doesn't serialize the front end.
-hpa
--
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