summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorWanpeng Li <wanpengli@tencent.com>2021-05-18 05:00:31 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2021-05-27 07:45:50 -0400
commit6bd5b743686243dae7351d5dcceeb7f171201bb4 (patch)
treec760534f54aca88f683598abe4a28bdde9bb1e19 /virt
parent28a4aa1160d71187a44414dac40b57d1fd9fcd77 (diff)
downloadlwn-6bd5b743686243dae7351d5dcceeb7f171201bb4.tar.gz
lwn-6bd5b743686243dae7351d5dcceeb7f171201bb4.zip
KVM: PPC: exit halt polling on need_resched()
This is inspired by commit 262de4102c7bb8 (kvm: exit halt polling on need_resched() as well). Due to PPC implements an arch specific halt polling logic, we have to the need_resched() check there as well. This patch adds a helper function that can be shared between book3s and generic halt-polling loops. Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Venkatesh Srinivas <venkateshs@chromium.org> Cc: Ben Segall <bsegall@google.com> Cc: Venkatesh Srinivas <venkateshs@chromium.org> Cc: Jim Mattson <jmattson@google.com> Cc: David Matlack <dmatlack@google.com> Cc: Paul Mackerras <paulus@ozlabs.org> Cc: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Signed-off-by: Wanpeng Li <wanpengli@tencent.com> Message-Id: <1621339235-11131-1-git-send-email-wanpengli@tencent.com> [Make the function inline. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 6b4feb92dc79..5f40725144f5 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2973,8 +2973,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
goto out;
}
poll_end = cur = ktime_get();
- } while (single_task_running() && !need_resched() &&
- ktime_before(cur, stop));
+ } while (kvm_vcpu_can_poll(cur, stop));
}
prepare_to_rcuwait(&vcpu->wait);