* [PULL for 10.0 0/3] final fixes (tcg tests, plugins)
@ 2025-04-09 13:19 Alex Bennée
2025-04-09 13:19 ` [PULL 1/3] tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S Alex Bennée
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Alex Bennée @ 2025-04-09 13:19 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée
The following changes since commit c302660920acf48425a1317d56122ea8af60fbc4:
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging (2025-04-08 09:59:33 -0400)
are available in the Git repository at:
https://gitlab.com/stsquad/qemu.git tags/pull-10.0-final-fixes-090425-1
for you to fetch changes up to d832ff9d0248c2f1895352ced3b3bf7a71f42702:
tests/tcg/plugins: add plugin to test reset and uninstall (2025-04-09 10:35:29 +0100)
----------------------------------------------------------------
Final fixes for 10.0
- properly exit aarch64-softmmu tcg tests on unexpected exceptions
- fix deadlock when uninstalling a plugin
----------------------------------------------------------------
Alex Bennée (1):
tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S
Pierrick Bouvier (2):
plugins/loader: fix deadlock when resetting/uninstalling a plugin
tests/tcg/plugins: add plugin to test reset and uninstall
plugins/loader.c | 2 +-
tests/tcg/plugins/reset.c | 73 +++++++++++++++++++++++++++++++++++++++++
tests/tcg/aarch64/system/boot.S | 5 ++-
tests/tcg/plugins/meson.build | 2 +-
4 files changed, 77 insertions(+), 5 deletions(-)
create mode 100644 tests/tcg/plugins/reset.c
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL 1/3] tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S
2025-04-09 13:19 [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Alex Bennée
@ 2025-04-09 13:19 ` Alex Bennée
2025-04-09 13:19 ` [PULL 2/3] plugins/loader: fix deadlock when resetting/uninstalling a plugin Alex Bennée
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2025-04-09 13:19 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Richard Henderson, Peter Maydell,
open list:ARM TCG CPUs
We don't expect to hit exceptions in our testing so currently all the
vectors report an un-expected exception and then attempt to exit.
However for aarch64 we should always use the extended information
block as we do in _exit. Rather than duplicate the code on the error
handler just branch to the _exit handler with a failing status code.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250404115641.258048-1-alex.bennee@linaro.org>
diff --git a/tests/tcg/aarch64/system/boot.S b/tests/tcg/aarch64/system/boot.S
index 4eb1b35b88..a5df9c173d 100644
--- a/tests/tcg/aarch64/system/boot.S
+++ b/tests/tcg/aarch64/system/boot.S
@@ -73,9 +73,8 @@ lower_a32_serror:
mov x0, SYS_WRITE0
adr x1, .error
semihosting_call
- mov x0, SYS_EXIT
- mov x1, 1
- semihosting_call
+ mov x0, 1 /* EXIT_FAILURE */
+ bl _exit
/* never returns */
.section .rodata
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 2/3] plugins/loader: fix deadlock when resetting/uninstalling a plugin
2025-04-09 13:19 [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Alex Bennée
2025-04-09 13:19 ` [PULL 1/3] tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S Alex Bennée
@ 2025-04-09 13:19 ` Alex Bennée
2025-04-09 13:19 ` [PULL 3/3] tests/tcg/plugins: add plugin to test reset and uninstall Alex Bennée
2025-04-14 19:28 ` [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2025-04-09 13:19 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Alex Bennée, Philippe Mathieu-Daudé,
Alexandre Iooss, Mahmoud Mandour
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reported and fixed by Dmitry Kurakin.
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2901
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20250404032027.430575-2-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/plugins/loader.c b/plugins/loader.c
index 7523d554f0..0d6e082e17 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -370,7 +370,7 @@ static void plugin_reset_destroy(struct qemu_plugin_reset_data *data)
{
qemu_rec_mutex_lock(&plugin.lock);
plugin_reset_destroy__locked(data);
- qemu_rec_mutex_lock(&plugin.lock);
+ qemu_rec_mutex_unlock(&plugin.lock);
}
static void plugin_flush_destroy(CPUState *cpu, run_on_cpu_data arg)
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 3/3] tests/tcg/plugins: add plugin to test reset and uninstall
2025-04-09 13:19 [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Alex Bennée
2025-04-09 13:19 ` [PULL 1/3] tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S Alex Bennée
2025-04-09 13:19 ` [PULL 2/3] plugins/loader: fix deadlock when resetting/uninstalling a plugin Alex Bennée
@ 2025-04-09 13:19 ` Alex Bennée
2025-04-14 19:28 ` [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2025-04-09 13:19 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Alex Bennée, Alexandre Iooss,
Mahmoud Mandour
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
We perform a plugin reset, uninstall, and make sure we went through
those steps.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20250404032027.430575-3-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/tests/tcg/plugins/reset.c b/tests/tcg/plugins/reset.c
new file mode 100644
index 0000000000..1be8be2a4b
--- /dev/null
+++ b/tests/tcg/plugins/reset.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2025 Linaro Ltd
+ *
+ * Test the reset/uninstall cycle of a plugin.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <glib.h>
+
+#include <qemu-plugin.h>
+
+QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
+static qemu_plugin_id_t plugin_id;
+static bool was_reset;
+static bool was_uninstalled;
+
+static void after_uninstall(qemu_plugin_id_t id)
+{
+ g_assert(was_reset && !was_uninstalled);
+ qemu_plugin_outs("uninstall done\n");
+ was_uninstalled = true;
+}
+
+static void tb_exec_after_reset(unsigned int vcpu_index, void *userdata)
+{
+ g_assert(was_reset && !was_uninstalled);
+ qemu_plugin_uninstall(plugin_id, after_uninstall);
+}
+
+static void tb_trans_after_reset(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
+{
+ g_assert(was_reset && !was_uninstalled);
+ qemu_plugin_register_vcpu_tb_exec_cb(tb, tb_exec_after_reset,
+ QEMU_PLUGIN_CB_NO_REGS, NULL);
+}
+
+static void after_reset(qemu_plugin_id_t id)
+{
+ g_assert(!was_reset && !was_uninstalled);
+ qemu_plugin_outs("reset done\n");
+ was_reset = true;
+ qemu_plugin_register_vcpu_tb_trans_cb(id, tb_trans_after_reset);
+}
+
+static void tb_exec_before_reset(unsigned int vcpu_index, void *userdata)
+{
+ g_assert(!was_reset && !was_uninstalled);
+ qemu_plugin_reset(plugin_id, after_reset);
+}
+
+static void tb_trans_before_reset(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
+{
+ g_assert(!was_reset && !was_uninstalled);
+ qemu_plugin_register_vcpu_tb_exec_cb(tb, tb_exec_before_reset,
+ QEMU_PLUGIN_CB_NO_REGS, NULL);
+}
+
+QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
+ const qemu_info_t *info,
+ int argc, char **argv)
+{
+ plugin_id = id;
+ qemu_plugin_register_vcpu_tb_trans_cb(id, tb_trans_before_reset);
+ return 0;
+}
+
+/* Since we uninstall the plugin, we can't use qemu_plugin_register_atexit_cb,
+ * so we use destructor attribute instead. */
+static void __attribute__((destructor)) on_plugin_exit(void)
+{
+ g_assert(was_reset && was_uninstalled);
+ qemu_plugin_outs("plugin exit\n");
+}
diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build
index c8cb0626a6..41f02f2c7f 100644
--- a/tests/tcg/plugins/meson.build
+++ b/tests/tcg/plugins/meson.build
@@ -1,6 +1,6 @@
t = []
if get_option('plugins')
- foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'syscall']
+ foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall']
if host_os == 'windows'
t += shared_module(i, files(i + '.c') + '../../../contrib/plugins/win32_linker.c',
include_directories: '../../../include/qemu',
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL for 10.0 0/3] final fixes (tcg tests, plugins)
2025-04-09 13:19 [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Alex Bennée
` (2 preceding siblings ...)
2025-04-09 13:19 ` [PULL 3/3] tests/tcg/plugins: add plugin to test reset and uninstall Alex Bennée
@ 2025-04-14 19:28 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2025-04-14 19:28 UTC (permalink / raw)
To: Alex Bennée; +Cc: qemu-devel
Applied, thanks!
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-14 19:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09 13:19 [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Alex Bennée
2025-04-09 13:19 ` [PULL 1/3] tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S Alex Bennée
2025-04-09 13:19 ` [PULL 2/3] plugins/loader: fix deadlock when resetting/uninstalling a plugin Alex Bennée
2025-04-09 13:19 ` [PULL 3/3] tests/tcg/plugins: add plugin to test reset and uninstall Alex Bennée
2025-04-14 19:28 ` [PULL for 10.0 0/3] final fixes (tcg tests, plugins) Stefan Hajnoczi
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).