[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] plugins: Avoid deadlock in qemu_plugin_user_exit
From: |
Alex Bennée |
Subject: |
Re: [PATCH 2/3] plugins: Avoid deadlock in qemu_plugin_user_exit |
Date: |
Fri, 20 Jan 2023 17:35:14 +0000 |
User-agent: |
mu4e 1.9.15; emacs 29.0.60 |
Richard Henderson <richard.henderson@linaro.org> writes:
> 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.
We don't want to be doing any translation while un-registering things
lest things get confused. You could split the patch in two though as the
early return seems reasonable.
>
> 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();
> }
--
Alex Bennée
Virtualisation Tech Lead @ Linaro