diff mbox series

[v4,3/9] KVM: x86: MMU: Commets update

Message ID 20230209024022.3371768-4-robert.hu@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Linear Address Masking (LAM) KVM Enabling | expand

Commit Message

Robert Hoo Feb. 9, 2023, 2:40 a.m. UTC
kvm_mmu_ensure_valid_pgd() is stale. Update the comments according to
latest code.

No function changes.

P.S. Sean firstly noticed this in
https://lore.kernel.org/kvm/Yg%2FguAXFLJBmDflh@google.com/.

Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
---
 arch/x86/kvm/mmu/mmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Chao Gao Feb. 10, 2023, 6:59 a.m. UTC | #1
On Thu, Feb 09, 2023 at 10:40:16AM +0800, Robert Hoo wrote:
>kvm_mmu_ensure_valid_pgd() is stale. Update the comments according to
>latest code.
>
>No function changes.
>
>P.S. Sean firstly noticed this in

Reported-by:?

Should not this be post separately? This patch has nothing to do with LAM.

>https://lore.kernel.org/kvm/Yg%2FguAXFLJBmDflh@google.com/.
>
>Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
>---
> arch/x86/kvm/mmu/mmu.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
>index 1d61dfe37c77..9a780445a88e 100644
>--- a/arch/x86/kvm/mmu/mmu.c
>+++ b/arch/x86/kvm/mmu/mmu.c
>@@ -4497,8 +4497,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 no root is found in cache, current active root.hpa will be (set)
>+	 * INVALID_PAGE, a new root will be set up during vcpu_enter_guest()
>+	 * --> kvm_mmu_reload().
>+	 */
> 	if (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role)) {
>-		/* kvm_mmu_ensure_valid_pgd will set up a new root.  */
> 		return;
> 	}
> 
>-- 
>2.31.1
>
Robert Hoo Feb. 10, 2023, 7:55 a.m. UTC | #2
On Fri, 2023-02-10 at 14:59 +0800, Chao Gao wrote:
> On Thu, Feb 09, 2023 at 10:40:16AM +0800, Robert Hoo wrote:
> > kvm_mmu_ensure_valid_pgd() is stale. Update the comments according
> > to
> > latest code.
> > 
> > No function changes.
> > 
> > P.S. Sean firstly noticed this in
> 
> Reported-by:?

OK. Sean agree?
> 
> Should not this be post separately? This patch has nothing to do with
> LAM.

It's too trivial to post separately, I think, just comments updates.
And it on the code path of LAM KVM enabling, therefore I observed and
update passingly; although no code change happens.
> 
> > https://lore.kernel.org/kvm/Yg%2FguAXFLJBmDflh@google.com/.
> > 
> > Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
> > ---
> > arch/x86/kvm/mmu/mmu.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> > index 1d61dfe37c77..9a780445a88e 100644
> > --- a/arch/x86/kvm/mmu/mmu.c
> > +++ b/arch/x86/kvm/mmu/mmu.c
> > @@ -4497,8 +4497,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 no root is found in cache, current active root.hpa will
> > be (set)
> > +	 * INVALID_PAGE, a new root will be set up during
> > vcpu_enter_guest()
> > +	 * --> kvm_mmu_reload().
> > +	 */
> > 	if (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role)) {
> > -		/* kvm_mmu_ensure_valid_pgd will set up a new root.  */
> > 		return;
> > 	}
> > 
> > -- 
> > 2.31.1
> >
Sean Christopherson Feb. 10, 2023, 4:54 p.m. UTC | #3
On Fri, Feb 10, 2023, Robert Hoo wrote:
> On Fri, 2023-02-10 at 14:59 +0800, Chao Gao wrote:
> > On Thu, Feb 09, 2023 at 10:40:16AM +0800, Robert Hoo wrote:
> > > kvm_mmu_ensure_valid_pgd() is stale. Update the comments according
> > > to
> > > latest code.
> > > 
> > > No function changes.
> > > 
> > > P.S. Sean firstly noticed this in
> > 
> > Reported-by:?
> 
> OK. Sean agree?
> > 
> > Should not this be post separately? This patch has nothing to do with
> > LAM.
> 
> It's too trivial to post separately, I think, just comments updates.
> And it on the code path of LAM KVM enabling, therefore I observed and
> update passingly; although no code change happens.

No need, I already applied a similar patch:

https://lore.kernel.org/all/20221128214709.224710-1-wei.liu@kernel.org
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 1d61dfe37c77..9a780445a88e 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -4497,8 +4497,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 no root is found in cache, current active root.hpa will be (set)
+	 * INVALID_PAGE, a new root will be set up during vcpu_enter_guest()
+	 * --> kvm_mmu_reload().
+	 */
 	if (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role)) {
-		/* kvm_mmu_ensure_valid_pgd will set up a new root.  */
 		return;
 	}