[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/35] accel/kvm: Implement AccelOpsClass::has_work()
From: |
Richard Henderson |
Subject: |
[PULL 06/35] accel/kvm: Implement AccelOpsClass::has_work() |
Date: |
Thu, 16 Sep 2021 08:29:56 -0700 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Implement KVM has_work() handler in AccelOpsClass and
remove it from cpu_thread_is_idle() since cpu_has_work()
is already called.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210912172731.789788-6-f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/kvm/kvm-accel-ops.c | 6 ++++++
softmmu/cpus.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index 7516c67a3f..6f4d5df3a0 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -74,6 +74,11 @@ static void kvm_start_vcpu_thread(CPUState *cpu)
cpu, QEMU_THREAD_JOINABLE);
}
+static bool kvm_cpu_has_work(CPUState *cpu)
+{
+ return kvm_halt_in_kernel();
+}
+
static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
{
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
@@ -83,6 +88,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void
*data)
ops->synchronize_post_init = kvm_cpu_synchronize_post_init;
ops->synchronize_state = kvm_cpu_synchronize_state;
ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
+ ops->has_work = kvm_cpu_has_work;
}
static const TypeInfo kvm_accel_ops_type = {
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 2a61dfd628..3db7bd4eb4 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -90,7 +90,7 @@ bool cpu_thread_is_idle(CPUState *cpu)
return true;
}
if (!cpu->halted || cpu_has_work(cpu) ||
- kvm_halt_in_kernel() || whpx_apic_in_platform()) {
+ whpx_apic_in_platform()) {
return false;
}
return true;
--
2.25.1
- [PULL 00/35] tcg patch queue, Richard Henderson, 2021/09/16
- [PULL 06/35] accel/kvm: Implement AccelOpsClass::has_work(),
Richard Henderson <=
- [PULL 03/35] hw/core: Restrict cpu_has_work() to sysemu, Richard Henderson, 2021/09/16
- [PULL 08/35] accel/tcg: Implement AccelOpsClass::has_work() as stub, Richard Henderson, 2021/09/16
- [PULL 04/35] hw/core: Un-inline cpu_has_work(), Richard Henderson, 2021/09/16
- [PULL 07/35] accel/whpx: Implement AccelOpsClass::has_work(), Richard Henderson, 2021/09/16
- [PULL 05/35] sysemu: Introduce AccelOpsClass::has_work(), Richard Henderson, 2021/09/16
- [PULL 02/35] accel/tcg: Restrict cpu_handle_halt() to sysemu, Richard Henderson, 2021/09/16
- [PULL 01/35] include/exec: Move cpu_signal_handler declaration, Richard Henderson, 2021/09/16
- [PULL 13/35] target/hexagon: Remove unused has_work() handler, Richard Henderson, 2021/09/16
- [PULL 11/35] target/avr: Restrict has_work() handler to sysemu, Richard Henderson, 2021/09/16
- [PULL 12/35] target/cris: Restrict has_work() handler to sysemu, Richard Henderson, 2021/09/16