From patchwork Tue Jan 24 18:01:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 646057 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp342640pvb; Tue, 24 Jan 2023 10:10:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXtpUuzdhgECa80S0CttFu976F3SkHZFJiRcxCCzXBoOLbgoYKXuGcSNInV/VSHzupajgbHv X-Received: by 2002:ac5:c8b4:0:b0:3e0:f90a:1f31 with SMTP id o20-20020ac5c8b4000000b003e0f90a1f31mr18702686vkl.6.1674583830449; Tue, 24 Jan 2023 10:10:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674583830; cv=none; d=google.com; s=arc-20160816; b=qKzDuqNXuro62GfOPh3eleFCufug2YQZ98MfbsnBXibvMj8jybR+ZluogUVDRkor+g 9n+yFTJMcJBdP3Udg3WN6jL/SQ31HNspM8HNhS6fmyxPDpfbC0/iomtN3SAmyhbU3kN3 K3MLGdawy9qSRkB3/hsz/x3Eu7Wn757YhB/6ei5q45PqngYfSqmku/Veq0i81OeHP1rt PXaKVajCeKMEK3E39vD7FkvgCYPnnRHuE1wIvczOQ5FL71QIWrrfbMvWblt3TNNiXC4k yKimgkLq+G7wz8gXkVg9XQv5tLKzn1A4/b7O7ABvvzxGApN4N/ASTE8n8w1VWgAIxBey 8bTg== 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=KCv4GZIK6k8jIwysULPrpggmGg7wtqEW43qJ6E7mFEA=; b=lErH+D8+kKch6KoNItipUb/I8E4ZyqkqYlrdKYEt9Kph+dEhvote3S28BM0TelAZRt Wn1T/fyFkFpyXcvWQoyaeVno6shMrHSeSprbgaj5ouq7mSrcoj/XwcpWC7TDCPEF/9h3 qScM2/JCgbTcpmzQR1zH3o9/OhQXiKqnlo824Nm60mbzO+1oszydqa5O9EE0tnj4xN8e 2VEeYeZFuxkVLwXEN4xfgfaULneXc6BxfN4KHqKnSqze/lYA9r5bFv0StTNx5cnj9Ysg T+Zf9AHUiYJv7GARWKFicszpNaKCrV6PXtEtrOLYg4daoi/+F/f8V73Z8syx0fb5hd91 OcmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MnYY6H5e; 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 d15-20020a05620a136f00b006fcaa1ec2d0si2123313qkl.571.2023.01.24.10.10.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jan 2023 10:10:30 -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=MnYY6H5e; 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 1pKNhf-0005cT-30; Tue, 24 Jan 2023 13:07:27 -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 1pKNhL-00057i-90 for qemu-devel@nongnu.org; Tue, 24 Jan 2023 13:07:09 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKNhH-00074t-1D for qemu-devel@nongnu.org; Tue, 24 Jan 2023 13:07:07 -0500 Received: by mail-wm1-x336.google.com with SMTP id f19-20020a1c6a13000000b003db0ef4dedcso13413590wmc.4 for ; Tue, 24 Jan 2023 10:07:02 -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=KCv4GZIK6k8jIwysULPrpggmGg7wtqEW43qJ6E7mFEA=; b=MnYY6H5edYg10qXbLwVMm/0qs99bf7I8cEPBz9gDAYjmZV2F+RpQZsinb92NxXZ+rB B3kWOtfsSiM/wp73MWRuonJse0PMOnSli0SqRqaHOjXzH8HdjStUJEQtFMWzEMpJLHp8 DNyP/lAv4iW+AJr7PLAnkWgIbM+/OT6wlE9Ps6s8eG7G4hXv03lSkCyDj0ywXJXtbfqS CDhCtcbAk5wxE8OMLNNh9WJJNrabyy9MClNkWm2lxvPfzommzfNuUnC3BhRZkLQ/8xon AcfoEJ3um4aCIrUj2iKIMOhwSILqkhLEfc8I+4ZJlooqEDNQdm2H9UsYrWV7gIVHw8BP E1eA== 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=KCv4GZIK6k8jIwysULPrpggmGg7wtqEW43qJ6E7mFEA=; b=BaOBu0qkYgOpgzcLF4wVo+hGOIT0tsR2D8U2pw6dAoEQ96uX67d6Va1hvREciYbAgk zsO9FpvF2++SXI/hZCRgssf72QkVopmQQ60+Dhi8IzKGkQTcbIAhbfhW4cngOqpbr/eZ FJ0stYL4RS/pDUGoL1LK4yBYBWPugwfy6xNK2UzC2srxzJIvwWrF+eFeQRQZF784PAfv 5odpp3PZKtZAiupf0zyrukv5MJU5jXh84iqCN2aVjlYGAXPk2m4Z9E14Ef65pThC+nsm 9CWutihFxKEi64YdGPKBu7603czjAjlq5Hi0u5z/HvxmXY9KL1YzDD3bG3unBOMxc4PN F2LA== X-Gm-Message-State: AFqh2kpQ7+6a/HduCEygFwU/o1RH4qBCq6oyQKIRLGY3HhNEzHVBYq9D 5qPCeyMP9ZdrO1S3VHxOgKc6Iw== X-Received: by 2002:a05:600c:3489:b0:3db:693:3fc9 with SMTP id a9-20020a05600c348900b003db06933fc9mr27692535wmq.27.1674583620890; Tue, 24 Jan 2023 10:07:00 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id h13-20020a05600c2cad00b003cfa622a18asm15401351wmc.3.2023.01.24.10.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 10:06:59 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BDE071FFD9; Tue, 24 Jan 2023 18:01:31 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Ed Maste , Thomas Huth , Alexandre Iooss , Markus Armbruster , Jagannathan Raman , John G Johnson , Mahmoud Mandour , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , Bandan Das , Elena Ufimtseva , Michael Roth , Eduardo Habkost , Beraldo Leal , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Qiuhao Li , Stefan Hajnoczi , Alexander Bulekov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Paolo Bonzini , Darren Kenny , qemu-arm@nongnu.org, Yanan Wang , Cleber Rosa , Wainer dos Santos Moschetta , Marcel Apfelbaum , Li-Wen Hsu , Peter Maydell Subject: [PATCH v2 35/35] plugins: Iterate on cb_lists in qemu_plugin_user_exit Date: Tue, 24 Jan 2023 18:01:27 +0000 Message-Id: <20230124180127.1881110-36-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230124180127.1881110-1-alex.bennee@linaro.org> References: <20230124180127.1881110-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.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 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.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé --- 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, &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); } } }