Re: [PATCH v2 0/4] KVM: x86: APICv cleanups

From: Paolo Bonzini
Date: Mon Oct 25 2021 - 11:22:05 EST


On 25/10/21 16:35, Sean Christopherson wrote:
So yeah, I think you're right.
Yep. The alternative would be to explicitly check for a pending APICv update.
I don't have a strong opinion, I dislike both options equally:-)

No, checking for the update is worse and with this example, I can now point my finger on why I preferred the VM check even before: because even though the page fault path runs in vCPU context and uses a vCPU-specific role, overall the page tables are still per-VM.

Therefore it makes sense for the page fault path to synchronize with whoever updates the flag and zaps the page, and not with the KVM_REQ_* handler of the same vCPU.

(Here goes the usual shameless plug of my lockless programming articles on LWN---I think you're old enough to vaguely remember Jerry Pournelle---and in particular the first one at https://lwn.net/Articles/844224/).

Want me to type up a v3 comment?

Yes, please do.

Paolo