From nobody Sun Feb 8 13:39:30 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 65A5B1FF7A3; Mon, 2 Dec 2024 11:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733138061; cv=none; b=evMGISXtfHFBPiPFXASwdsh+HpOJ0xKjYncbEiXQpcL3x69ySyj/uThvB+mQ/USxhiEor78djq0MAED9GeicjDd/CcEEjJMor8JtUskrmjfKcgXLgfYvsrR5rqcUMK33vfr38BdSRmskq/r3C8NYK9TD3XQzin+NX5eQ46hyt8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733138061; c=relaxed/simple; bh=LK5HXiPW8Ui+bHksZXNSR4m1nNezliGdFXWHGqoI0Zs=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=VSxqT2dLk7Jx9SlhVdQDQM06B5oAsh+DeMoMuUNnaqAcst6iKXh4u7t1Xc4/Dx85jght+Yz5En/aiTsOWTyFq4uOgH/lH367+7IqJwMxhQ+EFzfHYat3D0xCLpYYmozQWxOtqcqrXmdg2qRRYV8jtmoS9/QG3bdw23sHyv/IKvQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2nh2VQrE; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rvWa+NvA; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2nh2VQrE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rvWa+NvA" Date: Mon, 02 Dec 2024 11:14:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1733138056; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3EwmR18SzxzeL8qcxUdyXY1D2zlwxZWtpC8Z7Y6U6TM=; b=2nh2VQrEWaRzhy6EDm8KHZCOXbdRisek0bEqeKpxw5opG8Aq5huJ4CMF+m2UXJJZ9fOjR2 Hdcuc5kWI5IzQHlDSUFYCToebaE6Z47tABF8mN7uh5UzzJ+stuhqqQ9Z4xLZ4F2rBReelL WsWaMBDykeXzEeBwBMzwuhChuXPtrtVS9FQNK9CfZf57/rzy0vLjkoBqTkt/QPMaRoCpzg Nnf43gx3E8v8evWz43+J7dqmUYag0pfSD1+BKV96RacL/TGeQ8oh15/veTTtSci6O+ax2P TNgrvTKriMFgnlFvZFDRjJNNgLXtVYxtxXJW7EpnP9gB8jMHrHF7y+FAvku4Fw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1733138056; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3EwmR18SzxzeL8qcxUdyXY1D2zlwxZWtpC8Z7Y6U6TM=; b=rvWa+NvAlfPtee3E6fX8zUylTZJhNp+rQJpvh+vHmVAbprVOBOOQRPV7kSPFiSMirO4NsA SlRW2Rpghra1vEBQ== From: "tip-bot2 for Dhananjay Ugwekar" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/rapl: Add arguments to the init and cleanup functions Cc: Dhananjay Ugwekar , "Peter Zijlstra (Intel)" , "Gautham R. Shenoy" , Zhang Rui , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20241115060805.447565-7-Dhananjay.Ugwekar@amd.com> References: <20241115060805.447565-7-Dhananjay.Ugwekar@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <173313805585.412.13173575120952927966.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the perf/core branch of tip: Commit-ID: eeca4c6b2529ff41a10519952bf988c0f3605353 Gitweb: https://git.kernel.org/tip/eeca4c6b2529ff41a10519952bf988c0f= 3605353 Author: Dhananjay Ugwekar AuthorDate: Fri, 15 Nov 2024 06:08:02=20 Committer: Peter Zijlstra CommitterDate: Mon, 02 Dec 2024 12:01:36 +01:00 perf/x86/rapl: Add arguments to the init and cleanup functions Prepare for the addition of RAPL core energy counter support. Add arguments to the init and cleanup functions, which will help in initialization and cleaning up of two separate PMUs. No functional change. Signed-off-by: Dhananjay Ugwekar Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: "Gautham R. Shenoy" Reviewed-by: Zhang Rui Tested-by: Zhang Rui Link: https://lore.kernel.org/r/20241115060805.447565-7-Dhananjay.Ugwekar@a= md.com --- arch/x86/events/rapl.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c index 1049686..249bcd3 100644 --- a/arch/x86/events/rapl.c +++ b/arch/x86/events/rapl.c @@ -603,7 +603,7 @@ static void __init rapl_advertise(void) } } =20 -static void cleanup_rapl_pmus(void) +static void cleanup_rapl_pmus(struct rapl_pmus *rapl_pmus) { int i; =20 @@ -621,7 +621,7 @@ static const struct attribute_group *rapl_attr_update[]= =3D { NULL, }; =20 -static int __init init_rapl_pmu(void) +static int __init init_rapl_pmu(struct rapl_pmus *rapl_pmus) { struct rapl_pmu *rapl_pmu; int idx; @@ -647,20 +647,20 @@ free: return -ENOMEM; } =20 -static int __init init_rapl_pmus(void) +static int __init init_rapl_pmus(struct rapl_pmus **rapl_pmus_ptr, int rap= l_pmu_scope) { int nr_rapl_pmu =3D topology_max_packages(); - int rapl_pmu_scope =3D PERF_PMU_SCOPE_PKG; + struct rapl_pmus *rapl_pmus; =20 - if (!rapl_pmu_is_pkg_scope()) { - nr_rapl_pmu *=3D topology_max_dies_per_package(); - rapl_pmu_scope =3D PERF_PMU_SCOPE_DIE; - } + if (rapl_pmu_scope =3D=3D PERF_PMU_SCOPE_DIE) + nr_rapl_pmu *=3D topology_max_dies_per_package(); =20 rapl_pmus =3D kzalloc(struct_size(rapl_pmus, rapl_pmu, nr_rapl_pmu), GFP_= KERNEL); if (!rapl_pmus) return -ENOMEM; =20 + *rapl_pmus_ptr =3D rapl_pmus; + rapl_pmus->nr_rapl_pmu =3D nr_rapl_pmu; rapl_pmus->pmu.attr_groups =3D rapl_attr_groups; rapl_pmus->pmu.attr_update =3D rapl_attr_update; @@ -675,7 +675,7 @@ static int __init init_rapl_pmus(void) rapl_pmus->pmu.module =3D THIS_MODULE; rapl_pmus->pmu.capabilities =3D PERF_PMU_CAP_NO_EXCLUDE; =20 - return init_rapl_pmu(); + return init_rapl_pmu(rapl_pmus); } =20 static struct rapl_model model_snb =3D { @@ -799,8 +799,12 @@ MODULE_DEVICE_TABLE(x86cpu, rapl_model_match); static int __init rapl_pmu_init(void) { const struct x86_cpu_id *id; + int rapl_pmu_scope =3D PERF_PMU_SCOPE_DIE; int ret; =20 + if (rapl_pmu_is_pkg_scope()) + rapl_pmu_scope =3D PERF_PMU_SCOPE_PKG; + id =3D x86_match_cpu(rapl_model_match); if (!id) return -ENODEV; @@ -816,7 +820,7 @@ static int __init rapl_pmu_init(void) if (ret) return ret; =20 - ret =3D init_rapl_pmus(); + ret =3D init_rapl_pmus(&rapl_pmus, rapl_pmu_scope); if (ret) return ret; =20 @@ -829,7 +833,7 @@ static int __init rapl_pmu_init(void) =20 out: pr_warn("Initialization failed (%d), disabled\n", ret); - cleanup_rapl_pmus(); + cleanup_rapl_pmus(rapl_pmus); return ret; } module_init(rapl_pmu_init); @@ -837,6 +841,6 @@ module_init(rapl_pmu_init); static void __exit intel_rapl_exit(void) { perf_pmu_unregister(&rapl_pmus->pmu); - cleanup_rapl_pmus(); + cleanup_rapl_pmus(rapl_pmus); } module_exit(intel_rapl_exit);