[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 11/13] accel/tcg: Add rr_destroy_vcpu_thread_precheck()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v4 11/13] accel/tcg: Add rr_destroy_vcpu_thread_precheck() |
Date: |
Wed, 23 Mar 2022 18:17:49 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
TCG/RR is special and creates a single vCPU. It only have
to release its resources once. Implement the .precheck()
for that purpose.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
accel/tcg/tcg-accel-ops-rr.c | 9 +++++++++
accel/tcg/tcg-accel-ops.c | 1 +
2 files changed, 10 insertions(+)
diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index 006b787289..6fe8e20356 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -295,3 +295,12 @@ void rr_create_vcpu_thread_postcheck(CPUState *cpu)
cpu->created = true;
}
}
+
+bool rr_destroy_vcpu_thread_precheck(CPUState *cpu)
+{
+ if (single_tcg_cpu_thread) {
+ single_tcg_cpu_thread = NULL;
+ return true;
+ }
+ return false;
+}
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 127dd6fee5..0b0dbcc47a 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -102,6 +102,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops)
ops->vcpu_thread_fn = rr_vcpu_thread_fn;
ops->create_vcpu_thread_precheck = rr_create_vcpu_thread_precheck;
ops->create_vcpu_thread_postcheck = rr_create_vcpu_thread_postcheck;
+ ops->destroy_vcpu_thread_precheck = rr_destroy_vcpu_thread_precheck;
ops->kick_vcpu_thread = rr_kick_vcpu_thread;
if (icount_enabled()) {
--
2.35.1
- [PATCH v4 06/13] accel/tcg: Reorganize tcg_accel_ops_init(), (continued)
- [PATCH v4 06/13] accel/tcg: Reorganize tcg_accel_ops_init(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 07/13] accel-ops: Introduce create_vcpu_thread_precheck / postcheck handlers, Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 08/13] accel/tcg: Extract rr_create_vcpu_thread_precheck(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 09/13] accel/all: Extract common_vcpu_thread_create(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 10/13] accel-ops: Introduce common_vcpu_thread_destroy() and .precheck handler, Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 11/13] accel/tcg: Add rr_destroy_vcpu_thread_precheck(),
Philippe Mathieu-Daudé <=
- [PATCH v4 12/13] softmmu/cpus: Free cpu->thread in generic_destroy_vcpu_thread(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 13/13] softmmu/cpus: Free cpu->halt_cond in generic_destroy_vcpu_thread(), Philippe Mathieu-Daudé, 2022/03/23