Re: [PATCH] KVM: x86: Allow guest to set EFER.NX=1 on non-PAE 32-bit kernels

From: Paolo Bonzini
Date: Fri Aug 06 2021 - 07:58:08 EST


On 05/08/21 20:38, Sean Christopherson wrote:
Fast forward to today, and KVM has long since stopped running the guest
with the host's EFER.NX. Not only does KVM context switch EFER if
host.EFER.NX=1 && guest.EFER.NX=0, KVM also forces host.EFER.NX=0 &&
guest.EFER.NX=1 when using shadow paging (to emulate SMEP). Furthermore,
the entire motivation for the restriction was made obsolete over a decade
ago when Intel added dedicated host and guest EFER fields in the VMCS
(Nehalem timeframe), which reduced the overhead of context switching EFER
from 400+ cycles (2 * WRMSR + 1 * RDMSR) to a mere ~2 cycles.

Both pretty good points. :) Queued, thanks.

Paolo