Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1F7CC61DA3 for ; Fri, 27 Jan 2023 14:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233293AbjA0OcE (ORCPT ); Fri, 27 Jan 2023 09:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233311AbjA0Ob6 (ORCPT ); Fri, 27 Jan 2023 09:31:58 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2A8582400; Fri, 27 Jan 2023 06:31:53 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 680962B; Fri, 27 Jan 2023 06:32:35 -0800 (PST) Received: from e126815.warwick.arm.com (e126815.arm.com [10.32.32.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC4E73F5A1; Fri, 27 Jan 2023 06:31:51 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org, peterz@infradead.org, ravi.bangoria@amd.com Cc: James Clark , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org Subject: [PATCH 0/1] perf: Fix warning from concurrent read/write of perf_event_pmu_context Date: Fri, 27 Jan 2023 14:31:40 +0000 Message-Id: <20230127143141.1782804-1-james.clark@arm.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter and Ravi, I came across this issue, and I also found there was a syzbot report for it and linked it on the commit. I have one question about the fix, where I had to remove the if (epc->ctx) from put_pmu_ctx(). I assume this was added for a reason, but I can't see where it's not ever set? Unless it's removed, the function got a lot more complicated to take the lock before the reference decrement. Also now I think the atomic type for epc->refcount is redundant, because everything is always done with the lock held. Except for get_pmu_ctx(), but that is just a read for a warning. So unless you think the scope of my extra locking can be reduced, I would probably also send a commit to remove that as well. Thanks James James Clark (1): perf: Fix warning from concurrent read/write of perf_event_pmu_context kernel/events/core.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) base-commit: 5912e15f25d6d584f3b8449e0b6a244a0f4f0903 -- 2.39.1