From: "Doru Blânzeanu" <dblanzeanu@linux.microsoft.com>
To: qemu-devel@nongnu.org
Cc: "Wei Liu" <liuwe@microsoft.com>, "Wei Liu" <wei.liu@kernel.org>,
"Magnus Kulke" <magnuskulke@microsoft.com>,
"Doru Blânzeanu" <dblanzeanu@microsoft.com>,
"Doru Blânzeanu" <dblanzeanu@linux.microsoft.com>,
"Magnus Kulke" <magnuskulke@linux.microsoft.com>
Subject: [PATCH v2 4/4] accel/mshv: break the vCPU run loop on exit_request
Date: Fri, 31 Jul 2026 21:46:42 +0300 [thread overview]
Message-ID: <20260731184643.89604-5-dblanzeanu@linux.microsoft.com> (raw)
In-Reply-To: <20260731184643.89604-1-dblanzeanu@linux.microsoft.com>
Ignored VM exits can cause mshv_cpu_exec() to re-enter MSHV_RUN_VP
without returning to qemu_process_cpu_events(). A busy vCPU may
prevent pause_all_vcpus() from completing.
Check exit_request before re-entering MSHV_RUN_VP and return
EXCP_INTERRUPT so pending stop requests can be processed.
Signed-off-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
---
accel/mshv/mshv-all.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
index afcb87b3b8..b7c1126fe0 100644
--- a/accel/mshv/mshv-all.c
+++ b/accel/mshv/mshv-all.c
@@ -780,6 +780,16 @@ static int mshv_cpu_exec(CPUState *cpu)
cpu->vcpu_dirty = false;
}
+ /*
+ * A kick/stop can't reliably break MSHV_RUN_VP out, so leave the run
+ * loop here too; otherwise a busy vCPU never reaches
+ * qemu_process_cpu_events() and pause_all_vcpus() hangs under the BQL.
+ */
+ if (cpu->stop || qatomic_load_acquire(&cpu->exit_request)) {
+ ret = EXCP_INTERRUPT;
+ break;
+ }
+
ret = mshv_run_vcpu(mshv_state->vm, cpu, &mshv_msg, &exit_reason);
if (ret < 0) {
error_report("Failed to run on vcpu %d", cpu->cpu_index);
--
2.53.0
prev parent reply other threads:[~2026-07-31 18:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 18:46 [PATCH v2 0/4] accel/mshv: add gdbstub guest debugging support Doru Blânzeanu
2026-07-31 18:46 ` [PATCH v2 1/4] include/hw/hyperv: add ABI for exception intercepts and pending events Doru Blânzeanu
2026-07-31 18:46 ` [PATCH v2 2/4] accel/mshv: add gdbstub software breakpoint support Doru Blânzeanu
2026-07-31 18:46 ` [PATCH v2 3/4] target/i386/mshv: support single-stepping Doru Blânzeanu
2026-07-31 18:46 ` Doru Blânzeanu [this message]
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=20260731184643.89604-5-dblanzeanu@linux.microsoft.com \
--to=dblanzeanu@linux.microsoft.com \
--cc=dblanzeanu@microsoft.com \
--cc=liuwe@microsoft.com \
--cc=magnuskulke@linux.microsoft.com \
--cc=magnuskulke@microsoft.com \
--cc=qemu-devel@nongnu.org \
--cc=wei.liu@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.