From mboxrd@z Thu Jan 1 00:00:00 1970 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 D669C20B213; Fri, 6 Dec 2024 15:20:02 +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=1733498402; cv=none; b=j8e/gUVjCVAsXwqx7a9GaQ4xtNwU0EGG/iyoihmASZXBV1b2fCsGCzBMewyVhwvIlwHiq9TxqVo7iMz+nSfwnC3uk5tUgTbMWvfn/OVrPtPDlPxFSMmboTLvp7JR8yzGZ0fVbgky418UkodKXvt3Uvn+iDyEHoizim5R4xePGWA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733498402; c=relaxed/simple; bh=f6V9dyJhrzIN/eykcQneu6gFVZ/627Yrt98VKZdlptM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F6drArhucaKz8X5/UKu6QX1tVCWTFnkkHenhE3/rOdB2KoDpliEDibC4Upx7P3kF6cFsZ14j14toy0kaHkcHgKa9p+13DmGDu42tndfrkVbmXnSMaio7N8oqstsRReRecMXuB9f8c72yz9F93aI4+VZZcwactunDm/3QkUnA9y0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=U00Oq0Ds; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="U00Oq0Ds" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF85C4CED1; Fri, 6 Dec 2024 15:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733498402; bh=f6V9dyJhrzIN/eykcQneu6gFVZ/627Yrt98VKZdlptM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U00Oq0DsAur+49n1HEuAdzPiYzyjFKSu21UYWL4whtzyfMmHSDAiEnGY8uzxzivpb 9CMBZ38pUfUbUWWROKAkmkrVBXAQKBahPjRuKWN4ILxAmbowbK9mxQ2jrZVH34TCcA Swb6bCekt36Gx1Z4ISpJyaGXsi1Za4FkLzr8M0xs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Greg Thelen , Namhyung Kim , Robin Murphy , Tuan Phan , Chun-Tse Shao , Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH 6.6 574/676] perf/arm-smmuv3: Fix lockdep assert in ->event_init() Date: Fri, 6 Dec 2024 15:36:33 +0100 Message-ID: <20241206143715.778011069@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206143653.344873888@linuxfoundation.org> References: <20241206143653.344873888@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chun-Tse Shao [ Upstream commit 02a55f2743012a8089f09f6867220c3d57f16564 ] Same as https://lore.kernel.org/all/20240514180050.182454-1-namhyung@kernel.org/, we should skip `for_each_sibling_event()` for group leader since it doesn't have the ctx yet. Fixes: f3c0eba28704 ("perf: Add a few assertions") Reported-by: Greg Thelen Cc: Namhyung Kim Cc: Robin Murphy Cc: Tuan Phan Signed-off-by: Chun-Tse Shao Acked-by: Will Deacon Link: https://lore.kernel.org/r/20241108050806.3730811-1-ctshao@google.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- drivers/perf/arm_smmuv3_pmu.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index 6303b82566f98..31e491e7f2065 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -431,6 +431,17 @@ static int smmu_pmu_event_init(struct perf_event *event) return -EINVAL; } + /* + * Ensure all events are on the same cpu so all events are in the + * same cpu context, to avoid races on pmu_enable etc. + */ + event->cpu = smmu_pmu->on_cpu; + + hwc->idx = -1; + + if (event->group_leader == event) + return 0; + for_each_sibling_event(sibling, event->group_leader) { if (is_software_event(sibling)) continue; @@ -442,14 +453,6 @@ static int smmu_pmu_event_init(struct perf_event *event) return -EINVAL; } - hwc->idx = -1; - - /* - * Ensure all events are on the same cpu so all events are in the - * same cpu context, to avoid races on pmu_enable etc. - */ - event->cpu = smmu_pmu->on_cpu; - return 0; } -- 2.43.0