{"id":2225021,"url":"http://patchwork.ozlabs.org/api/patches/2225021/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/patch/20260420094437.731979-2-piotr.kubaj@intel.com/","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260420094437.731979-2-piotr.kubaj@intel.com>","list_archive_url":null,"date":"2026-04-20T09:44:38","name":"[v7] high_freq_hwp_cap_cppc.c: new test","commit_ref":null,"pull_url":null,"state":"needs-review-ack","archived":false,"hash":"5aecf705411407ae60f4164245faa3d98ba2a342","submitter":{"id":92049,"url":"http://patchwork.ozlabs.org/api/people/92049/?format=json","name":"Piotr Kubaj","email":"piotr.kubaj@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260420094437.731979-2-piotr.kubaj@intel.com/mbox/","series":[{"id":500575,"url":"http://patchwork.ozlabs.org/api/series/500575/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/list/?series=500575","date":"2026-04-20T09:44:38","name":"[v7] high_freq_hwp_cap_cppc.c: new test","version":7,"mbox":"http://patchwork.ozlabs.org/series/500575/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225021/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/2225021/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=WpZ9t2b7;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=213.254.12.146; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)"],"Received":["from picard.linux.it (picard.linux.it [213.254.12.146])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fzgb05ZKNz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 19:45:30 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id DA2DE3E28F8\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 11:45:26 +0200 (CEST)","from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id A63AF3C18AB\n for <ltp@lists.linux.it>; Mon, 20 Apr 2026 11:45:23 +0200 (CEST)","from mgamail.intel.com (mgamail.intel.com [192.198.163.9])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 30CE36008D7\n for <ltp@lists.linux.it>; Mon, 20 Apr 2026 11:45:21 +0200 (CEST)","from orviesa003.jf.intel.com ([10.64.159.143])\n by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Apr 2026 02:45:18 -0700","from pkubaj-desk.igk.intel.com (HELO intel.com) ([10.217.160.221])\n by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Apr 2026 02:45:17 -0700"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1776678322; x=1808214322;\n h=from:to:cc:subject:date:message-id:mime-version:\n content-transfer-encoding;\n bh=tnMRZujHdXQ0UdzAZfIsPbpwcxXuqcIE1eheUJI4hCc=;\n b=WpZ9t2b75Aytp3CfRST4x3XwDPeC6qAz7+q1gyVMQ+kira0HyewAbva8\n 8BiT3hrzAO+Frvo36+5YgakmQba6tV8LMQkWW8v3u8OowgFLdT5C9bs9/\n rPvex2Uvpa/hwMdKIlfzOIXmwerGZ7ZMg4eJh23Ag3Hv3EPCSlNPP1Wmt\n wHJzxNBMmkxwa9eA2PogAnMoFNzcknQGkKsB48mPlFQmShD7q2iSzC0d9\n LwlXUtozeusnewcNyVxFtC4Gk3e9AL5/kktouSaNQ/wMBNMNA0MbIOMp3\n 1i5xxEw/t6JJH3g48p7T3QGMNQ+azg6YWSDJCFb9DjZ9odgmDhnT3Pj8V g==;","X-CSE-ConnectionGUID":["6zwNgrxARZWWHJdmjbph5g==","Mhwb7BJjQ1G/KnprKJgTKA=="],"X-CSE-MsgGUID":["/nulhBXnTOOXI5J9HaC2TA==","xGEc/uEjROy6hZFjF5ns4Q=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11762\"; a=\"88288519\"","E=Sophos;i=\"6.23,189,1770624000\"; d=\"scan'208\";a=\"88288519\"","E=Sophos;i=\"6.23,189,1770624000\"; d=\"scan'208\";a=\"235674971\""],"X-ExtLoop1":"1","From":"Piotr Kubaj <piotr.kubaj@intel.com>","To":"ltp@lists.linux.it","Date":"Mon, 20 Apr 2026 11:44:38 +0200","Message-ID":"<20260420094437.731979-2-piotr.kubaj@intel.com>","X-Mailer":"git-send-email 2.47.3","MIME-Version":"1.0","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-5.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-5.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH v7] high_freq_hwp_cap_cppc.c: new test","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","Cc":"helena.anna.dubel@intel.com, tomasz.ossowski@intel.com,\n rafael.j.wysocki@intel.com, daniel.niestepski@intel.com","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"Verify for all online logical CPUs that their highest performance value are\nthe same for HWP Capability MSR 0x771 and CPPC sysfs file.\n\nSigned-off-by: Piotr Kubaj <piotr.kubaj@intel.com>\n---\nAddresses Andrea's feedback.\n runtest/power_management_tests                |  1 +\n testcases/kernel/power_management/.gitignore  |  1 +\n .../power_management/high_freq_hwp_cap_cppc.c | 90 +++++++++++++++++++\n 3 files changed, 92 insertions(+)\n create mode 100644 testcases/kernel/power_management/high_freq_hwp_cap_cppc.c","diff":"diff --git a/runtest/power_management_tests b/runtest/power_management_tests\nindex 884e615cd..6d87dfb7f 100644\n--- a/runtest/power_management_tests\n+++ b/runtest/power_management_tests\n@@ -1,4 +1,5 @@\n #POWER_MANAGEMENT\n+high_freq_hwp_cap_cppc high_freq_hwp_cap_cppc\n runpwtests01 runpwtests01.sh\n runpwtests02 runpwtests02.sh\n runpwtests03 runpwtests03.sh\ndiff --git a/testcases/kernel/power_management/.gitignore b/testcases/kernel/power_management/.gitignore\nindex 0c2a3ed4b..c13bca1c4 100644\n--- a/testcases/kernel/power_management/.gitignore\n+++ b/testcases/kernel/power_management/.gitignore\n@@ -1 +1,2 @@\n+high_freq_hwp_cap_cppc\n pm_get_sched_values\ndiff --git a/testcases/kernel/power_management/high_freq_hwp_cap_cppc.c b/testcases/kernel/power_management/high_freq_hwp_cap_cppc.c\nnew file mode 100644\nindex 000000000..3cd7db221\n--- /dev/null\n+++ b/testcases/kernel/power_management/high_freq_hwp_cap_cppc.c\n@@ -0,0 +1,90 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (C) 2026 Piotr Kubaj <piotr.kubaj@intel.com>\n+ */\n+\n+/*\\\n+ * Verify for all online logical CPUs that their highest performance value are\n+ * the same for HWP Capability MSR 0x771 and CPPC sysfs file.\n+ */\n+\n+#include \"tst_test.h\"\n+#include \"tst_safe_prw.h\"\n+\n+#define MSR_HWP_CAPABILITIES\t0x771\n+#define HIGHEST_PERF_MASK\t0xFF\n+\n+static int nproc;\n+\n+static void setup(void)\n+{\n+\tnproc = tst_ncpus_conf();\n+}\n+\n+static void run(void)\n+{\n+\tbool status = true;\n+\n+\tfor (int i = 0; i < nproc; i++) {\n+\t\tint online = 1;\n+\t\tchar path[PATH_MAX];\n+\t\tunsigned long long msr_highest_perf = 0, sysfs_highest_perf = 0;\n+\n+\t\tsnprintf(path, sizeof(path), \"/sys/devices/system/cpu/cpu%d/online\", i);\n+\t\tif (i)\n+\t\t\tSAFE_FILE_SCANF(path, \"%d\", &online);\n+\n+\t\tif (!online) {\n+\t\t\ttst_res(TINFO, \"CPU%d offline, skipping\", i);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tsnprintf(path, sizeof(path), \"/sys/devices/system/cpu/cpu%d/acpi_cppc/highest_perf\", i);\n+\t\tif (access(path, F_OK) == -1) {\n+\t\t\ttst_res(TCONF | TERRNO, \"CPPC sysfs not available, skipping\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tSAFE_FILE_SCANF(path, \"%llu\", &sysfs_highest_perf);\n+\t\ttst_res(TDEBUG, \"%s: %llu\", path, sysfs_highest_perf);\n+\n+\t\tsnprintf(path, sizeof(path), \"/dev/cpu/%d/msr\", i);\n+\t\tint fd = SAFE_OPEN(path, O_RDONLY);\n+\n+\t\tSAFE_PREAD(1, fd, &msr_highest_perf, sizeof(msr_highest_perf), MSR_HWP_CAPABILITIES);\n+\t\tSAFE_CLOSE(fd);\n+\t\tmsr_highest_perf &= HIGHEST_PERF_MASK;\n+\t\ttst_res(TDEBUG, \"%s: %llu\", path, msr_highest_perf);\n+\n+\t\tif (msr_highest_perf != sysfs_highest_perf) {\n+\t\t\ttst_res(TINFO, \"cpu%d: sysfs=%llu MSR=%llu\",\n+\t\t\t\ti, sysfs_highest_perf, msr_highest_perf);\n+\t\t\tstatus = false;\n+\t\t}\n+\t}\n+\n+\tif (status)\n+\t\ttst_res(TPASS, \"Sysfs and MSR values are equal\");\n+\telse\n+\t\ttst_res(TFAIL, \"Highest performance values differ between sysfs and MSR\");\n+}\n+\n+static struct tst_test test = {\n+\t.needs_drivers = (const char *const []) {\n+\t\t\"msr\",\n+\t\tNULL\n+\t},\n+\t.needs_kconfigs = (const char *const []) {\n+\t\t\"CONFIG_ACPI_CPPC_LIB\",\n+\t\t\"CONFIG_X86_MSR\",\n+\t\tNULL\n+\t},\n+\t.needs_root = 1,\n+\t.setup = setup,\n+\t.supported_archs = (const char *const []) {\n+\t\t\"x86\",\n+\t\t\"x86_64\",\n+\t\tNULL\n+\t},\n+\t.test_all = run\n+};\n","prefixes":["v7"]}