[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <76d0ec7c-5482-0782-af35-6871c8c88016@citrix.com>
Date: Thu, 1 Dec 2016 17:46:08 +0000
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: Andy Lutomirski <luto@...capital.net>,
Borislav Petkov <bp@...en8.de>, Jan Beulich <jbeulich@...e.com>
CC: Andy Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Brian Gerst <brgerst@...il.com>,
Matthew Whitehead <tedheadster@...il.com>,
Henrique de Moraes Holschuh <hmh@....eng.br>
Subject: Re: [PATCH 4/4] x86/asm: Change sync_core() to use MOV to CR2 to
serialize
On 01/12/16 17:08, Andy Lutomirski wrote:
> On Thu, Dec 1, 2016 at 1:22 AM, Borislav Petkov <bp@...en8.de> wrote:
>> On Wed, Nov 30, 2016 at 12:34:55PM -0800, Andy Lutomirski wrote:
>>> Aside from being excessively slow, CPUID is problematic: Linux runs
>>> on a handful of CPUs that don't have CPUID. MOV to CR2 is always
>>> available, so use it instead.
>>>
>>> Signed-off-by: Andy Lutomirski <luto@...nel.org>
>>> ---
>>> arch/x86/include/asm/processor.h | 31 ++++++++-----------------------
>>> 1 file changed, 8 insertions(+), 23 deletions(-)
>> Looks nice.
>>
>> I'm wondering if we should leave this one in tip for an additional cycle
>> to have it tested on more hw. I know, it is architectural and so on but
>> who knows what every implementation actually does...
> I want the Xen opinion as well.
>
> Xen folks, can Linux use write_cr2 to serialize the CPU core on Xen PV
> or do we need something a bit heavier weight like native_write_cr2?
To sum up our conversation on IRC.
xen_write_cr2() is not serialising; it is just a write into a shared page.
native_write_cr2() would trap and be emulated. This will incur #GP[0]
due to cpl, although not necessarily an iret on the way back out of Xen.
Something like an iret-to-self would be far quicker, and avoid trapping
into the hypervisor.
~Andrew
Powered by blists - more mailing lists