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

From: Dave Hansen
Date: Thu Aug 06 2020 - 15:57:30 EST


On 8/6/20 12:25 PM, Ricardo Neri wrote:
> static inline void sync_core(void)
> {
> /*
> - * There are quite a few ways to do this. IRET-to-self is nice
> + * Hardware can do this for us if SERIALIZE is available. Otherwise,
> + * there are quite a few ways to do this. IRET-to-self is nice

This seems to imply that things other than SERIALIZE aren't the hardware
doing this. All of these methods are equally architecturally
serializing *and* provided by the hardware.

I also don't quite get the point of separating the comments from the
code. Shouldn't this be:

/*
* The SERIALIZE instruction is the most straightforward way to
* do this but it not universally available.
*/
if (static_cpu_has(X86_FEATURE_SERIALIZE)) {
asm volatile(__ASM_SERIALIZE ::: "memory");
return;
}

/*
* For all other processors, IRET-to-self is nice ...
*/
iret_to_self();