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 67A08C25B77 for ; Fri, 17 May 2024 12:18:24 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iVx0WbtNHzQiVzGJsrO/7P5eR5lW1rUsgUA1lbIzHKA=; b=PmKUqiIn5WPGdq OlYb3X2w96Q41nO5AAaeJNtevUechBWblVcPANJ5GD/ZKqoVjiEFWmvkbFyeWVfT0KlUrlJHH7aI2 jWWH9WuiOn491Thz6L1DVrTKB4/z/naLFCN0vb5tATxrPBHgliLbhR7Mzjsdkh1S+8ymH2kdZ8ieX N6ZHuKPqvuXL6BxiZ6ucmkhmf6Waet8z2nIqFARkvYYLXliQ2xU+3dsjRaW/l/MRESACrKbBxkaal +4enTfY+5MU//ZQOr1ALjMqKI/9GWOl+GP8e3GeeC48OTM4+wc3aGFAnVW+XA5qLDksoXgaEJI535 f/v439m6UEicKdEytbkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7wXL-00000007nsW-2LAV; Fri, 17 May 2024 12:18:11 +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 1s7wXI-00000007nrD-0dHd for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 12:18:10 +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 16DD21477; Fri, 17 May 2024 05:18:31 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 955213F7A6; Fri, 17 May 2024 05:18:05 -0700 (PDT) Date: Fri, 17 May 2024 14:17:59 +0200 From: Mark Rutland To: Will Deacon Cc: Namhyung Kim , Ingo Molnar , Peter Zijlstra , LKML , linux-arm-kernel@lists.infradead.org, Greg Thelen , Robin Murphy , Tuan Phan Subject: Re: [PATCH] perf/arm-dmc620: Fix lockdep assert in ->event_init() Message-ID: References: <20240514180050.182454-1-namhyung@kernel.org> <20240517120234.GA32598@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline 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_051808_291332_500C4E42 X-CRM114-Status: GOOD ( 28.94 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 17, 2024 at 01:02:34PM +0100, 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; > > > > 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 :/ Sorry; what I was referring to was that some drivers (including this one) also forgot to validate that the group size could actually fit on the PMU, which we're *supposed* to check, but if we fail to do so the only fallout is that events won't count and we waste a bit of time trying to schedule events unnecessarily. For this patch as-is: Acked-by: Mark Rutland ... and I'll try to take a look at the rest when I'm back in the UK. Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel