[PATCH v2] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd()

Wei Liu posted 1 patch 2 years, 9 months ago
arch/x86/kvm/mmu/mmu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
[PATCH v2] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd()
Posted by Wei Liu 2 years, 9 months ago
There is no function named kvm_mmu_ensure_valid_pgd().

Fix the comment and remove the pair of braces to conform to Linux kernel
coding style.

Signed-off-by: Wei Liu <wei.liu@kernel.org>
---
v2: incorporate Sean's suggestions
---
 arch/x86/kvm/mmu/mmu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index b6f96d47e596..a1895fd9eaf4 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -4452,10 +4452,12 @@ void kvm_mmu_new_pgd(struct kvm_vcpu *vcpu, gpa_t new_pgd)
 	struct kvm_mmu *mmu = vcpu->arch.mmu;
 	union kvm_mmu_page_role new_role = mmu->root_role;
 
-	if (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role)) {
-		/* kvm_mmu_ensure_valid_pgd will set up a new root.  */
+	/*
+	 * Return immediately if no usable root was found, kvm_mmu_reload()
+	 * will establish a valid root prior to the next VM-Enter.
+	 */
+	if (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role))
 		return;
-	}
 
 	/*
 	 * It's possible that the cached previous root page is obsolete because
-- 
2.35.1
Re: [PATCH v2] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd()
Posted by Sean Christopherson 2 years, 8 months ago
On Mon, 28 Nov 2022 21:47:09 +0000, Wei Liu wrote:
> There is no function named kvm_mmu_ensure_valid_pgd().
> 
> Fix the comment and remove the pair of braces to conform to Linux kernel
> coding style.
> 
> 

Applied to kvm-x86 mmu, thanks!

[1/1] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd()
      https://github.com/kvm-x86/linux/commit/03e5fdfd708e

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes
Re: [PATCH v2] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd()
Posted by Sean Christopherson 2 years, 9 months ago
On Mon, Nov 28, 2022, Wei Liu wrote:
> There is no function named kvm_mmu_ensure_valid_pgd().
> 
> Fix the comment and remove the pair of braces to conform to Linux kernel
> coding style.
> 
> Signed-off-by: Wei Liu <wei.liu@kernel.org>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>