Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1726762
| From | Alexander Shishkin <alexander.shishkin@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH 16/17] perf/x86/intel/pt: Add PMU info |
| Date | 2017-09-05 16:10 +0200 |
| Message-ID | <ummI9-3Fq-1@gated-at.bofh.it> (permalink) |
| References | <ummf8-3dY-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Add PMU-specific data structure with family/model/stepping and clock
information required by the decoder.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
arch/x86/events/intel/pt.c | 23 ++++++++++++++++++++++-
arch/x86/events/intel/pt.h | 11 +++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 3b993942a0..053b96f491 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -35,6 +35,8 @@
static DEFINE_PER_CPU(struct pt, pt_ctx);
+#define PMU_NAME "intel_pt"
+
static struct pt_pmu pt_pmu;
/*
@@ -271,6 +273,22 @@ static int __init pt_pmu_hw_init(void)
return ret;
}
+static struct intel_pt_pmu_info pt_pmu_info;
+
+static void pt_pmu_info_setup(void)
+{
+ BUILD_BUG_ON(sizeof(pt_pmu_info) +
+ sizeof(struct perf_event_mmap_page) > PAGE_SIZE);
+ pt_pmu_info.pi.note_size = sizeof(pt_pmu_info.pi);
+ pt_pmu_info.pi.pmu_descsz = sizeof(pt_pmu_info) - pt_pmu_info.pi.note_size;
+ pt_pmu_info.x86_family = boot_cpu_data.x86;
+ pt_pmu_info.x86_model = boot_cpu_data.x86_model;
+ pt_pmu_info.x86_step = boot_cpu_data.x86_mask;
+ pt_pmu_info.x86_tsc_max_nonturbo_ratio = pt_pmu.max_nonturbo_ratio;
+ pt_pmu_info.x86_tsc_to_art_numerator = pt_pmu.tsc_art_num;
+ pt_pmu_info.x86_tsc_to_art_denominator = pt_pmu.tsc_art_den;
+}
+
#define RTIT_CTL_CYC_PSB (RTIT_CTL_CYCLEACC | \
RTIT_CTL_CYC_THRESH | \
RTIT_CTL_PSB_FREQ)
@@ -1512,6 +1530,8 @@ static __init int pt_init(void)
return -ENODEV;
}
+ pt_pmu_info_setup();
+
if (!pt_cap_get(PT_CAP_topa_multiple_entries))
pt_pmu.pmu.capabilities =
PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_AUX_SW_DOUBLEBUF;
@@ -1531,8 +1551,9 @@ static __init int pt_init(void)
pt_pmu.pmu.addr_filters_validate = pt_event_addr_filters_validate;
pt_pmu.pmu.nr_addr_filters =
pt_cap_get(PT_CAP_num_address_ranges);
+ pt_pmu.pmu.pmu_info = &pt_pmu_info.pi;
- ret = perf_pmu_register(&pt_pmu.pmu, "intel_pt", -1);
+ ret = perf_pmu_register(&pt_pmu.pmu, PMU_NAME, -1);
return ret;
}
diff --git a/arch/x86/events/intel/pt.h b/arch/x86/events/intel/pt.h
index 25fa9710f4..fc19080ca3 100644
--- a/arch/x86/events/intel/pt.h
+++ b/arch/x86/events/intel/pt.h
@@ -189,4 +189,15 @@ struct pt {
int vmx_on;
};
+struct intel_pt_pmu_info {
+ struct pmu_info pi;
+ u8 x86_family;
+ u8 x86_model;
+ u8 x86_step;
+ u8 x86_tsc_max_nonturbo_ratio;
+ u32 x86_tsc_to_art_numerator;
+ u32 x86_tsc_to_art_denominator;
+ u32 __reserved_0;
+};
+
#endif /* __INTEL_PT_H__ */
--
2.14.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 00/17] perf: Detached events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:40 +0200
[RFC PATCH 04/17] tracefs: Add ->unlink callback to tracefs_dir_ops Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:40 +0200
[RFC PATCH 05/17] perf: Introduce detached events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:40 +0200
[RFC PATCH 01/17] perf: Allow mmapping only user page Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:40 +0200
Re: [RFC PATCH 01/17] perf: Allow mmapping only user page Borislav Petkov <bp@alien8.de> - 2017-09-06 18:30 +0200
[RFC PATCH 03/17] tracefs: De-globalize instances' callbacks Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:40 +0200
[RFC PATCH 02/17] perf: Factor out mlock accounting Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:40 +0200
[RFC PATCH 08/17] perf: Allow inheritance for detached events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:50 +0200
[RFC PATCH 10/17] perf: Implement pinning and scheduling for SHMEM events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:50 +0200
[RFC PATCH 07/17] perf: Add pmu_info to user page Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:50 +0200
[RFC PATCH 06/17] perf: Add buffers to the detached events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:50 +0200
[RFC PATCH 09/17] perf: Use shmemfs pages for userspace-only per-thread detached events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:50 +0200
[RFC PATCH 11/17] perf: Implement mlock accounting for shmem ring buffers Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 15:50 +0200
[RFC PATCH 12/17] perf: Track pinned events per user Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 16:00 +0200
[RFC PATCH 13/17] perf: Re-inject shmem buffers after exec Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 16:00 +0200
[RFC PATCH 14/17] perf: Add ioctl(REATTACH) for detached events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 16:00 +0200
[RFC PATCH 16/17] perf/x86/intel/pt: Add PMU info Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 16:10 +0200
[RFC PATCH 17/17] perf/x86/intel/bts: Add PMU info Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 16:10 +0200
[RFC PATCH 15/17] perf: Allow controlled non-root access to detached events Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-09-05 16:10 +0200
Re: [RFC PATCH 00/17] perf: Detached events Borislav Petkov <bp@alien8.de> - 2017-09-06 18:30 +0200
csiph-web