From mboxrd@z Thu Jan 1 00:00:00 1970 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 14630C04FFE for ; Fri, 17 May 2024 12:17:09 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FLML9LlNAKxI4HQ0eknHdOVr6SJcfmiYGVRfdSm0w0E=; b=HlWOBJSk6lRSPL CM/3KfU7E5T5mzHfJRyQ5JlK00rtGyBtwOOkDlHLmKodhc14fWrFfxdVYpHKaK/TXCTiq3r/XmuNL I2GxVjTK+XMcBMka+PzBkb+Dxx2OECLjN7j7T0sioJDax4CcbktcmRipJJ+jJXizdyl+HmXU+I/Tp BXsGcgPmEiMjpb/9PYh7wVwzuuZ7ayZY6+sT7f0mCrJ2L/YpSCit2xgDLPBi6WZ2gLsolkonK2v+J NJq9k+1trIX/+Y5uPBZUucwmdcf4eFhAbpsaytPjsThlJcdxKAuJNNukdtAY7vM12jJAA14t6VBcf VdocI/U/0aSu6bG6MF6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7wW6-00000007nTJ-3yAH; Fri, 17 May 2024 12:16:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7wW2-00000007nR8-1wCR for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 12:16:53 +0000 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 85D5B1424; Fri, 17 May 2024 05:17:08 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3901C3F7A6; Fri, 17 May 2024 05:16:41 -0700 (PDT) Message-ID: Date: Fri, 17 May 2024 13:16:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] perf/arm-dmc620: Fix lockdep assert in ->event_init() To: Will Deacon , Namhyung Kim Cc: Mark Rutland , Ingo Molnar , Peter Zijlstra , LKML , linux-arm-kernel@lists.infradead.org, Greg Thelen , Tuan Phan References: <20240514180050.182454-1-namhyung@kernel.org> <20240517120234.GA32598@willie-the-truck> From: Robin Murphy Content-Language: en-GB In-Reply-To: <20240517120234.GA32598@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_051650_597940_1F0D4257 X-CRM114-Status: GOOD ( 19.01 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 17/05/2024 1:02 pm, Will Deacon wrote: > On Tue, May 14, 2024 at 11:00:50AM -0700, Namhyung Kim wrote: >> 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 >> --- >> 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; Oh, come to think of it, I believe we shouldn't actually need to keep this check either, since commit bf480f938566 ("perf/core: Don't allow grouping events from different hw pmus"). Thanks, Robin. >> >> 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; >> } > > Thanks, I'll pick this up, although Mark reckoned he'd found some other > issues over at: > > https://lore.kernel.org/r/Zg0l642PgQ7T3a8Z@FVFF77S0Q05N > > but didn't elaborate on what exactly he'd found :/ > > Will > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel