summary refs log tree commit diff stats
path: root/plugins/core.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-01-24 18:01:27 +0000
committerAlex Bennée <alex.bennee@linaro.org>2023-02-02 11:48:20 +0000
commitf45549233f67e5fd3038d2c886ef7de876c8ff01 (patch)
tree78cbca16fd59b45e3224c4ec57445716a11b1ab5 /plugins/core.c
parent882f5b1b4418cfa8f65ff2be52286247db40d152 (diff)
downloadfocaccia-qemu-f45549233f67e5fd3038d2c886ef7de876c8ff01.tar.gz
focaccia-qemu-f45549233f67e5fd3038d2c886ef7de876c8ff01.zip
plugins: Iterate on cb_lists in qemu_plugin_user_exit
Rather than iterate over all plugins for all events,
iterate over plugins that have registered a given event.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230117035701.168514-4-richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230124180127.1881110-36-alex.bennee@linaro.org>
Diffstat (limited to 'plugins/core.c')
-rw-r--r--plugins/core.c7
1 files 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, &plugin.ctxs, entry) {
-                plugin_unregister_cb__locked(ctx, ev);
+            struct qemu_plugin_cb *cb, *next;
+
+            QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
+                plugin_unregister_cb__locked(cb->ctx, ev);
             }
         }
     }