* [PULL 01/21] contrib/plugins/hotblocks: Correctly free sorted counts list
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 02/21] contrib/plugins/hotblocks: Fix off by one error in iteration of sorted blocks Pierrick Bouvier
` (20 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bradbury, Manos Pitsidianakis, Pierrick Bouvier
From: Alex Bradbury <asb@igalia.com>
g_list_free should be passed the head of the list.
Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/cf5a00136738b981a12270b76572e8d502daf208.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
contrib/plugins/hotblocks.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index 98404b68852..d3dd23ed9fa 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -73,15 +73,16 @@ static void exec_count_free(gpointer key, gpointer value, gpointer user_data)
static void plugin_exit(qemu_plugin_id_t id, void *p)
{
g_autoptr(GString) report = g_string_new("collected ");
- GList *counts, *it;
+ GList *counts, *sorted_counts, *it;
int i;
g_string_append_printf(report, "%d entries in the hash table\n",
g_hash_table_size(hotblocks));
counts = g_hash_table_get_values(hotblocks);
- it = g_list_sort_with_data(counts, cmp_exec_count, NULL);
+ sorted_counts = g_list_sort_with_data(counts, cmp_exec_count, NULL);
- if (it) {
+ if (sorted_counts) {
+ it = sorted_counts;
g_string_append_printf(report, "pc, tcount, icount, ecount\n");
for (i = 0; i < limit && it->next; i++, it = it->next) {
@@ -94,7 +95,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
qemu_plugin_scoreboard_u64(rec->exec_count)));
}
- g_list_free(it);
+ g_list_free(sorted_counts);
}
qemu_plugin_outs(report->str);
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 02/21] contrib/plugins/hotblocks: Fix off by one error in iteration of sorted blocks
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
2026-01-29 17:37 ` [PULL 01/21] contrib/plugins/hotblocks: Correctly free sorted counts list Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 03/21] contrib/plugins/hotblocks: Print uint64_t with PRIu64 rather than PRId64 Pierrick Bouvier
` (19 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bradbury, Pierrick Bouvier
From: Alex Bradbury <asb@igalia.com>
The logic to iterate over the hottest blocks will never reach the last
item in the list, as it checks `it->next != NULL` before entering the
loop. It's hard to trigger this off-by-one error with the default
limit=20, but it is a bug and is problematic if that default is changed
to something larger.
Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/f1ba2e57c6126472c0c8310774009f2455efc370.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
contrib/plugins/hotblocks.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index d3dd23ed9fa..cf4d6b8c363 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -82,10 +82,9 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
sorted_counts = g_list_sort_with_data(counts, cmp_exec_count, NULL);
if (sorted_counts) {
- it = sorted_counts;
g_string_append_printf(report, "pc, tcount, icount, ecount\n");
- for (i = 0; i < limit && it->next; i++, it = it->next) {
+ for (i = 0, it = sorted_counts; i < limit && it; i++, it = it->next) {
ExecCount *rec = (ExecCount *) it->data;
g_string_append_printf(
report, "0x%016"PRIx64", %d, %ld, %"PRId64"\n",
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 03/21] contrib/plugins/hotblocks: Print uint64_t with PRIu64 rather than PRId64
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
2026-01-29 17:37 ` [PULL 01/21] contrib/plugins/hotblocks: Correctly free sorted counts list Pierrick Bouvier
2026-01-29 17:37 ` [PULL 02/21] contrib/plugins/hotblocks: Fix off by one error in iteration of sorted blocks Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 04/21] docs/about/emulation: Add documentation for hotblocks plugin arguments Pierrick Bouvier
` (18 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bradbury, Manos Pitsidianakis, Pierrick Bouvier
From: Alex Bradbury <asb@igalia.com>
qemu_plugin_u64_sum returns a uint64_t, so PRIu64 is the correct format
specifier.
Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/5d26c9d99ee87ac4a4034ff64e3d8881253eedf3.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
contrib/plugins/hotblocks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index cf4d6b8c363..40d8dae1cd3 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -87,7 +87,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
for (i = 0, it = sorted_counts; i < limit && it; i++, it = it->next) {
ExecCount *rec = (ExecCount *) it->data;
g_string_append_printf(
- report, "0x%016"PRIx64", %d, %ld, %"PRId64"\n",
+ report, "0x%016"PRIx64", %d, %ld, %"PRIu64"\n",
rec->start_addr, rec->trans_count,
rec->insns,
qemu_plugin_u64_sum(
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 04/21] docs/about/emulation: Add documentation for hotblocks plugin arguments
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (2 preceding siblings ...)
2026-01-29 17:37 ` [PULL 03/21] contrib/plugins/hotblocks: Print uint64_t with PRIu64 rather than PRId64 Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 05/21] contrib/plugins/hotblocks: Allow limit to be set as a command line argument Pierrick Bouvier
` (17 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bradbury, Pierrick Bouvier
From: Alex Bradbury <asb@igalia.com>
Currently just 'inline'.
Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/35128cc5a86a0c18418f9d3150fb8771c54ef7d8.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
docs/about/emulation.rst | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst
index 4a7d1f41780..543efc4d7dc 100644
--- a/docs/about/emulation.rst
+++ b/docs/about/emulation.rst
@@ -463,6 +463,16 @@ Example::
0x000000004002b0, 1, 4, 66087
...
+Behaviour can be tweaked with the following arguments:
+
+.. list-table:: Hot Blocks plugin arguments
+ :widths: 20 80
+ :header-rows: 1
+
+ * - Option
+ - Description
+ * - inline=true|false
+ - Use faster inline addition of a single counter.
Hot Pages
.........
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 05/21] contrib/plugins/hotblocks: Allow limit to be set as a command line argument
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (3 preceding siblings ...)
2026-01-29 17:37 ` [PULL 04/21] docs/about/emulation: Add documentation for hotblocks plugin arguments Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 06/21] linux-user: move user/syscall-trace.h to linux-user/syscall.c Pierrick Bouvier
` (16 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bradbury, Pierrick Bouvier
From: Alex Bradbury <asb@igalia.com>
Also add documentation for this argument. This allows the default of 20
to be overridden, and is helpful for using the hotblocks plugin for
analysis scripts that require collecting data on a larger number of
blocks (e.g. setting limit=0 to dump information on all blocks).
Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/58281d6e54bcad1802e8d3dc8d8501d54c2a971e.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
docs/about/emulation.rst | 2 ++
contrib/plugins/hotblocks.c | 10 +++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst
index 543efc4d7dc..e8793b0f9ce 100644
--- a/docs/about/emulation.rst
+++ b/docs/about/emulation.rst
@@ -473,6 +473,8 @@ Behaviour can be tweaked with the following arguments:
- Description
* - inline=true|false
- Use faster inline addition of a single counter.
+ * - limit=N
+ - The number of blocks to be printed. (Default: N = 20, use 0 for no limit).
Hot Pages
.........
diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index 40d8dae1cd3..8ecf0339974 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -84,7 +84,8 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
if (sorted_counts) {
g_string_append_printf(report, "pc, tcount, icount, ecount\n");
- for (i = 0, it = sorted_counts; i < limit && it; i++, it = it->next) {
+ for (i = 0, it = sorted_counts; (limit == 0 || i < limit) && it;
+ i++, it = it->next) {
ExecCount *rec = (ExecCount *) it->data;
g_string_append_printf(
report, "0x%016"PRIx64", %d, %ld, %"PRIu64"\n",
@@ -170,6 +171,13 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info,
fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
return -1;
}
+ } else if (g_strcmp0(tokens[0], "limit") == 0) {
+ char *endptr = NULL;
+ limit = g_ascii_strtoull(tokens[1], &endptr, 10);
+ if (endptr == tokens[1] || *endptr != '\0') {
+ fprintf(stderr, "unsigned integer parsing failed: %s\n", opt);
+ return -1;
+ }
} else {
fprintf(stderr, "option parsing failed: %s\n", opt);
return -1;
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 06/21] linux-user: move user/syscall-trace.h to linux-user/syscall.c
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (4 preceding siblings ...)
2026-01-29 17:37 ` [PULL 05/21] contrib/plugins/hotblocks: Allow limit to be set as a command line argument Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 07/21] linux-user: add plugin API to filter syscalls Pierrick Bouvier
` (15 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Richard Henderson
For now, only linux-user supports plugin syscall API, so restrict the
scope of these functions to linux-user/syscall.c
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260129013134.3956938-7-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
include/user/syscall-trace.h | 43 -----------------------------------
bsd-user/freebsd/os-syscall.c | 1 -
linux-user/syscall.c | 20 +++++++++++++++-
3 files changed, 19 insertions(+), 45 deletions(-)
delete mode 100644 include/user/syscall-trace.h
diff --git a/include/user/syscall-trace.h b/include/user/syscall-trace.h
deleted file mode 100644
index 9bd7ca19c84..00000000000
--- a/include/user/syscall-trace.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Common System Call Tracing Wrappers for *-user
- *
- * Copyright (c) 2019 Linaro
- * Written by Alex Bennée <alex.bennee@linaro.org>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#ifndef SYSCALL_TRACE_H
-#define SYSCALL_TRACE_H
-
-#include "user/abitypes.h"
-#include "gdbstub/user.h"
-#include "qemu/plugin.h"
-#include "trace/trace-root.h"
-
-/*
- * These helpers just provide a common place for the various
- * subsystems that want to track syscalls to put their hooks in. We
- * could potentially unify the -strace code here as well.
- */
-
-static inline void record_syscall_start(CPUState *cpu, int num,
- abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4,
- abi_long arg5, abi_long arg6,
- abi_long arg7, abi_long arg8)
-{
- qemu_plugin_vcpu_syscall(cpu, num,
- arg1, arg2, arg3, arg4,
- arg5, arg6, arg7, arg8);
- gdb_syscall_entry(cpu, num);
-}
-
-static inline void record_syscall_return(CPUState *cpu, int num, abi_long ret)
-{
- qemu_plugin_vcpu_syscall_ret(cpu, num, ret);
- gdb_syscall_return(cpu, num);
-}
-
-
-#endif /* SYSCALL_TRACE_H */
diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c
index ca2f6fdb66e..4c1191b8f47 100644
--- a/bsd-user/freebsd/os-syscall.c
+++ b/bsd-user/freebsd/os-syscall.c
@@ -31,7 +31,6 @@
#include "qemu.h"
#include "signal-common.h"
-#include "user/syscall-trace.h"
/* BSD independent syscall shims */
#include "bsd-file.h"
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3944004568f..b4b551ad148 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -132,6 +132,7 @@
#include "uname.h"
#include "qemu.h"
+#include "gdbstub/user.h"
#include "user-internals.h"
#include "strace.h"
#include "signal-common.h"
@@ -142,7 +143,6 @@
#include "user/signal.h"
#include "qemu/guest-random.h"
#include "qemu/selfmap.h"
-#include "user/syscall-trace.h"
#include "special-errno.h"
#include "qapi/error.h"
#include "fd-trans.h"
@@ -14334,6 +14334,24 @@ static bool sys_dispatch(CPUState *cpu, TaskState *ts)
return true;
}
+static void record_syscall_start(CPUState *cpu, int num,
+ abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4,
+ abi_long arg5, abi_long arg6,
+ abi_long arg7, abi_long arg8)
+{
+ qemu_plugin_vcpu_syscall(cpu, num,
+ arg1, arg2, arg3, arg4,
+ arg5, arg6, arg7, arg8);
+ gdb_syscall_entry(cpu, num);
+}
+
+static void record_syscall_return(CPUState *cpu, int num, abi_long ret)
+{
+ qemu_plugin_vcpu_syscall_ret(cpu, num, ret);
+ gdb_syscall_return(cpu, num);
+}
+
abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6, abi_long arg7,
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 07/21] linux-user: add plugin API to filter syscalls
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (5 preceding siblings ...)
2026-01-29 17:37 ` [PULL 06/21] linux-user: move user/syscall-trace.h to linux-user/syscall.c Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 08/21] tcg tests: add a test to verify the syscall filter plugin API Pierrick Bouvier
` (14 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Ziyang Zhang, Mingyuan Xia, Pierrick Bouvier
From: Ziyang Zhang <functioner@sjtu.edu.cn>
This commit adds a syscall filter API to the TCG plugin API set.
Plugins can register a filter callback to QEMU to decide whether
to intercept a syscall, process it and bypass the QEMU syscall
handler.
Signed-off-by: Ziyang Zhang <functioner@sjtu.edu.cn>
Co-authored-by: Mingyuan Xia <xiamy@ultrarisc.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
[Pierrick - move send_through_syscall_filters to linux-user/syscall.c]
Link: https://lore.kernel.org/qemu-devel/20251214144620.179282-2-functioner@sjtu.edu.cn
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
include/qemu/plugin-event.h | 1 +
include/qemu/plugin.h | 33 ++++++++++++++++++++++++---------
include/qemu/qemu-plugin.h | 32 ++++++++++++++++++++++++++++++++
linux-user/syscall.c | 24 ++++++++++++++++++++++--
plugins/api.c | 7 +++++++
plugins/core.c | 37 +++++++++++++++++++++++++++++++++++++
6 files changed, 123 insertions(+), 11 deletions(-)
diff --git a/include/qemu/plugin-event.h b/include/qemu/plugin-event.h
index 1100dae2123..7f3c5927f1f 100644
--- a/include/qemu/plugin-event.h
+++ b/include/qemu/plugin-event.h
@@ -23,6 +23,7 @@ enum qemu_plugin_event {
QEMU_PLUGIN_EV_VCPU_INTERRUPT,
QEMU_PLUGIN_EV_VCPU_EXCEPTION,
QEMU_PLUGIN_EV_VCPU_HOSTCALL,
+ QEMU_PLUGIN_EV_VCPU_SYSCALL_FILTER,
QEMU_PLUGIN_EV_MAX, /* total number of plugin events we support */
};
diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h
index cea0a68858b..b74a7d0811b 100644
--- a/include/qemu/plugin.h
+++ b/include/qemu/plugin.h
@@ -55,15 +55,16 @@ void qemu_plugin_opt_parse(const char *optstr, QemuPluginList *head);
int qemu_plugin_load_list(QemuPluginList *head, Error **errp);
union qemu_plugin_cb_sig {
- qemu_plugin_simple_cb_t simple;
- qemu_plugin_udata_cb_t udata;
- qemu_plugin_vcpu_simple_cb_t vcpu_simple;
- qemu_plugin_vcpu_udata_cb_t vcpu_udata;
- qemu_plugin_vcpu_discon_cb_t vcpu_discon;
- qemu_plugin_vcpu_tb_trans_cb_t vcpu_tb_trans;
- qemu_plugin_vcpu_mem_cb_t vcpu_mem;
- qemu_plugin_vcpu_syscall_cb_t vcpu_syscall;
- qemu_plugin_vcpu_syscall_ret_cb_t vcpu_syscall_ret;
+ qemu_plugin_simple_cb_t simple;
+ qemu_plugin_udata_cb_t udata;
+ qemu_plugin_vcpu_simple_cb_t vcpu_simple;
+ qemu_plugin_vcpu_udata_cb_t vcpu_udata;
+ qemu_plugin_vcpu_discon_cb_t vcpu_discon;
+ qemu_plugin_vcpu_tb_trans_cb_t vcpu_tb_trans;
+ qemu_plugin_vcpu_mem_cb_t vcpu_mem;
+ qemu_plugin_vcpu_syscall_cb_t vcpu_syscall;
+ qemu_plugin_vcpu_syscall_ret_cb_t vcpu_syscall_ret;
+ qemu_plugin_vcpu_syscall_filter_cb_t vcpu_syscall_filter;
void *generic;
};
@@ -169,6 +170,11 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, uint64_t a1,
uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5,
uint64_t a6, uint64_t a7, uint64_t a8);
void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret);
+bool
+qemu_plugin_vcpu_syscall_filter(CPUState *cpu, int64_t num, uint64_t a1,
+ uint64_t a2, uint64_t a3, uint64_t a4,
+ uint64_t a5, uint64_t a6, uint64_t a7,
+ uint64_t a8, uint64_t *sysret);
void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr,
uint64_t value_low,
@@ -280,6 +286,15 @@ static inline
void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret)
{ }
+static inline bool
+qemu_plugin_vcpu_syscall_filter(CPUState *cpu, int64_t num, uint64_t a1,
+ uint64_t a2, uint64_t a3, uint64_t a4,
+ uint64_t a5, uint64_t a6, uint64_t a7,
+ uint64_t a8, uint64_t *sysret)
+{
+ return false;
+}
+
static inline void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr,
uint64_t value_low,
uint64_t value_high,
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 60de4fdd3fa..84976fd67dd 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -798,6 +798,33 @@ typedef void
uint64_t a3, uint64_t a4, uint64_t a5,
uint64_t a6, uint64_t a7, uint64_t a8);
+/**
+ * typedef qemu_plugin_vcpu_syscall_filter_cb_t - vCPU syscall filter callback
+ * function type
+ * @id: plugin id
+ * @vcpu_index: the executing vCPU
+ * @num: the syscall number
+ * @a1: the 1st syscall argument
+ * @a2: the 2nd syscall argument
+ * @a3: the 3rd syscall argument
+ * @a4: the 4th syscall argument
+ * @a5: the 5th syscall argument
+ * @a6: the 6th syscall argument
+ * @a7: the 7th syscall argument
+ * @a8: the 8th syscall argument
+ * @sysret: reference of the syscall return value, must set this if filtered
+ *
+ * Returns true if you want to filter this syscall (i.e. stop it being
+ * handled further), otherwise returns false.
+ */
+typedef bool
+(*qemu_plugin_vcpu_syscall_filter_cb_t)(qemu_plugin_id_t id,
+ unsigned int vcpu_index,
+ int64_t num, uint64_t a1, uint64_t a2,
+ uint64_t a3, uint64_t a4, uint64_t a5,
+ uint64_t a6, uint64_t a7, uint64_t a8,
+ uint64_t *sysret);
+
QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_syscall_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_syscall_cb_t cb);
@@ -811,6 +838,11 @@ void
qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_syscall_ret_cb_t cb);
+QEMU_PLUGIN_API
+void
+qemu_plugin_register_vcpu_syscall_filter_cb(qemu_plugin_id_t id,
+ qemu_plugin_vcpu_syscall_filter_cb_t cb);
+
/**
* qemu_plugin_insn_disas() - return disassembly string for instruction
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b4b551ad148..3e6a56aa0f6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -14352,6 +14352,23 @@ static void record_syscall_return(CPUState *cpu, int num, abi_long ret)
gdb_syscall_return(cpu, num);
}
+static bool send_through_syscall_filters(CPUState *cpu, int num,
+ abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4,
+ abi_long arg5, abi_long arg6,
+ abi_long arg7, abi_long arg8,
+ abi_long *sysret)
+{
+ uint64_t sysret64 = 0;
+ bool filtered = qemu_plugin_vcpu_syscall_filter(cpu, num, arg1, arg2,
+ arg3, arg4, arg5, arg6,
+ arg7, arg8, &sysret64);
+ if (filtered) {
+ *sysret = sysret64;
+ }
+ return filtered;
+}
+
abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6, abi_long arg7,
@@ -14386,8 +14403,11 @@ abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
print_syscall(cpu_env, num, arg1, arg2, arg3, arg4, arg5, arg6);
}
- ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
- arg5, arg6, arg7, arg8);
+ if (!send_through_syscall_filters(cpu, num, arg1, arg2, arg3, arg4, arg5,
+ arg6, arg7, arg8, &ret)) {
+ ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
+ arg5, arg6, arg7, arg8);
+ }
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall_ret(cpu_env, num, ret, arg1, arg2,
diff --git a/plugins/api.c b/plugins/api.c
index eac04cc1f6b..478d0c88890 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -208,6 +208,13 @@ qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id,
plugin_register_cb(id, QEMU_PLUGIN_EV_VCPU_SYSCALL_RET, cb);
}
+void
+qemu_plugin_register_vcpu_syscall_filter_cb(qemu_plugin_id_t id,
+ qemu_plugin_vcpu_syscall_filter_cb_t cb)
+{
+ plugin_register_cb(id, QEMU_PLUGIN_EV_VCPU_SYSCALL_FILTER, cb);
+}
+
/*
* Plugin Queries
*
diff --git a/plugins/core.c b/plugins/core.c
index b4b783008f7..85fabf9ec81 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -564,6 +564,43 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret)
}
}
+/*
+ * Disable CFI checks.
+ * The callback function has been loaded from an external library so we do not
+ * have type information
+ */
+QEMU_DISABLE_CFI
+bool
+qemu_plugin_vcpu_syscall_filter(CPUState *cpu, int64_t num, uint64_t a1,
+ uint64_t a2, uint64_t a3, uint64_t a4,
+ uint64_t a5, uint64_t a6, uint64_t a7,
+ uint64_t a8, uint64_t *sysret)
+{
+ struct qemu_plugin_cb *cb, *next;
+ enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_SYSCALL_FILTER;
+ bool filtered = false;
+
+ if (!test_bit(ev, cpu->plugin_state->event_mask)) {
+ return false;
+ }
+
+ qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS);
+
+ QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
+ qemu_plugin_vcpu_syscall_filter_cb_t func = cb->f.vcpu_syscall_filter;
+
+ if (func(cb->ctx->id, cpu->cpu_index, num, a1, a2, a3, a4,
+ a5, a6, a7, a8, sysret)) {
+ filtered = true;
+ break;
+ }
+ }
+
+ qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS);
+
+ return filtered;
+}
+
void qemu_plugin_vcpu_idle_cb(CPUState *cpu)
{
/* idle and resume cb may be called before init, ignore in this case */
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 08/21] tcg tests: add a test to verify the syscall filter plugin API
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (6 preceding siblings ...)
2026-01-29 17:37 ` [PULL 07/21] linux-user: add plugin API to filter syscalls Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 09/21] plugins: return bool from register r/w API Pierrick Bouvier
` (13 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Ziyang Zhang, Mingyuan Xia, Pierrick Bouvier
From: Ziyang Zhang <functioner@sjtu.edu.cn>
Register a syscall filter callback in tests/tcg/plugins/sycall.c,
returns a specific value for a magic system call number, and check
it in tests/tcg/multiarch/test-plugin-syscall-filter.c.
Signed-off-by: Ziyang Zhang <functioner@sjtu.edu.cn>
Co-authored-by: Mingyuan Xia <xiamy@ultrarisc.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
[Pierrick - Changed syscall number to 4096 to make it work with mips32]
[Pierrick - Skip test when compiling without plugins enabled]
Link: https://lore.kernel.org/qemu-devel/20251214144620.179282-3-functioner@sjtu.edu.cn
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
.../multiarch/test-plugin-syscall-filter.c | 39 +++++++++++++++++++
tests/tcg/plugins/syscall.c | 19 +++++++++
tests/tcg/multiarch/Makefile.target | 7 +++-
3 files changed, 64 insertions(+), 1 deletion(-)
create mode 100644 tests/tcg/multiarch/test-plugin-syscall-filter.c
diff --git a/tests/tcg/multiarch/test-plugin-syscall-filter.c b/tests/tcg/multiarch/test-plugin-syscall-filter.c
new file mode 100644
index 00000000000..951e338a7c9
--- /dev/null
+++ b/tests/tcg/multiarch/test-plugin-syscall-filter.c
@@ -0,0 +1,39 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This test attempts to execute a magic syscall. The syscall test plugin
+ * should intercept this and return an expected value.
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+#ifdef SKIP
+ return EXIT_SUCCESS;
+#endif
+ /*
+ * We cannot use a very large magic syscall number, because on some ISAs,
+ * QEMU will treat it as an illegal instruction and trigger a critical
+ * exception. For instance, on arm32, the syscall number cannot exceed
+ * ARM_NR_BASE (0xf0000), as can be seen in
+ * "linux-user/arm/cpu_loop.c:cpu_loop".
+ * As well, some arch expect a minimum, like 4000 for mips 32 bits.
+ *
+ * Therefore, we pick 4096 because, as of now, no ISA in Linux uses this
+ * number. This is just a test case; replace this number as needed in the
+ * future.
+ *
+ * The corresponding syscall filter is implemented in
+ * "tests/tcg/plugins/syscall.c".
+ */
+ long ret = syscall(4096, 0x66CCFF);
+ if (ret != 0xFFCC66) {
+ fprintf(stderr, "Error: unexpected syscall return value %ld\n", ret);
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
+}
diff --git a/tests/tcg/plugins/syscall.c b/tests/tcg/plugins/syscall.c
index 42801f5c863..5658f830879 100644
--- a/tests/tcg/plugins/syscall.c
+++ b/tests/tcg/plugins/syscall.c
@@ -170,6 +170,24 @@ static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx,
}
}
+static bool vcpu_syscall_filter(qemu_plugin_id_t id, unsigned int vcpu_index,
+ int64_t num, uint64_t a1, uint64_t a2,
+ uint64_t a3, uint64_t a4, uint64_t a5,
+ uint64_t a6, uint64_t a7, uint64_t a8,
+ uint64_t *sysret)
+{
+ /* Special syscall to test the filter functionality. */
+ if (num == 4096 && a1 == 0x66CCFF) {
+ *sysret = 0xFFCC66;
+
+ if (!statistics) {
+ qemu_plugin_outs("magic syscall filtered, set magic return\n");
+ }
+ return true;
+ }
+ return false;
+}
+
static void print_entry(gpointer val, gpointer user_data)
{
SyscallStats *entry = (SyscallStats *) val;
@@ -255,6 +273,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
qemu_plugin_register_vcpu_syscall_cb(id, vcpu_syscall);
qemu_plugin_register_vcpu_syscall_ret_cb(id, vcpu_syscall_ret);
+ qemu_plugin_register_vcpu_syscall_filter_cb(id, vcpu_syscall_filter);
qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
return 0;
}
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index f5b4d2b8138..07d0b27bdd3 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -202,8 +202,13 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
CHECK_PLUGIN_OUTPUT_COMMAND= \
$(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
$(QEMU) $<
+run-plugin-test-plugin-syscall-filter-with-libsyscall.so:
-EXTRA_RUNS_WITH_PLUGIN += run-plugin-test-plugin-mem-access-with-libmem.so
+EXTRA_RUNS_WITH_PLUGIN += run-plugin-test-plugin-mem-access-with-libmem.so \
+ run-plugin-test-plugin-syscall-filter-with-libsyscall.so
+else
+# test-plugin-syscall-filter needs syscall plugin to succeed
+test-plugin-syscall-filter: CFLAGS+=-DSKIP
endif
# Update TESTS
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 09/21] plugins: return bool from register r/w API
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (7 preceding siblings ...)
2026-01-29 17:37 ` [PULL 08/21] tcg tests: add a test to verify the syscall filter plugin API Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 10/21] plugins: move win32_linker.c file to plugins directory Pierrick Bouvier
` (12 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Florian Hofhammer, Pierrick Bouvier
From: Florian Hofhammer <florian.hofhammer@fhofhammer.de>
The qemu_plugin_{read,write} register API previously was inconsistent
with regard to its docstring (where a return value of both -1 and 0
would indicate an error) and to the memory read/write APIs, which
already return a boolean value to indicate success or failure.
Returning the number of bytes read or written is superfluous, as the
GByteArray* passed to the API functions already encodes the length.
See the linked thread for more details.
This patch moves from returning an int (number of bytes read/written) to
returning a bool from the register read/write API, bumps the plugin API
version, and adjusts plugins and tests accordingly.
Signed-off-by: Florian Hofhammer <florian.hofhammer@fhofhammer.de>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/f877dd79-1285-4752-811e-f0d430ff27fe@fhofhammer.de
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
include/qemu/qemu-plugin.h | 19 +++++++++++--------
contrib/plugins/execlog.c | 14 ++++++++------
contrib/plugins/uftrace.c | 8 ++++----
plugins/api.c | 29 +++++++++++++++--------------
tests/tcg/plugins/insn.c | 4 ++--
5 files changed, 40 insertions(+), 34 deletions(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 84976fd67dd..eb6179ab1ab 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -72,11 +72,14 @@ typedef uint64_t qemu_plugin_id_t;
* - added qemu_plugin_write_memory_hwaddr
* - added qemu_plugin_write_register
* - added qemu_plugin_translate_vaddr
+ *
+ * version 6:
+ * - changed return value of qemu_plugin_{read,write}_register from int to bool
*/
extern QEMU_PLUGIN_EXPORT int qemu_plugin_version;
-#define QEMU_PLUGIN_VERSION 5
+#define QEMU_PLUGIN_VERSION 6
/**
* struct qemu_info_t - system information for plugins
@@ -1004,12 +1007,12 @@ GArray *qemu_plugin_get_registers(void);
* qemu_plugin_register_vcpu_init_cb(), except for callbacks registered with
* qemu_plugin_register_atexit_cb() and qemu_plugin_register_flush_cb().
*
- * Returns the size of the read register. The content of @buf is in target byte
- * order. On failure returns -1.
+ * Returns true on success, false on failure. The content of @buf is in target
+ * byte order.
*/
QEMU_PLUGIN_API
-int qemu_plugin_read_register(struct qemu_plugin_register *handle,
- GByteArray *buf);
+bool qemu_plugin_read_register(struct qemu_plugin_register *handle,
+ GByteArray *buf);
/**
* qemu_plugin_write_register() - write register for current vCPU
@@ -1029,11 +1032,11 @@ int qemu_plugin_read_register(struct qemu_plugin_register *handle,
* Attempting to write a register with @buf smaller than the register size
* will result in a crash or other undesired behavior.
*
- * Returns the number of bytes written. On failure returns 0.
+ * Returns true on sucess, false on failure.
*/
QEMU_PLUGIN_API
-int qemu_plugin_write_register(struct qemu_plugin_register *handle,
- GByteArray *buf);
+bool qemu_plugin_write_register(struct qemu_plugin_register *handle,
+ GByteArray *buf);
/**
* qemu_plugin_read_memory_vaddr() - read from memory using a virtual address
diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 811f3203199..d00d9c4ff39 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -91,11 +91,13 @@ static void insn_check_regs(CPU *cpu)
{
for (int n = 0; n < cpu->registers->len; n++) {
Register *reg = cpu->registers->pdata[n];
- int sz;
+ bool success = false;
+ int sz = 0;
g_byte_array_set_size(reg->new, 0);
- sz = qemu_plugin_read_register(reg->handle, reg->new);
- g_assert(sz > 0);
+ success = qemu_plugin_read_register(reg->handle, reg->new);
+ g_assert(success);
+ sz = reg->new->len;
g_assert(sz == reg->last->len);
if (memcmp(reg->last->data, reg->new->data, sz)) {
@@ -303,7 +305,7 @@ static Register *init_vcpu_register(qemu_plugin_reg_descriptor *desc)
{
Register *reg = g_new0(Register, 1);
g_autofree gchar *lower = g_utf8_strdown(desc->name, -1);
- int r;
+ bool success = false;
reg->handle = desc->handle;
reg->name = g_intern_string(lower);
@@ -311,8 +313,8 @@ static Register *init_vcpu_register(qemu_plugin_reg_descriptor *desc)
reg->new = g_byte_array_new();
/* read the initial value */
- r = qemu_plugin_read_register(reg->handle, reg->last);
- g_assert(r > 0);
+ success = qemu_plugin_read_register(reg->handle, reg->last);
+ g_assert(success);
return reg;
}
diff --git a/contrib/plugins/uftrace.c b/contrib/plugins/uftrace.c
index b7d6124d2f5..a7e21b5b87a 100644
--- a/contrib/plugins/uftrace.c
+++ b/contrib/plugins/uftrace.c
@@ -403,8 +403,8 @@ static uint64_t cpu_read_register64(Cpu *cpu, struct qemu_plugin_register *reg)
{
GByteArray *buf = cpu->buf;
g_byte_array_set_size(buf, 0);
- size_t sz = qemu_plugin_read_register(reg, buf);
- g_assert(sz == 8);
+ bool success = qemu_plugin_read_register(reg, buf);
+ g_assert(success);
g_assert(buf->len == 8);
return *((uint64_t *) buf->data);
}
@@ -413,8 +413,8 @@ static uint32_t cpu_read_register32(Cpu *cpu, struct qemu_plugin_register *reg)
{
GByteArray *buf = cpu->buf;
g_byte_array_set_size(buf, 0);
- size_t sz = qemu_plugin_read_register(reg, buf);
- g_assert(sz == 4);
+ bool success = qemu_plugin_read_register(reg, buf);
+ g_assert(success);
g_assert(buf->len == 4);
return *((uint32_t *) buf->data);
}
diff --git a/plugins/api.c b/plugins/api.c
index 478d0c88890..04ca7da7f18 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -441,27 +441,28 @@ GArray *qemu_plugin_get_registers(void)
return create_register_handles(regs);
}
-int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray *buf)
-{
- g_assert(current_cpu);
-
- if (qemu_plugin_get_cb_flags() == QEMU_PLUGIN_CB_NO_REGS) {
- return -1;
- }
-
- return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1);
-}
-
-int qemu_plugin_write_register(struct qemu_plugin_register *reg,
+bool qemu_plugin_read_register(struct qemu_plugin_register *reg,
GByteArray *buf)
{
g_assert(current_cpu);
+ if (qemu_plugin_get_cb_flags() == QEMU_PLUGIN_CB_NO_REGS) {
+ return false;
+ }
+
+ return (gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1) > 0);
+}
+
+bool qemu_plugin_write_register(struct qemu_plugin_register *reg,
+ GByteArray *buf)
+{
+ g_assert(current_cpu);
+
if (buf->len == 0 || qemu_plugin_get_cb_flags() != QEMU_PLUGIN_CB_RW_REGS) {
- return -1;
+ return false;
}
- return gdb_write_register(current_cpu, buf->data, GPOINTER_TO_INT(reg) - 1);
+ return (gdb_write_register(current_cpu, buf->data, GPOINTER_TO_INT(reg) - 1) > 0);
}
bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByteArray *data, size_t len)
diff --git a/tests/tcg/plugins/insn.c b/tests/tcg/plugins/insn.c
index 0c723cb9ed8..e6c5207cd69 100644
--- a/tests/tcg/plugins/insn.c
+++ b/tests/tcg/plugins/insn.c
@@ -93,8 +93,8 @@ static void vcpu_init(qemu_plugin_id_t id, unsigned int vcpu_index)
for (int i = 0; i < reg_list->len; i++) {
qemu_plugin_reg_descriptor *rd = &g_array_index(
reg_list, qemu_plugin_reg_descriptor, i);
- int count = qemu_plugin_read_register(rd->handle, reg_value);
- g_assert(count > 0);
+ bool success = qemu_plugin_read_register(rd->handle, reg_value);
+ g_assert(success);
}
}
}
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 10/21] plugins: move win32_linker.c file to plugins directory
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (8 preceding siblings ...)
2026-01-29 17:37 ` [PULL 09/21] plugins: return bool from register r/w API Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 11/21] plugins: factorize plugin dependencies and library details Pierrick Bouvier
` (11 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Richard Henderson, Manos Pitsidianakis
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-2-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
{contrib/plugins => plugins}/win32_linker.c | 0
contrib/plugins/meson.build | 2 +-
tests/tcg/plugins/meson.build | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
rename {contrib/plugins => plugins}/win32_linker.c (100%)
diff --git a/contrib/plugins/win32_linker.c b/plugins/win32_linker.c
similarity index 100%
rename from contrib/plugins/win32_linker.c
rename to plugins/win32_linker.c
diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build
index eb944b5159a..6f72b2ce0c9 100644
--- a/contrib/plugins/meson.build
+++ b/contrib/plugins/meson.build
@@ -10,7 +10,7 @@ t = []
if get_option('plugins')
foreach i : contrib_plugins
if host_os == 'windows'
- t += shared_module(i, files(i + '.c') + 'win32_linker.c',
+ t += shared_module(i, files(i + '.c') + '../../plugins/win32_linker.c',
include_directories: '../../include/qemu',
link_depends: [win32_qemu_plugin_api_lib],
link_args: win32_qemu_plugin_api_link_flags,
diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build
index 561584159eb..a6e78438510 100644
--- a/tests/tcg/plugins/meson.build
+++ b/tests/tcg/plugins/meson.build
@@ -2,7 +2,7 @@ t = []
if get_option('plugins')
foreach i : ['bb', 'discons', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall', 'patch']
if host_os == 'windows'
- t += shared_module(i, files(i + '.c') + '../../../contrib/plugins/win32_linker.c',
+ t += shared_module(i, files(i + '.c') + '../../../plugins/win32_linker.c',
include_directories: '../../../include/qemu',
link_depends: [win32_qemu_plugin_api_lib],
link_args: win32_qemu_plugin_api_link_flags,
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 11/21] plugins: factorize plugin dependencies and library details
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (9 preceding siblings ...)
2026-01-29 17:37 ` [PULL 10/21] plugins: move win32_linker.c file to plugins directory Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 12/21] plugins: use complete filename for defining plugins sources Pierrick Bouvier
` (10 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Daniel P. Berrangé
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-3-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 2 +-
contrib/plugins/meson.build | 13 ++-----------
plugins/meson.build | 15 ++++++++++++++-
tests/tcg/plugins/meson.build | 13 ++-----------
4 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/meson.build b/meson.build
index cc0dfed0667..82e0188b0bc 100644
--- a/meson.build
+++ b/meson.build
@@ -4450,7 +4450,7 @@ if get_option('plugins')
if host_os == 'windows'
# On windows, we want to deliver the qemu_plugin_api.lib file in the qemu installer,
# so that plugin authors can compile against it.
- install_data(win32_qemu_plugin_api_lib, install_dir: 'lib')
+ install_data(win32_qemu_plugin_api, install_dir: 'lib')
endif
endif
diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build
index 6f72b2ce0c9..6915ffa5fbc 100644
--- a/contrib/plugins/meson.build
+++ b/contrib/plugins/meson.build
@@ -9,17 +9,8 @@ endif
t = []
if get_option('plugins')
foreach i : contrib_plugins
- if host_os == 'windows'
- t += shared_module(i, files(i + '.c') + '../../plugins/win32_linker.c',
- include_directories: '../../include/qemu',
- link_depends: [win32_qemu_plugin_api_lib],
- link_args: win32_qemu_plugin_api_link_flags,
- dependencies: glib)
- else
- t += shared_module(i, files(i + '.c'),
- include_directories: '../../include/qemu',
- dependencies: glib)
- endif
+ t += shared_module(i, files(i + '.c'),
+ dependencies: plugins_deps)
endforeach
endif
if t.length() > 0
diff --git a/plugins/meson.build b/plugins/meson.build
index 62c991d87fc..4318e3a1671 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -51,11 +51,24 @@ if host_os == 'windows'
dlltool_cmd = [dlltool, '--input-def', '@INPUT@',
'--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
endif
- win32_qemu_plugin_api_lib = configure_file(
+ win32_qemu_plugin_api = configure_file(
input: win32_plugin_def,
output: 'libqemu_plugin_api.a',
command: dlltool_cmd
)
+ win32_qemu_plugin_api_lib = static_library('win32_qemu_plugin_api',
+ link_depends: win32_qemu_plugin_api)
+endif
+
+if host_os == 'windows'
+ plugins_deps = declare_dependency(sources: [files('win32_linker.c')],
+ include_directories: '../include/qemu',
+ link_with: win32_qemu_plugin_api_lib,
+ link_args: win32_qemu_plugin_api_link_flags,
+ dependencies: glib)
+else
+ plugins_deps = declare_dependency(include_directories: '../include/qemu',
+ dependencies: glib)
endif
user_ss.add(files('user.c', 'api-user.c'))
diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build
index a6e78438510..d7823704616 100644
--- a/tests/tcg/plugins/meson.build
+++ b/tests/tcg/plugins/meson.build
@@ -1,17 +1,8 @@
t = []
if get_option('plugins')
foreach i : ['bb', 'discons', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall', 'patch']
- if host_os == 'windows'
- t += shared_module(i, files(i + '.c') + '../../../plugins/win32_linker.c',
- include_directories: '../../../include/qemu',
- link_depends: [win32_qemu_plugin_api_lib],
- link_args: win32_qemu_plugin_api_link_flags,
- dependencies: glib)
- else
- t += shared_module(i, files(i + '.c'),
- include_directories: '../../../include/qemu',
- dependencies: glib)
- endif
+ t += shared_module(i, files(i + '.c'),
+ dependencies: plugins_deps)
endforeach
endif
if t.length() > 0
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 12/21] plugins: use complete filename for defining plugins sources
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (10 preceding siblings ...)
2026-01-29 17:37 ` [PULL 11/21] plugins: factorize plugin dependencies and library details Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:37 ` [PULL 13/21] plugins: define plugin API symbols as extern "C" when compiling in C++ Pierrick Bouvier
` (9 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé,
Manos Pitsidianakis
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-4-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
contrib/plugins/meson.build | 10 +++++-----
tests/tcg/plugins/meson.build | 7 +++++--
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build
index 6915ffa5fbc..3d2d7862e0c 100644
--- a/contrib/plugins/meson.build
+++ b/contrib/plugins/meson.build
@@ -1,15 +1,15 @@
-contrib_plugins = ['bbv', 'cache', 'cflow', 'drcov', 'execlog', 'hotblocks',
- 'hotpages', 'howvec', 'hwprofile', 'ips', 'stoptrigger',
- 'traps', 'uftrace']
+contrib_plugins = ['bbv.c', 'cache.c', 'cflow.c', 'drcov.c', 'execlog.c',
+ 'hotblocks.c', 'hotpages.c', 'howvec.c', 'hwprofile.c',
+ 'ips.c', 'stoptrigger.c', 'traps.c', 'uftrace.c']
if host_os != 'windows'
# lockstep uses socket.h
- contrib_plugins += 'lockstep'
+ contrib_plugins += 'lockstep.c'
endif
t = []
if get_option('plugins')
foreach i : contrib_plugins
- t += shared_module(i, files(i + '.c'),
+ t += shared_module(fs.stem(i), files(i),
dependencies: plugins_deps)
endforeach
endif
diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build
index d7823704616..303f97f9679 100644
--- a/tests/tcg/plugins/meson.build
+++ b/tests/tcg/plugins/meson.build
@@ -1,7 +1,10 @@
+test_plugins = ['bb.c', 'discons.c', 'empty.c', 'inline.c', 'insn.c', 'mem.c',
+ 'reset.c', 'syscall.c', 'patch.c']
+
t = []
if get_option('plugins')
- foreach i : ['bb', 'discons', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall', 'patch']
- t += shared_module(i, files(i + '.c'),
+ foreach i : test_plugins
+ t += shared_module(fs.stem(i), files(i),
dependencies: plugins_deps)
endforeach
endif
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 13/21] plugins: define plugin API symbols as extern "C" when compiling in C++
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (11 preceding siblings ...)
2026-01-29 17:37 ` [PULL 12/21] plugins: use complete filename for defining plugins sources Pierrick Bouvier
@ 2026-01-29 17:37 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 14/21] tests/tcg/plugins/mem.c: remove dependency on qemu headers Pierrick Bouvier
` (8 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:37 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Richard Henderson, Philippe Mathieu-Daudé
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-5-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
include/qemu/qemu-plugin.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index eb6179ab1ab..7f449d1b50a 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -16,6 +16,10 @@
#include <stdbool.h>
#include <stddef.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* For best performance, build the plugin with -fvisibility=hidden so that
* QEMU_PLUGIN_LOCAL is implicit. Then, just mark qemu_plugin_install with
@@ -1245,4 +1249,8 @@ void qemu_plugin_u64_set(qemu_plugin_u64 entry, unsigned int vcpu_index,
QEMU_PLUGIN_API
uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry);
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
#endif /* QEMU_QEMU_PLUGIN_H */
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 14/21] tests/tcg/plugins/mem.c: remove dependency on qemu headers
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (12 preceding siblings ...)
2026-01-29 17:37 ` [PULL 13/21] plugins: define plugin API symbols as extern "C" when compiling in C++ Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 15/21] plugins: move qemu-plugin.h to include/plugins/ Pierrick Bouvier
` (7 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Manos Pitsidianakis,
Philippe Mathieu-Daudé
This plugin uses endianness conversion primitives from QEMU headers. As
next commit will strongly isolate plugins code from those headers, those
primitives can't be used anymore.
glib.h provides such primitives:
https://docs.gtk.org/glib/conversion-macros.html#byte-order-conversion
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-6-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
tests/tcg/plugins/mem.c | 59 ++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 36 deletions(-)
diff --git a/tests/tcg/plugins/mem.c b/tests/tcg/plugins/mem.c
index 9649bce99ca..7d64e7018f2 100644
--- a/tests/tcg/plugins/mem.c
+++ b/tests/tcg/plugins/mem.c
@@ -12,16 +12,7 @@
#include <stdio.h>
#include <glib.h>
-/*
- * plugins should not include anything from QEMU aside from the
- * API header. However as this is a test plugin to exercise the
- * internals of QEMU and we want to avoid needless code duplication we
- * do so here. bswap.h is pretty self-contained although it needs a
- * few things provided by compiler.h.
- */
-#include <compiler.h>
#include <stdbool.h>
-#include <bswap.h>
#include <qemu-plugin.h>
QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
@@ -152,56 +143,52 @@ static void update_region_info(uint64_t region, uint64_t offset,
ri->reads++;
}
+ void *ri_data = &ri->data[offset];
switch (value.type) {
case QEMU_PLUGIN_MEM_VALUE_U8:
+ {
+ uint8_t val = value.data.u8;
+ uint8_t *p = ri_data;
if (is_store) {
- ri->data[offset] = value.data.u8;
- } else if (ri->data[offset] != value.data.u8) {
- unseen_data = true;
+ *p = val;
+ } else {
+ unseen_data = *p != val;
}
break;
+ }
case QEMU_PLUGIN_MEM_VALUE_U16:
{
- uint16_t *p = (uint16_t *) &ri->data[offset];
+ uint16_t val = be ? GUINT16_FROM_BE(value.data.u16) :
+ GUINT16_FROM_LE(value.data.u16);
+ uint16_t *p = ri_data;
if (is_store) {
- if (be) {
- stw_be_p(p, value.data.u16);
- } else {
- stw_le_p(p, value.data.u16);
- }
+ *p = val;
} else {
- uint16_t val = be ? lduw_be_p(p) : lduw_le_p(p);
- unseen_data = val != value.data.u16;
+ unseen_data = *p != val;
}
break;
}
case QEMU_PLUGIN_MEM_VALUE_U32:
{
- uint32_t *p = (uint32_t *) &ri->data[offset];
+ uint32_t val = be ? GUINT32_FROM_BE(value.data.u32) :
+ GUINT32_FROM_LE(value.data.u32);
+ uint32_t *p = ri_data;
if (is_store) {
- if (be) {
- stl_be_p(p, value.data.u32);
- } else {
- stl_le_p(p, value.data.u32);
- }
+ *p = val;
} else {
- uint32_t val = be ? ldl_be_p(p) : ldl_le_p(p);
- unseen_data = val != value.data.u32;
+ unseen_data = *p != val;
}
break;
}
case QEMU_PLUGIN_MEM_VALUE_U64:
{
- uint64_t *p = (uint64_t *) &ri->data[offset];
+ uint64_t val = be ? GUINT64_FROM_BE(value.data.u64) :
+ GUINT64_FROM_LE(value.data.u64);
+ uint64_t *p = ri_data;
if (is_store) {
- if (be) {
- stq_be_p(p, value.data.u64);
- } else {
- stq_le_p(p, value.data.u64);
- }
+ *p = val;
} else {
- uint64_t val = be ? ldq_be_p(p) : ldq_le_p(p);
- unseen_data = val != value.data.u64;
+ unseen_data = *p != val;
}
break;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 15/21] plugins: move qemu-plugin.h to include/plugins/
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (13 preceding siblings ...)
2026-01-29 17:38 ` [PULL 14/21] tests/tcg/plugins/mem.c: remove dependency on qemu headers Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 16/21] meson: fix supported compiler arguments in other languages than C Pierrick Bouvier
` (6 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Richard Henderson, Manos Pitsidianakis
This change has two benefits:
- ensure plugins can't include anything else from QEMU than plugins API
- when compiling a C++ module, solves the header conflict with iostream
header that includes transitively the wrong ctype.h, which already
exists in include/qemu.
By Hyrum's law, there was already one usage of other headers with mem
plugin, which has been eliminated in previous commit.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-7-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
docs/devel/tcg-plugins.rst | 4 ++--
meson.build | 2 +-
include/{qemu => plugins}/qemu-plugin.h | 3 ---
include/qemu/plugin.h | 2 +-
plugins/core.c | 2 +-
plugins/meson.build | 6 +++---
6 files changed, 8 insertions(+), 11 deletions(-)
rename include/{qemu => plugins}/qemu-plugin.h (99%)
diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst
index 9463692c411..f48c32bd844 100644
--- a/docs/devel/tcg-plugins.rst
+++ b/docs/devel/tcg-plugins.rst
@@ -166,7 +166,7 @@ Plugin API
==========
The following API is generated from the inline documentation in
-``include/qemu/qemu-plugin.h``. Please ensure any updates to the API
+``include/plugins/qemu-plugin.h``. Please ensure any updates to the API
include the full kernel-doc annotations.
-.. kernel-doc:: include/qemu/qemu-plugin.h
+.. kernel-doc:: include/plugins/qemu-plugin.h
diff --git a/meson.build b/meson.build
index 82e0188b0bc..23252afc7d0 100644
--- a/meson.build
+++ b/meson.build
@@ -4446,7 +4446,7 @@ endforeach
# Other build targets
if get_option('plugins')
- install_headers('include/qemu/qemu-plugin.h')
+ install_headers('include/plugins/qemu-plugin.h')
if host_os == 'windows'
# On windows, we want to deliver the qemu_plugin_api.lib file in the qemu installer,
# so that plugin authors can compile against it.
diff --git a/include/qemu/qemu-plugin.h b/include/plugins/qemu-plugin.h
similarity index 99%
rename from include/qemu/qemu-plugin.h
rename to include/plugins/qemu-plugin.h
index 7f449d1b50a..17a834dca90 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/plugins/qemu-plugin.h
@@ -2,9 +2,6 @@
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
* Copyright (C) 2019, Linaro
*
- * License: GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- *
* SPDX-License-Identifier: GPL-2.0-or-later
*/
diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h
index b74a7d0811b..ddd77bd82c9 100644
--- a/include/qemu/plugin.h
+++ b/include/qemu/plugin.h
@@ -8,7 +8,7 @@
#define QEMU_PLUGIN_H
#include "qemu/config-file.h"
-#include "qemu/qemu-plugin.h"
+#include "plugins/qemu-plugin.h"
#include "qemu/error-report.h"
#include "qemu/queue.h"
#include "qemu/option.h"
diff --git a/plugins/core.c b/plugins/core.c
index 85fabf9ec81..42fd9865930 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -15,7 +15,7 @@
#include "qemu/lockable.h"
#include "qemu/option.h"
#include "qemu/plugin.h"
-#include "qemu/qemu-plugin.h"
+#include "plugins/qemu-plugin.h"
#include "qemu/queue.h"
#include "qemu/rcu_queue.h"
#include "qemu/rcu.h"
diff --git a/plugins/meson.build b/plugins/meson.build
index 4318e3a1671..34643e2cea3 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -3,7 +3,7 @@ if not get_option('plugins')
endif
qemu_plugin_symbols = configure_file(
- input: files('../include/qemu/qemu-plugin.h'),
+ input: files('../include/plugins/qemu-plugin.h'),
output: 'qemu-plugin.symbols',
capture: true,
command: [files('../scripts/qemu-plugin-symbols.py'), '@INPUT@'])
@@ -62,12 +62,12 @@ endif
if host_os == 'windows'
plugins_deps = declare_dependency(sources: [files('win32_linker.c')],
- include_directories: '../include/qemu',
+ include_directories: '../include/plugins',
link_with: win32_qemu_plugin_api_lib,
link_args: win32_qemu_plugin_api_link_flags,
dependencies: glib)
else
- plugins_deps = declare_dependency(include_directories: '../include/qemu',
+ plugins_deps = declare_dependency(include_directories: '../include/plugins',
dependencies: glib)
endif
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 16/21] meson: fix supported compiler arguments in other languages than C
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (14 preceding siblings ...)
2026-01-29 17:38 ` [PULL 15/21] plugins: move qemu-plugin.h to include/plugins/ Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 17/21] meson: enable cpp (optionally) for plugins Pierrick Bouvier
` (5 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé,
Manos Pitsidianakis
qemu_common_flags are only checked for c compiler, even though they
are applied to c++ and objc. This is a problem when C compiler is gcc,
and C++ compiler is clang, creating a possible mismatch.
One concrete example is option -fzero-call-used-regs=used-gpr with
ubuntu2204 container, which is supported by gcc, but not by clang, thus
leading to a failure when compiling a C++ TCG plugin.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-8-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/meson.build b/meson.build
index 23252afc7d0..ad8550d9e97 100644
--- a/meson.build
+++ b/meson.build
@@ -682,10 +682,7 @@ if cc.compiles('extern struct { void (*cb)(void); } s; void f(void) { s.cb(); }'
hardening_flags += '-fzero-call-used-regs=used-gpr'
endif
-qemu_common_flags += cc.get_supported_arguments(hardening_flags)
-
-add_global_arguments(qemu_common_flags, native: false, language: all_languages)
-add_global_link_arguments(qemu_ldflags, native: false, language: all_languages)
+qemu_common_flags += hardening_flags
# Collect warning flags we want to set, sorted alphabetically
warn_flags = [
@@ -744,15 +741,19 @@ if 'cpp' in all_languages
qemu_cxxflags = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS'] + qemu_cflags
endif
-add_project_arguments(qemu_cflags, native: false, language: 'c')
-add_project_arguments(cc.get_supported_arguments(warn_flags), native: false, language: 'c')
+add_project_arguments(cc.get_supported_arguments(qemu_common_flags + qemu_cflags + warn_flags),
+ native: false, language: 'c')
+add_global_link_arguments(qemu_ldflags, native: false, language: all_languages)
+
if 'cpp' in all_languages
- add_project_arguments(qemu_cxxflags, native: false, language: 'cpp')
+ add_project_arguments(cxx.get_supported_arguments(qemu_common_flags + qemu_cxxflags),
+ native: false, language: 'cpp')
add_project_arguments(cxx.get_supported_arguments(warn_flags), native: false, language: 'cpp')
endif
if 'objc' in all_languages
# Note sanitizer flags are not applied to Objective-C sources!
- add_project_arguments(objc.get_supported_arguments(warn_flags), native: false, language: 'objc')
+ add_project_arguments(objc.get_supported_arguments(qemu_common_flags + warn_flags),
+ native: false, language: 'objc')
endif
if host_os == 'linux'
add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 17/21] meson: enable cpp (optionally) for plugins
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (15 preceding siblings ...)
2026-01-29 17:38 ` [PULL 16/21] meson: fix supported compiler arguments in other languages than C Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 18/21] qga/vss-win32: fix clang warning with C++20 Pierrick Bouvier
` (4 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé,
Manos Pitsidianakis
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-9-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index ad8550d9e97..149655058a9 100644
--- a/meson.build
+++ b/meson.build
@@ -77,7 +77,8 @@ python = import('python').find_installation()
cc = meson.get_compiler('c')
all_languages = ['c']
-if host_os == 'windows' and add_languages('cpp', required: false, native: false)
+enable_cpp = host_os == 'windows' or get_option('plugins')
+if enable_cpp and add_languages('cpp', required: false, native: false)
all_languages += ['cpp']
cxx = meson.get_compiler('cpp')
endif
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 18/21] qga/vss-win32: fix clang warning with C++20
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (16 preceding siblings ...)
2026-01-29 17:38 ` [PULL 17/21] meson: enable cpp (optionally) for plugins Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 19/21] meson: update C++ standard to C++23 Pierrick Bouvier
` (3 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Manos Pitsidianakis
C++20 deprecated such constructs.
../qga/vss-win32/requester.cpp:380:32: error: bitwise operation between different enumeration types ('_VSS_SNAPSHOT_CONTEXT' and '_VSS_VOLUME_SNAPSHOT_ATTRIBUTES') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
380 | ctx = VSS_CTX_APP_ROLLBACK | VSS_VOLSNAP_ATTR_TRANSPORTABLE |
This is a false positive, since VSS_CTX_APP_ROLLBACK is not a value
defined in _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enum.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-10-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qga/vss-win32/requester.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 5615955b6f3..74489fcd0ae 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -377,8 +377,10 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
* To prevent the final commit (which requires to write to snapshots),
* ATTR_NO_AUTORECOVERY and ATTR_TRANSPORTABLE are specified here.
*/
- ctx = VSS_CTX_APP_ROLLBACK | VSS_VOLSNAP_ATTR_TRANSPORTABLE |
- VSS_VOLSNAP_ATTR_NO_AUTORECOVERY | VSS_VOLSNAP_ATTR_TXF_RECOVERY;
+ ctx = VSS_CTX_APP_ROLLBACK;
+ ctx |= VSS_VOLSNAP_ATTR_TRANSPORTABLE |
+ VSS_VOLSNAP_ATTR_NO_AUTORECOVERY |
+ VSS_VOLSNAP_ATTR_TXF_RECOVERY;
hr = vss_ctx.pVssbc->SetContext(ctx);
if (hr == (HRESULT)VSS_E_UNSUPPORTED_CONTEXT) {
/* Non-server version of Windows doesn't support ATTR_TRANSPORTABLE */
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 19/21] meson: update C++ standard to C++23
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (17 preceding siblings ...)
2026-01-29 17:38 ` [PULL 18/21] qga/vss-win32: fix clang warning with C++20 Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 20/21] contrib/plugins: add empty cpp plugin Pierrick Bouvier
` (2 subsequent siblings)
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Manos Pitsidianakis
C++ is evolving faster than C, so it's useful to enable new standards,
especially for standard library.
Update to most recent standard available in our build environments.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-11-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 149655058a9..8c6c0a9a32f 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('qemu', ['c'], meson_version: '>=1.5.0',
- default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
+ default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++23', 'b_colorout=auto',
'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true',
'rust_std=2021', 'build.rust_std=2021'],
version: files('VERSION'))
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 20/21] contrib/plugins: add empty cpp plugin
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (18 preceding siblings ...)
2026-01-29 17:38 ` [PULL 19/21] meson: update C++ standard to C++23 Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:38 ` [PULL 21/21] plugins: reduce source conflicts in plugins list Pierrick Bouvier
2026-01-29 17:41 ` [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé,
Manos Pitsidianakis
This plugin makes sure we can compile in C++ while including qemu-plugin
header. It includes all C++ standard headers, up to C++23 standard,
minus the ones that are missing in the oldest environments we need to
build for.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-12-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
contrib/plugins/cpp.cpp | 119 ++++++++++++++++++++++++++++++++++++
contrib/plugins/meson.build | 4 ++
2 files changed, 123 insertions(+)
create mode 100644 contrib/plugins/cpp.cpp
diff --git a/contrib/plugins/cpp.cpp b/contrib/plugins/cpp.cpp
new file mode 100644
index 00000000000..1ff54896d97
--- /dev/null
+++ b/contrib/plugins/cpp.cpp
@@ -0,0 +1,119 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This C++ plugin ensures we don't have regression when compiling C++.
+ */
+
+#include <qemu-plugin.h>
+
+/* https://en.cppreference.com/w/cpp/headers.html */
+#include <algorithm>
+#include <any>
+#include <array>
+#include <atomic>
+#include <barrier>
+#include <bit>
+#include <bitset>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <charconv>
+#include <chrono>
+#include <cinttypes>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <codecvt>
+#include <compare>
+#include <complex>
+#include <concepts>
+#include <condition_variable>
+#include <coroutine>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <cuchar>
+#include <cwchar>
+#include <cwctype>
+#include <deque>
+#include <exception>
+#include <execution>
+#include <filesystem>
+#include <forward_list>
+#include <fstream>
+#include <functional>
+#include <future>
+#include <initializer_list>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <iostream>
+#include <istream>
+#include <iterator>
+#include <latch>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <memory_resource>
+#include <mutex>
+#include <new>
+#include <numbers>
+#include <numeric>
+#include <optional>
+#include <ostream>
+#include <queue>
+#include <random>
+#include <ranges>
+#include <ratio>
+#include <regex>
+#include <scoped_allocator>
+#include <semaphore>
+#include <set>
+#include <shared_mutex>
+#include <source_location>
+#include <span>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <stop_token>
+#include <streambuf>
+#include <string>
+#include <string_view>
+#include <syncstream>
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <typeindex>
+#include <typeinfo>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <valarray>
+#include <variant>
+#include <vector>
+#include <version>
+
+QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
+
+static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
+{
+}
+
+QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
+ const qemu_info_t *info,
+ int argc, char **argv)
+{
+ qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
+ return 0;
+}
diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build
index 3d2d7862e0c..53d52c97967 100644
--- a/contrib/plugins/meson.build
+++ b/contrib/plugins/meson.build
@@ -6,6 +6,10 @@ if host_os != 'windows'
contrib_plugins += 'lockstep.c'
endif
+if 'cpp' in all_languages
+ contrib_plugins += 'cpp.cpp'
+endif
+
t = []
if get_option('plugins')
foreach i : contrib_plugins
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PULL 21/21] plugins: reduce source conflicts in plugins list
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (19 preceding siblings ...)
2026-01-29 17:38 ` [PULL 20/21] contrib/plugins: add empty cpp plugin Pierrick Bouvier
@ 2026-01-29 17:38 ` Pierrick Bouvier
2026-01-29 17:41 ` [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
21 siblings, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Philippe Mathieu-Daudé
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/87cy2uat5e.fsf@draig.linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
contrib/plugins/meson.build | 19 ++++++++++++++++---
tests/tcg/plugins/meson.build | 13 +++++++++++--
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build
index 53d52c97967..099319e7a17 100644
--- a/contrib/plugins/meson.build
+++ b/contrib/plugins/meson.build
@@ -1,6 +1,19 @@
-contrib_plugins = ['bbv.c', 'cache.c', 'cflow.c', 'drcov.c', 'execlog.c',
- 'hotblocks.c', 'hotpages.c', 'howvec.c', 'hwprofile.c',
- 'ips.c', 'stoptrigger.c', 'traps.c', 'uftrace.c']
+contrib_plugins = [
+'bbv.c',
+'cache.c',
+'cflow.c',
+'drcov.c',
+'execlog.c',
+'hotblocks.c',
+'hotpages.c',
+'howvec.c',
+'hwprofile.c',
+'ips.c',
+'stoptrigger.c',
+'traps.c',
+'uftrace.c',
+]
+
if host_os != 'windows'
# lockstep uses socket.h
contrib_plugins += 'lockstep.c'
diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build
index 303f97f9679..c5e49753fd9 100644
--- a/tests/tcg/plugins/meson.build
+++ b/tests/tcg/plugins/meson.build
@@ -1,5 +1,14 @@
-test_plugins = ['bb.c', 'discons.c', 'empty.c', 'inline.c', 'insn.c', 'mem.c',
- 'reset.c', 'syscall.c', 'patch.c']
+test_plugins = [
+'bb.c',
+'discons.c',
+'empty.c',
+'inline.c',
+'insn.c',
+'mem.c',
+'patch.c',
+'reset.c',
+'syscall.c',
+]
t = []
if get_option('plugins')
--
2.47.3
^ permalink raw reply related [flat|nested] 33+ messages in thread* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-01-29 17:37 [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
` (20 preceding siblings ...)
2026-01-29 17:38 ` [PULL 21/21] plugins: reduce source conflicts in plugins list Pierrick Bouvier
@ 2026-01-29 17:41 ` Pierrick Bouvier
2026-02-02 4:03 ` Richard Henderson
21 siblings, 1 reply; 33+ messages in thread
From: Pierrick Bouvier @ 2026-01-29 17:41 UTC (permalink / raw)
To: qemu-devel
On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
> The following changes since commit 65fb9de4888f9bf32bc4f60c880da3dff04c4fd9:
>
> Merge tag 'pr-build_fix-20260128' of https://gitlab.com/pbo-linaro/qemu into staging (2026-01-29 13:29:33 +1100)
>
> are available in the Git repository at:
>
> https://gitlab.com/pbo-linaro/qemu tags/pr-plugins-20260129
>
> for you to fetch changes up to bed25f00d306bbbcc85d068b6469fc00aeecbd11:
>
> plugins: reduce source conflicts in plugins list (2026-01-29 09:34:14 -0800)
>
> ----------------------------------------------------------------
> Changes:
> - contrib/plugins/hotblocks: Minor bug fixes and add limit argument (Alex Bradbury <asb@igalia.com>)
> - linux-user: introduce syscall-filter plugin API (Ziyang Zhang <functioner@sjtu.edu.cn>)
> - plugins: return bool from register r/w API (Florian Hofhammer <florian.hofhammer@fhofhammer.de>)
> - plugins: enable C++ plugins (Pierrick Bouvier <pierrick.bouvier@linaro.org>)
> - plugins: reduce source conflicts in plugins list (Pierrick Bouvier <pierrick.bouvier@linaro.org>)
>
> ----------------------------------------------------------------
> Alex Bradbury (5):
> contrib/plugins/hotblocks: Correctly free sorted counts list
> contrib/plugins/hotblocks: Fix off by one error in iteration of sorted blocks
> contrib/plugins/hotblocks: Print uint64_t with PRIu64 rather than PRId64
> docs/about/emulation: Add documentation for hotblocks plugin arguments
> contrib/plugins/hotblocks: Allow limit to be set as a command line argument
>
> Florian Hofhammer (1):
> plugins: return bool from register r/w API
>
> Pierrick Bouvier (13):
> linux-user: move user/syscall-trace.h to linux-user/syscall.c
> plugins: move win32_linker.c file to plugins directory
> plugins: factorize plugin dependencies and library details
> plugins: use complete filename for defining plugins sources
> plugins: define plugin API symbols as extern "C" when compiling in C++
> tests/tcg/plugins/mem.c: remove dependency on qemu headers
> plugins: move qemu-plugin.h to include/plugins/
> meson: fix supported compiler arguments in other languages than C
> meson: enable cpp (optionally) for plugins
> qga/vss-win32: fix clang warning with C++20
> meson: update C++ standard to C++23
> contrib/plugins: add empty cpp plugin
> plugins: reduce source conflicts in plugins list
>
> Ziyang Zhang (2):
> linux-user: add plugin API to filter syscalls
> tcg tests: add a test to verify the syscall filter plugin API
>
> docs/about/emulation.rst | 12 +++
> docs/devel/tcg-plugins.rst | 4 +-
> meson.build | 26 ++---
> include/{qemu => plugins}/qemu-plugin.h | 62 +++++++++---
> include/qemu/plugin-event.h | 1 +
> include/qemu/plugin.h | 35 +++++--
> include/user/syscall-trace.h | 43 --------
> bsd-user/freebsd/os-syscall.c | 1 -
> contrib/plugins/execlog.c | 14 +--
> contrib/plugins/hotblocks.c | 20 ++--
> contrib/plugins/uftrace.c | 8 +-
> linux-user/syscall.c | 44 ++++++++-
> plugins/api.c | 36 ++++---
> plugins/core.c | 39 +++++++-
> {contrib/plugins => plugins}/win32_linker.c | 0
> tests/tcg/multiarch/test-plugin-syscall-filter.c | 39 ++++++++
> tests/tcg/plugins/insn.c | 4 +-
> tests/tcg/plugins/mem.c | 59 +++++------
> tests/tcg/plugins/syscall.c | 19 ++++
> contrib/plugins/cpp.cpp | 119 +++++++++++++++++++++++
> contrib/plugins/meson.build | 38 +++++---
> plugins/meson.build | 17 +++-
> qga/vss-win32/requester.cpp | 6 +-
> tests/tcg/multiarch/Makefile.target | 7 +-
> tests/tcg/plugins/meson.build | 27 ++---
> 25 files changed, 497 insertions(+), 183 deletions(-)
> rename include/{qemu => plugins}/qemu-plugin.h (95%)
> delete mode 100644 include/user/syscall-trace.h
> rename {contrib/plugins => plugins}/win32_linker.c (100%)
> create mode 100644 tests/tcg/multiarch/test-plugin-syscall-filter.c
> create mode 100644 contrib/plugins/cpp.cpp
v2
--
- Delete syscall-trace header and move functions to linux-user/syscall.c
Note: There is a regression upstream with native windows builds where:
$ ./configure
Looking in links: file://C:/GitLab-Runner/builds/qemu/python/wheels
WARNING: Location 'file://C:/GitLab-Runner/builds/qemu/python/wheels' is
ignored: it is neither a file nor a directory.
ERROR: Could not find a version that satisfies the requirement
meson==1.10.0 (from versions: none)
This is not related to this series, and seems like an MSYS bug. It can
be avoiding by *not* updating core packages (pacman -Syu). Hopefully
will be solved upstream before updating becomes mandatory.
This series has been tested on Windows with changes described above and
it works as expected.
Regards,
Pierrick
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-01-29 17:41 ` [PULL 00/21] Plugins patches for 2026-01-29 Pierrick Bouvier
@ 2026-02-02 4:03 ` Richard Henderson
2026-02-02 13:26 ` Peter Maydell
0 siblings, 1 reply; 33+ messages in thread
From: Richard Henderson @ 2026-02-02 4:03 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
On 1/30/26 04:41, Pierrick Bouvier wrote:
> On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
>> The following changes since commit 65fb9de4888f9bf32bc4f60c880da3dff04c4fd9:
>>
>> Merge tag 'pr-build_fix-20260128' of https://gitlab.com/pbo-linaro/qemu into staging
>> (2026-01-29 13:29:33 +1100)
>>
>> are available in the Git repository at:
>>
>> https://gitlab.com/pbo-linaro/qemu tags/pr-plugins-20260129
>>
>> for you to fetch changes up to bed25f00d306bbbcc85d068b6469fc00aeecbd11:
>>
>> plugins: reduce source conflicts in plugins list (2026-01-29 09:34:14 -0800)
>>
>> ----------------------------------------------------------------
>> Changes:
>> - contrib/plugins/hotblocks: Minor bug fixes and add limit argument (Alex Bradbury
>> <asb@igalia.com>)
>> - linux-user: introduce syscall-filter plugin API (Ziyang Zhang <functioner@sjtu.edu.cn>)
>> - plugins: return bool from register r/w API (Florian Hofhammer
>> <florian.hofhammer@fhofhammer.de>)
>> - plugins: enable C++ plugins (Pierrick Bouvier <pierrick.bouvier@linaro.org>)
>> - plugins: reduce source conflicts in plugins list (Pierrick Bouvier
>> <pierrick.bouvier@linaro.org>)
>>
>> ----------------------------------------------------------------
>> Alex Bradbury (5):
>> contrib/plugins/hotblocks: Correctly free sorted counts list
>> contrib/plugins/hotblocks: Fix off by one error in iteration of sorted blocks
>> contrib/plugins/hotblocks: Print uint64_t with PRIu64 rather than PRId64
>> docs/about/emulation: Add documentation for hotblocks plugin arguments
>> contrib/plugins/hotblocks: Allow limit to be set as a command line argument
>>
>> Florian Hofhammer (1):
>> plugins: return bool from register r/w API
>>
>> Pierrick Bouvier (13):
>> linux-user: move user/syscall-trace.h to linux-user/syscall.c
>> plugins: move win32_linker.c file to plugins directory
>> plugins: factorize plugin dependencies and library details
>> plugins: use complete filename for defining plugins sources
>> plugins: define plugin API symbols as extern "C" when compiling in C++
>> tests/tcg/plugins/mem.c: remove dependency on qemu headers
>> plugins: move qemu-plugin.h to include/plugins/
>> meson: fix supported compiler arguments in other languages than C
>> meson: enable cpp (optionally) for plugins
>> qga/vss-win32: fix clang warning with C++20
>> meson: update C++ standard to C++23
>> contrib/plugins: add empty cpp plugin
>> plugins: reduce source conflicts in plugins list
>>
>> Ziyang Zhang (2):
>> linux-user: add plugin API to filter syscalls
>> tcg tests: add a test to verify the syscall filter plugin API
>>
>> docs/about/emulation.rst | 12 +++
>> docs/devel/tcg-plugins.rst | 4 +-
>> meson.build | 26 ++---
>> include/{qemu => plugins}/qemu-plugin.h | 62 +++++++++---
>> include/qemu/plugin-event.h | 1 +
>> include/qemu/plugin.h | 35 +++++--
>> include/user/syscall-trace.h | 43 --------
>> bsd-user/freebsd/os-syscall.c | 1 -
>> contrib/plugins/execlog.c | 14 +--
>> contrib/plugins/hotblocks.c | 20 ++--
>> contrib/plugins/uftrace.c | 8 +-
>> linux-user/syscall.c | 44 ++++++++-
>> plugins/api.c | 36 ++++---
>> plugins/core.c | 39 +++++++-
>> {contrib/plugins => plugins}/win32_linker.c | 0
>> tests/tcg/multiarch/test-plugin-syscall-filter.c | 39 ++++++++
>> tests/tcg/plugins/insn.c | 4 +-
>> tests/tcg/plugins/mem.c | 59 +++++------
>> tests/tcg/plugins/syscall.c | 19 ++++
>> contrib/plugins/cpp.cpp | 119 +++++++++++++++++++++++
>> contrib/plugins/meson.build | 38 +++++---
>> plugins/meson.build | 17 +++-
>> qga/vss-win32/requester.cpp | 6 +-
>> tests/tcg/multiarch/Makefile.target | 7 +-
>> tests/tcg/plugins/meson.build | 27 ++---
>> 25 files changed, 497 insertions(+), 183 deletions(-)
>> rename include/{qemu => plugins}/qemu-plugin.h (95%)
>> delete mode 100644 include/user/syscall-trace.h
>> rename {contrib/plugins => plugins}/win32_linker.c (100%)
>> create mode 100644 tests/tcg/multiarch/test-plugin-syscall-filter.c
>> create mode 100644 contrib/plugins/cpp.cpp
>
> v2
> --
>
> - Delete syscall-trace header and move functions to linux-user/syscall.c
>
> Note: There is a regression upstream with native windows builds where:
>
> $ ./configure
> Looking in links: file://C:/GitLab-Runner/builds/qemu/python/wheels
> WARNING: Location 'file://C:/GitLab-Runner/builds/qemu/python/wheels' is
> ignored: it is neither a file nor a directory.
> ERROR: Could not find a version that satisfies the requirement
> meson==1.10.0 (from versions: none)
>
> This is not related to this series, and seems like an MSYS bug. It can be avoiding by
> *not* updating core packages (pacman -Syu). Hopefully will be solved upstream before
> updating becomes mandatory.
>
> This series has been tested on Windows with changes described above and it works as expected.
>
> Regards,
> Pierrick
>
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/11.0 as appropriate.
r~
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 4:03 ` Richard Henderson
@ 2026-02-02 13:26 ` Peter Maydell
2026-02-02 15:42 ` Cornelia Huck
0 siblings, 1 reply; 33+ messages in thread
From: Peter Maydell @ 2026-02-02 13:26 UTC (permalink / raw)
To: Richard Henderson; +Cc: Pierrick Bouvier, qemu-devel
On Mon, 2 Feb 2026 at 04:04, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 1/30/26 04:41, Pierrick Bouvier wrote:
> > On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
> >> contrib/plugins: add empty cpp plugin
Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
In file included from ../../contrib/plugins/cpp.cpp:33:
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
error: "the <coroutine> header requires -fcoroutines"
38 | # error "the <coroutine> header requires -fcoroutines"
| ^
1 error generated.
thanks
-- PMM
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 13:26 ` Peter Maydell
@ 2026-02-02 15:42 ` Cornelia Huck
2026-02-02 16:55 ` Mark Cave-Ayland
0 siblings, 1 reply; 33+ messages in thread
From: Cornelia Huck @ 2026-02-02 15:42 UTC (permalink / raw)
To: Peter Maydell, Richard Henderson; +Cc: Pierrick Bouvier, qemu-devel
On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
> On Mon, 2 Feb 2026 at 04:04, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> On 1/30/26 04:41, Pierrick Bouvier wrote:
>> > On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
>> >> contrib/plugins: add empty cpp plugin
>
> Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
>
> In file included from ../../contrib/plugins/cpp.cpp:33:
> /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
> error: "the <coroutine> header requires -fcoroutines"
> 38 | # error "the <coroutine> header requires -fcoroutines"
> | ^
> 1 error generated.
Fails for me as well on Fedora 42 (x86_64) with gcc:
In file included from ../qemu/contrib/plugins/cpp.cpp:33:
/usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
43 | # error "the <coroutine> header requires -fcoroutines"
| ^~~~~
(It works for me on an aarch64 RHEL 9 system.)
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 15:42 ` Cornelia Huck
@ 2026-02-02 16:55 ` Mark Cave-Ayland
2026-02-02 17:25 ` Cornelia Huck
2026-02-02 17:30 ` Pierrick Bouvier
0 siblings, 2 replies; 33+ messages in thread
From: Mark Cave-Ayland @ 2026-02-02 16:55 UTC (permalink / raw)
To: Cornelia Huck, Peter Maydell, Richard Henderson
Cc: Pierrick Bouvier, qemu-devel
On 02/02/2026 15:42, Cornelia Huck wrote:
> On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
>
>> On Mon, 2 Feb 2026 at 04:04, Richard Henderson
>> <richard.henderson@linaro.org> wrote:
>>>
>>> On 1/30/26 04:41, Pierrick Bouvier wrote:
>>>> On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
>>>>> contrib/plugins: add empty cpp plugin
>>
>> Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
>>
>> In file included from ../../contrib/plugins/cpp.cpp:33:
>> /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
>> error: "the <coroutine> header requires -fcoroutines"
>> 38 | # error "the <coroutine> header requires -fcoroutines"
>> | ^
>> 1 error generated.
>
> Fails for me as well on Fedora 42 (x86_64) with gcc:
>
> In file included from ../qemu/contrib/plugins/cpp.cpp:33:
> /usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
> 43 | # error "the <coroutine> header requires -fcoroutines"
> | ^~~~~
>
> (It works for me on an aarch64 RHEL 9 system.)
Is this with a clean build? I had exactly the same error message
earlier, but I was able to fix it by destroying my build/ directory,
then re-running configure followed again by make.
ATB,
Mark.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 16:55 ` Mark Cave-Ayland
@ 2026-02-02 17:25 ` Cornelia Huck
2026-02-02 17:30 ` Pierrick Bouvier
1 sibling, 0 replies; 33+ messages in thread
From: Cornelia Huck @ 2026-02-02 17:25 UTC (permalink / raw)
To: Mark Cave-Ayland, Peter Maydell, Richard Henderson
Cc: Pierrick Bouvier, qemu-devel
On Mon, Feb 02 2026, Mark Cave-Ayland <mark.caveayland@nutanix.com> wrote:
> On 02/02/2026 15:42, Cornelia Huck wrote:
>
>> On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>>> On Mon, 2 Feb 2026 at 04:04, Richard Henderson
>>> <richard.henderson@linaro.org> wrote:
>>>>
>>>> On 1/30/26 04:41, Pierrick Bouvier wrote:
>>>>> On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
>>>>>> contrib/plugins: add empty cpp plugin
>>>
>>> Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
>>>
>>> In file included from ../../contrib/plugins/cpp.cpp:33:
>>> /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
>>> error: "the <coroutine> header requires -fcoroutines"
>>> 38 | # error "the <coroutine> header requires -fcoroutines"
>>> | ^
>>> 1 error generated.
>>
>> Fails for me as well on Fedora 42 (x86_64) with gcc:
>>
>> In file included from ../qemu/contrib/plugins/cpp.cpp:33:
>> /usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
>> 43 | # error "the <coroutine> header requires -fcoroutines"
>> | ^~~~~
>>
>> (It works for me on an aarch64 RHEL 9 system.)
>
> Is this with a clean build? I had exactly the same error message
> earlier, but I was able to fix it by destroying my build/ directory,
> then re-running configure followed again by make.
Rebuilding with a fresh build dir looks promising so far ('make clean'
is not enough.) I'm wondering if we're missing some rebuild trigger (and
I'm also wondering why I didn't see this problem on my RHEL 9 aarch64
box.)
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 16:55 ` Mark Cave-Ayland
2026-02-02 17:25 ` Cornelia Huck
@ 2026-02-02 17:30 ` Pierrick Bouvier
2026-02-02 17:34 ` Daniel P. Berrangé
1 sibling, 1 reply; 33+ messages in thread
From: Pierrick Bouvier @ 2026-02-02 17:30 UTC (permalink / raw)
To: Mark Cave-Ayland, Cornelia Huck, Peter Maydell, Richard Henderson
Cc: qemu-devel
On 2/2/26 8:55 AM, Mark Cave-Ayland wrote:
> On 02/02/2026 15:42, Cornelia Huck wrote:
>
>> On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>>> On Mon, 2 Feb 2026 at 04:04, Richard Henderson
>>> <richard.henderson@linaro.org> wrote:
>>>>
>>>> On 1/30/26 04:41, Pierrick Bouvier wrote:
>>>>> On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
>>>>>> contrib/plugins: add empty cpp plugin
>>>
>>> Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
>>>
>>> In file included from ../../contrib/plugins/cpp.cpp:33:
>>> /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
>>> error: "the <coroutine> header requires -fcoroutines"
>>> 38 | # error "the <coroutine> header requires -fcoroutines"
>>> | ^
>>> 1 error generated.
>>
>> Fails for me as well on Fedora 42 (x86_64) with gcc:
>>
>> In file included from ../qemu/contrib/plugins/cpp.cpp:33:
>> /usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
>> 43 | # error "the <coroutine> header requires -fcoroutines"
>> | ^~~~~
>>
>> (It works for me on an aarch64 RHEL 9 system.)
>
> Is this with a clean build? I had exactly the same error message
> earlier, but I was able to fix it by destroying my build/ directory,
> then re-running configure followed again by make.
>
>
> ATB,
>
> Mark.
>
Thanks for the reports everyone.
I tried it on ubuntu LTS and didn't encounter this problem.
What is happening is that meson unfortunately caches default_options
set, including the C++ standard version in our case.
Thus, you indeed need to clean and rebuild once.
The solution for this would be to not use default_options and add the
flag to qemu_cflags instead. It's the same limitation if we change the
default warning level, or any other option set with default_options.
Let me know if cleaning solved the problem for you Cornelia and Peter,
and sorry for the noise it created.
Regards,
Pierrick
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 17:30 ` Pierrick Bouvier
@ 2026-02-02 17:34 ` Daniel P. Berrangé
2026-02-02 17:45 ` Pierrick Bouvier
0 siblings, 1 reply; 33+ messages in thread
From: Daniel P. Berrangé @ 2026-02-02 17:34 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: Mark Cave-Ayland, Cornelia Huck, Peter Maydell, Richard Henderson,
qemu-devel
On Mon, Feb 02, 2026 at 09:30:31AM -0800, Pierrick Bouvier wrote:
> On 2/2/26 8:55 AM, Mark Cave-Ayland wrote:
> > On 02/02/2026 15:42, Cornelia Huck wrote:
> >
> > > On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
> > >
> > > > On Mon, 2 Feb 2026 at 04:04, Richard Henderson
> > > > <richard.henderson@linaro.org> wrote:
> > > > >
> > > > > On 1/30/26 04:41, Pierrick Bouvier wrote:
> > > > > > On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
> > > > > > > contrib/plugins: add empty cpp plugin
> > > >
> > > > Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
> > > >
> > > > In file included from ../../contrib/plugins/cpp.cpp:33:
> > > > /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
> > > > error: "the <coroutine> header requires -fcoroutines"
> > > > 38 | # error "the <coroutine> header requires -fcoroutines"
> > > > | ^
> > > > 1 error generated.
> > >
> > > Fails for me as well on Fedora 42 (x86_64) with gcc:
> > >
> > > In file included from ../qemu/contrib/plugins/cpp.cpp:33:
> > > /usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
> > > 43 | # error "the <coroutine> header requires -fcoroutines"
> > > | ^~~~~
> > >
> > > (It works for me on an aarch64 RHEL 9 system.)
> >
> > Is this with a clean build? I had exactly the same error message
> > earlier, but I was able to fix it by destroying my build/ directory,
> > then re-running configure followed again by make.
> >
>
> Thanks for the reports everyone.
>
> I tried it on ubuntu LTS and didn't encounter this problem.
> What is happening is that meson unfortunately caches default_options set,
> including the C++ standard version in our case.
> Thus, you indeed need to clean and rebuild once.
>
> The solution for this would be to not use default_options and add the flag
> to qemu_cflags instead. It's the same limitation if we change the default
> warning level, or any other option set with default_options.
If that's correct as the root cause, then it feels like this is a meson bug
that ought to be reported upstream. Any meson.build default_options changes
that affect the compiler behaviour should invalidate cache in the same way
as when we modify qemu_cflags.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 17:34 ` Daniel P. Berrangé
@ 2026-02-02 17:45 ` Pierrick Bouvier
2026-02-02 17:49 ` Daniel P. Berrangé
2026-02-02 17:51 ` Pierrick Bouvier
0 siblings, 2 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-02-02 17:45 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Mark Cave-Ayland, Cornelia Huck, Peter Maydell, Richard Henderson,
qemu-devel
On 2/2/26 9:34 AM, Daniel P. Berrangé wrote:
> On Mon, Feb 02, 2026 at 09:30:31AM -0800, Pierrick Bouvier wrote:
>> On 2/2/26 8:55 AM, Mark Cave-Ayland wrote:
>>> On 02/02/2026 15:42, Cornelia Huck wrote:
>>>
>>>> On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
>>>>
>>>>> On Mon, 2 Feb 2026 at 04:04, Richard Henderson
>>>>> <richard.henderson@linaro.org> wrote:
>>>>>>
>>>>>> On 1/30/26 04:41, Pierrick Bouvier wrote:
>>>>>>> On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
>>>>>>>> contrib/plugins: add empty cpp plugin
>>>>>
>>>>> Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
>>>>>
>>>>> In file included from ../../contrib/plugins/cpp.cpp:33:
>>>>> /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
>>>>> error: "the <coroutine> header requires -fcoroutines"
>>>>> 38 | # error "the <coroutine> header requires -fcoroutines"
>>>>> | ^
>>>>> 1 error generated.
>>>>
>>>> Fails for me as well on Fedora 42 (x86_64) with gcc:
>>>>
>>>> In file included from ../qemu/contrib/plugins/cpp.cpp:33:
>>>> /usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
>>>> 43 | # error "the <coroutine> header requires -fcoroutines"
>>>> | ^~~~~
>>>>
>>>> (It works for me on an aarch64 RHEL 9 system.)
>>>
>>> Is this with a clean build? I had exactly the same error message
>>> earlier, but I was able to fix it by destroying my build/ directory,
>>> then re-running configure followed again by make.
>>>
>>
>> Thanks for the reports everyone.
>>
>> I tried it on ubuntu LTS and didn't encounter this problem.
>> What is happening is that meson unfortunately caches default_options set,
>> including the C++ standard version in our case.
>> Thus, you indeed need to clean and rebuild once.
>>
>> The solution for this would be to not use default_options and add the flag
>> to qemu_cflags instead. It's the same limitation if we change the default
>> warning level, or any other option set with default_options.
>
> If that's correct as the root cause, then it feels like this is a meson bug
> that ought to be reported upstream. Any meson.build default_options changes
> that affect the compiler behaviour should invalidate cache in the same way
> as when we modify qemu_cflags.
>
I totally agree with you Daniel, and I've been bitten by that in my
previous company when updating cpp standard we used. As you can see, it
slipped out of my mind for current series...
I never understood why it had this counter intuitive behaviour, and
didn't bother to report to be honest, I simply switched to manual flags
instead at the time.
Meson devs usually have a strong opinion of how things should be, so I
don't expect this to be something that fell through the cracks but a
deliberate design choice.
EDIT: after typing the answer above, did a quick search, and indeed,
it's how it's supposed to be. So be it.
https://github.com/mesonbuild/meson/issues/13556
> With regards,
> Daniel
Regards,
Pierrick
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 17:45 ` Pierrick Bouvier
@ 2026-02-02 17:49 ` Daniel P. Berrangé
2026-02-02 17:51 ` Pierrick Bouvier
1 sibling, 0 replies; 33+ messages in thread
From: Daniel P. Berrangé @ 2026-02-02 17:49 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: Mark Cave-Ayland, Cornelia Huck, Peter Maydell, Richard Henderson,
qemu-devel
On Mon, Feb 02, 2026 at 09:45:52AM -0800, Pierrick Bouvier wrote:
> On 2/2/26 9:34 AM, Daniel P. Berrangé wrote:
> > On Mon, Feb 02, 2026 at 09:30:31AM -0800, Pierrick Bouvier wrote:
> > > On 2/2/26 8:55 AM, Mark Cave-Ayland wrote:
> > > > On 02/02/2026 15:42, Cornelia Huck wrote:
> > > >
> > > > > On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
> > > > >
> > > > > > On Mon, 2 Feb 2026 at 04:04, Richard Henderson
> > > > > > <richard.henderson@linaro.org> wrote:
> > > > > > >
> > > > > > > On 1/30/26 04:41, Pierrick Bouvier wrote:
> > > > > > > > On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
> > > > > > > > > contrib/plugins: add empty cpp plugin
> > > > > >
> > > > > > Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
> > > > > >
> > > > > > In file included from ../../contrib/plugins/cpp.cpp:33:
> > > > > > /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
> > > > > > error: "the <coroutine> header requires -fcoroutines"
> > > > > > 38 | # error "the <coroutine> header requires -fcoroutines"
> > > > > > | ^
> > > > > > 1 error generated.
> > > > >
> > > > > Fails for me as well on Fedora 42 (x86_64) with gcc:
> > > > >
> > > > > In file included from ../qemu/contrib/plugins/cpp.cpp:33:
> > > > > /usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
> > > > > 43 | # error "the <coroutine> header requires -fcoroutines"
> > > > > | ^~~~~
> > > > >
> > > > > (It works for me on an aarch64 RHEL 9 system.)
> > > >
> > > > Is this with a clean build? I had exactly the same error message
> > > > earlier, but I was able to fix it by destroying my build/ directory,
> > > > then re-running configure followed again by make.
> > > >
> > >
> > > Thanks for the reports everyone.
> > >
> > > I tried it on ubuntu LTS and didn't encounter this problem.
> > > What is happening is that meson unfortunately caches default_options set,
> > > including the C++ standard version in our case.
> > > Thus, you indeed need to clean and rebuild once.
> > >
> > > The solution for this would be to not use default_options and add the flag
> > > to qemu_cflags instead. It's the same limitation if we change the default
> > > warning level, or any other option set with default_options.
> >
> > If that's correct as the root cause, then it feels like this is a meson bug
> > that ought to be reported upstream. Any meson.build default_options changes
> > that affect the compiler behaviour should invalidate cache in the same way
> > as when we modify qemu_cflags.
> >
>
> I totally agree with you Daniel, and I've been bitten by that in my previous
> company when updating cpp standard we used. As you can see, it slipped out
> of my mind for current series...
>
> I never understood why it had this counter intuitive behaviour, and didn't
> bother to report to be honest, I simply switched to manual flags instead at
> the time.
> Meson devs usually have a strong opinion of how things should be, so I don't
> expect this to be something that fell through the cracks but a deliberate
> design choice.
>
> EDIT: after typing the answer above, did a quick search, and indeed, it's
> how it's supposed to be. So be it.
> https://github.com/mesonbuild/meson/issues/13556
That's been marked a dupe of:
https://github.com/mesonbuild/meson/issues/2193
where Paolo says recent refactoring has (finally) made fixing this
problem a pratical task.... but that was 6+ months ago still, so
guess we'll have to wait a while yet.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PULL 00/21] Plugins patches for 2026-01-29
2026-02-02 17:45 ` Pierrick Bouvier
2026-02-02 17:49 ` Daniel P. Berrangé
@ 2026-02-02 17:51 ` Pierrick Bouvier
1 sibling, 0 replies; 33+ messages in thread
From: Pierrick Bouvier @ 2026-02-02 17:51 UTC (permalink / raw)
To: Daniel P. Berrangé, Paolo Bonzini
Cc: Mark Cave-Ayland, Cornelia Huck, Peter Maydell, Richard Henderson,
qemu-devel
On 2/2/26 9:45 AM, Pierrick Bouvier wrote:
> On 2/2/26 9:34 AM, Daniel P. Berrangé wrote:
>> On Mon, Feb 02, 2026 at 09:30:31AM -0800, Pierrick Bouvier wrote:
>>> On 2/2/26 8:55 AM, Mark Cave-Ayland wrote:
>>>> On 02/02/2026 15:42, Cornelia Huck wrote:
>>>>
>>>>> On Mon, Feb 02 2026, Peter Maydell <peter.maydell@linaro.org> wrote:
>>>>>
>>>>>> On Mon, 2 Feb 2026 at 04:04, Richard Henderson
>>>>>> <richard.henderson@linaro.org> wrote:
>>>>>>>
>>>>>>> On 1/30/26 04:41, Pierrick Bouvier wrote:
>>>>>>>> On 1/29/26 9:37 AM, Pierrick Bouvier wrote:
>>>>>>>>> contrib/plugins: add empty cpp plugin
>>>>>>
>>>>>> Hi; this fails to build for me on Linux (Ubuntu 24.04) with clang:
>>>>>>
>>>>>> In file included from ../../contrib/plugins/cpp.cpp:33:
>>>>>> /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/coroutine:38:3:
>>>>>> error: "the <coroutine> header requires -fcoroutines"
>>>>>> 38 | # error "the <coroutine> header requires -fcoroutines"
>>>>>> | ^
>>>>>> 1 error generated.
>>>>>
>>>>> Fails for me as well on Fedora 42 (x86_64) with gcc:
>>>>>
>>>>> In file included from ../qemu/contrib/plugins/cpp.cpp:33:
>>>>> /usr/include/c++/15/coroutine:43:3: error: #error "the <coroutine> header requires -fcoroutines"
>>>>> 43 | # error "the <coroutine> header requires -fcoroutines"
>>>>> | ^~~~~
>>>>>
>>>>> (It works for me on an aarch64 RHEL 9 system.)
>>>>
>>>> Is this with a clean build? I had exactly the same error message
>>>> earlier, but I was able to fix it by destroying my build/ directory,
>>>> then re-running configure followed again by make.
>>>>
>>>
>>> Thanks for the reports everyone.
>>>
>>> I tried it on ubuntu LTS and didn't encounter this problem.
>>> What is happening is that meson unfortunately caches default_options set,
>>> including the C++ standard version in our case.
>>> Thus, you indeed need to clean and rebuild once.
>>>
>>> The solution for this would be to not use default_options and add the flag
>>> to qemu_cflags instead. It's the same limitation if we change the default
>>> warning level, or any other option set with default_options.
>>
>> If that's correct as the root cause, then it feels like this is a meson bug
>> that ought to be reported upstream. Any meson.build default_options changes
>> that affect the compiler behaviour should invalidate cache in the same way
>> as when we modify qemu_cflags.
>>
>
> I totally agree with you Daniel, and I've been bitten by that in my
> previous company when updating cpp standard we used. As you can see, it
> slipped out of my mind for current series...
>
> I never understood why it had this counter intuitive behaviour, and
> didn't bother to report to be honest, I simply switched to manual flags
> instead at the time.
> Meson devs usually have a strong opinion of how things should be, so I
> don't expect this to be something that fell through the cracks but a
> deliberate design choice.
>
> EDIT: after typing the answer above, did a quick search, and indeed,
> it's how it's supposed to be. So be it.
> https://github.com/mesonbuild/meson/issues/13556
>
>> With regards,
>> Daniel
>
> Regards,
> Pierrick
Paolo, since it seems complicated to change this in meson, should we at
least remove C and C++ standard from default_options, and rely on manual
flags instead?
Probably, same goes for rust standard when we'll have to update it to 2024.
I'll let you (or anyone else on the thread more legitimate than me)
judge what's the best approach on this, and I can help to implement it
if needed.
Regards,
Pierrick
^ permalink raw reply [flat|nested] 33+ messages in thread