From patchwork Sun Feb 2 17:09:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861503 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 84CD41FB3 for ; Sun, 2 Feb 2025 17:12:56 +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=1738516376; cv=none; b=eq2YrDI9Z1VnsjrTNb+V5FnikTSTRkNAul9tMkhw38Gj+VlwhaKQmXfCyx3rjOfWfp/hCwvDGvYODNGuOx30M/aMBxXpm4fyyGB9WbpEU4YGY2B0izjkyFIx9QMvagiAHlTT+h/PeVPm/Wo0CWeueum+LKNaGKhedMAWxPADgOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516376; c=relaxed/simple; bh=BuJLxNw1vz+OlyItJ3DDeI9tiugzhIX5h9AxN6MO3pE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i8O+xpqGPz2E4JfADbGxGr1aECtik9xaY50+quyWALZuyAMiLUzAwIdOB3HKvJ+Xz3NNuZwkVeZU7ViLfaLKN+Sl4EjTKrH/GLokzSwdeoNDxTlExSTb3qla4ITd9k4Rtvk2kllBA48iqZ2nm7cO/XAobD4q5Xq/7TC1XIWazoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hy4n8Ppl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hy4n8Ppl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61DBDC4CEE1; Sun, 2 Feb 2025 17:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516376; bh=BuJLxNw1vz+OlyItJ3DDeI9tiugzhIX5h9AxN6MO3pE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=Hy4n8PpliOiXzZ6JC3I9UkAep6JAV7ejKt8adNHrJnMtoij4yagLrjTzwvjpZQtpz u9QC4YSVBl5PVkv6ggbeJD0iaAk3Ag3qZ6mZA7kHdIVU3SAfhYWiG6b25oIkRjcj6T 7987lE2EuUtYJY4wESUUAiwPmXIADziHkq4b9yJO0TigrBieKAsHg1R4i3d6Mr/sPi QJCf3uG8okksm0hcyS+sP+vCBlloIWEwfOnh1JCZUPLzTf6Ayih9mlnCDLl6uwrNE3 nj5wS3TQdcVYcUsbn3jnybJQimfKq8QE4F4RZY8vqr8H8FOOtAaA/LqTByYvOjukzI 9p3C670wYFywA== From: Len Brown To: linux-pm@vger.kernel.org Cc: Zhang Rui , Len Brown Subject: [PATCH 01/25] tools/power turbostat: Add initial support for PantherLake Date: Sun, 2 Feb 2025 11:09:17 -0600 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250202171249.402610-1-lenb@kernel.org> References: <20250202171249.402610-1-lenb@kernel.org> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Zhang Rui Add initial support for PantherLake. It shares the same features with Lunarlake. Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 58a487c225a7..540336138ce9 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -1024,6 +1024,7 @@ static const struct platform_data turbostat_pdata[] = { { INTEL_ARROWLAKE_U, &adl_features }, { INTEL_ARROWLAKE, &adl_features }, { INTEL_LUNARLAKE_M, &lnl_features }, + { INTEL_PANTHERLAKE_L, &lnl_features }, { INTEL_ATOM_SILVERMONT, &slv_features }, { INTEL_ATOM_SILVERMONT_D, &slvd_features }, { INTEL_ATOM_AIRMONT, &amt_features }, From patchwork Sun Feb 2 17:09:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861502 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 A6F751FB3 for ; Sun, 2 Feb 2025 17:12:59 +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=1738516379; cv=none; b=kv7BbNxCGhMuIshIedYBpiOszDuQJwrViMBVAJk1nVDpwmGxBtj5ZNT+OqrM/8vo3MmaOvtDGgJBY1eGaQup0zcxitvOZnZIDVKgJOP5oF0WSToXtoMng03WU9UCHL/SCDPlZRdcVxcVy+pUVres8llLLhlozyhQoNnPw4drPSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516379; c=relaxed/simple; bh=HZvtJGHwFfuZ1oAKiELf3sAagITeotaEIXsLvIJwtKY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NcJmw5h+Jn2v/zGu9Zm5YTB0fn3JmVWKKYKIvJSJfCZT2BJeoMNuZOwfU1rKiMjvcUmUBAmPtlFkrJDHSvwwWzhKKdyO7cc74BrPq5LNrgyjihlQ8sAjrrCb/ZxhLa9ewTG3awdkUQPYT5X2x/XQFO4a1b4tVvIQTAMN9W/18xo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N+HsMxgD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N+HsMxgD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CFD5C4CEE0; Sun, 2 Feb 2025 17:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516379; bh=HZvtJGHwFfuZ1oAKiELf3sAagITeotaEIXsLvIJwtKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=N+HsMxgDEj2WtIBbxXqlXelFdFLZZPnBipo+fF2QdBlNXJYd/X1TpUgz5VFo3mecK WT5cXKunwSyopeOHh/067rf5evWqScfabZGqztF72tVbhSPcUWBkI1apciav9fcwQD drjePHJxdKAUq8ZCpchCbY3RjehMKErVBIedpkNuom8axJvHZ60dQlS05tnlZNivwI RkFwLGbnrq/FSp3tZ7V9z67v0gXBsW9WPj9ngTMSbjloJjPMzIA6RIJe6DcLRfHc0U AUD4Arr7IDrhTP8dhnofBgMgEGCtSAw3B5tekSjcZjfQaLPskMWB25YLAXWlGLNvJ0 q4+xjFU2xab4Q== From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown Subject: [PATCH 03/25] tools/power turbostat: update turbostat(8) Date: Sun, 2 Feb 2025 11:09:19 -0600 Message-ID: <9e47f8adb053b69e2e8310551e6fd5156704cef4.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Len Brown Clarify how to get the latest version. Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.8 | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8 index a7f7ed01421c..59b89e6b25bf 100644 --- a/tools/power/x86/turbostat/turbostat.8 +++ b/tools/power/x86/turbostat/turbostat.8 @@ -516,14 +516,40 @@ that they count at TSC rate, which is true on all processors tested to date. Volume 3B: System Programming Guide" https://www.intel.com/products/processor/manuals/ +.SH RUN THE LATEST VERSION +If turbostat complains that it doesn't recognize your processor, +please try the latest version. + +The latest version of turbostat does not require the latest version of the Linux kernel. +However, some features, such as perf(1) counters, do require kernel support. + +The latest turbostat release is available in the upstream Linux Kernel source tree. +eg. "git pull https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git" +and run make in tools/power/x86/turbostat/. + +n.b. "make install" will update your system manually, but a distro update may subsequently downgrade your turbostat to an older version. +For this reason, manually installing to /usr/local/bin may be what you want. + +Note that turbostat/Makefile has a "make snapshot" target, which will create a tar file +that can build without a local kernel source tree. + +If the upstream version isn't new enough, the development tree can be found here: +"git pull https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat" + +If the development tree doesn't work, please contact the author via chat, +or via email with the word "turbostat" on the Subject line. + .SH FILES .ta .nf +/sys/bus/event_source/devices/ /dev/cpu/*/msr +/sys/class/intel_pmt/ +/sys/devices/system/cpu/ .fi .SH "SEE ALSO" -msr(4), vmstat(8) +perf(1), msr(4), vmstat(8) .PP .SH AUTHOR .nf From patchwork Sun Feb 2 17:09:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861501 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 9F8411F8917 for ; Sun, 2 Feb 2025 17:13: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=1738516382; cv=none; b=E7wTZjc8Yg3NunaBABFM9va/WeKLCDVgjUsaZBhDcgByAS1kcdFoKYmxa6ve4IwOA3uRpW2MUkqSvdjWXmoxy8gMgHpe9W6HesdSLMXahjBFY0LiX/xhCr7CUX5Vrchv7IcIB4IVDY3h+SyZw9FFkxOQX2ZMb7FwpeMX+oSvuvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516382; c=relaxed/simple; bh=wQvAfClLg/NJt+BX1HeP7ba8swpvY0Vu2Be+yznQT2E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lc71WQ1q68hXcumZzD5yiGrmErmvgXaY18xkUKGLRlUHutTTmiiWv8zLDM03iwNy11ij8aj/61YQkuNTFhqWHKM4YgIGz0rq1PfpbqywocjwYw0SSPhapOb1L0Sbz91iUbWO1AOWPByby3+xcprBb7Sng8/EvUyXfKevXmFrj28= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lvzdrw8H; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lvzdrw8H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21417C4CED1; Sun, 2 Feb 2025 17:13:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516382; bh=wQvAfClLg/NJt+BX1HeP7ba8swpvY0Vu2Be+yznQT2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=lvzdrw8HGDeZBSFk1RSsDvNFJgHBgs8nUbxnx4up1leir5msn9MzS1TqIOqhxlR/O CEq33zCnMwxH3AAiDBQczcdezUMk2hmri4wNxjt1+rgKnP8OJH94Bcl2BYApriaPQs o5/PT6+vAfEnQsZeEYcjTMl9eGdbH5L9lUs9lCNQ/f6sPAYcMviR3ZAgURSNLgfuSF Vdcr6ST13OH4KSD39blJfTcBSZrJmCAIR37g7oyUScUXhzNTkscL8VEk3CRP65V7pX IQFrjPK6Wr6eCEFUJxUKi6ZaAQCS6AS39PqAEqUOpWRE5fBF+zjWoVmJ7FGNzQvN96 s4QKLN8UU/qNA== From: Len Brown To: linux-pm@vger.kernel.org Cc: Zhang Rui , Len Brown Subject: [PATCH 05/25] tools/power turbostat: Exit on unsupported Vendors Date: Sun, 2 Feb 2025 11:09:21 -0600 Message-ID: <48c62ba1b407140229e92f5cfae6ae113fc4af8e.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Zhang Rui Turbostat currently supports x86 processors from Intel, AMD, and Hygon. The behavior of turbostat on CPUs from other vendors has not been evaluated and may lead to incorrect or undefined behavior. Enhance turbostat to exit by default when running on an unsupported CPU vendor. This ensures that users are aware that their CPU is not currently supported by turbostat, guiding them to seek support for their specific hardware through future patches. Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 5e894b71003c..cb659b274554 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -1056,9 +1056,9 @@ void probe_platform_features(unsigned int family, unsigned int model) { int i; - platform = &default_features; if (authentic_amd || hygon_genuine) { + platform = &default_features; if (max_extended_level >= 0x80000007) { unsigned int eax, ebx, ecx, edx; @@ -1071,7 +1071,7 @@ void probe_platform_features(unsigned int family, unsigned int model) } if (!genuine_intel) - return; + goto end; for (i = 0; turbostat_pdata[i].features; i++) { if (VFM_FAMILY(turbostat_pdata[i].vfm) == family && VFM_MODEL(turbostat_pdata[i].vfm) == model) { @@ -1080,6 +1080,10 @@ void probe_platform_features(unsigned int family, unsigned int model) } } +end: + if (platform) + return; + fprintf(stderr, "Unsupported platform detected.\n" "\tSee RUN THE LATEST VERSION on turbostat(8)\n"); exit(1); From patchwork Sun Feb 2 17:09:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861500 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 6D53A1FAC46 for ; Sun, 2 Feb 2025 17:13:05 +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=1738516385; cv=none; b=RjUYdraa2yDd4bixSou3MwiC1yDVOJAcvnBXNwXNATjcf27QLBtsLTtLgTfKN5W5EAeeBokZUt0pSyul6++koT3H44MwGExO8koZzMac+lT14m9/cZeOlaBfBvPQKPL/Wrkp5VPT0vnCwJeCXaVUZTQ67bWt/reeUlV0E0YcjeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516385; c=relaxed/simple; bh=h6cbDga1vMkMlHFF16RpT/8JhquiFTawIQvLXM0PzF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c8qEjsK5ieVGL4I5C9Xq+Tx3p8iFic4Z/lgALq/hKqE+6a3pkr7dxS88I4Ot3RUMgxZCrn3LE8czNxGmgLjtdjYXXWlLKMMCQ23vuvnXZPLAGX6A1N0FIH+NqP0C769yTma9PO3mfDzT0VihevawX3Cl3MH28aVlJPJyyk250OM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CnTc+fmN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CnTc+fmN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32DB6C4CEE1; Sun, 2 Feb 2025 17:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516385; bh=h6cbDga1vMkMlHFF16RpT/8JhquiFTawIQvLXM0PzF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=CnTc+fmNGI9SCuDNSHqo0qnQ7gHslNyNMikr1GCrleaQlqctKGoBI0ztIBl6C8UTl e7Raugk/ahkniVvHqjxgTwa/LkmROMlCj3jyrxHdh4MEPR+FJkZ+cAF5iDPY9af6Wc P6VKQJaGY0TAskT2Eg4Z+mYDOza4NU5fr3nD65KR+qa3Npp0c33hWnqhwvz2DmwYd7 BydaFcjxCydN6xbxd506NgBzPcZQ2bjqs8KYBNZhGnabVvQhvMBerwjfl62pIp50v9 4vo97gUyPGK3SS0dg3AjKPfJHhOqlpO+qHzGBba68PlmyyDOjfhx9iNArHBmoNtHP6 tcFm0LJ4TKpzA== From: Len Brown To: linux-pm@vger.kernel.org Cc: Zhang Rui , Len Brown Subject: [PATCH 07/25] tools/power turbostat: Introduce --force parameter Date: Sun, 2 Feb 2025 11:09:23 -0600 Message-ID: <3d94026af328d3d355d15c1d7fe73278f77c6a42.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Zhang Rui Turbostat currently exits under the following conditions: 1. When running on non-Intel/AMD/Hygon x86 vendors. 2. When running on Intel models that lack specific platform features. Introduce a new `--force` parameter that allows turbostat to run on these unsupported platforms with minimal default feature support. This provides users with the flexibility to gather basic information even on unsupported systems. [lenb: updated warning message text] Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 5165450a8187..7accc4a73366 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -326,6 +326,7 @@ unsigned int rapl_joules; unsigned int summary_only; unsigned int list_header_only; unsigned int dump_only; +unsigned int force_load; unsigned int has_aperf; unsigned int has_aperf_access; unsigned int has_epb; @@ -1058,7 +1059,8 @@ void probe_platform_features(unsigned int family, unsigned int model) if (authentic_amd || hygon_genuine) { - platform = &default_features; + /* fallback to default features on unsupported models */ + force_load++; if (max_extended_level >= 0x80000007) { unsigned int eax, ebx, ecx, edx; @@ -1067,7 +1069,7 @@ void probe_platform_features(unsigned int family, unsigned int model) if ((edx & (1 << 14)) && family >= 0x17) platform = &amd_features_with_rapl; } - return; + goto end; } if (!genuine_intel) @@ -1081,6 +1083,11 @@ void probe_platform_features(unsigned int family, unsigned int model) } end: + if (force_load && !platform) { + fprintf(outf, "Forced to run on unsupported platform!\n"); + platform = &default_features; + } + if (platform) return; @@ -2160,6 +2167,8 @@ void help(void) " displays the raw counter values\n" " -e, --enable [all | column]\n" " shows all or the specified disabled column\n" + " -f, --force\n" + " force load turbostat with minimum default features on unsupported platforms.\n" " -H, --hide [column | column,column,...]\n" " hide the specified column(s)\n" " -i, --interval sec.subsec\n" @@ -9942,6 +9951,7 @@ void cmdline(int argc, char **argv) { "Dump", no_argument, 0, 'D' }, { "debug", no_argument, 0, 'd' }, /* internal, not documented */ { "enable", required_argument, 0, 'e' }, + { "force", no_argument, 0, 'f' }, { "interval", required_argument, 0, 'i' }, { "IPC", no_argument, 0, 'I' }, { "num_iterations", required_argument, 0, 'n' }, @@ -10002,6 +10012,9 @@ void cmdline(int argc, char **argv) /* --enable specified counter */ bic_enabled = bic_enabled | bic_lookup(optarg, SHOW_LIST); break; + case 'f': + force_load++; + break; case 'd': debug++; ENABLE_BIC(BIC_DISABLED_BY_DEFAULT); From patchwork Sun Feb 2 17:09:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861499 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 4EB7E1F8917 for ; Sun, 2 Feb 2025 17:13:08 +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=1738516389; cv=none; b=mXm4bmTVIwzkITF7/6eyn93Tmjt4P5hz8Z0U4tOAYRomeWzPM4qjh9NUS5LI0N8v9PrUBEC7u9EgwgCSrCvaUisocU6ln0xsMRCY98hwz8LUlAn9lLthbz+8GTnkdnogN5KzDSd0IrVVwHFvc3nfDlIa5f9ggGrZCgbi4bERnts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516389; c=relaxed/simple; bh=JxLS3TSJ4YczXSb/1IUkAJsWu0Z50hEAkvoyXf+p+Kk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=od0Os9bRTaQB8SE9bwZpUFpkF5TlVWj0LS5UfE+rMIeVV9DBrgeQPKsDNbp/MZzhkL8G5q33uJsCUWXp0MabrqmJ/xTHtSItC/8aOmZgHPxhSVi8brgjDefqKOwXQgBoogDYaUyS2quwETn5TH9TVaFTjgMsA4Yx+hX1/BfPJ78= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=F4Vky6yI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="F4Vky6yI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA661C4CED1; Sun, 2 Feb 2025 17:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516388; bh=JxLS3TSJ4YczXSb/1IUkAJsWu0Z50hEAkvoyXf+p+Kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=F4Vky6yIoDv9CYxlianX7lm4r/keUhLRDGqDpdF2TS0W9VIKY+GyiM0TXRTkCNWki v2mQvKRVKZO8waUbzMKGTByM+w/dDbPwYzG8Cpq9Dfg+Kq5YKGXyBaoP7S36iN714A d5fQer61A82YI0EnlSmLMQwCYl+leT6PxTmerCAm6KUpNtHhrMA3spr7EkumpSTanF MwX7yod8ZBLCbXE2Ns9hegbuF0td3o6yo5iLpalBkiWfzTgLqKhvyzujJLv1fZRwvE Kdd5MicCS3zWyA41Ax8UjpyPWUnNPeS+E0EbTOFQGHZDFI+y9hHLFkOSo9GVN8svY1 /28z4TKoOTgqg== From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown , Artem Bityutskiy Subject: [PATCH 09/25] tools/power turbostat: Add an NMI column Date: Sun, 2 Feb 2025 11:09:25 -0600 Message-ID: <22a835282b6240f38097f479ae2194bbeb0181e4.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Len Brown Add an NMI column, a proper sub-set of the IRQ column. It would be preferable if the kernel exported /sys/kernel/irq/NMI/per_cpu_count. But since we are already forced to parse /proc/interrupts, noticing which row is the NMI is simple enough. Suggested-by: Artem Bityutskiy Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 54 ++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 7a10e51a1349..2620ed000ad0 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -202,6 +202,7 @@ struct msr_counter bic[] = { { 0x0, "Die%c6", NULL, 0, 0, 0, NULL, 0 }, { 0x0, "SysWatt", NULL, 0, 0, 0, NULL, 0 }, { 0x0, "Sys_J", NULL, 0, 0, 0, NULL, 0 }, + { 0x0, "NMI", NULL, 0, 0, 0, NULL, 0 }, }; #define MAX_BIC (sizeof(bic) / sizeof(struct msr_counter)) @@ -266,12 +267,13 @@ struct msr_counter bic[] = { #define BIC_Diec6 (1ULL << 58) #define BIC_SysWatt (1ULL << 59) #define BIC_Sys_J (1ULL << 60) +#define BIC_NMI (1ULL << 61) #define BIC_TOPOLOGY (BIC_Package | BIC_Node | BIC_CoreCnt | BIC_PkgCnt | BIC_Core | BIC_CPU | BIC_Die ) #define BIC_THERMAL_PWR ( BIC_CoreTmp | BIC_PkgTmp | BIC_PkgWatt | BIC_CorWatt | BIC_GFXWatt | BIC_RAMWatt | BIC_PKG__ | BIC_RAM__) #define BIC_FREQUENCY (BIC_Avg_MHz | BIC_Busy | BIC_Bzy_MHz | BIC_TSC_MHz | BIC_GFXMHz | BIC_GFXACTMHz | BIC_SAMMHz | BIC_SAMACTMHz | BIC_UNCORE_MHZ) #define BIC_IDLE (BIC_Busy | BIC_sysfs | BIC_CPU_c1 | BIC_CPU_c3 | BIC_CPU_c6 | BIC_CPU_c7 | BIC_GFX_rc6 | BIC_Pkgpc2 | BIC_Pkgpc3 | BIC_Pkgpc6 | BIC_Pkgpc7 | BIC_Pkgpc8 | BIC_Pkgpc9 | BIC_Pkgpc10 | BIC_CPU_LPI | BIC_SYS_LPI | BIC_Mod_c6 | BIC_Totl_c0 | BIC_Any_c0 | BIC_GFX_c0 | BIC_CPUGFX | BIC_SAM_mc6 | BIC_Diec6) -#define BIC_OTHER ( BIC_IRQ | BIC_SMI | BIC_ThreadC | BIC_CoreTmp | BIC_IPC) +#define BIC_OTHER ( BIC_IRQ | BIC_NMI | BIC_SMI | BIC_ThreadC | BIC_CoreTmp | BIC_IPC) #define BIC_DISABLED_BY_DEFAULT (BIC_USEC | BIC_TOD | BIC_APIC | BIC_X2APIC | BIC_SysWatt | BIC_Sys_J) @@ -1628,6 +1630,7 @@ struct thread_data { unsigned long long c1; unsigned long long instr_count; unsigned long long irq_count; + unsigned long long nmi_count; unsigned int smi_count; unsigned int cpu_id; unsigned int apic_id; @@ -1934,6 +1937,7 @@ struct timeval tv_even, tv_odd, tv_delta; int *irq_column_2_cpu; /* /proc/interrupts column numbers */ int *irqs_per_cpu; /* indexed by cpu_num */ +int *nmi_per_cpu; /* indexed by cpu_num */ void setup_all_buffers(bool startup); @@ -2319,6 +2323,12 @@ void print_header(char *delim) else outp += sprintf(outp, "%sIRQ", (printed++ ? delim : "")); } + if (DO_BIC(BIC_NMI)) { + if (sums_need_wide_columns) + outp += sprintf(outp, "%s NMI", (printed++ ? delim : "")); + else + outp += sprintf(outp, "%sNMI", (printed++ ? delim : "")); + } if (DO_BIC(BIC_SMI)) outp += sprintf(outp, "%sSMI", (printed++ ? delim : "")); @@ -2605,6 +2615,8 @@ int dump_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p if (DO_BIC(BIC_IRQ)) outp += sprintf(outp, "IRQ: %lld\n", t->irq_count); + if (DO_BIC(BIC_NMI)) + outp += sprintf(outp, "IRQ: %lld\n", t->nmi_count); if (DO_BIC(BIC_SMI)) outp += sprintf(outp, "SMI: %d\n", t->smi_count); @@ -2824,6 +2836,14 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), t->irq_count); } + /* NMI */ + if (DO_BIC(BIC_NMI)) { + if (sums_need_wide_columns) + outp += sprintf(outp, "%s%8lld", (printed++ ? delim : ""), t->nmi_count); + else + outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), t->nmi_count); + } + /* SMI */ if (DO_BIC(BIC_SMI)) outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), t->smi_count); @@ -3439,6 +3459,9 @@ int delta_thread(struct thread_data *new, struct thread_data *old, struct core_d if (DO_BIC(BIC_IRQ)) old->irq_count = new->irq_count - old->irq_count; + if (DO_BIC(BIC_NMI)) + old->nmi_count = new->nmi_count - old->nmi_count; + if (DO_BIC(BIC_SMI)) old->smi_count = new->smi_count - old->smi_count; @@ -3519,6 +3542,7 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data t->instr_count = 0; t->irq_count = 0; + t->nmi_count = 0; t->smi_count = 0; c->c3 = 0; @@ -3623,6 +3647,7 @@ int sum_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) average.threads.instr_count += t->instr_count; average.threads.irq_count += t->irq_count; + average.threads.nmi_count += t->nmi_count; average.threads.smi_count += t->smi_count; for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) { @@ -3764,6 +3789,9 @@ void compute_average(struct thread_data *t, struct core_data *c, struct pkg_data if (average.threads.irq_count > 9999999) sums_need_wide_columns = 1; + if (average.threads.nmi_count > 9999999) + sums_need_wide_columns = 1; + average.cores.c3 /= topo.allowed_cores; average.cores.c6 /= topo.allowed_cores; @@ -4620,6 +4648,8 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) if (DO_BIC(BIC_IRQ)) t->irq_count = irqs_per_cpu[cpu]; + if (DO_BIC(BIC_NMI)) + t->nmi_count = nmi_per_cpu[cpu]; get_cstate_counters(cpu, t, c, p); @@ -5365,6 +5395,7 @@ void free_all_buffers(void) free(irq_column_2_cpu); free(irqs_per_cpu); + free(nmi_per_cpu); for (i = 0; i <= topo.max_cpu_num; ++i) { if (cpus[i].put_ids) @@ -5821,31 +5852,37 @@ int snapshot_proc_interrupts(void) irq_column_2_cpu[column] = cpu_number; irqs_per_cpu[cpu_number] = 0; + nmi_per_cpu[cpu_number] = 0; } /* read /proc/interrupt count lines and sum up irqs per cpu */ while (1) { int column; char buf[64]; + int this_row_is_nmi = 0; - retval = fscanf(fp, " %s:", buf); /* flush irq# "N:" */ + retval = fscanf(fp, " %s:", buf); /* irq# "N:" */ if (retval != 1) break; + if (strncmp(buf, "NMI", strlen("NMI")) == 0) + this_row_is_nmi = 1; + /* read the count per cpu */ for (column = 0; column < topo.num_cpus; ++column) { int cpu_number, irq_count; retval = fscanf(fp, " %d", &irq_count); + if (retval != 1) break; cpu_number = irq_column_2_cpu[column]; irqs_per_cpu[cpu_number] += irq_count; - + if (this_row_is_nmi) + nmi_per_cpu[cpu_number] += irq_count; } - while (getc(fp) != '\n') ; /* flush interrupt description */ } @@ -5942,7 +5979,7 @@ int snapshot_sys_lpi_us(void) */ int snapshot_proc_sysfs_files(void) { - if (DO_BIC(BIC_IRQ)) + if (DO_BIC(BIC_IRQ) || DO_BIC(BIC_NMI)) if (snapshot_proc_interrupts()) return 1; @@ -8263,6 +8300,7 @@ void process_cpuid() aperf_mperf_multiplier = platform->need_perf_multiplier ? 1024 : 1; BIC_PRESENT(BIC_IRQ); + BIC_PRESENT(BIC_NMI); BIC_PRESENT(BIC_TSC_MHz); } @@ -8613,7 +8651,11 @@ void allocate_irq_buffers(void) irqs_per_cpu = calloc(topo.max_cpu_num + 1, sizeof(int)); if (irqs_per_cpu == NULL) - err(-1, "calloc %d", topo.max_cpu_num + 1); + err(-1, "calloc %d IRQ", topo.max_cpu_num + 1); + + nmi_per_cpu = calloc(topo.max_cpu_num + 1, sizeof(int)); + if (nmi_per_cpu == NULL) + err(-1, "calloc %d NMI", topo.max_cpu_num + 1); } int update_topo(struct thread_data *t, struct core_data *c, struct pkg_data *p) From patchwork Sun Feb 2 17:09:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861498 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 E05BF1D7E57 for ; Sun, 2 Feb 2025 17:13:12 +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=1738516393; cv=none; b=j2nl9KzPybVJFjdjuTqY5UqkXP9Si9RLIzzyxFxsXd698vJAM7RxD3xNPb5fLL8pCc+FxEVpaTQ/OVvbHFau+JtkUGFQncT8hOrxgxl6t8+5XcUjzzivcC1ffsu2SCH5vVib/3P41kpSQrWxgldHuQVJE2PSA1sKz2LKAl7ke8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516393; c=relaxed/simple; bh=WFpmSrIgIrhNo6DTrNv+2W8Ut9DCsZ2P6okj3zjDCzQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FRhR6c4szkH3Sb/SEy/QcyXky+Cld2mYDbO+oFJwHv87Xsijzgsoq92H480StzuuuUQPpN3qQMkZKlWQUW9EFBfKEOsbmAQcRn4UXNTc8cZTdprPozhxgcdEG+dpnr+vrSCGgHZ3zCsWQmLIPSmO2Wb1Tslx6GVznf+PUuveqds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tqkRQ7Jr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tqkRQ7Jr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F3DFC4CEE0; Sun, 2 Feb 2025 17:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516392; bh=WFpmSrIgIrhNo6DTrNv+2W8Ut9DCsZ2P6okj3zjDCzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=tqkRQ7JrAsCGqUx3zSW1BPdTFDhl9RasYJWitMM/DtbTYYq7j5e0V9TukiHCPnAGK ufkxKZRC43NLHAG+5TmUJ/PjnXwODCU9dIbM0QTfaXBcWwY5YtwTcP8fXVPC8dn6Vz l3UJ3Rh9MazjHmtLBPwlyLIt6EWGLxSBnfmGpBC2HS+FyDYOa6/E8otDz71pbRUc+s t1XfKoEV+ofXeSh5i3+ygM17JXv1HgxnwwX8tUMK5NiGrt4NNyzPj4nT4A0j3EGdXa ++rLpl6mCRcUsTHlvIhG4HyBoUV5izykv+MnmBwX0wrcvW1yEUCmBTP+Cm+D8WeV4J 6GqYmNLy0iplg== From: Len Brown To: linux-pm@vger.kernel.org Cc: Patryk Wlazlyn , Len Brown Subject: [PATCH 11/25] tools/power turbostat: Fix PMT mmaped file size rounding Date: Sun, 2 Feb 2025 11:09:27 -0600 Message-ID: <2f60f03934a50bc1fb69bb4f47a25cddd6807b0b.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Patryk Wlazlyn This (the old code) is just not how you round up to a page size. Noticed on a recent Intel platform. Previous ones must have been reporting sizes already aligned to a page and so the bug was missed when testing. Fixes: f0e4ed752fda ("tools/power turbostat: Add early support for PMT counters") Signed-off-by: Patryk Wlazlyn Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 1d99aaf9681b..a2ca1c6c3638 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -95,6 +95,8 @@ #define INTEL_ECORE_TYPE 0x20 #define INTEL_PCORE_TYPE 0x40 +#define ROUND_UP_TO_PAGE_SIZE(n) (((n) + 0x1000UL-1UL) & ~(0x1000UL-1UL)) + enum counter_scope { SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE }; enum counter_type { COUNTER_ITEMS, COUNTER_CYCLES, COUNTER_SECONDS, COUNTER_USEC, COUNTER_K2M }; enum counter_format { FORMAT_RAW, FORMAT_DELTA, FORMAT_PERCENT, FORMAT_AVERAGE }; @@ -8996,7 +8998,7 @@ struct pmt_mmio *pmt_mmio_open(unsigned int target_guid) if (fd_pmt == -1) goto loop_cleanup_and_break; - mmap_size = (size + 0x1000UL) & (~0x1000UL); + mmap_size = ROUND_UP_TO_PAGE_SIZE(size); mmio = mmap(0, mmap_size, PROT_READ, MAP_SHARED, fd_pmt, 0); if (mmio != MAP_FAILED) { From patchwork Sun Feb 2 17:09:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861497 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 E8F4B1F9F73 for ; Sun, 2 Feb 2025 17:13:15 +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=1738516397; cv=none; b=ils1CZrMpusKrZTg/v68N3DqgarAmZbjlfNpM3YDegTucwnPVZE30Gjx4bCpmoUMHzFEwMpIXnJ+DozoEFk08INus6oP6jWqM1Qz3xTxc/6sCvXZx+48ZjVXzxipByn7dnNQbdYwIaKDxI0dqRESVDcifwWZeII8N55546xtzWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516397; c=relaxed/simple; bh=g8HieEwPr/jjn7MVyejBANxeNQfG154FQDsz9L/zD+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HhUCF5lGMTsArtz4GZPebjFo/awf6UZKTP8636qvQKlPF/4F72pmhIIID1sXx7R/y5xdINzcKj3UzfBIPaDNyWtBCe0ARLBFH6As4canhEG7Lmwx6zrd0IzvUOkTRoXHsHzvR74KY5FHhSHxYQy4hjyl8A8HVRp6seFQCbnbL08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lg4+fRm4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lg4+fRm4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9068BC4CED1; Sun, 2 Feb 2025 17:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516395; bh=g8HieEwPr/jjn7MVyejBANxeNQfG154FQDsz9L/zD+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=lg4+fRm4KuVH9ECv3Pj3ROEJ30gyUK0O4ZEAmQnoI9nagBsaO5+x/rBjdYIpU9J51 heWI57HV6CDqKKuWg0dbM1xYYY4d9MXUysGtRRASrq3kW7c5AzEy2QD35tVjMMV4wq zpqbc9vm4qkVfoez3060HQVKeLctd+wToikaajuOvsngwmN9NAUB/I+Wt3/BHgVpgd us36vM7G3PHpe//QxkogKyQM3U4EBydhwF6yyNoIKSrY/bqQjLNH6DuT+eHEtYAUOt WINmm92VHrrUqifB+vfc1hgnIm7DvaShbYw7aeLU9xkJ1QGv2t+yhsKXjh3yhSgsPl j+9xPClhDO78A== From: Len Brown To: linux-pm@vger.kernel.org Cc: Zhang Rui , Len Brown Subject: [PATCH 13/25] tools/power turbostat: Enhance turbostat self-performance visibility Date: Sun, 2 Feb 2025 11:09:29 -0600 Message-ID: <1af5baeda512d0940748fdf9b559e1041dbab0cf.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Zhang Rui Include procfs and sysfs data collection time in the system summary row of the "usec" column. This is useful for isolating where the time goes during turbostat data collection. Background: Column "usec" shows 1. the number of microseconds elapsed during counter collection, including thread migration -- if any, for each CPU row. 2. total elapsed time to collect the counters on all cpus, for the summary row. This can be used to check the time cost of a give column. For example, run below commands separately turbostat --show usec sleep 1 turbostat --show usec,CoreTmp sleep 1 and the delta in the usec column will tell the time cost for CoreTmp (Thermal MSR read) Problem: Some of the kernel procfs/sysfs accesses are expensive, especially on high core count systems. "usec" column cannot tell this because it only includes the time cost of the counters. Solution: Leave the per CPU "usec" as it is and modify the summary "usec" to include the time cost of the procfs/sysfs snapshot. With it, the "usec" column can be used to get 1. the baseline, e.g. turbostat --show usec sleep 1 2. the baseline + some per CPU counter cost, e.g. turbostat --show usec,CoreTmp sleep 1 3. the baseline + some per CPU sysfs cost, e.g. turbostat --show usec,C1 sleep 1 4. the baseline + /proc/interrupts cost, e.g turbostat --show usec,IRQ sleep 1 Man-page update is also included. Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.8 | 2 +- tools/power/x86/turbostat/turbostat.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8 index f043a93defd4..99bf905ade81 100644 --- a/tools/power/x86/turbostat/turbostat.8 +++ b/tools/power/x86/turbostat/turbostat.8 @@ -136,7 +136,7 @@ displays the statistics gathered since it was forked. The system configuration dump (if --quiet is not used) is followed by statistics. The first row of the statistics labels the content of each column (below). The second row of statistics is the system summary line. The system summary line has a '-' in the columns for the Package, Core, and CPU. The contents of the system summary line depends on the type of column. Columns that count items (eg. IRQ) show the sum across all CPUs in the system. Columns that show a percentage show the average across all CPUs in the system. Columns that dump raw MSR values simply show 0 in the summary. After the system summary row, each row describes a specific Package/Core/CPU. Note that if the --cpu parameter is used to limit which specific CPUs are displayed, turbostat will still collect statistics for all CPUs in the system and will still show the system summary for all CPUs in the system. .SH COLUMN DESCRIPTIONS .PP -\fBusec\fP For each CPU, the number of microseconds elapsed during counter collection, including thread migration -- if any. This counter is disabled by default, and is enabled with "--enable usec", or --debug. On the summary row, usec refers to the total elapsed time to collect the counters on all cpus. +\fBusec\fP For each CPU, the number of microseconds elapsed during counter collection, including thread migration -- if any. This counter is disabled by default, and is enabled with "--enable usec", or --debug. On the summary row, usec refers to the total elapsed time to snapshot the procfs/sysfs and collect the counters on all cpus. .PP \fBTime_Of_Day_Seconds\fP For each CPU, the gettimeofday(2) value (seconds.subsec since Epoch) when the counters ending the measurement interval were collected. This column is disabled by default, and can be enabled with "--enable Time_Of_Day_Seconds" or "--debug". On the summary row, Time_Of_Day_Seconds refers to the timestamp following collection of counters on the last CPU. .PP diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 1bcecfed721b..adcf5f0a0633 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -370,6 +370,9 @@ unsigned int has_hwp_activity_window; /* IA32_HWP_REQUEST[bits 41:32] */ unsigned int has_hwp_epp; /* IA32_HWP_REQUEST[bits 31:24] */ unsigned int has_hwp_pkg; /* IA32_HWP_REQUEST_PKG */ unsigned int first_counter_read = 1; + +static struct timeval procsysfs_tv_begin; + int ignore_stdin; bool no_msr; bool no_perf; @@ -3638,7 +3641,7 @@ int sum_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) /* remember first tv_begin */ if (average.threads.tv_begin.tv_sec == 0) - average.threads.tv_begin = t->tv_begin; + average.threads.tv_begin = procsysfs_tv_begin; /* remember last tv_end */ average.threads.tv_end = t->tv_end; @@ -5983,6 +5986,8 @@ int snapshot_sys_lpi_us(void) */ int snapshot_proc_sysfs_files(void) { + gettimeofday(&procsysfs_tv_begin, (struct timezone *)NULL); + if (DO_BIC(BIC_IRQ) || DO_BIC(BIC_NMI)) if (snapshot_proc_interrupts()) return 1; From patchwork Sun Feb 2 17:09:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861496 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 9081D1FAC58 for ; Sun, 2 Feb 2025 17:13:18 +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=1738516398; cv=none; b=p/2s9YwDwlTLS5DaHa5G1EIUKaqDO9whSJLjAXP0xo2qRzh6MaoS1o3Wr7QxoJfylXcP6gZwAdIl6LPdAATzuG5GCx6jf77s1eEpwGhwmd5VM5S+JOn2uZutHennoy5+d88bBziuuLBG6YaZOcDEtdEBT12bmba7K1KcZOuGqig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516398; c=relaxed/simple; bh=WmfjOgS7hlMT/ZPiOYjYQeFGWmHwA8wgdwYjiEshNOw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ddIgTDf3UAzfrTIK3TMtgWrXZZE2ZpL9O2HLu4avf5yByipdp4uoPQzmZeyErtNBt7lekqJd3PJ1ihBXh11cdSMVfXKZlCpaPX86q9AsllZALAuhl0HdztOnBcBHAp2e6ohBlNwWEIAyC0tve0Tk50SruKxBaoYgky1SGC2IeG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fO+umJvE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fO+umJvE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 302FBC4CED1; Sun, 2 Feb 2025 17:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516398; bh=WmfjOgS7hlMT/ZPiOYjYQeFGWmHwA8wgdwYjiEshNOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=fO+umJvECJiOBvoJy31pBZOavkauBMqwPOdMSatyi/ViDin19g/RBax6VutNUSYi2 ins+fuw515fH2ESvbMqs9tDHxDnSFWHHBDGQfjI1WgweerGuHbESiRZS5x2OJjRV6M W118fNFPOjUW6sEhzVK/Jj1ib9t9hqPw27XJsDbWy2IVJgn+U0aIrAlym6GEUL/FUW g+MsrTXkzwdML1BU8enTSFzKKDmhOFOYcQdYUdwBHX9Kma78j+gSXFGP/ahAzilmci d48W6FiMeaF6Ihfo3q6ze4XozwShSFL43Jt3fSmwcCiTWgF9zekCLUm5YUpzo6KK1Y UKPiKPhcFZj8A== From: Len Brown To: linux-pm@vger.kernel.org Cc: Patryk Wlazlyn , Len Brown Subject: [PATCH 15/25] tools/power turbostat: Return default value for unmapped PMT domains Date: Sun, 2 Feb 2025 11:09:31 -0600 Message-ID: <34537ddd208d614dbefeb97823ae1c79e7771588.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Patryk Wlazlyn When requesting PMT counters with --add command, user may want to skip specifying values for all the domains (that is, cpu, core, package etc). For the domains that user did not provide information on how to read the counter, return default value - zero. Signed-off-by: Patryk Wlazlyn Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 6b72b922e2f5..60b1ade8659b 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4615,7 +4615,8 @@ unsigned long pmt_gen_value_mask(unsigned int lsb, unsigned int msb) unsigned long pmt_read_counter(struct pmt_counter *ppmt, unsigned int domain_id) { - assert(domain_id < ppmt->num_domains); + if (domain_id >= ppmt->num_domains) + return 0; const unsigned long *pmmio = ppmt->domains[domain_id].pcounter; const unsigned long value = pmmio ? *pmmio : 0; From patchwork Sun Feb 2 17:09:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861495 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 2042A1FAC52 for ; Sun, 2 Feb 2025 17:13:20 +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=1738516401; cv=none; b=iLgNXWB6M+dZsTxV6tDF6zXBaj8m5QmMmVv1aTSEGR2I1HjSqRj0hHjQzIr3Bn5Ma+X/4TxvyN2PdSVymoIDiwGwy+eYMMaeXreErknfcbTE2Uk0ONlpJ/H8XIwGtMWd+GSVjyq5T8zdRZUPYPkrM1HzCbb8BfnpOfJcxET9I/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516401; c=relaxed/simple; bh=uREfF30nWOFy42XQ5hKVpFSe4MjlgRSdzUlXw76xFng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aASZ6Duf2Ww9NKCnfCDASqn2vjFOAo1+0hXnnh+H/eJbmjlRtD1OiY9IHHlkoDdM25GwsxRRKui301A5JyrqSZnhYhp53GvJNrZn85AZGf9h50BSVl7ZvBti8uAWUhWtSDJNZt3ZtgZAJqDuExHyOxl9tY+uNjIyrntxS0xwy70= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aAJrW/Tw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aAJrW/Tw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4058C4CED1; Sun, 2 Feb 2025 17:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516400; bh=uREfF30nWOFy42XQ5hKVpFSe4MjlgRSdzUlXw76xFng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=aAJrW/TwD1bvNYKaSEK02kWg1ZrpWH7dt/djDUySERMOZiwDr1ldkqKDHD9aAyN5Y EgqX8mS/1LYSZSZu3Ot6QTQdquII4vIpR09aEfWkPEZQHK7uvK/5uoXUuH6KTjNmsJ sMnM77wPc432Ov1GB4Cwo2JFQJmICmVz9rMD0vO5HndPDkEUSoP/EGlQR2YnU24Ehf q39ZolBf2UTxp64K1tZBbI29Qyd4++pxN9q1NTc6hqYxrODW0xI0dSA+mWxZ6vNyht b/KBYb5hqo9VI6Cc4bZ0+x1lMu0eNiT5t4TEB/NNQiGiXSIF6+uRysssI8merxjpyk Zyct6yae9MHMg== From: Len Brown To: linux-pm@vger.kernel.org Cc: Patryk Wlazlyn , Len Brown Subject: [PATCH 17/25] tools/power turbostat: Add PMT directory iterator helper Date: Sun, 2 Feb 2025 11:09:33 -0600 Message-ID: <4265a86582eaa224d171328be0c71e2a7ccd194f.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Patryk Wlazlyn PMT directories exposed in sysfs use the following pattern: telem%u for example: telem0, telem2, telem3, ..., telem15, telem16 This naming scheme preserves the ordering from the PCIe discovery, which is important to correctly map the telemetry directory to the specific domain (cpu, core, package etc). Because readdir() traverses the entries in alphabetical order, causing for example "telem13" to be traversed before "telem3", it is necessary to use scandir() with custom compare() callback to preserve the PCIe ordering. Signed-off-by: Patryk Wlazlyn Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 87 +++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 14c495886746..6104d5bcca5c 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -1589,6 +1589,93 @@ struct pmt_counter { struct pmt_domain_info *domains; }; +/* + * PMT telemetry directory iterator. + * Used to iterate telemetry files in sysfs in correct order. + */ +struct pmt_diriter_t +{ + DIR *dir; + struct dirent **namelist; + unsigned int num_names; + unsigned int current_name_idx; +}; + +int pmt_telemdir_filter(const struct dirent *e) +{ + unsigned int dummy; + return sscanf(e->d_name, "telem%u", &dummy); +} + +int pmt_telemdir_sort(const struct dirent **a, const struct dirent **b) +{ + unsigned int aidx = 0, bidx = 0; + + sscanf((*a)->d_name, "telem%u", &aidx); + sscanf((*b)->d_name, "telem%u", &bidx); + + return aidx >= bidx; +} + +const struct dirent* pmt_diriter_next(struct pmt_diriter_t *iter) +{ + const struct dirent *ret = NULL; + + if (!iter->dir) + return NULL; + + if (iter->current_name_idx >= iter->num_names) + return NULL; + + ret = iter->namelist[iter->current_name_idx]; + ++iter->current_name_idx; + + return ret; +} + +const struct dirent* pmt_diriter_begin(struct pmt_diriter_t *iter, const char *pmt_root_path) +{ + int num_names = iter->num_names; + + if (!iter->dir) { + iter->dir = opendir(pmt_root_path); + if (iter->dir == NULL) + return NULL; + + num_names = scandir(pmt_root_path, &iter->namelist, pmt_telemdir_filter, pmt_telemdir_sort); + if (num_names == -1) + return NULL; + } + + iter->current_name_idx = 0; + iter->num_names = num_names; + + return pmt_diriter_next(iter); +} + +void pmt_diriter_init(struct pmt_diriter_t *iter) +{ + memset(iter, 0, sizeof(*iter)); +} + +void pmt_diriter_remove(struct pmt_diriter_t *iter) +{ + if (iter->namelist) { + for (unsigned int i = 0; i < iter->num_names; i++) { + free(iter->namelist[i]); + iter->namelist[i] = NULL; + } + } + + free(iter->namelist); + iter->namelist = NULL; + iter->num_names = 0; + iter->current_name_idx = 0; + + closedir(iter->dir); + iter->dir = NULL; +} + unsigned int pmt_counter_get_width(const struct pmt_counter *p) { return (p->msb - p->lsb) + 1; From patchwork Sun Feb 2 17:09:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861494 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 E29A31FAC58 for ; Sun, 2 Feb 2025 17:13:23 +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=1738516404; cv=none; b=m914rgal/totkY7c0TE12AffuqWVVhZhnyK1IFOuuR2Y2QVZNCZ93pD+8hyTv0vU7A8RB0vlglZJp4AkIZYw3DBNPMHnl2FRNTEg+52k5UQF4TLLqngIzGSpxc7MC5DjcoTvP0L8WUa7/5GxfkK3kDg/lZO2NkFTZA7Fz6YNQvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516404; c=relaxed/simple; bh=ZbFypzkJdExdN3+OlsfxgzJeLkCZaTY5FmSg9vTVA5Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sOxJ6IL45W8nfU6QJemTylsxf4iZ8TFHJ75ejyItFgfxlZ1rLPE70otn6rYfUnMEn9g5LAfRbQQxL3CgKmqhVzMR2huPYnKdot3dG+3ZS11wIABy2sGR3S2txAesp3DkpVCFInJXM8K5QImG+wUBtdTN0KXDFvSSnu835k9TZJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uwmpvXsv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uwmpvXsv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A3B6C4CED1; Sun, 2 Feb 2025 17:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516403; bh=ZbFypzkJdExdN3+OlsfxgzJeLkCZaTY5FmSg9vTVA5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=uwmpvXsvr2x9utu9U7fFUYdNKdh/mxBsfLGgs65w9hxP4C43fxyJOhXwpcojCqkZz 7+4gEAl/w+HQ95hHM+TRXxjWxyBx6mGOmFjyna1gDjiC8vhfpolJOw1e2GsW61v2+B +aR20dVUrxpdPI/twZZi0q+JSiU9Y3qXYbJPItmrL/UO38nJrIv3vCKkQK+OhN7qOk 9HYhOa+rnn+F35UeYm7fcSZ7Y3JMk++ixYTIz7Jnb/svl8srgv8eFee3RM7aFHrwjQ dxGDIB4PWqXiNHh+Ylq2nH2VbxxiCCWt9/IuDYH6AxXmk8+/TvclujME81kjd7uJC5 gYxzkGgFiP/xw== From: Len Brown To: linux-pm@vger.kernel.org Cc: Patryk Wlazlyn , Len Brown Subject: [PATCH 19/25] tools/power turbostat: Allow adding PMT counters directly by sysfs path Date: Sun, 2 Feb 2025 11:09:35 -0600 Message-ID: <83fbeb9f9776cd044d36af606127f56206337bab.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Patryk Wlazlyn Allow user to add PMT counters by either identifying the source with: guid=%u,seq=%u or, since this patch, with direct sysfs path: path=%s, for example path=/sys/class/intel_pmt/telem5 In the later case, the guid and sequence number will be infered by turbostat. Signed-off-by: Patryk Wlazlyn Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 107 +++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index f76e1de3f968..0f2475fa9fa4 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -9788,11 +9788,96 @@ bool starts_with(const char *str, const char *prefix) return strncmp(prefix, str, strlen(prefix)) == 0; } +int pmt_parse_from_path(const char *target_path, unsigned int *out_guid, unsigned int *out_seq) +{ + struct pmt_diriter_t pmt_iter; + const struct dirent *dirname; + struct stat stat, target_stat; + int fd_telem_dir = -1; + int fd_target_dir; + unsigned int seq = 0; + unsigned long guid, target_guid; + int ret = -1; + + fd_target_dir = open(target_path, O_RDONLY | O_DIRECTORY); + if (fd_target_dir == -1) { + return -1; + } + + if (fstat(fd_target_dir, &target_stat) == -1) { + fprintf(stderr, "%s: Failed to stat the target: %s", __func__, strerror(errno)); + exit(1); + } + + if (parse_telem_info_file(fd_target_dir, "guid", "%lx", &target_guid)) { + fprintf(stderr, "%s: Failed to parse the target guid file: %s", __func__, strerror(errno)); + exit(1); + } + + close(fd_target_dir); + + pmt_diriter_init(&pmt_iter); + + for (dirname = pmt_diriter_begin(&pmt_iter, SYSFS_TELEM_PATH); dirname != NULL; + dirname = pmt_diriter_next(&pmt_iter)) { + + fd_telem_dir = openat(dirfd(pmt_iter.dir), dirname->d_name, O_RDONLY | O_DIRECTORY); + if (fd_telem_dir == -1) { + continue; + } + + if (parse_telem_info_file(fd_telem_dir, "guid", "%lx", &guid)) { + fprintf(stderr, "%s: Failed to parse the guid file: %s", __func__, strerror(errno)); + continue; + } + + if (fstat(fd_telem_dir, &stat) == -1) { + fprintf(stderr, "%s: Failed to stat %s directory: %s", __func__, + dirname->d_name, strerror(errno)); + continue; + } + + /* + * If reached the same directory as target, exit the loop. + * Seq has the correct value now. + */ + if (stat.st_dev == target_stat.st_dev && stat.st_ino == target_stat.st_ino) { + ret = 0; + break; + } + + /* + * If reached directory with the same guid, + * but it's not the target directory yet, + * increment seq and continue the search. + */ + if (guid == target_guid) + ++seq; + + close(fd_telem_dir); + fd_telem_dir = -1; + } + + pmt_diriter_remove(&pmt_iter); + + if (fd_telem_dir != -1) + close(fd_telem_dir); + + if (!ret) { + *out_guid = target_guid; + *out_seq = seq; + } + + return ret; +} + void parse_add_command_pmt(char *add_command) { char *name = NULL; char *type_name = NULL; char *format_name = NULL; + char *direct_path = NULL; + static const char direct_path_prefix[] = "path="; unsigned int offset; unsigned int lsb; unsigned int msb; @@ -9881,6 +9966,10 @@ void parse_add_command_pmt(char *add_command) goto next; } + if (strncmp(add_command, direct_path_prefix, strlen(direct_path_prefix)) == 0) { + direct_path = add_command + strlen(direct_path_prefix); + goto next; + } next: add_command = strchr(add_command, ','); if (add_command) { @@ -9952,8 +10041,24 @@ void parse_add_command_pmt(char *add_command) exit(1); } + if (direct_path && has_guid) { + printf("%s: path and guid+seq parameters are mutually exclusive\n" + "notice: passed guid=0x%x and path=%s\n", __func__, guid, direct_path); + exit(1); + } + + if (direct_path) { + if (pmt_parse_from_path(direct_path, &guid, &seq)) { + printf("%s: failed to parse PMT file from %s\n", __func__, direct_path); + exit(1); + } + + /* GUID was just infered from the direct path. */ + has_guid = true; + } + if (!has_guid) { - printf("%s: missing %s\n", __func__, "guid"); + printf("%s: missing %s\n", __func__, "guid or path"); exit(1); } From patchwork Sun Feb 2 17:09:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861493 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 65DC11F9F73 for ; Sun, 2 Feb 2025 17:13:26 +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=1738516407; cv=none; b=prH95sIlNvSLkd+OPI8iWP4kfAHGbchO5RHX+jsMJxi/AlnMmlTqOdMaDCpfwSQkJsxGCYzxodFyT0gWIDCUg8M4IFw2EAwJNRPFfwbTaDZ+cD4c2nvv10g+QcMeaE0xfxVkJFvx7ioKRfl3p3PirgRHo9qn1ntjhdRg+smguNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516407; c=relaxed/simple; bh=RMVZNI9GML9uxNNbHkqdaqva2odlb4BkpDhEXrPUJgk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MNfelQ1/mDI4CWJfeH+k5N5iv1mZK0aEvAu0HQv7/vUOfI/S2/YutPkXdtQAnPK5AH45no75j7wO3UQERUWtU0vKU8b6aHv1Bqjgl8SuMEY6LfgUM6SwwJJrfGtKbsQ6AysvhM0o2VFMRECXuFNSOMxCaO7Z+7CSIMY4xa5LMUU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cut1W6y/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cut1W6y/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83437C4CEE1; Sun, 2 Feb 2025 17:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516406; bh=RMVZNI9GML9uxNNbHkqdaqva2odlb4BkpDhEXrPUJgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=Cut1W6y/EiKUxMPhGJcoQHAgpGpjuzeFdVaJ+NX5lz6565DMBk2/mGo4BkkDaXzz9 y+OFoDBwsKs1HmoPwztZL3qWalcDqkcxJYuONKAVBKDhtAsbJuAKmG5hdiGhjA/N1K bTc9/36cm2BnIaDGfgEq+zjiR+yPOX2oj9JR73r61ByphlwTxRqig54SyHJkvbCYZ7 hbFpeP5TvTCuOIjgrQG084CUPCwRpfLQ/1zGox4vD485XxHjwpgEUTiVcR5Ws1RtRT vh2wxd9RoZ2HQoqgytUR5nG59ZH4u7GlP2/mEA0HJQ56vh6/ifl4es0Hbw7srantQ6 bbRUrsevZQPAA== From: Len Brown To: linux-pm@vger.kernel.org Cc: Patryk Wlazlyn , Len Brown Subject: [PATCH 21/25] tools/power turbostat: Add tcore clock PMT type Date: Sun, 2 Feb 2025 11:09:37 -0600 Message-ID: <1a202afeaa370970413846c2cb09b383875e753c.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Patryk Wlazlyn Some PMT counters, for example module c1e residency on Intel Clearwater Forest, are reported using tcore clock type. Signed-off-by: Patryk Wlazlyn Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 32 ++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 76d2632e60ac..ecaa4e0fb2c0 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -1538,6 +1538,8 @@ static struct msr_counter_arch_info msr_counter_arch_infos[] = { #define PMT_MTL_DC6_GUID 0x1a067102 #define PMT_MTL_DC6_SEQ 0 +unsigned long long tcore_clock_freq_hz = 800000000; + #define PMT_COUNTER_NAME_SIZE_BYTES 16 #define PMT_COUNTER_TYPE_NAME_SIZE_BYTES 32 @@ -1560,6 +1562,7 @@ struct pmt_mmio { enum pmt_datatype { PMT_TYPE_RAW, PMT_TYPE_XTAL_TIME, + PMT_TYPE_TCORE_CLOCK, }; struct pmt_domain_info { @@ -2474,6 +2477,7 @@ void print_header(char *delim) break; case PMT_TYPE_XTAL_TIME: + case PMT_TYPE_TCORE_CLOCK: outp += sprintf(outp, "%s%s", (printed++ ? delim : ""), ppmt->name); break; } @@ -2548,6 +2552,7 @@ void print_header(char *delim) break; case PMT_TYPE_XTAL_TIME: + case PMT_TYPE_TCORE_CLOCK: outp += sprintf(outp, "%s%s", (printed++ ? delim : ""), ppmt->name); break; } @@ -2679,6 +2684,7 @@ void print_header(char *delim) break; case PMT_TYPE_XTAL_TIME: + case PMT_TYPE_TCORE_CLOCK: outp += sprintf(outp, "%s%s", (printed++ ? delim : ""), ppmt->name); break; } @@ -2997,7 +3003,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data for (i = 0, ppmt = sys.pmt_tp; ppmt; i++, ppmt = ppmt->next) { const unsigned long value_raw = t->pmt_counter[i]; - const double value_converted = 100.0 * value_raw / crystal_hz / interval_float; + double value_converted; switch (ppmt->type) { case PMT_TYPE_RAW: if (pmt_counter_get_width(ppmt) <= 32) @@ -3009,8 +3015,13 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data break; case PMT_TYPE_XTAL_TIME: + value_converted = 100.0 * value_raw / crystal_hz / interval_float; outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted); break; + + case PMT_TYPE_TCORE_CLOCK: + value_converted = 100.0 * value_raw / tcore_clock_freq_hz / interval_float; + outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted); } } @@ -3077,7 +3088,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data for (i = 0, ppmt = sys.pmt_cp; ppmt; i++, ppmt = ppmt->next) { const unsigned long value_raw = c->pmt_counter[i]; - const double value_converted = 100.0 * value_raw / crystal_hz / interval_float; + double value_converted; switch (ppmt->type) { case PMT_TYPE_RAW: if (pmt_counter_get_width(ppmt) <= 32) @@ -3089,8 +3100,13 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data break; case PMT_TYPE_XTAL_TIME: + value_converted = 100.0 * value_raw / crystal_hz / interval_float; outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted); break; + + case PMT_TYPE_TCORE_CLOCK: + value_converted = 100.0 * value_raw / tcore_clock_freq_hz / interval_float; + outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted); } } @@ -3275,7 +3291,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data for (i = 0, ppmt = sys.pmt_pp; ppmt; i++, ppmt = ppmt->next) { const unsigned long value_raw = p->pmt_counter[i]; - const double value_converted = 100.0 * value_raw / crystal_hz / interval_float; + double value_converted; switch (ppmt->type) { case PMT_TYPE_RAW: if (pmt_counter_get_width(ppmt) <= 32) @@ -3287,8 +3303,13 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data break; case PMT_TYPE_XTAL_TIME: + value_converted = 100.0 * value_raw / crystal_hz / interval_float; outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted); break; + + case PMT_TYPE_TCORE_CLOCK: + value_converted = 100.0 * value_raw / tcore_clock_freq_hz / interval_float; + outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted); } } @@ -10016,6 +10037,11 @@ void parse_add_command_pmt(char *add_command) has_type = true; } + if (strcmp("tcore_clock", type_name) == 0) { + type = PMT_TYPE_TCORE_CLOCK; + has_type = true; + } + if (!has_type) { printf("%s: invalid %s: %s\n", __func__, "type", type_name); exit(1); From patchwork Sun Feb 2 17:09:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861492 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 DF71C1FBC83 for ; Sun, 2 Feb 2025 17:13:29 +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=1738516410; cv=none; b=OLn2u+0TsYveTle7fmGWpADhVOJaR2yeaAkDozjgtFPaw2TErgftp9l97y/IPywVWiRt0C39CmRYoPyFpJwQMCUMzBgtFHxW85ELUBfxx5uO/UAPSc+urYXYklVP4b8+twy+J/SFZIDCSUOIhE1AIjlsm+1HTtBbnJzy2OTylZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516410; c=relaxed/simple; bh=SZkNjPY0jaCu7dScCcBFarX5Jns6URGV09FAWZnPqY8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KLP7i9PjomBbiuPtsadpwMTAtEVnOUj0HGIhmlw6PVg2qR6CrVzlDzufcildJ/VknwkxsXJQD1JiFxMUH7o6Z2K5dzHOl87qH1fXKyV1wTmkBtnTNqWmzP4JPaQG74VIcLytqbh58tl0hFhLpGBKTSHLoKtAS6nZG9lVKBGzo+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZvqRnfV3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZvqRnfV3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3C36C4CEE0; Sun, 2 Feb 2025 17:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516409; bh=SZkNjPY0jaCu7dScCcBFarX5Jns6URGV09FAWZnPqY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=ZvqRnfV3vsqcl1k2KofxF3HD73qbsWqdwvOSw/qikI8rnDPnA5uHyHofwm/9yybPE Ue8VZ1YjP0A0/YjJCgBH5dyRgE3C6UAwwt3OOtZVxc0bH0L9BDEk15ab4k4IWKiyrr 7B6qwCWuA5WN7vQjuFVVfJ/aGdBfXu0rD56Y2/E1hRx1boOzbYvGx6oelVamEzE8uN Muld06qJAU7lpZDyeLJ/iNVSiY2VZJbuA5woinvx6gt2vZ579SfA5HmsGhdQUAkurL mxWkJoW9ohjnwqIGY+ZdOl0mn/qnPlCU8umCNLrekcQad4vBw1vUm567qMkYyIiSfb ZPZ3qOlJ8ooSA== From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown , Zhang Rui Subject: [PATCH 23/25] tools/power turbostat: Harden one-shot mode against cpu offline Date: Sun, 2 Feb 2025 11:09:39 -0600 Message-ID: <5499b5ac0b2c661cc37190a23a4aee9308b3d3ee.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Len Brown when turbostat interval mode can't migrate to a CPU, it complains, prints no data, re-initializes with the new CPU configuration and starts a new interval. But this strategy in the face of a CPU hotplug offline during an interval doesn't help in one-shot mode. When the missing CPU is discovered at the end of the interval, the forked program has already returned and there is nothing left for a new interval to measure. So instead of aborting get_coutners() and delta_cpu() if a missing CPU is detected, complain, but carry on and output what statistics are actually present. Use the same strategy for delta_cpu when aperf:mperf are observed to have been reset -- complain, but carry on and print data for the CPUs that are still present. Interval mode error handling is unchanged. One-shot mode can now do this: $ sudo chcpu -e 1 ; sudo ./turbostat --quiet --show PkgWatt,Busy%,CPU chcpu -d 1 CPU 1 enabled CPU 1 disabled get_counters: Could not migrate to CPU 1 ./turbostat: Counter reset detected 0.036920 sec CPU Busy% PkgWatt - 0.00 10.00 0 99.73 10.00 1 0.00 2 91.53 3 16.83 Suggested-by: Zhang Rui Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 1f188a0908da..8df08819e7b4 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -2063,6 +2063,8 @@ int for_all_cpus(int (func) (struct thread_data *, struct core_data *, struct pk { int retval, pkg_no, core_no, thread_no, node_no; + retval = 0; + for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { for (node_no = 0; node_no < topo.nodes_per_pkg; node_no++) { for (core_no = 0; core_no < topo.cores_per_node; ++core_no) { @@ -2078,14 +2080,12 @@ int for_all_cpus(int (func) (struct thread_data *, struct core_data *, struct pk c = GET_CORE(core_base, core_no, node_no, pkg_no); p = GET_PKG(pkg_base, pkg_no); - retval = func(t, c, p); - if (retval) - return retval; + retval |= func(t, c, p); } } } } - return 0; + return retval; } int is_cpu_first_thread_in_core(struct thread_data *t, struct core_data *c, struct pkg_data *p) @@ -3620,12 +3620,10 @@ int delta_cpu(struct thread_data *t, struct core_data *c, /* always calculate thread delta */ retval = delta_thread(t, t2, c2); /* c2 is core delta */ - if (retval) - return retval; /* calculate package delta only for 1st core in package */ if (is_cpu_first_core_in_package(t, c, p)) - retval = delta_package(p, p2); + retval |= delta_package(p, p2); return retval; } @@ -5748,6 +5746,8 @@ int for_all_cpus_2(int (func) (struct thread_data *, struct core_data *, { int retval, pkg_no, node_no, core_no, thread_no; + retval = 0; + for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { for (node_no = 0; node_no < topo.nodes_per_pkg; ++node_no) { for (core_no = 0; core_no < topo.cores_per_node; ++core_no) { @@ -5769,14 +5769,12 @@ int for_all_cpus_2(int (func) (struct thread_data *, struct core_data *, p = GET_PKG(pkg_base, pkg_no); p2 = GET_PKG(pkg_base2, pkg_no); - retval = func(t, c, p, t2, c2, p2); - if (retval) - return retval; + retval |= func(t, c, p, t2, c2, p2); } } } } - return 0; + return retval; } /* @@ -9462,10 +9460,9 @@ int fork_it(char **argv) timersub(&tv_odd, &tv_even, &tv_delta); if (for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS)) fprintf(outf, "%s: Counter reset detected\n", progname); - else { - compute_average(EVEN_COUNTERS); - format_all_counters(EVEN_COUNTERS); - } + + compute_average(EVEN_COUNTERS); + format_all_counters(EVEN_COUNTERS); fprintf(outf, "%.6f sec\n", tv_delta.tv_sec + tv_delta.tv_usec / 1000000.0); From patchwork Sun Feb 2 17:09:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 861491 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 F065F1FBC83 for ; Sun, 2 Feb 2025 17:13:32 +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=1738516413; cv=none; b=tXfpiaaq/xpovBjnHLVfxJVH0+hr8czYBnLfAQfjVwnDQmCBcX5bjzuniZaOTJe1zNtPGxbTvRlIKk2kYS960RE2No1oV0lrl1PcctBU4DaGDM0jhLlC//5aiCexHcV2jtVBUR/nue6ZRPUoo2EpPAV1c04PqNsqPN1SDDGsdB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738516413; c=relaxed/simple; bh=GappRWpAvVdmFdj2co70h0M69z2g1/IHpwxfABymrA8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sFXjvTZFtfxTeVnmI54uT9cX9kG6lJ4pSv7gSJTi0dmlFMu4DVHlEqMgmAsVlrVxnjetlq7OsQerSCOzQNTzL6ll51i/093NyfrHUs6+UZmdnwRP+ARIniSe3oKmtyGSB0V2jX01n20q6T3SbAdPYogxVhHrWqfJzGMUXNg2cco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dLiv7dif; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dLiv7dif" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D73CC4CED1; Sun, 2 Feb 2025 17:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738516412; bh=GappRWpAvVdmFdj2co70h0M69z2g1/IHpwxfABymrA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=dLiv7difCV7/LC+4SMuNwtmr1gt5Pm9cTxMFkFkO8CvlZJEmaDm4mTKYjsMb7z3/o arI/nDNL4p9+9exVCarlkmz+qXs5GzOmbUZEtVn+OJ97RApvMVTgQ4SfoLZN4KFgxc bDTf3pnwfY1N3ahyphjRnZEHuSqh5KYXF1hXXw+XY5wH1n/sEgX2BSMbtlwCfv7S3w pguLSqPKFboMwr6M+z/Vu+lUH4uYz13MRuXCSA+njNjMclCGqFi43hzjn/wYbJHj0H Zwc+q2rnx6vi5GzW5K+XePUjElzUvJD8oeL/KrOKSwBr62AcWA7uSos/l+h1fzsnEG uYWZ+YAIqFDUg== From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown Subject: [PATCH 25/25] tools/power turbostat: version 2025.02.02 Date: Sun, 2 Feb 2025 11:09:41 -0600 Message-ID: <2c4627c8ced77855b106c7104ecab70837d53799.1738515889.git.len.brown@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center From: Len Brown Summary of Changes since 2024.11.30: Fix regression in 2023.11.07 that affinitized forked child in one-shot mode. Harden one-shot mode against hotplug online/offline Enable RAPL SysWatt column by default. Add initial PTL, CWF platform support. Harden initial PMT code in response to early use. Enable first built-in PMT counter: CWF c1e residency Refuse to run on unsupported platforms without --force, to encourage updating to a version that supports the system, and to avoid no-so-useful measurement results. Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 364a44a7d7ae..8d5011a0bf60 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -9559,7 +9559,7 @@ int get_and_dump_counters(void) void print_version() { - fprintf(outf, "turbostat version 2025.01.14 - Len Brown \n"); + fprintf(outf, "turbostat version 2025.02.02 - Len Brown \n"); } #define COMMAND_LINE_SIZE 2048