Re: [PATCH v2] x86/cpu: Use SERIALIZE in sync_core() when available

From: hpa
Date: Wed Aug 05 2020 - 01:12:54 EST


On August 4, 2020 10:08:08 PM PDT, Borislav Petkov <bp@xxxxxxxxx> wrote:
>On Tue, Aug 04, 2020 at 09:58:25PM -0700, hpa@xxxxxxxxx wrote:
>> Because why use an alternative to jump over one instruction?
>>
>> I personally would prefer to have the IRET put out of line
>
>Can't yet - SERIALIZE CPUs are a minority at the moment.
>
>> and have the call/jmp replaced by SERIALIZE inline.
>
>Well, we could do:
>
> alternative_io("... IRET bunch", __ASM_SERIALIZE,
>X86_FEATURE_SERIALIZE, ...);
>
>and avoid all kinds of jumping. Alternatives get padded so there
>would be a couple of NOPs following when SERIALIZE gets patched in
>but it shouldn't be a problem. I guess one needs to look at what gcc
>generates...

I didn't say behind a trap. IRET is a control transfer instruction, and slow, so putting it out of line really isn't unreasonable. Can even do a call to a common handler.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.