From patchwork Tue Jan 17 03:57:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 643394 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp951306pvb; Mon, 16 Jan 2023 19:57:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXtU4L9kD8XDfgn9BAo5DnrmWcDDyEe5n7UugZt2IBN27A6s0x/C6zE3xVPM+VCX9uL5dqFJ X-Received: by 2002:a05:6214:451b:b0:532:ab2:992f with SMTP id oo27-20020a056214451b00b005320ab2992fmr3720216qvb.3.1673927872815; Mon, 16 Jan 2023 19:57:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673927872; cv=none; d=google.com; s=arc-20160816; b=s7lzOXY5WKrFJX/aBqKhHK1drVMeRveGz0TXaFtRgJm1EoC5GvjFirER6JgM62YepT JTp6vRN/WIlFGkcrR6ijKEfTlQtC6H25ms7W+jZupqnXjTTo4Uf2r1FeReE4fVOjONqK utc6DiXnTN0vKbwNM1DpdNojtDaXBT7ickSXgWQh5JCsd0vdOfE49PSBYtSb4pOnFaGl 7hh6bUu8AtDB3eFn61mTKNxJBMGsdrA0FXVaLMI6ho5ATGfkBZaTDIRHGtyjUTs26rD/ bHYZzEfM9s/nrsKn4RCIfxLhuEoR/TrgyukS+YnvTpwfrJ1csumh5nJGNKXHk2CaLG4O 34eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aGVt08F4UpzpEZ1GVThy9tOfv3POzTFbKCIbVhJ6UWA=; b=fF590N2BUq3Aq+4H1kpnTf/ycUw6Y9hcq9Q1dGh96Kc3X14dUVMWVPCJ4UsWc/Qzz6 w9fB/+IC7RfhiNiMZoogkklZr7Q+C4WIPWrlCS6Tziuq75ADQsHNNI9HelC1Fjr/9lD4 QOJwP56xdW28dirCLjORynL/OIbZDyw0MJjxUSTLYqdseBp47v5mhZge5BpHK0t0UxXp HyCq4Qf8sPT9wb5T7BqfzziNVN9/Js8CrYYD7wJFGXKwm+CFIHdnkwTgrqYjg+4HSXRq DrKxMv9Dafh5QgAwjMrEhAjR6q/pvCbusEHoqLYNHM01Q9Ug1i6VLIxXCX5RmVys4Xgt p1/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ygUbIQ0w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 13-20020a05621420cd00b004c749392024si19193220qve.364.2023.01.16.19.57.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jan 2023 19:57:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ygUbIQ0w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHd68-0000Vf-Gv; Mon, 16 Jan 2023 22:57:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHd64-0000Se-9U for qemu-devel@nongnu.org; Mon, 16 Jan 2023 22:57:18 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHd62-0005eC-Gz for qemu-devel@nongnu.org; Mon, 16 Jan 2023 22:57:16 -0500 Received: by mail-pl1-x634.google.com with SMTP id r21so170288plg.13 for ; Mon, 16 Jan 2023 19:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aGVt08F4UpzpEZ1GVThy9tOfv3POzTFbKCIbVhJ6UWA=; b=ygUbIQ0w0isWjuC5WTNZlJhQD8+WzLJjdUxQCeBOFUaR8PPb2IYWaua/g5cBtIBceu cqpmbq5rCW/24Ha0El+wuRvL8991P5FyOSWZ0AhHPZDJ1+RVT/BOc3pGlihrFXRXqKV3 iNd43rGa2o/hxfWB3XAjnr+1yArYALTomVOmo9nxzmbxqpvoYWbzFnJL/PTmllWLzaZw +q4Oi9SqwaJTpArAV7EBj+xdnT00uxIpzv0itSiB3CXa+sVrmDx7RWa7uhIJI4DgGwps rIKR1ofwG144nqmLspMS/jbMXbLx/sKWgN8ypAawhPmh6J60WJ/YqfCXIikJSA30WZzO VrJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aGVt08F4UpzpEZ1GVThy9tOfv3POzTFbKCIbVhJ6UWA=; b=LsMkdZbAjeoAZhcIe26S0qVzxxyM4e+lIQBpbj7bXOPm1QQn+FlJS42N2PTpbVZ6aX w4IxmsUsG+8YVdGf8QTNMQY6dtYFh/48n8sIqRJeA/6vUkqFoB5/bIIaukHQ1UWeCSNI DFWUcOOzedh3Wzl4xbpe5CmYBdCz8LEmk+cYmJ7MYYNdWzpbTBbIhZUdzEmqAZkjhxxg jG64ng5gl8jfQFQo463Xs8grx6Y5Mv2JCbH0hk0sbep7FNcQP4KFqsFR2hvhEKRxYlks wM9JT2Pd57mzNC6oOyzIujvkhQrsAlYpBZ2gmK3ciDQqnCuFYUZS30B2TAZZ0jw+wfO5 afMA== X-Gm-Message-State: AFqh2kpDQwms2cQVlsnZt5mzA5LQTvazeAhR8xDiYuboJMyWpSykvkmJ 37W0wVy+lbPnFQQdbRYCh3lInfEugJio+5Nt X-Received: by 2002:a17:902:c10d:b0:185:441e:4cfc with SMTP id 13-20020a170902c10d00b00185441e4cfcmr2202333pli.44.1673927828727; Mon, 16 Jan 2023 19:57:08 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id z15-20020a1709027e8f00b001869079d083sm19991531pla.90.2023.01.16.19.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 19:57:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org Subject: [PATCH 3/3] plugins: Iterate on cb_lists in qemu_plugin_user_exit Date: Mon, 16 Jan 2023 17:57:01 -1000 Message-Id: <20230117035701.168514-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117035701.168514-1-richard.henderson@linaro.org> References: <20230117035701.168514-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than iterate over all plugins for all events, iterate over plugins that have registered a given event. Signed-off-by: Richard Henderson --- plugins/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/core.c b/plugins/core.c index 35aca0266d..f22f8edc74 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -509,9 +509,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); } } }