Message ID | 20230117035701.168514-3-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | tests: Fix some deadlocks | expand |
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(); > }
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(); }
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(-)