All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save
@ 2015-04-12 18:47 Nadav Amit
  2015-04-13 10:08 ` Paolo Bonzini
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nadav Amit @ 2015-04-12 18:47 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, Nadav Amit

kvm_init_msr_list is currently called before hardware_setup. As a result,
vmx_mpx_supported always returns false when kvm_init_msr_list checks whether to
save MSR_IA32_BNDCFGS.

Move kvm_init_msr_list after vmx_hardware_setup is called to fix this issue.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>

---

Note that this patch was not tested on a system that supports MPX.
---
 arch/x86/kvm/x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b8cb1d0..b7e3b05 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5800,7 +5800,6 @@ int kvm_arch_init(void *opaque)
 	kvm_set_mmio_spte_mask();
 
 	kvm_x86_ops = ops;
-	kvm_init_msr_list();
 
 	kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
 			PT_DIRTY_MASK, PT64_NX_MASK, 0);
@@ -7254,7 +7253,14 @@ void kvm_arch_hardware_disable(void)
 
 int kvm_arch_hardware_setup(void)
 {
-	return kvm_x86_ops->hardware_setup();
+	int r;
+
+	r = kvm_x86_ops->hardware_setup();
+	if (r != 0)
+		return r;
+
+	kvm_init_msr_list();
+	return 0;
 }
 
 void kvm_arch_hardware_unsetup(void)
-- 
1.9.1


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

* Re: [PATCH] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save
  2015-04-12 18:47 [PATCH] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save Nadav Amit
@ 2015-04-13 10:08 ` Paolo Bonzini
  2015-04-29 12:06 ` Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 4.0-stable tree gregkh
  2015-04-29 12:11 ` Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 3.19-stable tree gregkh
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-04-13 10:08 UTC (permalink / raw)
  To: Nadav Amit; +Cc: kvm



On 12/04/2015 20:47, Nadav Amit wrote:
> kvm_init_msr_list is currently called before hardware_setup. As a result,
> vmx_mpx_supported always returns false when kvm_init_msr_list checks whether to
> save MSR_IA32_BNDCFGS.
> 
> Move kvm_init_msr_list after vmx_hardware_setup is called to fix this issue.
> 
> Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
> 
> ---
> 
> Note that this patch was not tested on a system that supports MPX.
> ---
>  arch/x86/kvm/x86.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index b8cb1d0..b7e3b05 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5800,7 +5800,6 @@ int kvm_arch_init(void *opaque)
>  	kvm_set_mmio_spte_mask();
>  
>  	kvm_x86_ops = ops;
> -	kvm_init_msr_list();
>  
>  	kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
>  			PT_DIRTY_MASK, PT64_NX_MASK, 0);
> @@ -7254,7 +7253,14 @@ void kvm_arch_hardware_disable(void)
>  
>  int kvm_arch_hardware_setup(void)
>  {
> -	return kvm_x86_ops->hardware_setup();
> +	int r;
> +
> +	r = kvm_x86_ops->hardware_setup();
> +	if (r != 0)
> +		return r;
> +
> +	kvm_init_msr_list();
> +	return 0;
>  }
>  
>  void kvm_arch_hardware_unsetup(void)
> 

Applied (locally) for 4.1 with Cc stable.

Paolo

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

* Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 4.0-stable tree
  2015-04-12 18:47 [PATCH] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save Nadav Amit
  2015-04-13 10:08 ` Paolo Bonzini
@ 2015-04-29 12:06 ` gregkh
  2015-04-29 12:11 ` Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 3.19-stable tree gregkh
  2 siblings, 0 replies; 4+ messages in thread
From: gregkh @ 2015-04-29 12:06 UTC (permalink / raw)
  To: namit, gregkh, pbonzini; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save

to the 4.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-x86-fix-msr_ia32_bndcfgs-in-msrs_to_save.patch
and it can be found in the queue-4.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 9e9c3fe40bcd28e3f98f0ad8408435f4503f2781 Mon Sep 17 00:00:00 2001
From: Nadav Amit <namit@cs.technion.ac.il>
Date: Sun, 12 Apr 2015 21:47:15 +0300
Subject: KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save

From: Nadav Amit <namit@cs.technion.ac.il>

commit 9e9c3fe40bcd28e3f98f0ad8408435f4503f2781 upstream.

kvm_init_msr_list is currently called before hardware_setup. As a result,
vmx_mpx_supported always returns false when kvm_init_msr_list checks whether to
save MSR_IA32_BNDCFGS.

Move kvm_init_msr_list after vmx_hardware_setup is called to fix this issue.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Message-Id: <1428864435-4732-1-git-send-email-namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

---
 arch/x86/kvm/x86.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5775,7 +5775,6 @@ int kvm_arch_init(void *opaque)
 	kvm_set_mmio_spte_mask();
 
 	kvm_x86_ops = ops;
-	kvm_init_msr_list();
 
 	kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
 			PT_DIRTY_MASK, PT64_NX_MASK, 0);
@@ -7209,7 +7208,14 @@ void kvm_arch_hardware_disable(void)
 
 int kvm_arch_hardware_setup(void)
 {
-	return kvm_x86_ops->hardware_setup();
+	int r;
+
+	r = kvm_x86_ops->hardware_setup();
+	if (r != 0)
+		return r;
+
+	kvm_init_msr_list();
+	return 0;
 }
 
 void kvm_arch_hardware_unsetup(void)


Patches currently in stable-queue which might be from namit@cs.technion.ac.il are

queue-4.0/kvm-x86-fix-msr_ia32_bndcfgs-in-msrs_to_save.patch

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

* Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 3.19-stable tree
  2015-04-12 18:47 [PATCH] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save Nadav Amit
  2015-04-13 10:08 ` Paolo Bonzini
  2015-04-29 12:06 ` Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 4.0-stable tree gregkh
@ 2015-04-29 12:11 ` gregkh
  2 siblings, 0 replies; 4+ messages in thread
From: gregkh @ 2015-04-29 12:11 UTC (permalink / raw)
  To: namit, gregkh, pbonzini; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save

to the 3.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-x86-fix-msr_ia32_bndcfgs-in-msrs_to_save.patch
and it can be found in the queue-3.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 9e9c3fe40bcd28e3f98f0ad8408435f4503f2781 Mon Sep 17 00:00:00 2001
From: Nadav Amit <namit@cs.technion.ac.il>
Date: Sun, 12 Apr 2015 21:47:15 +0300
Subject: KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save

From: Nadav Amit <namit@cs.technion.ac.il>

commit 9e9c3fe40bcd28e3f98f0ad8408435f4503f2781 upstream.

kvm_init_msr_list is currently called before hardware_setup. As a result,
vmx_mpx_supported always returns false when kvm_init_msr_list checks whether to
save MSR_IA32_BNDCFGS.

Move kvm_init_msr_list after vmx_hardware_setup is called to fix this issue.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Message-Id: <1428864435-4732-1-git-send-email-namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

---
 arch/x86/kvm/x86.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5781,7 +5781,6 @@ int kvm_arch_init(void *opaque)
 	kvm_set_mmio_spte_mask();
 
 	kvm_x86_ops = ops;
-	kvm_init_msr_list();
 
 	kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
 			PT_DIRTY_MASK, PT64_NX_MASK, 0);
@@ -7218,7 +7217,14 @@ void kvm_arch_hardware_disable(void)
 
 int kvm_arch_hardware_setup(void)
 {
-	return kvm_x86_ops->hardware_setup();
+	int r;
+
+	r = kvm_x86_ops->hardware_setup();
+	if (r != 0)
+		return r;
+
+	kvm_init_msr_list();
+	return 0;
 }
 
 void kvm_arch_hardware_unsetup(void)


Patches currently in stable-queue which might be from namit@cs.technion.ac.il are

queue-3.19/kvm-x86-fix-msr_ia32_bndcfgs-in-msrs_to_save.patch

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

end of thread, other threads:[~2015-04-29 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-12 18:47 [PATCH] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save Nadav Amit
2015-04-13 10:08 ` Paolo Bonzini
2015-04-29 12:06 ` Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 4.0-stable tree gregkh
2015-04-29 12:11 ` Patch "KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save" has been added to the 3.19-stable tree gregkh

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.