perf/x86/intel/pt: Add support for event tracing and TNT disabling
Subsystems (2)
Adrian Hunter
reviewercover perf/x86/intel/pt: Add support for event tracing and TNT disabling
Hi
As of Intel SDM (https://www.intel.com/sdm) version 076, there are 2 new Intel PT features called Event Trace and TNT-Disable.
Event Trace exposes details about asynchronous events such as interrupts and VM-Entry/Exit.
TNT-Disable disables TNT packets to reduce the tracing overhead, but with the result that exact control flow information is lost.
Tools patches are being sent in a separate patch set, but can be found here:
https://github.com/ahunter6/linux/tree/event-trace
Alexander Shishkin (2):
perf/x86/intel/pt: Add a capability and config bit for event tracing perf/x86/intel/pt: Add a capability and config bit for disabling TNTs
arch/x86/events/intel/pt.c | 16 ++++++++++++++++ arch/x86/include/asm/intel_pt.h | 2 ++ arch/x86/include/asm/msr-index.h | 2 ++ 3 files changed, 20 insertions(+)
Regards
Adrian
Adrian Hunter
reviewerPATCH 1/2 perf/x86/intel/pt: Add a capability and config bit for event tracing
From: Alexander Shishkin <[email protected]>
As of Intel SDM (https://www.intel.com/sdm) version 076, there is a new Intel PT feature called Event Trace which is enabled config bit 31.
Event Trace exposes details about asynchronous events such as interrupts and VM-Entry/Exit.
Add a capability and config bit for Event Trace.
--- arch/x86/events/intel/pt.c | 8 ++++++++ arch/x86/include/asm/intel_pt.h | 1 + arch/x86/include/asm/msr-index.h | 1 + 3 files changed, 10 insertions(+)
arch/x86/events/intel/pt.c +8 -0
@@ -57,6 +57,7 @@ static struct pt_cap_desc {PT_CAP (mtc,0 ,CPUID_EBX ,BIT (3 )),PT_CAP (ptwrite,0 ,CPUID_EBX ,BIT (4 )),PT_CAP (power_event_trace,0 ,CPUID_EBX ,BIT (5 )), +PT_CAP (event_trace,0 ,CPUID_EBX ,BIT (7 )),PT_CAP (topa_output,0 ,CPUID_ECX ,BIT (0 )),PT_CAP (topa_multiple_entries,0 ,CPUID_ECX ,BIT (1 )), PT_CAP(single_range_output, 0, CPUID_ECX, BIT(2)),
@@ -108,6 +109,7 @@ PMU_FORMAT_ATTR(tsc, "config:10" );PMU_FORMAT_ATTR (noretcomp,"config:11" );PMU_FORMAT_ATTR (ptw,"config:12" );PMU_FORMAT_ATTR (branch,"config:13" ); +PMU_FORMAT_ATTR (event,"config:31" );PMU_FORMAT_ATTR (mtc_period,"config:14-17" );PMU_FORMAT_ATTR (cyc_thresh,"config:19-22" );PMU_FORMAT_ATTR (psb_period,"config:24-27" );
@@ -116,6 +118,7 @@ static struct attribute *pt_formats_attr[] = { &format_attr_pt.attr, &format_attr_cyc.attr, &format_attr_pwr_evt.attr, + &format_attr_event.attr, &format_attr_fup_on_ptw.attr, &format_attr_mtc.attr, &format_attr_tsc.attr,
@@ -296,6 +299,7 @@ static int __init pt_pmu_hw_init(void)RTIT_CTL_CYC_PSB | \RTIT_CTL_MTC | \RTIT_CTL_PWR_EVT_EN | \ +RTIT_CTL_EVENT_EN | \RTIT_CTL_FUP_ON_PTW | \ RTIT_CTL_PTW_EN)
@@ -350,6 +354,10 @@ static bool pt_event_valid(struct perf_event *event) !intel_pt_validate_hw_cap(PT_CAP_power_event_trace))return false; +if (config &RTIT_CTL_EVENT_EN && + !intel_pt_validate_hw_cap (PT_CAP_event_trace)) +return false; +if (config &RTIT_CTL_PTW ) {if (!intel_pt_validate_hw_cap (PT_CAP_ptwrite))return false;
arch/x86/include/asm/intel_pt.h +1 -0
@@ -13,6 +13,7 @@ enum pt_capabilities { PT_CAP_mtc, PT_CAP_ptwrite, PT_CAP_power_event_trace, + PT_CAP_event_trace, PT_CAP_topa_output, PT_CAP_topa_multiple_entries, PT_CAP_single_range_output,
arch/x86/include/asm/msr-index.h +1 -0
@@ -205,6 +205,7 @@#define RTIT_CTL_DISRETC BIT(11)#define RTIT_CTL_PTW_EN BIT(12)#define RTIT_CTL_BRANCH_EN BIT(13) +#define RTIT_CTL_EVENT_EN BIT(31)#define RTIT_CTL_MTC_RANGE_OFFSET 14#define RTIT_CTL_MTC_RANGE (0x0full << RTIT_CTL_MTC_RANGE_OFFSET)#define RTIT_CTL_CYC_THRESH_OFFSET 19
Signature · 1 line
2.25.1
Adrian Hunter
reviewerPATCH 2/2 perf/x86/intel/pt: Add a capability and config bit for disabling TNTs
In reply to Adrian HunterFrom: Alexander Shishkin <[email protected]>
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 TNT 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.
--- arch/x86/events/intel/pt.c | 8 ++++++++ arch/x86/include/asm/intel_pt.h | 1 + arch/x86/include/asm/msr-index.h | 1 + 3 files changed, 10 insertions(+)
arch/x86/events/intel/pt.c +8 -0
@@ -58,6 +58,7 @@ static struct pt_cap_desc {PT_CAP (ptwrite,0 ,CPUID_EBX ,BIT (4 )),PT_CAP (power_event_trace,0 ,CPUID_EBX ,BIT (5 )),PT_CAP (event_trace,0 ,CPUID_EBX ,BIT (7 )), +PT_CAP (tnt_disable,0 ,CPUID_EBX ,BIT (8 )),PT_CAP (topa_output,0 ,CPUID_ECX ,BIT (0 )),PT_CAP (topa_multiple_entries,0 ,CPUID_ECX ,BIT (1 )), PT_CAP(single_range_output, 0, CPUID_ECX, BIT(2)),
@@ -110,6 +111,7 @@ PMU_FORMAT_ATTR(noretcomp, "config:11" );PMU_FORMAT_ATTR (ptw,"config:12" );PMU_FORMAT_ATTR (branch,"config:13" );PMU_FORMAT_ATTR (event,"config:31" ); +PMU_FORMAT_ATTR (notnt,"config:55" );PMU_FORMAT_ATTR (mtc_period,"config:14-17" );PMU_FORMAT_ATTR (cyc_thresh,"config:19-22" );PMU_FORMAT_ATTR (psb_period,"config:24-27" );
@@ -119,6 +121,7 @@ static struct attribute *pt_formats_attr[] = { &format_attr_cyc.attr, &format_attr_pwr_evt.attr, &format_attr_event.attr, + &format_attr_notnt.attr, &format_attr_fup_on_ptw.attr, &format_attr_mtc.attr, &format_attr_tsc.attr,
@@ -300,6 +303,7 @@ static int __init pt_pmu_hw_init(void)RTIT_CTL_MTC | \RTIT_CTL_PWR_EVT_EN | \RTIT_CTL_EVENT_EN | \ +RTIT_CTL_NOTNT | \RTIT_CTL_FUP_ON_PTW | \ RTIT_CTL_PTW_EN)
@@ -358,6 +362,10 @@ static bool pt_event_valid(struct perf_event *event) !intel_pt_validate_hw_cap(PT_CAP_event_trace))return false; +if (config &RTIT_CTL_NOTNT && + !intel_pt_validate_hw_cap (PT_CAP_tnt_disable)) +return false; +if (config &RTIT_CTL_PTW ) {if (!intel_pt_validate_hw_cap (PT_CAP_ptwrite))return false;
arch/x86/include/asm/intel_pt.h +1 -0
@@ -14,6 +14,7 @@ enum pt_capabilities { PT_CAP_ptwrite, PT_CAP_power_event_trace, PT_CAP_event_trace, + PT_CAP_tnt_disable, PT_CAP_topa_output, PT_CAP_topa_multiple_entries, PT_CAP_single_range_output,
arch/x86/include/asm/msr-index.h +1 -0
@@ -206,6 +206,7 @@#define RTIT_CTL_PTW_EN BIT(12)#define RTIT_CTL_BRANCH_EN BIT(13)#define RTIT_CTL_EVENT_EN BIT(31) +#define RTIT_CTL_NOTNT BIT_ULL(55)#define RTIT_CTL_MTC_RANGE_OFFSET 14#define RTIT_CTL_MTC_RANGE (0x0full << RTIT_CTL_MTC_RANGE_OFFSET)#define RTIT_CTL_CYC_THRESH_OFFSET 19
Signature · 1 line
2.25.1
Boris Petkov
maintainerRe: [PATCH 1/2] perf/x86/intel/pt: Add a capability and config bit for event tracing
In reply to Adrian HunterQuoted 5 lines · Adrian Hunter
From: Alexander Shishkin <[email protected]>
As of Intel SDM (https://www.intel.com/sdm) version 076, there is a new Intel PT feature called Event Trace which is enabled config bit 31.
Quoted 7 lines
Event Trace exposes details about asynchronous events such as interrupts and VM-Entry/Exit.
Add a capability and config bit for Event Trace.
Signed-off-by Alexander Shishkin <[email protected]>Reviewed-by Adrian Hunter <[email protected]>
These patches need your SOB to represent that you have handled them on their way upstream.
Signature · 1 line
Sent from a small device: formatting sux and brevity is inevitable.