Skip to content

Commit 5befef5

Browse files
committed
Merge tag 'pull-10.0-final-fixes-090425-1' of https://gitlab.com/stsquad/qemu into staging
Final fixes for 10.0 - properly exit aarch64-softmmu tcg tests on unexpected exceptions - fix deadlock when uninstalling a plugin # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmf2P+0ACgkQ+9DbCVqe # KkTHdAf/b4CGLNJBS7UV/eYxhgxJ2TM4KgfXm4FvrcS4V5rpNheMuLoQzgYDY+EC # 5ioANRcY+rOK2Yd+upO4SbaUyAvf7C5kAtMgs6AYiqbm5F8b47FS/q8f9mBBJ+qB # tl2FU6hjVjymMRoaPqqpPkkkHy9YNHe48TP4ohGfD6336JA5MW6v8nhdK+d3fsan # AUCSWAe8gxjmM6qnrhku6vvJ5EOiqpsb8zhsWVXdZesSG+1ATm6KCo6hDd0OkMrk # si6ML5txU1rxx5VOkGlDUo7ZV2TE/zdgMyaP/kXGtKuj+ipLMzqNjlD50xPJu05b # o4hTbt8erzxduVHrBKT5qhKQl8BEpw== # =LN/t # -----END PGP SIGNATURE----- # gpg: Signature made Wed 09 Apr 2025 05:37:49 EDT # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <[email protected]>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * tag 'pull-10.0-final-fixes-090425-1' of https://gitlab.com/stsquad/qemu: tests/tcg/plugins: add plugin to test reset and uninstall plugins/loader: fix deadlock when resetting/uninstalling a plugin tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents 56c6e24 + d832ff9 commit 5befef5

File tree

4 files changed

+77
-5
lines changed

4 files changed

+77
-5
lines changed

plugins/loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static void plugin_reset_destroy(struct qemu_plugin_reset_data *data)
370370
{
371371
qemu_rec_mutex_lock(&plugin.lock);
372372
plugin_reset_destroy__locked(data);
373-
qemu_rec_mutex_lock(&plugin.lock);
373+
qemu_rec_mutex_unlock(&plugin.lock);
374374
}
375375

376376
static void plugin_flush_destroy(CPUState *cpu, run_on_cpu_data arg)

tests/tcg/aarch64/system/boot.S

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ lower_a32_serror:
7373
mov x0, SYS_WRITE0
7474
adr x1, .error
7575
semihosting_call
76-
mov x0, SYS_EXIT
77-
mov x1, 1
78-
semihosting_call
76+
mov x0, 1 /* EXIT_FAILURE */
77+
bl _exit
7978
/* never returns */
8079

8180
.section .rodata

tests/tcg/plugins/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
t = []
22
if get_option('plugins')
3-
foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'syscall']
3+
foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall']
44
if host_os == 'windows'
55
t += shared_module(i, files(i + '.c') + '../../../contrib/plugins/win32_linker.c',
66
include_directories: '../../../include/qemu',

tests/tcg/plugins/reset.c

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (c) 2025 Linaro Ltd
3+
*
4+
* Test the reset/uninstall cycle of a plugin.
5+
*
6+
* SPDX-License-Identifier: GPL-2.0-or-later
7+
*/
8+
#include <glib.h>
9+
10+
#include <qemu-plugin.h>
11+
12+
QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
13+
static qemu_plugin_id_t plugin_id;
14+
static bool was_reset;
15+
static bool was_uninstalled;
16+
17+
static void after_uninstall(qemu_plugin_id_t id)
18+
{
19+
g_assert(was_reset && !was_uninstalled);
20+
qemu_plugin_outs("uninstall done\n");
21+
was_uninstalled = true;
22+
}
23+
24+
static void tb_exec_after_reset(unsigned int vcpu_index, void *userdata)
25+
{
26+
g_assert(was_reset && !was_uninstalled);
27+
qemu_plugin_uninstall(plugin_id, after_uninstall);
28+
}
29+
30+
static void tb_trans_after_reset(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
31+
{
32+
g_assert(was_reset && !was_uninstalled);
33+
qemu_plugin_register_vcpu_tb_exec_cb(tb, tb_exec_after_reset,
34+
QEMU_PLUGIN_CB_NO_REGS, NULL);
35+
}
36+
37+
static void after_reset(qemu_plugin_id_t id)
38+
{
39+
g_assert(!was_reset && !was_uninstalled);
40+
qemu_plugin_outs("reset done\n");
41+
was_reset = true;
42+
qemu_plugin_register_vcpu_tb_trans_cb(id, tb_trans_after_reset);
43+
}
44+
45+
static void tb_exec_before_reset(unsigned int vcpu_index, void *userdata)
46+
{
47+
g_assert(!was_reset && !was_uninstalled);
48+
qemu_plugin_reset(plugin_id, after_reset);
49+
}
50+
51+
static void tb_trans_before_reset(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
52+
{
53+
g_assert(!was_reset && !was_uninstalled);
54+
qemu_plugin_register_vcpu_tb_exec_cb(tb, tb_exec_before_reset,
55+
QEMU_PLUGIN_CB_NO_REGS, NULL);
56+
}
57+
58+
QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
59+
const qemu_info_t *info,
60+
int argc, char **argv)
61+
{
62+
plugin_id = id;
63+
qemu_plugin_register_vcpu_tb_trans_cb(id, tb_trans_before_reset);
64+
return 0;
65+
}
66+
67+
/* Since we uninstall the plugin, we can't use qemu_plugin_register_atexit_cb,
68+
* so we use destructor attribute instead. */
69+
static void __attribute__((destructor)) on_plugin_exit(void)
70+
{
71+
g_assert(was_reset && was_uninstalled);
72+
qemu_plugin_outs("plugin exit\n");
73+
}

0 commit comments

Comments
 (0)