From patchwork Tue May 14 18:00:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 13664332 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7031C25B75 for ; Tue, 14 May 2024 18:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=MtyCdT6jnxcyYvF8o0BRjU2OUrt4yR8a6JMkYqaF3VE=; b=BHu4x8SbqcC8HI +3PhCpGTe6JH6y3ewxdrkJK+FdllVDBFbj5DrddB+15CZkKcFyde3ZyVtd8odDPrApZFyM8O+Napl qwHscQJnfXBIfnXP0P4poypR4Dftbah4E8xz8RgzH4UOnsHpl0JNkn6jCokQsOoiUff9AM7wK9zcy N35S0D7KaOtVOXaoBX3CdIdW3KgjWbjsyVe1LwgzW0NjQxwdgPXfwVrbaASFZXmLGhyRMyOk61vO9 J5ls7IMPMktZwv+s99r+sBPBv1fPUAejo1yzJTDD5zkGyfgYSt1+xlDcxv+c/gEPvQWMrIRRq4/C4 vJmxp9r1X9kIP/4Dbw/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6wSO-0000000GlDn-1N05; Tue, 14 May 2024 18:00:56 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6wSL-0000000GlBb-3oxW for linux-arm-kernel@lists.infradead.org; Tue, 14 May 2024 18:00:55 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8AEA3612B1; Tue, 14 May 2024 18:00:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA626C2BD10; Tue, 14 May 2024 18:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715709651; bh=U1yWnXT2Sr4P5dC2uObQWu8ccCunhmR9/1rilnD2jBg=; h=From:To:Cc:Subject:Date:From; b=oxWmw0TaAaRNZ3X0MvdRTyFoL/SoNARC5pKMO+sapb0WN1m8CtTZxnq1t8OBxWuNh aUEKCpfw2w+yQMts+xQAmxavfC3+OcRPzkOHL0pY1sdzCTmPVLUxiNihOToWv1IDDU Pm0ML4l645Qy3DVfZ134gtWjn2d6BKJpqkrNf5T5gnGSOTw5JpLVP/k/xHsYFawCdI qk2+3iyQ3EUSeGUEGpXfaC5NiEICBqoiZ+iS0eptPMwav5ZuC4u0wC71893Pu3l38X El+1yh4PAmN2S6lxHRodlnMMk0O/TuQ7tperO9IZ2KIbEb3ywXEYN9hKxGxIRhKpXw Rv+RswwYubt3w== From: Namhyung Kim To: Will Deacon , Mark Rutland Cc: Ingo Molnar , Peter Zijlstra , LKML , linux-arm-kernel@lists.infradead.org, Greg Thelen , Robin Murphy , Tuan Phan Subject: [PATCH] perf/arm-dmc620: Fix lockdep assert in ->event_init() Date: Tue, 14 May 2024 11:00:50 -0700 Message-ID: <20240514180050.182454-1-namhyung@kernel.org> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240514_110054_013861_0075F5B6 X-CRM114-Status: GOOD ( 14.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org for_each_sibling_event() checks leader's ctx but it doesn't have the ctx yet if it's the leader. Like in perf_event_validate_size(), we should skip checking siblings in that case. Fixes: f3c0eba287049 ("perf: Add a few assertions") Reported-by: Greg Thelen Cc: Robin Murphy Cc: Tuan Phan Signed-off-by: Namhyung Kim Reviewed-by: Robin Murphy Acked-by: Mark Rutland --- drivers/perf/arm_dmc620_pmu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c index 8a81be2dd5ec..88c17c1d6d49 100644 --- a/drivers/perf/arm_dmc620_pmu.c +++ b/drivers/perf/arm_dmc620_pmu.c @@ -542,12 +542,16 @@ static int dmc620_pmu_event_init(struct perf_event *event) if (event->cpu < 0) return -EINVAL; + hwc->idx = -1; + + if (event->group_leader == event) + return 0; + /* * We can't atomically disable all HW counters so only one event allowed, * although software events are acceptable. */ - if (event->group_leader != event && - !is_software_event(event->group_leader)) + if (!is_software_event(event->group_leader)) return -EINVAL; for_each_sibling_event(sibling, event->group_leader) { @@ -556,7 +560,6 @@ static int dmc620_pmu_event_init(struct perf_event *event) return -EINVAL; } - hwc->idx = -1; return 0; }