lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251110013152.3099080-2-irogers@google.com>
Date: Sun,  9 Nov 2025 17:31:48 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
	John Garry <john.g.garry@...cle.com>, Will Deacon <will@...nel.org>, 
	James Clark <james.clark@...aro.org>, Mike Leach <mike.leach@...aro.org>, 
	Leo Yan <leo.yan@...ux.dev>, Suzuki K Poulose <suzuki.poulose@....com>, 
	Yicong Yang <yangyicong@...ilicon.com>, Jonathan Cameron <jonathan.cameron@...wei.com>, 
	Thomas Gleixner <tglx@...utronix.de>, Darren Hart <dvhart@...radead.org>, 
	Davidlohr Bueso <dave@...olabs.net>, 
	"André Almeida" <andrealmeid@...lia.com>, Tomas Glozar <tglozar@...hat.com>, 
	Quentin Monnet <qmo@...nel.org>, Yuzhuo Jing <yuzhuo@...gle.com>, Blake Jones <blakejones@...gle.com>, 
	Charlie Jenkins <charlie@...osinc.com>, Yeoreum Yun <yeoreum.yun@....com>, 
	Athira Rajeev <atrajeev@...ux.ibm.com>, Ravi Bangoria <ravi.bangoria@....com>, 
	Collin Funk <collin.funk1@...il.com>, Dapeng Mi <dapeng1.mi@...ux.intel.com>, 
	Thomas Richter <tmricht@...ux.ibm.com>, Dmitry Vyukov <dvyukov@...gle.com>, 
	Andi Kleen <ak@...ux.intel.com>, Howard Chu <howardchu95@...il.com>, 
	Zecheng Li <zecheng@...gle.com>, tanze <tanze@...inos.cn>, 
	Gabriele Monaco <gmonaco@...hat.com>, GuoHan Zhao <zhaoguohan@...inos.cn>, 
	Markus Elfring <Markus.Elfring@....de>, Colin Ian King <colin.i.king@...il.com>, 
	Kan Liang <kan.liang@...ux.intel.com>, "Dr. David Alan Gilbert" <linux@...blig.org>, 
	Jean-Philippe Romain <jean-philippe.romain@...s.st.com>, Yang Li <yang.lee@...ux.alibaba.com>, 
	linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: [PATCH v1 1/5] perf intel-pt: Use the perf provided "cpuid.h"

Rather than having a feature test and include of <cpuid.h> for the
__get_cpuid function, use the cpuid function provided by
tools/perf/arch/x86/util/cpuid.h.

Signed-off-by: Ian Rogers <irogers@...gle.com>
---
 tools/perf/arch/x86/tests/intel-pt-test.c | 6 +++---
 tools/perf/arch/x86/util/intel-pt.c       | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/arch/x86/tests/intel-pt-test.c b/tools/perf/arch/x86/tests/intel-pt-test.c
index b217ed67cd4e..970997759ec2 100644
--- a/tools/perf/arch/x86/tests/intel-pt-test.c
+++ b/tools/perf/arch/x86/tests/intel-pt-test.c
@@ -3,7 +3,6 @@
 #include <linux/compiler.h>
 #include <linux/bits.h>
 #include <string.h>
-#include <cpuid.h>
 #include <sched.h>
 
 #include "intel-pt-decoder/intel-pt-pkt-decoder.h"
@@ -11,6 +10,7 @@
 #include "debug.h"
 #include "tests/tests.h"
 #include "arch-tests.h"
+#include "../util/cpuid.h"
 #include "cpumap.h"
 
 /**
@@ -363,7 +363,7 @@ static int get_pt_caps(int cpu, struct pt_caps *caps)
 	memset(caps, 0, sizeof(*caps));
 
 	for (i = 0; i < INTEL_PT_SUBLEAF_CNT; i++) {
-		__get_cpuid_count(20, i, &r.eax, &r.ebx, &r.ecx, &r.edx);
+		cpuid(20, i, &r.eax, &r.ebx, &r.ecx, &r.edx);
 		pr_debug("CPU %d CPUID leaf 20 subleaf %d\n", cpu, i);
 		pr_debug("eax = 0x%08x\n", r.eax);
 		pr_debug("ebx = 0x%08x\n", r.ebx);
@@ -380,7 +380,7 @@ static bool is_hybrid(void)
 	unsigned int eax, ebx, ecx, edx = 0;
 	bool result;
 
-	__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx);
+	cpuid(7, 0, &eax, &ebx, &ecx, &edx);
 	result = edx & BIT(15);
 	pr_debug("Is %shybrid : CPUID leaf 7 subleaf 0 edx %#x (bit-15 indicates hybrid)\n",
 		 result ? "" : "not ", edx);
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 2d7c0dec86b0..b394ad9cc635 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -12,7 +12,6 @@
 #include <linux/log2.h>
 #include <linux/zalloc.h>
 #include <linux/err.h>
-#include <cpuid.h>
 
 #include "../../../util/session.h"
 #include "../../../util/event.h"
@@ -34,6 +33,7 @@
 #include <internal/lib.h> // page_size
 #include "../../../util/intel-pt.h"
 #include <api/fs/fs.h>
+#include "cpuid.h"
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
@@ -311,7 +311,7 @@ static void intel_pt_tsc_ctc_ratio(u32 *n, u32 *d)
 {
 	unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
 
-	__get_cpuid(0x15, &eax, &ebx, &ecx, &edx);
+	cpuid(0x15, 0, &eax, &ebx, &ecx, &edx);
 	*n = ebx;
 	*d = eax;
 }
-- 
2.51.2.1041.gc1ab5b90ca-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ