Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2850169lqo; Tue, 14 May 2024 11:01:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOQ/jsMlUeQ8BHxG7xTSVpZcUQ8aLMeXBl9ni+areyJJ0vBa4Hfp3EjM+mhJJqHyYdsKtp5/hkNa3Usl1k7UoHr/IgbxEm5Vi0HaiEZQ== X-Google-Smtp-Source: AGHT+IF0APS2Mx+jZsGdTIhDnikiFU4pdOMu0Al9LPwUosy3VbJj9ttk1yINaanFUpBP7xtu45Ta X-Received: by 2002:a05:6a20:43a5:b0:1af:df82:9999 with SMTP id adf61e73a8af0-1afdf829a5dmr14922841637.31.1715709666975; Tue, 14 May 2024 11:01:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715709666; cv=pass; d=google.com; s=arc-20160816; b=p0uRfknQsuOaKcjiUfhu5S8+k9gkSZcSnwi7G16jFA/laOaJ6nUrmzX/JL27BBvb6R A9lpldAp3zgUiieR8v9DMxhrl78LgksmCJhB3jSEjKVV0QYvXjJQ9YNR2HclfL0MYuEF 4j+Egxc9HBDSemOIyhKLTtd2GiV7MsxAyR/EcADWIJIOAo30H9Q4RQZDLLlhXwHgZiGi DIN7qn5Tc6lYNLnZHOZCiqK114yGtT66IDWZJEtOTcgtui5tvtvH6xzitI2LZSGFUQg7 ZI6F/gDBE1w4MT9nnYuQ0WC1Ew272s0KvIcIPrNfxld7goXgTEcdrEal0osCljULFpR7 fYSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=h/n1LzLBVEihFmOMqDOQX7cUoCLuDgiqsWifZ+xyPs4=; fh=db4ae0fct27Iyv+0ppqpIkvBqsVyaSKsxLdqxxuRUsw=; b=kRgH6rs9qxwf+gxt1EK2UIu6YwbVrfuw0UOf8alDyoUlMxu3eYvFPnAFxkqbJEIKJa BUY4z5Mx7sAn+782AvRuHA4/ZQqEVfln/UFy8js2R91j2PVqtHSW6+fs0MfI3FuD76mZ czDrRK5irLdNLkYyzB3gwLjqw5GUWSq/dXKYLYpQ6V4xlDOEZ1U57XwVUtu7mHqHm+TJ aVxX2e0ZetYsvnzNwKwtBc3T+yYHAqQQtBj/mitLeorgF9/dx/OLDrmnakSsXdonjrfQ P9VzhV3nzkCvw/+t8hsRJg59JaE7NQGgW7Ky9+n5pntLwYo0BiuAfr1Hu+hvRb55yOhr 8FFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oxWmw0Ta; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f6eb8si11703996a12.399.2024.05.14.11.01.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 11:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oxWmw0Ta; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 00C28282027 for ; Tue, 14 May 2024 18:01:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 339F91802CB; Tue, 14 May 2024 18:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oxWmw0Ta" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EFDA1802BC for ; Tue, 14 May 2024 18:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715709651; cv=none; b=J6yNxnAouHbdyitdzU05929YCz1a3DjrtjGnSzJXb5PwIj3VKTr3EOX04ZXy0hlsD7A/tUsc+id7WHUVYOou+lHNEXVI6fvbllHaMjEknDbVoyDm9T9bnZ+egYSx7pA58aCIgzN33sE9OBqTiiGwUSo0upHGqOUrKeih/MupBMY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715709651; c=relaxed/simple; bh=U1yWnXT2Sr4P5dC2uObQWu8ccCunhmR9/1rilnD2jBg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aAVA+9y5rhrjUNtblc/S9PxwVnCOIRrqS3CGQOWhv5eUWlsTeUsVASWC7UJQxSyuvzC2JN4sUwq/kB2l9NQ3aV0lz9y/wZC5Lbd7mptnjbIy0CSGZerjyi9g3m+9ZsRJXKNTDDZ0gB9iAAfFiXPGsUUui2tRlToebRAJ6H5XirU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oxWmw0Ta; arc=none smtp.client-ip=10.30.226.201 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; } -- 2.45.0.rc1.225.g2a3ae87e7f-goog