Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1726765

[RFC PATCH 17/17] perf/x86/intel/bts: Add PMU info

From Alexander Shishkin <alexander.shishkin@linux.intel.com>
Newsgroups linux.kernel
Subject [RFC PATCH 17/17] perf/x86/intel/bts: Add PMU info
Date 2017-09-05 16:10 +0200
Message-ID <ummIa-3Fq-11@gated-at.bofh.it> (permalink)
References <ummf8-3dY-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 arch/x86/events/intel/bts.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c
index 16076eb346..ce1dac7115 100644
--- a/arch/x86/events/intel/bts.c
+++ b/arch/x86/events/intel/bts.c
@@ -21,13 +21,22 @@
 #include <linux/slab.h>
 #include <linux/debugfs.h>
 #include <linux/device.h>
-#include <linux/coredump.h>
 
 #include <asm-generic/sizes.h>
 #include <asm/perf_event.h>
 
 #include "../perf_event.h"
 
+#define PMU_NAME "intel_bts"
+
+static struct intel_bts_pmu_info {
+	struct pmu_info		pi;
+	u8			x86_family;
+	u8			x86_model;
+	u8			x86_step;
+	u8			__reserved_0[5];
+} bts_pmu_info;
+
 struct bts_ctx {
 	struct perf_output_handle	handle;
 	struct debug_store		ds_back;
@@ -582,6 +591,12 @@ static __init int bts_init(void)
 	if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts)
 		return -ENODEV;
 
+	bts_pmu_info.pi.note_size  = sizeof(bts_pmu_info.pi);
+	bts_pmu_info.pi.pmu_descsz = sizeof(bts_pmu_info) - bts_pmu_info.pi.note_size;
+	bts_pmu_info.x86_family    = boot_cpu_data.x86;
+	bts_pmu_info.x86_model	    = boot_cpu_data.x86_model;
+	bts_pmu_info.x86_step	    = boot_cpu_data.x86_mask;
+
 	bts_pmu.capabilities	= PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_ITRACE |
 				  PERF_PMU_CAP_EXCLUSIVE;
 	bts_pmu.task_ctx_nr	= perf_sw_context;
@@ -593,7 +608,8 @@ static __init int bts_init(void)
 	bts_pmu.read		= bts_event_read;
 	bts_pmu.setup_aux	= bts_buffer_setup_aux;
 	bts_pmu.free_aux	= bts_buffer_free_aux;
+	bts_pmu.pmu_info	= &bts_pmu_info.pi;
 
-	return perf_pmu_register(&bts_pmu, "intel_bts", -1);
+	return perf_pmu_register(&bts_pmu, PMU_NAME, -1);
 }
 arch_initcall(bts_init);
-- 
2.14.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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