From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: acme@kernel.org, jolsa@kernel.org
Cc: peterz@infradead.org, mingo@redhat.com,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [PATCH V3 2/6] perf: Passing struct perf_event to function setup_aux()
Date: Thu, 28 Jul 2016 15:42:19 -0600 [thread overview]
Message-ID: <1469742143-22245-3-git-send-email-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <1469742143-22245-1-git-send-email-mathieu.poirier@linaro.org>
Some information, like driver specific configuration, is found
in the hw_perf_event structure. As such pass a 'struct perf_event'
to function setup_aux() rather than just the CPU number so that
individual drivers can make the right configuration when setting
up a session.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
arch/x86/events/intel/bts.c | 4 +++-
arch/x86/events/intel/pt.c | 5 +++--
drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++--
include/linux/perf_event.h | 2 +-
kernel/events/ring_buffer.c | 2 +-
5 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c
index 0a6e393a2e62..98155c2dfcce 100644
--- a/arch/x86/events/intel/bts.c
+++ b/arch/x86/events/intel/bts.c
@@ -68,8 +68,10 @@ 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)
{
+ int cpu = event->cpu;
struct bts_buffer *buf;
struct page *page;
int node = (cpu == -1) ? cpu : cpu_to_node(cpu);
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 04bb5fb5a8d7..5178c5de0b19 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -1003,10 +1003,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;
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 755125f7917f..f4174f36c5a0 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -155,7 +155,7 @@ 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;
@@ -163,7 +163,7 @@ static void *etm_setup_aux(int event_cpu, void **pages,
struct coresight_device *sink;
struct etm_event_data *event_data = NULL;
- event_data = alloc_event_data(event_cpu);
+ event_data = alloc_event_data(event->cpu);
if (!event_data)
return NULL;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 59d61a12cf9d..5275b6594989 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -407,7 +407,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 */
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index ae9b90dc9a5a..56aba90af437 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -616,7 +616,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;
--
2.7.4
next prev parent reply other threads:[~2016-07-28 21:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 21:42 [PATCH V3 0/6] perf: Driver specific configuration for PMU Mathieu Poirier
2016-07-28 21:42 ` [PATCH V3 1/6] perf/core: Adding PMU driver specific configuration Mathieu Poirier
2016-08-04 16:58 ` Peter Zijlstra
2016-08-05 15:35 ` Mathieu Poirier
2016-08-05 15:53 ` Peter Zijlstra
2016-08-10 23:07 ` Mathieu Poirier
2016-08-11 3:27 ` Vince Weaver
2016-08-04 16:59 ` Peter Zijlstra
2016-08-05 15:41 ` Mathieu Poirier
2016-08-05 15:54 ` Peter Zijlstra
2016-07-28 21:42 ` Mathieu Poirier [this message]
2016-08-04 17:19 ` [PATCH V3 2/6] perf: Passing struct perf_event to function setup_aux() Peter Zijlstra
2016-08-08 10:49 ` Alexander Shishkin
2016-08-08 14:38 ` Mathieu Poirier
2016-07-28 21:42 ` [PATCH V3 3/6] perf tools: add infrastructure for PMU specific configuration Mathieu Poirier
2016-07-31 12:02 ` Jiri Olsa
2016-07-28 21:42 ` [PATCH V3 4/6] perf tools: pushing driver configuration down to the kernel Mathieu Poirier
2016-07-31 12:03 ` Jiri Olsa
2016-08-03 21:46 ` Mathieu Poirier
2016-07-28 21:42 ` [PATCH V3 5/6] coresight: adding sink parameter to function coresight_build_path() Mathieu Poirier
2016-07-28 21:42 ` [PATCH V3 6/6] coresight: etm-perf: incorporating sink definition from cmd line Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1469742143-22245-3-git-send-email-mathieu.poirier@linaro.org \
--to=mathieu.poirier@linaro.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).