Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1357458
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.10 09/18] KVM: x86: move steal time initialization to vcpu entry time |
| Date | 2016-03-14 19:00 +0100 |
| Message-ID | <rcEWD-73F-25@gated-at.bofh.it> (permalink) |
| References | <rcEWB-73F-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Tosatti <mtosatti@redhat.com>
commit 7cae2bedcbd4680b155999655e49c27b9cf020fa upstream.
As reported at https://bugs.launchpad.net/qemu/+bug/1494350,
it is possible to have vcpu->arch.st.last_steal initialized
from a thread other than vcpu thread, say the iothread, via
KVM_SET_MSRS.
Which can cause an overflow later (when subtracting from vcpu threads
sched_info.run_delay).
To avoid that, move steal time accumulation to vcpu entry time,
before copying steal time data to guest.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kvm/x86.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1941,6 +1941,8 @@ static void accumulate_steal_time(struct
static void record_steal_time(struct kvm_vcpu *vcpu)
{
+ accumulate_steal_time(vcpu);
+
if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED))
return;
@@ -2074,12 +2076,6 @@ int kvm_set_msr_common(struct kvm_vcpu *
if (!(data & KVM_MSR_ENABLED))
break;
- vcpu->arch.st.last_steal = current->sched_info.run_delay;
-
- preempt_disable();
- accumulate_steal_time(vcpu);
- preempt_enable();
-
kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
break;
@@ -2758,7 +2754,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu
vcpu->cpu = cpu;
}
- accumulate_steal_time(vcpu);
kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.10 00/18] 3.10.101-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:00 +0100
[PATCH 3.10 09/18] KVM: x86: move steal time initialization to vcpu entry time Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:00 +0100
[PATCH 3.10 02/18] tracing: Fix check for cpu online when event is disabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:00 +0100
[PATCH 3.10 04/18] ASoC: wm8958: Fix enum ctl accesses in a wrong type Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:00 +0100
[PATCH 3.10 08/18] powerpc: Fix dedotify for binutils >= 2.26 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:00 +0100
[PATCH 3.10 06/18] mac80211: fix use of uninitialised values in RX aggregation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:00 +0100
[PATCH 3.10 18/18] Revert: "crypto: af_alg - Disallow bind/setkey/... after accept(2)" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:00 +0100
[PATCH 3.10 13/18] efi: Make our variable validation list include the guid Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:10 +0100
[PATCH 3.10 12/18] efi: Do variable name validation tests in utf8 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:10 +0100
[PATCH 3.10 11/18] efi: Use ucs2_as_utf8 in efivarfs instead of open coding a bad version Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:10 +0100
[PATCH 3.10 14/18] efi: Make efivarfs entries immutable by default Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:10 +0100
[PATCH 3.10 10/18] lib/ucs2_string: Add ucs2 -> utf8 helper functions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:10 +0100
[PATCH 3.10 15/18] efi: Add pstore variables to the deletion whitelist Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-14 19:10 +0100
Re: [PATCH 3.10 00/18] 3.10.101-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-03-15 00:20 +0100
Re: [PATCH 3.10 00/18] 3.10.101-stable review Guenter Roeck <linux@roeck-us.net> - 2016-03-15 03:40 +0100
Re: [PATCH 3.10 00/18] 3.10.101-stable review Guenter Roeck <linux@roeck-us.net> - 2016-03-16 04:10 +0100
Re: [PATCH 3.10 00/18] 3.10.101-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-16 05:20 +0100
csiph-web