From: Ian Rogers <irogers@google.com>
To: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>, "Ian Rogers" <irogers@google.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"John Garry" <john.g.garry@oracle.com>,
"Will Deacon" <will@kernel.org>,
"James Clark" <james.clark@linaro.org>,
"Mike Leach" <mike.leach@linaro.org>,
"Leo Yan" <leo.yan@linux.dev>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
"Yicong Yang" <yangyicong@hisilicon.com>,
"Jonathan Cameron" <jonathan.cameron@huawei.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"André Almeida" <andrealmeid@igalia.com>,
"Tomas Glozar" <tglozar@redhat.com>,
"Quentin Monnet" <qmo@kernel.org>,
"Yuzhuo Jing" <yuzhuo@google.com>,
"Blake Jones" <blakejones@google.com>,
"Charlie Jenkins" <charlie@rivosinc.com>,
"Yeoreum Yun" <yeoreum.yun@arm.com>,
"Athira Rajeev" <atrajeev@linux.ibm.com>,
"Ravi Bangoria" <ravi.bangoria@amd.com>,
"Collin Funk" <collin.funk1@gmail.com>,
"Dapeng Mi" <dapeng1.mi@linux.intel.com>,
"Thomas Richter" <tmricht@linux.ibm.com>,
"Dmitry Vyukov" <dvyukov@google.com>,
"Andi Kleen" <ak@linux.intel.com>,
"Howard Chu" <howardchu95@gmail.com>,
"Zecheng Li" <zecheng@google.com>, tanze <tanze@kylinos.cn>,
"Gabriele Monaco" <gmonaco@redhat.com>,
"GuoHan Zhao" <zhaoguohan@kylinos.cn>,
"Markus Elfring" <Markus.Elfring@web.de>,
"Colin Ian King" <colin.i.king@gmail.com>,
"Kan Liang" <kan.liang@linux.intel.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>,
"Jean-Philippe Romain" <jean-philippe.romain@foss.st.com>,
"Yang Li" <yang.lee@linux.alibaba.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH v1 1/5] perf intel-pt: Use the perf provided "cpuid.h"
Date: Sun, 9 Nov 2025 17:31:48 -0800 [thread overview]
Message-ID: <20251110013152.3099080-2-irogers@google.com> (raw)
In-Reply-To: <20251110013152.3099080-1-irogers@google.com>
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@google.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
next prev parent reply other threads:[~2025-11-10 1:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 1:31 [PATCH v1 0/5] Remove NO_AUXTRACE build option Ian Rogers
2025-11-10 1:31 ` Ian Rogers [this message]
2025-11-10 1:31 ` [PATCH v1 2/5] perf build: Don't add NO_AUXTRACE if missing feature-get_cpuid Ian Rogers
2025-11-10 1:31 ` [PATCH v1 3/5] tool build: Remove __get_cpuid feature test Ian Rogers
2025-11-10 1:31 ` [PATCH v1 4/5] perf build: Remove NO_AUXTRACE build option Ian Rogers
2025-11-10 1:31 ` [PATCH v1 5/5] perf auxtrace: Remove errno.h from auxtrace.h and fix transitive dependencies Ian Rogers
2025-11-11 6:21 ` [PATCH v1 0/5] Remove NO_AUXTRACE build option Namhyung Kim
2025-11-11 18:01 ` Ian Rogers
2025-11-12 9:21 ` James Clark
2025-11-14 18:35 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251110013152.3099080-2-irogers@google.com \
--to=irogers@google.com \
--cc=Markus.Elfring@web.de \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrealmeid@igalia.com \
--cc=atrajeev@linux.ibm.com \
--cc=blakejones@google.com \
--cc=charlie@rivosinc.com \
--cc=colin.i.king@gmail.com \
--cc=collin.funk1@gmail.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=dvyukov@google.com \
--cc=gmonaco@redhat.com \
--cc=howardchu95@gmail.com \
--cc=james.clark@linaro.org \
--cc=jean-philippe.romain@foss.st.com \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux@treblig.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=qmo@kernel.org \
--cc=ravi.bangoria@amd.com \
--cc=suzuki.poulose@arm.com \
--cc=tanze@kylinos.cn \
--cc=tglozar@redhat.com \
--cc=tglx@linutronix.de \
--cc=tmricht@linux.ibm.com \
--cc=will@kernel.org \
--cc=yang.lee@linux.alibaba.com \
--cc=yangyicong@hisilicon.com \
--cc=yeoreum.yun@arm.com \
--cc=yuzhuo@google.com \
--cc=zecheng@google.com \
--cc=zhaoguohan@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.