Re: [RFC][PATCH 5/3] tracing: Add smi counting to HWLAT
From: Peter Zijlstra
Date: Tue Aug 09 2016 - 17:26:15 EST
On Tue, Aug 09, 2016 at 02:05:43PM -0400, Steven Rostedt wrote:
> +int arch_smi_count(void)
> +{
> + unsigned long long count;
> + int err;
> +
> + err = rdmsrl_safe(MSR_SMI_COUNT, &count);
> + if (err)
> + return 0;
That's really yucky, relying on _safe() to detect availability.
Also, I just found AMD Fam15h has this counter through PMCs (event
0x2b).
> +
> + return count;
> +}