Re: [PATCH v2 35/35] plugins: Iterate on cb_lists in qemu_plugin_user_exit

2023-01-25 Thread Philippe Mathieu-Daudé

On 24/1/23 19:01, Alex Bennée wrote:

From: Richard Henderson 

Rather than iterate over all plugins for all events,
iterate over plugins that have registered a given event.

Signed-off-by: Richard Henderson 
Message-Id: <20230117035701.168514-4-richard.hender...@linaro.org>


(Missing Alex's S-o-b)


---
  plugins/core.c | 7 ---
  1 file changed, 4 insertions(+), 3 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 





[PATCH v2 35/35] plugins: Iterate on cb_lists in qemu_plugin_user_exit

2023-01-24 Thread Alex Bennée
From: Richard Henderson 

Rather than iterate over all plugins for all events,
iterate over plugins that have registered a given event.

Signed-off-by: Richard Henderson 
Message-Id: <20230117035701.168514-4-richard.hender...@linaro.org>
---
 plugins/core.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/plugins/core.c b/plugins/core.c
index 728bacef95..e04ffa1ba4 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -514,9 +514,10 @@ void qemu_plugin_user_exit(void)
 /* un-register all callbacks except the final AT_EXIT one */
 for (ev = 0; ev < QEMU_PLUGIN_EV_MAX; ev++) {
 if (ev != QEMU_PLUGIN_EV_ATEXIT) {
-struct qemu_plugin_ctx *ctx;
-QTAILQ_FOREACH(ctx, , entry) {
-plugin_unregister_cb__locked(ctx, ev);
+struct qemu_plugin_cb *cb, *next;
+
+QLIST_FOREACH_SAFE_RCU(cb, _lists[ev], entry, next) {
+plugin_unregister_cb__locked(cb->ctx, ev);
 }
 }
 }
-- 
2.34.1