From 6e33590abd650d7fc26e250890007a7323d61280 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Tue, 8 Dec 2015 00:35:36 +0100 Subject: [PATCH] kernel 3.10 : add kvm steal time fix Important fix which have been already applied on proxmox 4.0. I thinked it was just comestic, but guest with kernel 3.16 really slowdown when the bug is triggered. (seem that cpu scheduler is working bad) Signed-off-by: Alexandre Derumier --- Makefile | 1 + changelog.Debian | 2 + kvmstealtime.patch | 112 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 kvmstealtime.patch diff --git a/Makefile b/Makefile index a575e62..c04f8df 100644 --- a/Makefile +++ b/Makefile @@ -177,6 +177,7 @@ ${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README #cd ${KERNEL_SRC}; patch -p1 <../do-not-use-barrier-on-ext3.patch cd ${KERNEL_SRC}; patch -p1 <../bridge-patch.diff cd ${KERNEL_SRC}; patch -p1 <../bridge-forward-ipv6-neighbor-solicitation.patch + cd ${KERNEL_SRC}; patch -p1 <../kvmstealtime.patch #cd ${KERNEL_SRC}; patch -p1 <../kvm-fix-invalid-secondary-exec-controls.patch #cd ${KERNEL_SRC}; patch -p1 <../fix-aspm-policy.patch #cd ${KERNEL_SRC}; patch -p1 <../kbuild-generate-mudules-builtin.patch diff --git a/changelog.Debian b/changelog.Debian index 65a35b9..f629673 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -3,6 +3,8 @@ pve-kernel-3.10.0 (3.10.0-39) unstable; urgency=low * update to kernel-3.10.0-229.20.1.el7.src.rpm * bump api version to 14-pve + + * add kvm steal time fix -- Proxmox Support Team Tue, 08 Dec 2015 11:34:30 +0100 diff --git a/kvmstealtime.patch b/kvmstealtime.patch new file mode 100644 index 0000000..ef1807a --- /dev/null +++ b/kvmstealtime.patch @@ -0,0 +1,112 @@ +Return-Path: kvm-owner@vger.kernel.org +Received: from mailpro.odiso.net (LHLO mailpro.odiso.net) (10.1.31.112) by + mailpro.odiso.net with LMTP; Thu, 15 Oct 2015 00:33:53 +0200 (CEST) +Received: from localhost (localhost [127.0.0.1]) + by mailpro.odiso.net (Postfix) with ESMTP id 1F3454439326A + for ; Thu, 15 Oct 2015 00:33:53 +0200 (CEST) +X-Virus-Scanned: amavisd-new at mailpro.odiso.com +X-Spam-Flag: NO +X-Spam-Score: 0.971 +X-Spam-Level: +X-Spam-Status: No, score=0.971 tagged_above=-10 required=4 + tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, + KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01] + autolearn=no autolearn_force=no +Received: from mailpro.odiso.net ([127.0.0.1]) + by localhost (mailpro.odiso.net [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id hMmmKVYj2S2m for ; + Thu, 15 Oct 2015 00:33:47 +0200 (CEST) +Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) + by mailpro.odiso.net (Postfix) with ESMTP id 09D3D4439324A + for ; Thu, 15 Oct 2015 00:33:46 +0200 (CEST) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1754065AbbJNWdh (ORCPT ); + Wed, 14 Oct 2015 18:33:37 -0400 +Received: from mx1.redhat.com ([209.132.183.28]:48432 "EHLO mx1.redhat.com" + rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP + id S1753882AbbJNWdg (ORCPT ); + Wed, 14 Oct 2015 18:33:36 -0400 +Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) + by mx1.redhat.com (Postfix) with ESMTPS id 35096C0BFD02 + for ; Wed, 14 Oct 2015 22:33:36 +0000 (UTC) +Received: from amt.cnet (vpn1-4-185.ams2.redhat.com [10.36.4.185]) + by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9EMXYFs002263; + Wed, 14 Oct 2015 18:33:35 -0400 +Received: from amt.cnet (localhost [127.0.0.1]) + by amt.cnet (Postfix) with ESMTP id ADFE61009C7; + Wed, 14 Oct 2015 19:33:15 -0300 (BRT) +Received: (from marcelo@localhost) + by amt.cnet (8.14.7/8.14.7/Submit) id t9EMXCRq014112; + Wed, 14 Oct 2015 19:33:12 -0300 +Date: Wed, 14 Oct 2015 19:33:09 -0300 +From: Marcelo Tosatti +To: kvm@vger.kernel.org +Cc: Rik van Riel , + "Dr. David Alan Gilbert" , + Paolo Bonzini , + Amit Shah +Subject: [PATCH] KVM: x86: move steal time initialization to vcpu entry time +Message-ID: <20151014223309.GA13900@amt.cnet> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 +Sender: kvm-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: kvm@vger.kernel.org + + +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 + +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index 8f0f6ec..0e0332e 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -2030,6 +2030,8 @@ static void accumulate_steal_time(struct kvm_vcpu *vcpu) + + static void record_steal_time(struct kvm_vcpu *vcpu) + { ++ accumulate_steal_time(vcpu); ++ + if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED)) + return; + +@@ -2182,12 +2184,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) + 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; +@@ -2830,7 +2826,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) + vcpu->cpu = cpu; + } + +- accumulate_steal_time(vcpu); + kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu); + } + +-- +To unsubscribe from this list: send the line "unsubscribe kvm" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html -- 2.39.2