linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list()
@ 2019-11-13  1:15 Xiaoyao Li
  2019-11-13  8:20 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaoyao Li @ 2019-11-13  1:15 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář, kvm, linux-kernel
  Cc: Xiaoyao Li, Chenyi Qiang

When applying commit 7a5ee6edb42e ("KVM: X86: Fix initialization of MSR
lists"), it forgot to reset the three MSR lists number varialbes to 0
while removing the useless conditionals.

Fixes: 7a5ee6edb42e (KVM: X86: Fix initialization of MSR lists)
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 arch/x86/kvm/x86.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8c8a5e20ea06..9368b0e6bf21 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5102,6 +5102,10 @@ static void kvm_init_msr_list(void)
 
 	perf_get_x86_pmu_capability(&x86_pmu);
 
+	num_msrs_to_save = 0;
+	num_emulated_msrs = 0;
+	num_msr_based_features = 0;
+
 	for (i = 0; i < ARRAY_SIZE(msrs_to_save_all); i++) {
 		if (rdmsr_safe(msrs_to_save_all[i], &dummy[0], &dummy[1]) < 0)
 			continue;
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list()
  2019-11-13  1:15 [PATCH] KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list() Xiaoyao Li
@ 2019-11-13  8:20 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-11-13  8:20 UTC (permalink / raw)
  To: Xiaoyao Li, Radim Krčmář, kvm, linux-kernel; +Cc: Chenyi Qiang

On 13/11/19 02:15, Xiaoyao Li wrote:
> When applying commit 7a5ee6edb42e ("KVM: X86: Fix initialization of MSR
> lists"), it forgot to reset the three MSR lists number varialbes to 0
> while removing the useless conditionals.
> 
> Fixes: 7a5ee6edb42e (KVM: X86: Fix initialization of MSR lists)
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>  arch/x86/kvm/x86.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 8c8a5e20ea06..9368b0e6bf21 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5102,6 +5102,10 @@ static void kvm_init_msr_list(void)
>  
>  	perf_get_x86_pmu_capability(&x86_pmu);
>  
> +	num_msrs_to_save = 0;
> +	num_emulated_msrs = 0;
> +	num_msr_based_features = 0;
> +
>  	for (i = 0; i < ARRAY_SIZE(msrs_to_save_all); i++) {
>  		if (rdmsr_safe(msrs_to_save_all[i], &dummy[0], &dummy[1]) < 0)
>  			continue;
> 

Ouch.  Sorry.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-13  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13  1:15 [PATCH] KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list() Xiaoyao Li
2019-11-13  8:20 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).