aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mashtizadeh <mashti@uwaterloo.ca>2026-03-23 20:21:21 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2026-03-23 20:21:21 +0000
commit39515d8b623a2be39d0c42a537fd9a17c417ff6e (patch)
tree3c012b8e750855bc7c63db9f47d9a1866db1d447
parent47402c9422ec6c9ba76d96414f5a08bd35a9e1fd (diff)
hwpmc: Use rdtsc instead of rdtscp for timestamps
No need for a barrier here, we are inside an NMI handler and executing a number of serializing instructions with stronger semantics. Reducing this overhead will increase our maximum safe sampling rate. Tested by: Paulo Fragoso <paulo@nlink.com.br> Reviewed by: mhorne MFC after: 1 week Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/2076
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index fb1fdf832398..6133b52b516f 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -818,11 +818,9 @@ pmc_force_context_switch(void)
uint64_t
pmc_rdtsc(void)
{
-#if defined(__i386__) || defined(__amd64__)
- if (__predict_true(amd_feature & AMDID_RDTSCP))
- return (rdtscp());
- else
- return (rdtsc());
+#if defined(__i386__)
+ /* Unfortunately get_cyclecount on i386 uses cpu_ticks. */
+ return (rdtsc());
#else
return (get_cyclecount());
#endif