Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp899994lqo; Fri, 17 May 2024 05:17:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4KyhH0z5Dn8zHeM+xgv43yIkBLiJ1nygegRmg+oXB4ypuS+moEUazE/S3efKNpz9+CmtSuIw7/zbqSAMQwKJe261MzD6d3bU62kE+ZQ== X-Google-Smtp-Source: AGHT+IE72iE75NJEDU0cCL+oOuKQ5I6HiVsh944u8acG4zJEO8fOUs1ZadaZMjjiJ+b0q1atTJ9Q X-Received: by 2002:a05:6a00:2d8e:b0:6e6:946b:a983 with SMTP id d2e1a72fcca58-6f4e02ac8e1mr24356933b3a.10.1715948246493; Fri, 17 May 2024 05:17:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715948246; cv=pass; d=google.com; s=arc-20160816; b=HGN85S1u1dHJQRIwH+ruqLq0zm7N9a+6kZ9cM6VRa7dGyLBn6Uy9loMLAn0QpYsNOv rFN4wj3uSCmfGwD8bu52Ev5thE22nAQFi1abgkeoWAfBaQncW7aDHNn481wYe2ZAFm61 jf/4rQdLw1DXHrnrtmjMkHeH6u8VGhECZY4zCviTalHtvAp8jHvH8XaoTJVBXyUPw/7+ DR6lWyP5Vyc2lNBVZEPLoFyDy3Jrlt+s7xoo3SX3CBuiPqGZ0jpyE0cQwF0H43JM9PPN C1LYpIK+ynmSI9anjyi0zS54LCgt1TlORQOnYFFi7bZ0FXxaai7aOG5mN/5EkfGQ8RiZ PvIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=b8ehqQIObctGXgZUp218gF3DVq+NiS/vg3PSRad0RGw=; fh=z5c5ttwAEqLXl9omeq8qoTlkt1QaeuiWFXG+hRzRHvg=; b=JwlAjt38qOdsdhwiCfdtVcfpiE5q/oKR9+iITuH4+8PfClvfnIdhd9r55titAX6XRO zfhaxmYPrLzCLxW4FIY8B6fcFhsLInzLH6F6vvcdP6SMp992ehpzSHnPLGuhH71CvT8k GoFiHb8pabMkjBrmzBUyYIXYaMhK4wSqRrGR6SV7t3c/aSGNp73oxmeeJdsPlvYCkdRH moV39p3Tdk0Ig5oHwiGWkX+LPcqq24t7yTfLbKTTLbtc45toBWOGJtn48JSTZrReBUVi LWFYv52gO41UmLY9DkwsQoJLO3wK4kLrBpsrgA4juYHuzXECZdN0x9bmGVPI5MH9cCYI DafA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-182092-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2aee5fasi18291533b3a.155.2024.05.17.05.17.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 05:17:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182092-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-182092-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 26253B2155A for ; Fri, 17 May 2024 12:16:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E797D41214; Fri, 17 May 2024 12:16:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEFFE18651 for ; Fri, 17 May 2024 12:16:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715948208; cv=none; b=OpnSXjzHkwkpvfxTW168uJB9pSaNBcky3qKB+dMouesQPNsGMgaMkN22cjUkiLG4mXfr8cP6kmaYAR6dqrb1HwqpxxK+q5qXE7l5Ocek7ZQx+y5Sv+LmZz/8hZmLqj/O8WxzGSsBYRtJp1ZaXeyUEY0MzjvpSULn56p7wbbzgkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715948208; c=relaxed/simple; bh=FMEIJwpBSoHxgQQzBAd+1A3d9AcAxtLG1GG25U5na/w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dckb6EKzw8WbG+mC2HSWuHqJlHv7Ls17uPrNmhY+Yk7uCPXPBGEAa0TEkY+Wb/KvPu8Mxhfa6FNYSDCIPsSC1EQqWbq3fMTPw/e5AW+96jOIZNb5iB5TQMaweTy8izg4dtnq7t2GeGJ28m3z8g8KEjpsbb71fyu0iFysdcPE2N8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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