FAILED: patch "[PATCH] KVM: x86: Use adjustment in guest cycles when handling" failed to apply to 4.2-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.2-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
d7add05458084a5e3d65925764a02ca9c8202c1eMon Sep 17 00:00:00 2001
From: Haozhong Zhang <[email protected]>
Date: Fri, 7 Aug 2015 11:24:32 +0800
Subject: [PATCH] KVM: x86: Use adjustment in guest cycles when handling
MSR_IA32_TSC_ADJUST
When kvm_set_msr_common() handles a guest's write to MSR_IA32_TSC_ADJUST, it will calcuate an adjustment based on the data written by guest and then use it to adjust TSC offset by calling a call-back adjust_tsc_offset(). The 3rd parameter of adjust_tsc_offset() indicates whether the adjustment is in host TSC cycles or in guest TSC cycles. If SVM TSC scaling is enabled, adjust_tsc_offset() [i.e. svm_adjust_tsc_offset()] will first scale the adjustment; otherwise, it will just use the unscaled one. As the MSR write here comes from the guest, the adjustment is in guest TSC cycles. However, the current kvm_set_msr_common() uses it as a value in host TSC cycles (by using true as the 3rd parameter of adjust_tsc_offset()), which can result in an incorrect adjustment of TSC offset if SVM TSC scaling is enabled. This patch fixes this problem.
arch/x86/kvm/x86.c +1 -1
@@ -2105,7 +2105,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)if (guest_cpuid_has_tsc_adjust (vcpu)) {if (!msr_info->host_initiated) {s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr; - kvm_x86_ops->adjust_tsc_offset (vcpu, adj, true); +adjust_tsc_offset_guest (vcpu, adj); } vcpu->arch.ia32_tsc_adjust_msr = data; }
Quoted 10 lines · On Wed, Sep 16, 2015 at 10:05:54PM -0700, [email protected] wrote:
The patch below does not apply to the 4.2-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
Hi greg,
I found this patch is already in the 4.2-stable tree (commit id d7add05).
Thanks,
- Haozhong
Quoted 40 lines
------------------ original commit in Linus's tree ------------------
From
d7add05458084a5e3d65925764a02ca9c8202c1eMon Sep 17 00:00:00 2001
From: Haozhong Zhang <[email protected]>
Date: Fri, 7 Aug 2015 11:24:32 +0800
Subject: [PATCH] KVM: x86: Use adjustment in guest cycles when handling
MSR_IA32_TSC_ADJUSTWhen
kvm_set_msr_common()handles a guest's write toMSR_IA32_TSC_ADJUST, it will calcuate an adjustment based on the data written by guest and then use it to adjust TSC offset by calling a call-backadjust_tsc_offset(). The 3rd parameter ofadjust_tsc_offset()indicates whether the adjustment is in host TSC cycles or in guest TSC cycles. If SVM TSC scaling is enabled,adjust_tsc_offset()[i.e.svm_adjust_tsc_offset()] will first scale the adjustment; otherwise, it will just use the unscaled one. As the MSR write here comes from the guest, the adjustment is in guest TSC cycles. However, the currentkvm_set_msr_common()uses it as a value in host TSC cycles (by using true as the 3rd parameter ofadjust_tsc_offset()), which can result in an incorrect adjustment of TSC offset if SVM TSC scaling is enabled. This patch fixes this problem.Signed-off-by Haozhong Zhang <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>arch/x86/kvm/x86.c +1
-1@@ -2105,7 +2105,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)if (guest_cpuid_has_tsc_adjust (vcpu)) {if (!msr_info->host_initiated) {s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr; - kvm_x86_ops->adjust_tsc_offset (vcpu, adj, true); +adjust_tsc_offset_guest (vcpu, adj); } vcpu->arch.ia32_tsc_adjust_msr = data; }
Greg KH
maintainerQuoted 7 lines · Haozhong Zhang
Quoted 6 lines · On Wed, Sep 16, 2015 at 10:05:54PM -0700, [email protected] wrote:
The patch below does not apply to the 4.2-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Quoted 8 lines
Quoted 4 lines
thanks,
greg k-h
Hi greg,
I found this patch is already in the 4.2-stable tree (commit id d7add05).
Yeah, my fault, sorry about that, it's now in the 4.1-stable queue.
greg k-h