]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
perf/aux: Make perf_event accessible to setup_aux()
authorMathieu Poirier <mathieu.poirier@linaro.org>
Thu, 31 Jan 2019 18:47:08 +0000 (11:47 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838116
[ Upstream commit 840018668ce2d96783356204ff282d6c9b0e5f66 ]

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 Poulouse <suzuki.poulose@arm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-s390@vger.kernel.org
Link: http://lkml.kernel.org/r/20190131184714.20388-2-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
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 0292d68e7dded707496b7090c9b2d7377aab8b2b..2d55fc2bb18594a3ec457013689458ffd2d3a014 100644 (file)
@@ -1589,7 +1589,7 @@ static void aux_buffer_free(void *data)
 
 /*
  * 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
@@ -1601,8 +1601,8 @@ static void aux_buffer_free(void *data)
  *
  * 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 24ffa1e88cf948ecbe9839f6d956c69a12ecd4f0..7139f6bf27adfc6e819d1bf93a2caca773b7d6e8 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 81fd41d5a0d98eecd8e3252211e2e82d8e4b4cf5..a1a4f055bc0a7e033b2268c07de8e19224a96d16 100644 (file)
@@ -1104,10 +1104,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 8a0ad77574e733a0418155c733385db1ba7965f4..997ab270a66073534d4c374ba5ba6c252474b845 100644 (file)
@@ -192,15 +192,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 1adf03c7667d531090cd2cca630902b66cad15c1..7c3c2b2663e76db4485a2a0ea8c9e5b0e6237b1a 100644 (file)
@@ -812,10 +812,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 8073f256ec271f9576a2684deee0671043eede6d..31bdc450f73ab479c851f5616a1314b7c75c42e6 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 04a918dee1bce979e4dde22d9ee15ee4b0c888b8..53d10109185292d480b692d3f407e7984765a245 100644 (file)
@@ -647,7 +647,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;