From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: [PULL 11/12] KVM: PPC: Book3S HV: Fix preempted vcore stolen time calculation Date: Sat, 22 Aug 2015 11:21:34 +0200 Message-ID: <1440235295-244203-12-git-send-email-agraf@suse.de> References: <1440235295-244203-1-git-send-email-agraf@suse.de> Cc: KVM , Paolo Bonzini , Paul Mackerras To: kvm-ppc Return-path: Received: from mx2.suse.de ([195.135.220.15]:40533 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753311AbbHVJVj (ORCPT ); Sat, 22 Aug 2015 05:21:39 -0400 In-Reply-To: <1440235295-244203-1-git-send-email-agraf@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: From: Paul Mackerras Whenever a vcore state is VCORE_PREEMPT we need to be counting stolen time for it. This currently isn't the case when we have a vcore that no longer has any runnable threads in it but still has a runner task, so we do an explicit call to kvmppc_core_start_stolen() in that case. Signed-off-by: Paul Mackerras Signed-off-by: Alexander Graf --- arch/powerpc/kvm/book3s_hv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 3d02276..fad52f2 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -2283,9 +2283,14 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master) } list_del_init(&vc->preempt_list); if (!is_master) { - vc->vcore_state = vc->runner ? VCORE_PREEMPT : VCORE_INACTIVE; - if (still_running > 0) + if (still_running > 0) { kvmppc_vcore_preempt(vc); + } else if (vc->runner) { + vc->vcore_state = VCORE_PREEMPT; + kvmppc_core_start_stolen(vc); + } else { + vc->vcore_state = VCORE_INACTIVE; + } if (vc->n_runnable > 0 && vc->runner == NULL) { /* make sure there's a candidate runner awake */ vcpu = list_first_entry(&vc->runnable_threads, -- 1.8.1.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Sat, 22 Aug 2015 09:21:34 +0000 Subject: [PULL 11/12] KVM: PPC: Book3S HV: Fix preempted vcore stolen time calculation Message-Id: <1440235295-244203-12-git-send-email-agraf@suse.de> List-Id: References: <1440235295-244203-1-git-send-email-agraf@suse.de> In-Reply-To: <1440235295-244203-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc Cc: KVM , Paolo Bonzini , Paul Mackerras From: Paul Mackerras Whenever a vcore state is VCORE_PREEMPT we need to be counting stolen time for it. This currently isn't the case when we have a vcore that no longer has any runnable threads in it but still has a runner task, so we do an explicit call to kvmppc_core_start_stolen() in that case. Signed-off-by: Paul Mackerras Signed-off-by: Alexander Graf --- arch/powerpc/kvm/book3s_hv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 3d02276..fad52f2 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -2283,9 +2283,14 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master) } list_del_init(&vc->preempt_list); if (!is_master) { - vc->vcore_state = vc->runner ? VCORE_PREEMPT : VCORE_INACTIVE; - if (still_running > 0) + if (still_running > 0) { kvmppc_vcore_preempt(vc); + } else if (vc->runner) { + vc->vcore_state = VCORE_PREEMPT; + kvmppc_core_start_stolen(vc); + } else { + vc->vcore_state = VCORE_INACTIVE; + } if (vc->n_runnable > 0 && vc->runner = NULL) { /* make sure there's a candidate runner awake */ vcpu = list_first_entry(&vc->runnable_threads, -- 1.8.1.4