Re: [RFC PATCH] plugins: shorten aggressively long name
On 11/21/25 5:03 AM, Alex Bennée wrote:
The old name comes in at a 51 characters, contains at least one
redundant token and exec is arguably implied by inline as all inline
operations occur when instructions are executing.
By putting the name on a substantial diet we can reduce it by 15% and
gain valuable white-space in the process.
Signed-off-by: Alex Bennée
---
include/qemu/qemu-plugin.h| 4 ++--
contrib/plugins/cflow.c | 22 +++---
contrib/plugins/howvec.c | 2 +-
contrib/plugins/stoptrigger.c | 10 ++
plugins/api.c | 2 +-
tests/tcg/plugins/discons.c | 18 +-
tests/tcg/plugins/inline.c| 6 +++---
tests/tcg/plugins/insn.c | 5 +++--
8 files changed, 36 insertions(+), 33 deletions(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 60de4fdd3fa..29663591ebf 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -516,7 +516,7 @@ void qemu_plugin_register_vcpu_insn_exec_cond_cb(
void *userdata);
/**
- * qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inline op
+ * qemu_plugin_register_inline_per_vcpu() - insn exec inline op
* @insn: the opaque qemu_plugin_insn handle for an instruction
* @op: the type of qemu_plugin_op (e.g. ADD_U64)
* @entry: entry to run op
@@ -525,7 +525,7 @@ void qemu_plugin_register_vcpu_insn_exec_cond_cb(
* Insert an inline op to every time an instruction executes.
*/
QEMU_PLUGIN_API
-void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(
+void qemu_plugin_register_inline_per_vcpu(
struct qemu_plugin_insn *insn,
enum qemu_plugin_op op,
qemu_plugin_u64 entry,
diff --git a/contrib/plugins/cflow.c b/contrib/plugins/cflow.c
index b5e33f25f9b..cef5ae2239f 100644
--- a/contrib/plugins/cflow.c
+++ b/contrib/plugins/cflow.c
@@ -320,14 +320,14 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
* check where we are at. Do this on the first instruction and not
* the TB so we don't get mixed up with above.
*/
-qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn,
-
QEMU_PLUGIN_INLINE_STORE_U64,
- end_block,
qemu_plugin_insn_vaddr(last_insn));
-qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn,
-
QEMU_PLUGIN_INLINE_STORE_U64,
- pc_after_block,
-
qemu_plugin_insn_vaddr(last_insn) +
-
qemu_plugin_insn_size(last_insn));
+qemu_plugin_register_inline_per_vcpu(first_insn,
+ QEMU_PLUGIN_INLINE_STORE_U64,
+ end_block,
qemu_plugin_insn_vaddr(last_insn));
+qemu_plugin_register_inline_per_vcpu(first_insn,
+ QEMU_PLUGIN_INLINE_STORE_U64,
+ pc_after_block,
+ qemu_plugin_insn_vaddr(last_insn) +
+ qemu_plugin_insn_size(last_insn));
for (int idx = 0; idx < qemu_plugin_tb_n_insns(tb); ++idx) {
struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, idx);
@@ -355,9 +355,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
}
/* Store the PC of what we are about to execute */
-qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(insn,
-
QEMU_PLUGIN_INLINE_STORE_U64,
-last_pc, ipc);
+qemu_plugin_register_inline_per_vcpu(insn,
+ QEMU_PLUGIN_INLINE_STORE_U64,
+ last_pc, ipc);
}
}
diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
index 42bddb6566d..c60737d57f1 100644
--- a/contrib/plugins/howvec.c
+++ b/contrib/plugins/howvec.c
@@ -321,7 +321,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
if (cnt) {
if (do_inline) {
-qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(
+qemu_plugin_register_inline_per_vcpu(
insn, QEMU_PLUGIN_INLINE_ADD_U64,
qemu_plugin_scoreboard_u64(cnt), 1);
} else {
diff --git a/contrib/plugins/stoptrigger.c b/contrib/plugins/stoptrigger.c
index b3a6ed66a7b..68c0ed432af 100644
--- a/contrib/plugins/stoptrigger.c
+++ b/contrib/plugins/stoptrigger.c
@@ -73,10 +73,12 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
if (exit_on_icount) {
Re: [RFC PATCH] plugins: shorten aggressively long name
On 28/11/2025 10:40, Yodel Eldar via wrote: Hi, Alex! On 21/11/2025 07:03, Alex Bennée wrote: The old name comes in at a 51 characters, contains at least one redundant token and exec is arguably implied by inline as all inline operations occur when instructions are executing. By putting the name on a substantial diet we can reduce it by 15% and gain valuable white-space in the process. Thanks for proposing this: 51 characters does seem rather excessive! Signed-off-by: Alex Bennée --- include/qemu/qemu-plugin.h | 4 ++-- contrib/plugins/cflow.c | 22 +++--- contrib/plugins/howvec.c | 2 +- contrib/plugins/stoptrigger.c | 10 ++ plugins/api.c | 2 +- tests/tcg/plugins/discons.c | 18 +- tests/tcg/plugins/inline.c | 6 +++--- tests/tcg/plugins/insn.c | 5 +++-- 8 files changed, 36 insertions(+), 33 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 60de4fdd3fa..29663591ebf 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -516,7 +516,7 @@ void qemu_plugin_register_vcpu_insn_exec_cond_cb( void *userdata); /** - * qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inline op + * qemu_plugin_register_inline_per_vcpu() - insn exec inline op * @insn: the opaque qemu_plugin_insn handle for an instruction * @op: the type of qemu_plugin_op (e.g. ADD_U64) * @entry: entry to run op @@ -525,7 +525,7 @@ void qemu_plugin_register_vcpu_insn_exec_cond_cb( * Insert an inline op to every time an instruction executes. */ QEMU_PLUGIN_API -void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( +void qemu_plugin_register_inline_per_vcpu( struct qemu_plugin_insn *insn, enum qemu_plugin_op op, qemu_plugin_u64 entry, Could we preserve naming consistency with its sibling functions, tb and mem, by, say, removing the "_per_vcpu" thereby implying thread-safety instead? I.e., qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu -> qemu_plugin_register_vcpu_insn[_exec]_inline qemu_plugin_register_vcpu_mem_inline_per_vcpu -> qemu_plugin_register_vcpu_mem_inline qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu -> qemu_plugin_register_vcpu_tb[_exec]_inline Since the series, [email protected], that introduced the cycle also removed the non-thread-safe versions in fba3b490a, perhaps we could recycle the retired names sans the arguably redundant "exec." If we do remove the "exec" tokens, we should probably do the same for the corresponding callback functions, too: qemu_plugin_register_vcpu_insn_exec_cb -> qemu_plugin_register_vcpu_insn_cb -> qemu_plugin_register_vcpu_tb_exec_cb -> qemu_plugin_register_vcpu_tb_cb Nevermind about the callbacks: these don't enjoy implication via "inline." Sorry about the noise. Thanks, Yodel diff --git a/contrib/plugins/cflow.c b/contrib/plugins/cflow.c index b5e33f25f9b..cef5ae2239f 100644 --- a/contrib/plugins/cflow.c +++ b/contrib/plugins/cflow.c @@ -320,14 +320,14 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) * check where we are at. Do this on the first instruction and not * the TB so we don't get mixed up with above. */ - qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn, - QEMU_PLUGIN_INLINE_STORE_U64, - end_block, qemu_plugin_insn_vaddr(last_insn)); - qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn, - QEMU_PLUGIN_INLINE_STORE_U64, - pc_after_block, - qemu_plugin_insn_vaddr(last_insn) + - qemu_plugin_insn_size(last_insn)); + qemu_plugin_register_inline_per_vcpu(first_insn, + QEMU_PLUGIN_INLINE_STORE_U64, + end_block, qemu_plugin_insn_vaddr(last_insn)); + qemu_plugin_register_inline_per_vcpu(first_insn, + QEMU_PLUGIN_INLINE_STORE_U64, + pc_after_block, + qemu_plugin_insn_vaddr(last_insn) + + qemu_plugin_insn_size(last_insn)); for (int idx = 0; idx < qemu_plugin_tb_n_insns(tb); ++idx) { struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, idx); @@ -355,9 +355,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) } /* Store the PC of what we are about to execute */ - qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(insn, - QEMU_PLUGIN_I
Re: [RFC PATCH] plugins: shorten aggressively long name
Hi, Alex! On 21/11/2025 07:03, Alex Bennée wrote: The old name comes in at a 51 characters, contains at least one redundant token and exec is arguably implied by inline as all inline operations occur when instructions are executing. By putting the name on a substantial diet we can reduce it by 15% and gain valuable white-space in the process. Thanks for proposing this: 51 characters does seem rather excessive! Signed-off-by: Alex Bennée --- include/qemu/qemu-plugin.h| 4 ++-- contrib/plugins/cflow.c | 22 +++--- contrib/plugins/howvec.c | 2 +- contrib/plugins/stoptrigger.c | 10 ++ plugins/api.c | 2 +- tests/tcg/plugins/discons.c | 18 +- tests/tcg/plugins/inline.c| 6 +++--- tests/tcg/plugins/insn.c | 5 +++-- 8 files changed, 36 insertions(+), 33 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 60de4fdd3fa..29663591ebf 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -516,7 +516,7 @@ void qemu_plugin_register_vcpu_insn_exec_cond_cb( void *userdata); /** - * qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inline op + * qemu_plugin_register_inline_per_vcpu() - insn exec inline op * @insn: the opaque qemu_plugin_insn handle for an instruction * @op: the type of qemu_plugin_op (e.g. ADD_U64) * @entry: entry to run op @@ -525,7 +525,7 @@ void qemu_plugin_register_vcpu_insn_exec_cond_cb( * Insert an inline op to every time an instruction executes. */ QEMU_PLUGIN_API -void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( +void qemu_plugin_register_inline_per_vcpu( struct qemu_plugin_insn *insn, enum qemu_plugin_op op, qemu_plugin_u64 entry, Could we preserve naming consistency with its sibling functions, tb and mem, by, say, removing the "_per_vcpu" thereby implying thread-safety instead? I.e., qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu -> qemu_plugin_register_vcpu_insn[_exec]_inline qemu_plugin_register_vcpu_mem_inline_per_vcpu -> qemu_plugin_register_vcpu_mem_inline qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu -> qemu_plugin_register_vcpu_tb[_exec]_inline Since the series, [email protected], that introduced the cycle also removed the non-thread-safe versions in fba3b490a, perhaps we could recycle the retired names sans the arguably redundant "exec." If we do remove the "exec" tokens, we should probably do the same for the corresponding callback functions, too: qemu_plugin_register_vcpu_insn_exec_cb -> qemu_plugin_register_vcpu_insn_cb -> qemu_plugin_register_vcpu_tb_exec_cb -> qemu_plugin_register_vcpu_tb_cb Thanks, Yodel diff --git a/contrib/plugins/cflow.c b/contrib/plugins/cflow.c index b5e33f25f9b..cef5ae2239f 100644 --- a/contrib/plugins/cflow.c +++ b/contrib/plugins/cflow.c @@ -320,14 +320,14 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) * check where we are at. Do this on the first instruction and not * the TB so we don't get mixed up with above. */ -qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn, - QEMU_PLUGIN_INLINE_STORE_U64, - end_block, qemu_plugin_insn_vaddr(last_insn)); -qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn, - QEMU_PLUGIN_INLINE_STORE_U64, - pc_after_block, - qemu_plugin_insn_vaddr(last_insn) + - qemu_plugin_insn_size(last_insn)); +qemu_plugin_register_inline_per_vcpu(first_insn, + QEMU_PLUGIN_INLINE_STORE_U64, + end_block, qemu_plugin_insn_vaddr(last_insn)); +qemu_plugin_register_inline_per_vcpu(first_insn, + QEMU_PLUGIN_INLINE_STORE_U64, + pc_after_block, + qemu_plugin_insn_vaddr(last_insn) + + qemu_plugin_insn_size(last_insn)); for (int idx = 0; idx < qemu_plugin_tb_n_insns(tb); ++idx) { struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, idx); @@ -355,9 +355,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) } /* Store the PC of what we are about to execute */ -qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(insn, - QEMU_PLUGIN_INLINE_STORE_U64, -last_pc, ipc); +qemu_plugin_register_inline_per_vcpu(insn, +
