On Fri, Mar 20, 2020 at 02:16:39PM -0700, David Rientjes wrote: > On Thu, 19 Mar 2020, Joerg Roedel wrote: > > +#define GHCB_SEV_GHCB_RESP_CODE(v) ((v) & 0xfff) > > +#define VMGEXIT() { asm volatile("rep; vmmcall\n\r"); } > > Since preemption and irqs should be disabled before updating the GHCB and > its MSR and until the contents have been accessed following VMGEXIT, > should there be checks in place to ensure that's always the case? Good point, some checking is certainly helpful. Currently it is the case, because the GHCB is accessed and used only: 1) At boot when only the boot CPU is running 2) In the #VC handler, which does not enable interrupts 3) In the NMI handler, which is also not preemptible I can also add code to sev_es_get/put_ghcb to make sure these conditions are met. All this does not prevent the preemption by NMIs, which could cause another nested #VC exception, but that is handled separatly. Regards, Joerg