From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH v2 36/48] accel/whpx: Convert to AccelOpsClass::cpu_thread_routine
Date: Mon, 23 Jun 2025 14:31:04 +0200 [thread overview]
Message-ID: <76bd9e17-8350-42a0-aefd-ed96137c5955@linaro.org> (raw)
In-Reply-To: <aea4e119-1ac5-4b03-9639-0dc277375365@linaro.org>
On 22/6/25 04:10, Richard Henderson wrote:
> On 6/20/25 10:13, Philippe Mathieu-Daudé wrote:
>> By converting to AccelOpsClass::cpu_thread_routine we can
>> let the common accel_create_vcpu_thread() create the thread.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/i386/whpx/whpx-accel-ops.c | 12 +-----------
>> 1 file changed, 1 insertion(+), 11 deletions(-)
>>
>> diff --git a/target/i386/whpx/whpx-accel-ops.c b/target/i386/whpx/
>> whpx-accel-ops.c
>> index b8bebe403c9..c1b27d1b89d 100644
>> --- a/target/i386/whpx/whpx-accel-ops.c
>> +++ b/target/i386/whpx/whpx-accel-ops.c
>> @@ -61,16 +61,6 @@ static void *whpx_cpu_thread_fn(void *arg)
>> return NULL;
>> }
>> -static void whpx_start_vcpu_thread(CPUState *cpu)
>> -{
>> - char thread_name[VCPU_THREAD_NAME_SIZE];
>> -
>> - snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/WHPX",
>> - cpu->cpu_index);
>> - qemu_thread_create(cpu->thread, thread_name, whpx_cpu_thread_fn,
>> - cpu, QEMU_THREAD_JOINABLE);
>> -}
>> -
>> static void whpx_kick_vcpu_thread(CPUState *cpu)
>> {
>> if (!qemu_cpu_is_self(cpu)) {
>> @@ -87,7 +77,7 @@ static void whpx_accel_ops_class_init(ObjectClass
>> *oc, const void *data)
>> {
>> AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
>> - ops->create_vcpu_thread = whpx_start_vcpu_thread;
>> + ops->cpu_thread_routine = whpx_cpu_thread_fn;
>> ops->kick_vcpu_thread = whpx_kick_vcpu_thread;
>> ops->cpu_thread_is_idle = whpx_vcpu_thread_is_idle;
>
> After this, create_vcpu_thread is unused, correct?
Only RR left, which is a bit different:
339 void rr_start_vcpu_thread(CPUState *cpu)
340 {
341 char thread_name[VCPU_THREAD_NAME_SIZE];
342 static QemuCond *single_tcg_halt_cond;
343 static QemuThread *single_tcg_cpu_thread;
344
345 tcg_vcpu_thread_precreate(cpu);
346
347 if (!single_tcg_cpu_thread) {
348 single_tcg_halt_cond = cpu->halt_cond;
349 single_tcg_cpu_thread = cpu->thread;
350
351 /* share a single thread for all cpus with TCG */
352 snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "ALL CPUs/TCG");
353 qemu_thread_create(cpu->thread, thread_name,
354 rr_cpu_thread_fn,
355 cpu, QEMU_THREAD_JOINABLE);
356 } else {
357 /* we share the thread, dump spare data */
358 g_free(cpu->thread);
359 qemu_cond_destroy(cpu->halt_cond);
360 g_free(cpu->halt_cond);
361 cpu->thread = single_tcg_cpu_thread;
362 cpu->halt_cond = single_tcg_halt_cond;
363
364 /* copy the stuff done at start of rr_cpu_thread_fn */
365 cpu->thread_id = first_cpu->thread_id;
366 cpu->neg.can_do_io = 1;
367 cpu->created = true;
368 }
369 }
next prev parent reply other threads:[~2025-06-23 12:31 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 17:12 [RFC PATCH v2 00/48] accel: Preparatory cleanups for split-accel Philippe Mathieu-Daudé
2025-06-20 17:12 ` [RFC PATCH v2 01/48] system/runstate: Document qemu_add_vm_change_state_handler() Philippe Mathieu-Daudé
2025-06-22 1:11 ` Richard Henderson
2025-06-20 17:12 ` [RFC PATCH v2 02/48] system/cpus: Defer memory layout changes until vCPUs are realized Philippe Mathieu-Daudé
2025-06-20 17:12 ` [RFC PATCH v2 03/48] system/cpus: Assert interrupt handling is done with BQL locked Philippe Mathieu-Daudé
2025-06-22 1:12 ` Richard Henderson
2025-06-20 17:12 ` [RFC PATCH v2 04/48] accel/kvm: Remove kvm_init_cpu_signals() stub Philippe Mathieu-Daudé
2025-06-22 1:13 ` Richard Henderson
2025-06-20 17:12 ` [RFC PATCH v2 05/48] accel/kvm: Reduce kvm_create_vcpu() declaration scope Philippe Mathieu-Daudé
2025-06-22 1:14 ` Richard Henderson
2025-06-20 17:12 ` [RFC PATCH v2 06/48] accel: Propagate AccelState to AccelClass::init_machine() Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 07/48] accel/kvm: Prefer local AccelState over global MachineState::accel Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 08/48] accel/hvf: Re-use QOM allocated state Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 09/48] accel/tcg: Prefer local AccelState over global current_accel() Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 10/48] accel: Pass AccelState argument to gdbstub_supported_sstep_flags() Philippe Mathieu-Daudé
2025-06-22 1:16 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 11/48] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
2025-06-22 1:20 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 12/48] accel: Move cpus_are_resettable() " Philippe Mathieu-Daudé
2025-06-22 1:22 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 13/48] accel: Move cpu_common_[un]realize() declarations to AccelOpsClass Philippe Mathieu-Daudé
2025-06-22 1:24 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 14/48] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 15/48] accel/system: Add 'info accel' on human monitor Philippe Mathieu-Daudé
2025-06-22 1:26 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 16/48] accel/tcg: Factor tcg_dump_flush_info() out Philippe Mathieu-Daudé
2025-06-22 1:28 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 17/48] accel/tcg: Implement get_[vcpu]_stats() Philippe Mathieu-Daudé
2025-06-22 1:28 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 18/48] accel/hvf: Implement get_vcpu_stats() Philippe Mathieu-Daudé
2025-06-22 1:30 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 19/48] cpus: Document CPUState::vcpu_dirty field Philippe Mathieu-Daudé
2025-06-22 1:30 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 20/48] cpus: Rename 'vcpu_dirty' field as negated 'hwaccel_synchronized' Philippe Mathieu-Daudé
2025-06-22 1:35 ` Richard Henderson
2025-06-23 14:13 ` Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 21/48] accel/hvf: Replace @dirty field by generic @hwaccel_synchronized Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 22/48] accel/nvmm: " Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 23/48] accel/whpx: " Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 24/48] accel/kvm: Remove kvm_cpu_synchronize_state() stub Philippe Mathieu-Daudé
2025-06-22 1:35 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 25/48] accel/system: Document cpu_synchronize_state() Philippe Mathieu-Daudé
2025-06-22 1:46 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 26/48] accel/system: Document cpu_synchronize_state_post_init/reset() Philippe Mathieu-Daudé
2025-06-22 1:46 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 27/48] accel/dummy: Factor dummy_thread_precreate() out Philippe Mathieu-Daudé
2025-06-22 1:58 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 28/48] accel/dummy: Factor tcg_vcpu_thread_precreate() out Philippe Mathieu-Daudé
2025-06-22 1:49 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 29/48] accel: Factor accel_create_vcpu_thread() out Philippe Mathieu-Daudé
2025-06-22 1:56 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 30/48] accel: Introduce AccelOpsClass::cpu_thread_routine handler Philippe Mathieu-Daudé
2025-06-22 1:58 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 31/48] accel/dummy: Convert to AccelOpsClass::cpu_thread_routine Philippe Mathieu-Daudé
2025-06-22 1:59 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 32/48] accel/tcg: " Philippe Mathieu-Daudé
2025-06-22 2:03 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 33/48] accel/hvf: " Philippe Mathieu-Daudé
2025-06-22 2:04 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 34/48] accel/kvm: " Philippe Mathieu-Daudé
2025-06-22 2:05 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 35/48] accel/nvmm: " Philippe Mathieu-Daudé
2025-06-22 2:05 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 36/48] accel/whpx: " Philippe Mathieu-Daudé
2025-06-22 2:05 ` Richard Henderson
2025-06-22 2:10 ` Richard Henderson
2025-06-23 12:31 ` Philippe Mathieu-Daudé [this message]
2025-06-20 17:13 ` [RFC PATCH v2 37/48] accel/nvmm: Expose nvmm_enabled() to common code Philippe Mathieu-Daudé
2025-06-22 2:06 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 38/48] accel/whpx: Expose whpx_enabled() " Philippe Mathieu-Daudé
2025-06-22 2:07 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 39/48] accel/system: Introduce hwaccel_enabled() helper Philippe Mathieu-Daudé
2025-06-22 2:08 ` Richard Henderson
2025-06-20 17:13 ` [RFC PATCH v2 40/48] accel: Factor accel_cpu_realize() out Philippe Mathieu-Daudé
2025-06-22 2:14 ` Richard Henderson
2025-06-23 14:16 ` Philippe Mathieu-Daudé
2025-06-20 17:13 ` [RFC PATCH v2 41/48] accel/tcg: Factor tcg_vcpu_init() out for re-use Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=76bd9e17-8350-42a0-aefd-ed96137c5955@linaro.org \
--to=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).