Skip to content

Commit 161a9a3

Browse files
virtuosoPeter Zijlstra
authored andcommitted
perf/x86/intel/pt: Add a capability and config bit for disabling TNTs
As of Intel SDM (https://www.intel.com/sdm) version 076, there is a new Intel PT feature called TNT-Disable which is enabled config bit 55. TNT-Disable disables Taken-Not-Taken packets to reduce the tracing overhead, but with the result that exact control flow information is lost. Add a capability and config bit for TNT-Disable. Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 28c24de commit 161a9a3

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

arch/x86/events/intel/pt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static struct pt_cap_desc {
6060
PT_CAP(ptwrite, 0, CPUID_EBX, BIT(4)),
6161
PT_CAP(power_event_trace, 0, CPUID_EBX, BIT(5)),
6262
PT_CAP(event_trace, 0, CPUID_EBX, BIT(7)),
63+
PT_CAP(tnt_disable, 0, CPUID_EBX, BIT(8)),
6364
PT_CAP(topa_output, 0, CPUID_ECX, BIT(0)),
6465
PT_CAP(topa_multiple_entries, 0, CPUID_ECX, BIT(1)),
6566
PT_CAP(single_range_output, 0, CPUID_ECX, BIT(2)),
@@ -112,6 +113,7 @@ PMU_FORMAT_ATTR(noretcomp, "config:11" );
112113
PMU_FORMAT_ATTR(ptw, "config:12" );
113114
PMU_FORMAT_ATTR(branch, "config:13" );
114115
PMU_FORMAT_ATTR(event, "config:31" );
116+
PMU_FORMAT_ATTR(notnt, "config:55" );
115117
PMU_FORMAT_ATTR(mtc_period, "config:14-17" );
116118
PMU_FORMAT_ATTR(cyc_thresh, "config:19-22" );
117119
PMU_FORMAT_ATTR(psb_period, "config:24-27" );
@@ -121,6 +123,7 @@ static struct attribute *pt_formats_attr[] = {
121123
&format_attr_cyc.attr,
122124
&format_attr_pwr_evt.attr,
123125
&format_attr_event.attr,
126+
&format_attr_notnt.attr,
124127
&format_attr_fup_on_ptw.attr,
125128
&format_attr_mtc.attr,
126129
&format_attr_tsc.attr,
@@ -302,6 +305,7 @@ static int __init pt_pmu_hw_init(void)
302305
RTIT_CTL_MTC | \
303306
RTIT_CTL_PWR_EVT_EN | \
304307
RTIT_CTL_EVENT_EN | \
308+
RTIT_CTL_NOTNT | \
305309
RTIT_CTL_FUP_ON_PTW | \
306310
RTIT_CTL_PTW_EN)
307311

@@ -360,6 +364,10 @@ static bool pt_event_valid(struct perf_event *event)
360364
!intel_pt_validate_hw_cap(PT_CAP_event_trace))
361365
return false;
362366

367+
if (config & RTIT_CTL_NOTNT &&
368+
!intel_pt_validate_hw_cap(PT_CAP_tnt_disable))
369+
return false;
370+
363371
if (config & RTIT_CTL_PTW) {
364372
if (!intel_pt_validate_hw_cap(PT_CAP_ptwrite))
365373
return false;

arch/x86/include/asm/intel_pt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enum pt_capabilities {
1414
PT_CAP_ptwrite,
1515
PT_CAP_power_event_trace,
1616
PT_CAP_event_trace,
17+
PT_CAP_tnt_disable,
1718
PT_CAP_topa_output,
1819
PT_CAP_topa_multiple_entries,
1920
PT_CAP_single_range_output,

arch/x86/include/asm/msr-index.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
#define RTIT_CTL_PTW_EN BIT(12)
207207
#define RTIT_CTL_BRANCH_EN BIT(13)
208208
#define RTIT_CTL_EVENT_EN BIT(31)
209+
#define RTIT_CTL_NOTNT BIT_ULL(55)
209210
#define RTIT_CTL_MTC_RANGE_OFFSET 14
210211
#define RTIT_CTL_MTC_RANGE (0x0full << RTIT_CTL_MTC_RANGE_OFFSET)
211212
#define RTIT_CTL_CYC_THRESH_OFFSET 19

0 commit comments

Comments
 (0)