Re: [PATCH] KVM: x86: Use cpu_feature_enabled() for PKU instead of #ifdef

From: Mingwei Zhang
Date: Fri Jun 02 2023 - 16:58:47 EST


>
> As we move towards enabling PKRU on the host, due to some customer
> requests, I have to wonder if PKRU-disabled is the norm.
>
> In other words, is this a likely() or unlikely() optimization?

I think it should be likely() as PKU was introduced very early in the
Skylake-SP server cores many years ago. Today I think all recent
client CPUs should have PKU on default if I am not mistaken. So yeah,
adding a likely() probably should help prevent the compiler from
evicting this code chunk to the end of function.

Thanks.
-Mingwei