* [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
@ 2022-05-23 1:09 shaoqin.huang
2022-05-23 16:17 ` Sean Christopherson
0 siblings, 1 reply; 8+ messages in thread
From: shaoqin.huang @ 2022-05-23 1:09 UTC (permalink / raw)
To: pbonzini
Cc: Shaoqin Huang, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, kvm,
linux-kernel
From: Shaoqin Huang <shaoqin.huang@intel.com>
Iterate every prev_roots and only zap obsoleted roots.
Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
---
arch/x86/kvm/mmu/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 45e1573f8f1d..22803916a609 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5168,7 +5168,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
roots_to_free |= KVM_MMU_ROOT_CURRENT;
for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
- if (is_obsolete_root(kvm, mmu->root.hpa))
+ if (is_obsolete_root(kvm, mmu->prev_roots.hpa))
roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
2022-05-23 1:09 [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots() shaoqin.huang
@ 2022-05-23 16:17 ` Sean Christopherson
0 siblings, 0 replies; 8+ messages in thread
From: Sean Christopherson @ 2022-05-23 16:17 UTC (permalink / raw)
To: shaoqin.huang
Cc: pbonzini, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
Joerg Roedel, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, kvm, linux-kernel
On Sun, May 22, 2022, shaoqin.huang@intel.com wrote:
> From: Shaoqin Huang <shaoqin.huang@intel.com>
>
> Iterate every prev_roots and only zap obsoleted roots.
Better would be something like:
When freeing obsolete previous roots, check prev_roots as intended, not
the current root.
Ugh, my bad. This escaped into v5.18 :-(
Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
Cc: stable@vger.kernel.org
>
> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 45e1573f8f1d..22803916a609 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5168,7 +5168,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
> roots_to_free |= KVM_MMU_ROOT_CURRENT;
>
> for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
> - if (is_obsolete_root(kvm, mmu->root.hpa))
> + if (is_obsolete_root(kvm, mmu->prev_roots.hpa))
My version is bad, but at least it compiles ;-)
arch/x86/kvm/mmu/mmu.c: In function ‘__kvm_mmu_free_obsolete_roots’:
arch/x86/kvm/mmu/mmu.c:5182:58: error: ‘(struct kvm_mmu_root_info *)&mmu->prev_roots’ is a pointer; did you mean to use ‘->’?
5182 | if (is_obsolete_root(kvm, mmu->prev_roots.hpa))
| ^
| ->
if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
> roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
> }
>
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
@ 2022-06-06 23:48 shaoqin.huang
2022-06-06 9:26 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: shaoqin.huang @ 2022-06-06 23:48 UTC (permalink / raw)
To: shaoqin.huang; +Cc: stable
From: Shaoqin Huang <shaoqin.huang@intel.com>
When freeing obsolete previous roots, check prev_roots as intended, not
the current root.
Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
Cc: stable@vger.kernel.org
---
arch/x86/kvm/mmu/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index f4653688fa6d..e826ee9138fa 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
roots_to_free |= KVM_MMU_ROOT_CURRENT;
for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
- if (is_obsolete_root(kvm, mmu->root.hpa))
+ if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
@ 2022-06-06 23:46 shaoqin.huang
2022-06-06 9:26 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: shaoqin.huang @ 2022-06-06 23:46 UTC (permalink / raw)
To: shaoqin.huang; +Cc: stable
From: Shaoqin Huang <shaoqin.huang@intel.com>
When freeing obsolete previous roots, check prev_roots as intended, not
the current root.
Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
Cc: stable@vger.kernel.org
---
arch/x86/kvm/mmu/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index f4653688fa6d..e826ee9138fa 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
roots_to_free |= KVM_MMU_ROOT_CURRENT;
for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
- if (is_obsolete_root(kvm, mmu->root.hpa))
+ if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
@ 2022-06-06 23:44 shaoqin.huang
0 siblings, 0 replies; 8+ messages in thread
From: shaoqin.huang @ 2022-06-06 23:44 UTC (permalink / raw)
To: shaoqin.huang; +Cc: stable
From: Shaoqin Huang <shaoqin.huang@intel.com>
When freeing obsolete previous roots, check prev_roots as intended, not
the current root.
Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
Cc: stable@vger.kernel.org
---
arch/x86/kvm/mmu/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index f4653688fa6d..e826ee9138fa 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
roots_to_free |= KVM_MMU_ROOT_CURRENT;
for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
- if (is_obsolete_root(kvm, mmu->root.hpa))
+ if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
[not found] <20220606234211.2931304-1-shaoqin.huang@intel.com>
@ 2022-06-06 23:42 ` shaoqin.huang
0 siblings, 0 replies; 8+ messages in thread
From: shaoqin.huang @ 2022-06-06 23:42 UTC (permalink / raw)
To: shaoqin.huang; +Cc: stable
From: Shaoqin Huang <shaoqin.huang@intel.com>
When freeing obsolete previous roots, check prev_roots as intended, not
the current root.
Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
Cc: stable@vger.kernel.org
---
arch/x86/kvm/mmu/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index f4653688fa6d..e826ee9138fa 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
roots_to_free |= KVM_MMU_ROOT_CURRENT;
for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
- if (is_obsolete_root(kvm, mmu->root.hpa))
+ if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
2022-06-06 23:46 shaoqin.huang
@ 2022-06-06 9:26 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2022-06-06 9:26 UTC (permalink / raw)
To: shaoqin.huang; +Cc: stable
On Mon, Jun 06, 2022 at 05:46:36PM -0600, shaoqin.huang@intel.com wrote:
> From: Shaoqin Huang <shaoqin.huang@intel.com>
>
> When freeing obsolete previous roots, check prev_roots as intended, not
> the current root.
>
> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
> Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
> Cc: stable@vger.kernel.org
> ---
> arch/x86/kvm/mmu/mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index f4653688fa6d..e826ee9138fa 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
> roots_to_free |= KVM_MMU_ROOT_CURRENT;
>
> for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
> - if (is_obsolete_root(kvm, mmu->root.hpa))
> + if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
> roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
> }
>
> --
> 2.30.2
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
2022-06-06 23:48 shaoqin.huang
@ 2022-06-06 9:26 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2022-06-06 9:26 UTC (permalink / raw)
To: shaoqin.huang; +Cc: stable
On Mon, Jun 06, 2022 at 05:48:43PM -0600, shaoqin.huang@intel.com wrote:
> From: Shaoqin Huang <shaoqin.huang@intel.com>
>
> When freeing obsolete previous roots, check prev_roots as intended, not
> the current root.
>
> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
> Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
> Cc: stable@vger.kernel.org
> ---
> arch/x86/kvm/mmu/mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index f4653688fa6d..e826ee9138fa 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
> roots_to_free |= KVM_MMU_ROOT_CURRENT;
>
> for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
> - if (is_obsolete_root(kvm, mmu->root.hpa))
> + if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
> roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
> }
>
> --
> 2.30.2
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-06-06 9:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 1:09 [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots() shaoqin.huang
2022-05-23 16:17 ` Sean Christopherson
[not found] <20220606234211.2931304-1-shaoqin.huang@intel.com>
2022-06-06 23:42 ` shaoqin.huang
2022-06-06 23:44 shaoqin.huang
2022-06-06 23:46 shaoqin.huang
2022-06-06 9:26 ` Greg KH
2022-06-06 23:48 shaoqin.huang
2022-06-06 9:26 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.