Re: [PATCH 1/4] KVM: X86: Fix tlb flush for tdp in kvm_invalidate_pcid()

From: Paolo Bonzini
Date: Thu Oct 21 2021 - 13:13:24 EST


On 21/10/21 16:52, Sean Christopherson wrote:
I think the EPT violation happens*after* the cr3 write. So the instruction to be
emulated is not "cr3 write". The emulation will queue fault into guest though,
recursive EPT violation happens since the cr3 exceeds maxphyaddr limit.
Doh, you're correct. I think my mind wandered into thinking about what would
happen with PDPTRs and forgot to get back to normal MOV CR3.

So yeah, the only way to correctly handle this would be to intercept CR3 loads.
I'm guessing that would have a noticeable impact on guest performance.

Ouch... yeah, allow_smaller_maxphyaddr already has bad performance, but intercepting CR3 loads would be another kind of slow.

Paolo

Paolo, I'll leave this one for you to decide, we have pretty much written off
allow_smaller_maxphyaddr:-)