public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Wei Liu <wei.liu@kernel.org>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" 
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd
Date: Mon, 28 Nov 2022 18:02:46 +0000	[thread overview]
Message-ID: <Y4T3xsxszDShKqK0@google.com> (raw)
In-Reply-To: <20221127221245.204208-1-wei.liu@kernel.org>

On Sun, Nov 27, 2022, Wei Liu wrote:
> There is no function named kvm_mmu_ensure_valid_pgd.

() when referecing functions, here and in the comment.

> 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>
> ---
>  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..361574124fbe 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 is found. A new root will be

s/is/was

And technically, it may not be a "new" root, e.g. if a different vCPU creates a
usable root between now and kvm_mmu_reload().

> +	 * set up in vcpu_enter_guest prior to the next vmenter.

s/vmenter/VM-Enter

Pointing a reader at vcpu_enter_guest() isn't very helpful since that's a massive
function; kvm_mmu_reload() is where the real magic happens.  I generally prefer to
avoid referencing functions in comments unless doing so is absolutely "necessary"
because such comments always seem to become stale, but in this case I think it's
worthwhile.

	/*
	 * Return immediately if no usable 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
> 

  reply	other threads:[~2022-11-28 18:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-27 22:12 [PATCH] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd Wei Liu
2022-11-28 18:02 ` Sean Christopherson [this message]
2022-11-28 21:39   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4T3xsxszDShKqK0@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wei.liu@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox