linux_dsm_epyc7002/arch/x86/events/intel
Kan Liang c085fb8774 perf/x86/intel/lbr: Support XSAVES for arch LBR read
Reading LBR registers in a perf NMI handler for a non-PEBS event
causes a high overhead because the number of LBR registers is huge.
To reduce the overhead, the XSAVES instruction should be used to replace
the LBR registers' reading method.

The XSAVES buffer used for LBR read has to be per-CPU because the NMI
handler invoked the lbr_read(). The existing task_ctx_data buffer
cannot be used which is per-task and only be allocated for the LBR call
stack mode. A new lbr_xsave pointer is introduced in the cpu_hw_events
as an XSAVES buffer for LBR read.

The XSAVES buffer should be allocated only when LBR is used by a
non-PEBS event on the CPU because the total size of the lbr_xsave is
not small (~1.4KB).

The XSAVES buffer is allocated when a non-PEBS event is added, but it
is lazily released in x86_release_hardware() when perf releases the
entire PMU hardware resource, because perf may frequently schedule the
event, e.g. high context switch. The lazy release method reduces the
overhead of frequently allocate/free the buffer.

If the lbr_xsave fails to be allocated, roll back to normal Arch LBR
lbr_read().

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Link: https://lkml.kernel.org/r/1593780569-62993-24-git-send-email-kan.liang@linux.intel.com
2020-07-08 11:38:57 +02:00
..
bts.c perf/x86: Replace zero-length array with flexible-array 2020-05-19 20:34:16 +02:00
core.c perf/x86/intel/lbr: Support Architectural LBR 2020-07-08 11:38:54 +02:00
cstate.c perf/x86/cstate: Add Jasper Lake CPU support 2020-04-22 21:43:12 +02:00
ds.c perf/x86/intel/lbr: Unify the stored format of LBR information 2020-07-08 11:38:53 +02:00
knc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
lbr.c perf/x86/intel/lbr: Support XSAVES for arch LBR read 2020-07-08 11:38:57 +02:00
Makefile perf/x86/rapl: Move RAPL support to common x86 code 2020-05-28 07:58:55 +02:00
p4.c perf_event: Add support for LSM and SELinux checks 2019-10-17 21:31:55 +02:00
p6.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-15 01:15:52 +01:00
pt.c perf/x86/intel/pt: Drop pointless NULL assignment. 2020-04-30 20:14:36 +02:00
pt.h perf/x86/intel/pt: Prevent redundant WRMSRs 2019-11-13 11:06:18 +01:00
uncore_nhmex.c perf/x86/intel/uncore: Correct fixed counter index check for NHM 2018-05-31 12:36:28 +02:00
uncore_snb.c perf/x86/intel/uncore: Record the size of mapped area 2020-06-15 14:09:50 +02:00
uncore_snbep.c perf/x86/intel/uncore: Expose an Uncore unit to IIO PMON mapping 2020-06-15 14:09:51 +02:00
uncore.c perf/x86/intel/uncore: Wrap the max dies calculation into an accessor 2020-06-15 14:09:51 +02:00
uncore.h perf/x86/intel/uncore: Expose an Uncore unit to IIO PMON mapping 2020-06-15 14:09:51 +02:00