Re: [PATCH 17/22] KVM: x86: Check EMULTYPE_WRITE_PF_TO_SP before unprotecting gfn

From: Paolo Bonzini
Date: Wed Aug 14 2024 - 13:54:14 EST


On 8/9/24 21:03, Sean Christopherson wrote:
+ * Retry even if _this_ vCPU didn't unprotect the gfn, as it's possible
+ * all SPTEs were already zapped by a different task. The alternative
+ * is to report the error to userspace and likely terminate the guest,
+ * and the infinite loop detection logic will prevent retrying the page
+ * fault indefinitely, i.e. there's nothing to lose by retrying.

Putting myself in the shoes of someone unfamiliar with the code, I might prefer "the last_retry_eip/last_retry_addr checks" to "the infinite loop detection logic"; after all, you're saying in the same sentence that it's preventing an infinite loop.

Thanks,

Paolo