qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 3/4] accel/hvf: Make async_safe_run_on_cpu() safe
Date: Thu, 25 Sep 2025 17:13:46 -0700	[thread overview]
Message-ID: <645808ee-7fb3-4409-af62-c5dab3abf39e@linaro.org> (raw)
In-Reply-To: <20250925025520.71805-4-philmd@linaro.org>

On 9/24/25 19:55, Philippe Mathieu-Daudé wrote:
> Wrap hv_vcpu_run() calls with cpu_exec_start/end() in order to
> have the main loop perform more exclusive sections while all
> vCPUs are quiescent.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Could be related to the dubious thread_kicked access and pselect() in
> hvf_wait_for_ipi() (commit 219c101fa7f "arm/hvf: Add a WFI handler").
> 
> Cc: Peter Collingbourne <pcc@google.com>
> Cc: Alexander Graf <agraf@csgraf.de>
> Cc: Roman Bolshakov <r.bolshakov@yadro.com>
> Cc: Sergio Lopez <slp@redhat.com>
> ---
>   target/arm/hvf/hvf.c  | 2 ++
>   target/i386/hvf/hvf.c | 2 ++
>   2 files changed, 4 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

> 
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index b77db99079e..377eb4bbc6b 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -1927,7 +1927,9 @@ int hvf_vcpu_exec(CPUState *cpu)
>       flush_cpu_state(cpu);
>   
>       bql_unlock();
> +    cpu_exec_start(cpu);
>       r = hv_vcpu_run(cpu->accel->fd);
> +    cpu_exec_end(cpu);
>       bql_lock();
>       switch (r) {
>       case HV_SUCCESS:
> diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
> index 8445cadecec..913ad47f3d8 100644
> --- a/target/i386/hvf/hvf.c
> +++ b/target/i386/hvf/hvf.c
> @@ -749,8 +749,10 @@ int hvf_vcpu_exec(CPUState *cpu)
>               return EXCP_HLT;
>           }
>   
> +        cpu_exec_start(cpu);
>           hv_return_t r = hv_vcpu_run_until(cpu->accel->fd, HV_DEADLINE_FOREVER);
>           assert_hvf_ok(r);
> +        cpu_exec_end(cpu);
>   
>           /* handle VMEXIT */
>           uint64_t exit_reason = rvmcs(cpu->accel->fd, VMCS_EXIT_REASON);



  reply	other threads:[~2025-09-26  0:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25  2:55 [PATCH 0/4] cpus: Cleanups around cpu running state changes Philippe Mathieu-Daudé
2025-09-25  2:55 ` [PATCH 1/4] cpus: Only resume halted CPUs Philippe Mathieu-Daudé
2025-09-25  8:34   ` Philippe Mathieu-Daudé
2025-09-25  2:55 ` [PATCH 2/4] cpus: Access CPUState::thread_kicked atomically Philippe Mathieu-Daudé
2025-09-29  5:52   ` Manos Pitsidianakis
2025-09-25  2:55 ` [PATCH 3/4] accel/hvf: Make async_safe_run_on_cpu() safe Philippe Mathieu-Daudé
2025-09-26  0:13   ` Richard Henderson [this message]
2025-09-25  2:55 ` [PATCH 4/4] accel/tcg: Use cpu_is_stopped() helper to access CPUState::stopped Philippe Mathieu-Daudé
2025-09-26  0:44   ` Richard Henderson

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=645808ee-7fb3-4409-af62-c5dab3abf39e@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.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).