]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
perf/aux: Make perf_event accessible to setup_aux()
authorMathieu Poirier <mathieu.poirier@linaro.org>
Tue, 5 Feb 2019 23:24:56 +0000 (16:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Feb 2019 11:27:36 +0000 (12:27 +0100)
When pmu::setup_aux() is called the coresight PMU needs to know which
sink to use for the session by looking up the information in the
event's attr::config2 field.

As such simply replace the cpu information by the complete perf_event
structure and change all affected customers.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/kernel/perf_cpum_sf.c
arch/x86/events/intel/bts.c
arch/x86/events/intel/pt.c
drivers/hwtracing/coresight/coresight-etm-perf.c
drivers/perf/arm_spe_pmu.c
include/linux/perf_event.h
kernel/events/ring_buffer.c

index bfabeb1889cc0cca5c6859cb36bbbeb15b662049..1266194afb026fb04d626ff8f0a598b7cb2f4cbe 100644 (file)
@@ -1600,7 +1600,7 @@ static void aux_sdb_init(unsigned long sdb)
 
 /*
  * aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling
- * @cpu:       On which to allocate, -1 means current
+ * @event:     Event the buffer is setup for, event->cpu == -1 means current
  * @pages:     Array of pointers to buffer pages passed from perf core
  * @nr_pages:  Total pages
  * @snapshot:  Flag for snapshot mode
@@ -1612,8 +1612,8 @@ static void aux_sdb_init(unsigned long sdb)
  *
  * Return the private AUX buffer structure if success or NULL if fails.
  */
-static void *aux_buffer_setup(int cpu, void **pages, int nr_pages,
-                             bool snapshot)
+static void *aux_buffer_setup(struct perf_event *event, void **pages,
+                             int nr_pages, bool snapshot)
 {
        struct sf_buffer *sfb;
        struct aux_buffer *aux;
index a01ef1b0f8833fd08285ef18f7307fada4d3c059..7cdd7b13bbda67352ed0c6e8dad5f381f027514d 100644 (file)
@@ -77,10 +77,12 @@ static size_t buf_size(struct page *page)
 }
 
 static void *
-bts_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool overwrite)
+bts_buffer_setup_aux(struct perf_event *event, void **pages,
+                    int nr_pages, bool overwrite)
 {
        struct bts_buffer *buf;
        struct page *page;
+       int cpu = event->cpu;
        int node = (cpu == -1) ? cpu : cpu_to_node(cpu);
        unsigned long offset;
        size_t size = nr_pages << PAGE_SHIFT;
index 9494ca68fd9df094ab9a699f4fd814b55114ee98..c0e86ff21f816664adf5818388e3b9c34e62f56d 100644 (file)
@@ -1114,10 +1114,11 @@ static int pt_buffer_init_topa(struct pt_buffer *buf, unsigned long nr_pages,
  * Return:     Our private PT buffer structure.
  */
 static void *
-pt_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool snapshot)
+pt_buffer_setup_aux(struct perf_event *event, void **pages,
+                   int nr_pages, bool snapshot)
 {
        struct pt_buffer *buf;
-       int node, ret;
+       int node, ret, cpu = event->cpu;
 
        if (!nr_pages)
                return NULL;
index abe8249b893bbd6c5d564010e5f2c17af7db28c8..f21eb28b6782bb441eceee5212fe46fe4baf76d7 100644 (file)
@@ -177,15 +177,15 @@ static void etm_free_aux(void *data)
        schedule_work(&event_data->work);
 }
 
-static void *etm_setup_aux(int event_cpu, void **pages,
+static void *etm_setup_aux(struct perf_event *event, void **pages,
                           int nr_pages, bool overwrite)
 {
-       int cpu;
+       int cpu = event->cpu;
        cpumask_t *mask;
        struct coresight_device *sink;
        struct etm_event_data *event_data = NULL;
 
-       event_data = alloc_event_data(event_cpu);
+       event_data = alloc_event_data(cpu);
        if (!event_data)
                return NULL;
        INIT_WORK(&event_data->work, free_event_data);
index 8e46a9dad2fa2880ce629c8279ada5fa6ed54701..7cb766dafe851fc711f388b4d230dc96e3f1f665 100644 (file)
@@ -824,10 +824,10 @@ static void arm_spe_pmu_read(struct perf_event *event)
 {
 }
 
-static void *arm_spe_pmu_setup_aux(int cpu, void **pages, int nr_pages,
-                                  bool snapshot)
+static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages,
+                                  int nr_pages, bool snapshot)
 {
-       int i;
+       int i, cpu = event->cpu;
        struct page **pglist;
        struct arm_spe_pmu_buf *buf;
 
index 1d5c551a5add50794e6d0ae38456b98380f800e6..3e49b2144808a20cdda57534a8e67dcc1d341b2e 100644 (file)
@@ -409,7 +409,7 @@ struct pmu {
        /*
         * Set up pmu-private data structures for an AUX area
         */
-       void *(*setup_aux)              (int cpu, void **pages,
+       void *(*setup_aux)              (struct perf_event *event, void **pages,
                                         int nr_pages, bool overwrite);
                                        /* optional */
 
index 4a99370763319dd14d39c7547e4af930779dc38f..857308295f6361e4303b5eaa72a75a8613d88190 100644 (file)
@@ -658,7 +658,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event,
                        goto out;
        }
 
-       rb->aux_priv = event->pmu->setup_aux(event->cpu, rb->aux_pages, nr_pages,
+       rb->aux_priv = event->pmu->setup_aux(event, rb->aux_pages, nr_pages,
                                             overwrite);
        if (!rb->aux_priv)
                goto out;