From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org
Subject: [PATCH 2/3] plugins: Avoid deadlock in qemu_plugin_user_exit
Date: Mon, 16 Jan 2023 17:57:00 -1000 [thread overview]
Message-ID: <20230117035701.168514-3-richard.henderson@linaro.org> (raw)
In-Reply-To: <20230117035701.168514-1-richard.henderson@linaro.org>
Use of start_exclusive on this exit path leads to deadlock,
in particular when called from dump_core_and_abort. There
does not appear to be a need for it.
While we're at it, skip the entire function if no plugins.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
plugins/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/core.c b/plugins/core.c
index ccb770a485..35aca0266d 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -502,7 +502,9 @@ void qemu_plugin_user_exit(void)
QEMU_LOCK_GUARD(&plugin.lock);
- start_exclusive();
+ if (QTAILQ_EMPTY(&plugin.ctxs)) {
+ return;
+ }
/* un-register all callbacks except the final AT_EXIT one */
for (ev = 0; ev < QEMU_PLUGIN_EV_MAX; ev++) {
@@ -520,8 +522,6 @@ void qemu_plugin_user_exit(void)
qemu_plugin_disable_mem_helpers(cpu);
}
- end_exclusive();
-
/* now it's safe to handle the exit case */
qemu_plugin_atexit_cb();
}
--
2.34.1
next prev parent reply other threads:[~2023-01-17 3:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 3:56 [PATCH 0/3] tests: Fix some deadlocks Richard Henderson
2023-01-17 3:56 ` [PATCH 1/3] tests/tcg: Use SIGKILL for timeout Richard Henderson
2023-01-17 9:36 ` Alex Bennée
2023-01-17 15:28 ` Richard Henderson
2023-01-17 3:57 ` Richard Henderson [this message]
2023-01-20 17:35 ` [PATCH 2/3] plugins: Avoid deadlock in qemu_plugin_user_exit Alex Bennée
2023-01-17 3:57 ` [PATCH 3/3] plugins: Iterate on cb_lists " Richard Henderson
2023-01-20 17:39 ` Alex Bennée
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=20230117035701.168514-3-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@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).