KVM: PPC: Book3S HV: Fix preempted vcore stolen time calculation
authorPaul Mackerras <paulus@samba.org>
Thu, 16 Jul 2015 07:11:14 +0000 (17:11 +1000)
committerAlexander Graf <agraf@suse.de>
Sat, 22 Aug 2015 09:16:19 +0000 (11:16 +0200)
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 <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/kvm/book3s_hv.c

index 3d022766294aaba5d398724ee02c9f4fc50f99b6..fad52f226c12b7cfffbe0c5c3d5674782abcfd6f 100644 (file)
@@ -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,