Skip to content

Commit dd45407

Browse files
rchatreKAGA-KOKO
authored andcommitted
x86/intel_rdt: Use perf infrastructure for measurements
The success of a cache pseudo-locked region is measured using performance monitoring events that are programmed directly at the time the user requests a measurement. Modifying the performance event registers directly is not appropriate since it circumvents the in-kernel perf infrastructure that exists to manage these resources and provide resource arbitration to the performance monitoring hardware. The cache pseudo-locking measurements are modified to use the in-kernel perf infrastructure. Performance events are created and validated with the appropriate perf API. The performance counters are still read as directly as possible to avoid the additional cache hits. This is done safely by first ensuring with the perf API that the counters have been programmed correctly and only accessing the counters in an interrupt disabled section where they are not able to be moved. As part of the transition to the in-kernel perf infrastructure the L2 and L3 measurements are split into two separate measurements that can be triggered independently. This separation prevents additional cache misses incurred during the extra testing code used to decide if a L2 and/or L3 measurement should be made. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: peterz@infradead.org Cc: acme@kernel.org Cc: gavin.hindman@intel.com Cc: jithu.joseph@intel.com Cc: dave.hansen@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/fc24e728b446404f42c78573c506e98cd0599873.1537468643.git.reinette.chatre@intel.com
1 parent 0a701c9 commit dd45407

File tree

2 files changed

+203
-123
lines changed

2 files changed

+203
-123
lines changed

Documentation/x86/intel_rdt_ui.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -520,18 +520,24 @@ the pseudo-locked region:
520520
2) Cache hit and miss measurements using model specific precision counters if
521521
available. Depending on the levels of cache on the system the pseudo_lock_l2
522522
and pseudo_lock_l3 tracepoints are available.
523-
WARNING: triggering this measurement uses from two (for just L2
524-
measurements) to four (for L2 and L3 measurements) precision counters on
525-
the system, if any other measurements are in progress the counters and
526-
their corresponding event registers will be clobbered.
527523

528524
When a pseudo-locked region is created a new debugfs directory is created for
529525
it in debugfs as /sys/kernel/debug/resctrl/<newdir>. A single
530526
write-only file, pseudo_lock_measure, is present in this directory. The
531-
measurement on the pseudo-locked region depends on the number, 1 or 2,
532-
written to this debugfs file. Since the measurements are recorded with the
533-
tracing infrastructure the relevant tracepoints need to be enabled before the
534-
measurement is triggered.
527+
measurement of the pseudo-locked region depends on the number written to this
528+
debugfs file:
529+
1 - writing "1" to the pseudo_lock_measure file will trigger the latency
530+
measurement captured in the pseudo_lock_mem_latency tracepoint. See
531+
example below.
532+
2 - writing "2" to the pseudo_lock_measure file will trigger the L2 cache
533+
residency (cache hits and misses) measurement captured in the
534+
pseudo_lock_l2 tracepoint. See example below.
535+
3 - writing "3" to the pseudo_lock_measure file will trigger the L3 cache
536+
residency (cache hits and misses) measurement captured in the
537+
pseudo_lock_l3 tracepoint.
538+
539+
All measurements are recorded with the tracing infrastructure. This requires
540+
the relevant tracepoints to be enabled before the measurement is triggered.
535541

536542
Example of latency debugging interface:
537543
In this example a pseudo-locked region named "newlock" was created. Here is

0 commit comments

Comments
 (0)