diff mbox

[SRU,Wily] KVM: VMX: Fix host initiated access to guest MSR_TSC_AUX

Message ID 1456958363-31315-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa March 2, 2016, 10:39 p.m. UTC
From: Haozhong Zhang <haozhong.zhang@intel.com>

BugLink: {{ TBD: See the kernel-team ML thread:
    "KVM/QEMU live migration fails with Ubuntu wily kernel 4.2.0-30.35"
    Note this backport is also queued for 4.2-stable.  -Kamal }}

commit 81b1b9ca6d5ca5f3ce91c0095402def657cf5db3 upstream.

The current handling of accesses to guest MSR_TSC_AUX returns error if
vcpu does not support rdtscp, though those accesses are initiated by
host. This can result in the reboot failure of some versions of
QEMU. This patch fixes this issue by passing those host initiated
accesses for further handling instead.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Backported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kvm/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Brad Figg March 2, 2016, 11:38 p.m. UTC | #1
On Wed, Mar 02, 2016 at 02:39:23PM -0800, Kamal Mostafa wrote:
> From: Haozhong Zhang <haozhong.zhang@intel.com>
> 
> BugLink: {{ TBD: See the kernel-team ML thread:
>     "KVM/QEMU live migration fails with Ubuntu wily kernel 4.2.0-30.35"
>     Note this backport is also queued for 4.2-stable.  -Kamal }}
> 
> commit 81b1b9ca6d5ca5f3ce91c0095402def657cf5db3 upstream.
> 
> The current handling of accesses to guest MSR_TSC_AUX returns error if
> vcpu does not support rdtscp, though those accesses are initiated by
> host. This can result in the reboot failure of some versions of
> QEMU. This patch fixes this issue by passing those host initiated
> accesses for further handling instead.
> 
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Backported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  arch/x86/kvm/vmx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 6b56056..44976a5 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2673,7 +2673,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  		msr_info->data = vcpu->arch.ia32_xss;
>  		break;
>  	case MSR_TSC_AUX:
> -		if (!to_vmx(vcpu)->rdtscp_enabled)
> +		if (!to_vmx(vcpu)->rdtscp_enabled && !msr_info->host_initiated)
>  			return 1;
>  		/* Otherwise falls through */
>  	default:
> @@ -2779,7 +2779,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  			clear_atomic_switch_msr(vmx, MSR_IA32_XSS);
>  		break;
>  	case MSR_TSC_AUX:
> -		if (!vmx->rdtscp_enabled)
> +		if (!vmx->rdtscp_enabled && !msr_info->host_initiated)
>  			return 1;
>  		/* Check reserved bit, higher 32 bits should be zero */
>  		if ((data >> 32) != 0)
> -- 
> 2.1.4
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Looks like a valid cherry-pick.
Tim Gardner March 3, 2016, 12:35 a.m. UTC | #2

Kamal Mostafa March 3, 2016, 4:49 p.m. UTC | #3

diff mbox

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 6b56056..44976a5 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2673,7 +2673,7 @@  static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 		msr_info->data = vcpu->arch.ia32_xss;
 		break;
 	case MSR_TSC_AUX:
-		if (!to_vmx(vcpu)->rdtscp_enabled)
+		if (!to_vmx(vcpu)->rdtscp_enabled && !msr_info->host_initiated)
 			return 1;
 		/* Otherwise falls through */
 	default:
@@ -2779,7 +2779,7 @@  static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			clear_atomic_switch_msr(vmx, MSR_IA32_XSS);
 		break;
 	case MSR_TSC_AUX:
-		if (!vmx->rdtscp_enabled)
+		if (!vmx->rdtscp_enabled && !msr_info->host_initiated)
 			return 1;
 		/* Check reserved bit, higher 32 bits should be zero */
 		if ((data >> 32) != 0)