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
This commit is contained in:
Ali Mashtizadeh
2026-03-23 17:21:21 -03:00
committed by Mitchell Horne
parent 47402c9422
commit 39515d8b62
+3 -5
View File
@@ -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