Re: [PATCH v6 14/42] x86/sev: Register GHCB memory when SEV-SNP is active

From: Borislav Petkov
Date: Tue Nov 02 2021 - 14:44:30 EST


On Tue, Nov 02, 2021 at 01:24:01PM -0500, Brijesh Singh wrote:
> To answer your question, GHCB is registered at the time of first #VC
> handling by the second exception handler.

And this is what I don't like - register at use. Instead of init
everything *before* use.

> Mike can correct me, the CPUID page check is going to happen on first
> #VC handling inside the early exception handler (i.e case 1).

What is the "CPUID page check"?

And no, you don't want to do any detection when an exception happens -
you want to detect *everything* *first* and then do exceptions.

> See if my above explanation make sense. Based on it, I don't think it
> makes sense to register the GHCB during the CPUID page detection. The
> CPUID page detection will occur in early VC handling.

See above. If this needs more discussion, we can talk on IRC.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette