On Mon, Oct 18, 2021 at 12:10:20PM -0700, H. Peter Anvin wrote:
AFAIK no Intel CPU has ever had that behavior, and always cleared the segments; I don't Intel has any plans of supporting such a CPUID bit (although I'd certainly be willing to take such a request back to the CPU teams on request.)
No need - we can always set or clear a flag on Intel, depending on what we do.
That being said, this sounds like an ideal use for the hypervisor CPU feature flag.
Yap, it uses it.
Maybe we should consider a migration hypervisor flag too to explicitly tell the kernel not to rely on hardware probing that breaks migration in general.
Meh, migration-specific flag calls for all kinds of nasty when each HV would want different things to happen in the guest, for migration. And then the patch flood will come. I mean, we already do a bunch of X86_FEATURE_HYPERVISOR all over the place and apparently it is enough here too...
Now, with a CPUID but being introduced, the right thing would be to use the CPUID bit as a feature instead of using a bug flag, and add whitelisting in the vendor-specific code as applicable.
I guess we can flip all that logic checking X86_BUG_NULL_SEG... it sounds like a lot of churn to me, though and I don't see a pressing need for it unless someone is bored and wants to do some kernel patching exercises but whatever...