diff options
| author | Mathieu Poirier <mathieu.poirier@linaro.org> | 2019-04-25 15:53:01 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-25 16:00:17 -0400 |
| commit | a0f08a6a9fee0ce3f2d36e3e30799e4c1ec171f4 (patch) | |
| tree | 2857a8f2ca1f542ec1cc4b3453f9fb0a39025557 /drivers/hwtracing | |
| parent | f5200aa9831f38271c8104565fdcae4401658475 (diff) | |
coresight: Communicate perf event to sink buffer allocation functions
Make struct perf_event available to sink buffer allocation functions in
order to use the pid they carry to allocate and free buffer memory along
with regimenting access to what source a sink can collect data for.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
| -rw-r--r-- | drivers/hwtracing/coresight/coresight-etb10.c | 7 | ||||
| -rw-r--r-- | drivers/hwtracing/coresight/coresight-etm-perf.c | 2 | ||||
| -rw-r--r-- | drivers/hwtracing/coresight/coresight-tmc-etf.c | 7 | ||||
| -rw-r--r-- | drivers/hwtracing/coresight/coresight-tmc-etr.c | 18 |
4 files changed, 19 insertions, 15 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 00d664c6a401..eeae375c7aed 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c | |||
| @@ -343,10 +343,11 @@ static int etb_disable(struct coresight_device *csdev) | |||
| 343 | return 0; | 343 | return 0; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu, | 346 | static void *etb_alloc_buffer(struct coresight_device *csdev, |
| 347 | void **pages, int nr_pages, bool overwrite) | 347 | struct perf_event *event, void **pages, |
| 348 | int nr_pages, bool overwrite) | ||
| 348 | { | 349 | { |
| 349 | int node; | 350 | int node, cpu = event->cpu; |
| 350 | struct cs_buffers *buf; | 351 | struct cs_buffers *buf; |
| 351 | 352 | ||
| 352 | if (cpu == -1) | 353 | if (cpu == -1) |
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 806b3dd5872d..3c6294432748 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c | |||
| @@ -277,7 +277,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, | |||
| 277 | 277 | ||
| 278 | /* Allocate the sink buffer for this session */ | 278 | /* Allocate the sink buffer for this session */ |
| 279 | event_data->snk_config = | 279 | event_data->snk_config = |
| 280 | sink_ops(sink)->alloc_buffer(sink, cpu, pages, | 280 | sink_ops(sink)->alloc_buffer(sink, event, pages, |
| 281 | nr_pages, overwrite); | 281 | nr_pages, overwrite); |
| 282 | if (!event_data->snk_config) | 282 | if (!event_data->snk_config) |
| 283 | goto err; | 283 | goto err; |
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index a38ad2b0d95a..1df1f8fade71 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c | |||
| @@ -350,10 +350,11 @@ static void tmc_disable_etf_link(struct coresight_device *csdev, | |||
| 350 | dev_dbg(drvdata->dev, "TMC-ETF disabled\n"); | 350 | dev_dbg(drvdata->dev, "TMC-ETF disabled\n"); |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu, | 353 | static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, |
| 354 | void **pages, int nr_pages, bool overwrite) | 354 | struct perf_event *event, void **pages, |
| 355 | int nr_pages, bool overwrite) | ||
| 355 | { | 356 | { |
| 356 | int node; | 357 | int node, cpu = event->cpu; |
| 357 | struct cs_buffers *buf; | 358 | struct cs_buffers *buf; |
| 358 | 359 | ||
| 359 | if (cpu == -1) | 360 | if (cpu == -1) |
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 9a0b346be58b..55ee0aca321c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c | |||
| @@ -1167,13 +1167,18 @@ out: | |||
| 1167 | * reaches a minimum limit (1M), beyond which we give up. | 1167 | * reaches a minimum limit (1M), beyond which we give up. |
| 1168 | */ | 1168 | */ |
| 1169 | static struct etr_perf_buffer * | 1169 | static struct etr_perf_buffer * |
| 1170 | tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, int node, int nr_pages, | 1170 | tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, struct perf_event *event, |
| 1171 | void **pages, bool snapshot) | 1171 | int nr_pages, void **pages, bool snapshot) |
| 1172 | { | 1172 | { |
| 1173 | int node, cpu = event->cpu; | ||
| 1173 | struct etr_buf *etr_buf; | 1174 | struct etr_buf *etr_buf; |
| 1174 | struct etr_perf_buffer *etr_perf; | 1175 | struct etr_perf_buffer *etr_perf; |
| 1175 | unsigned long size; | 1176 | unsigned long size; |
| 1176 | 1177 | ||
| 1178 | if (cpu == -1) | ||
| 1179 | cpu = smp_processor_id(); | ||
| 1180 | node = cpu_to_node(cpu); | ||
| 1181 | |||
| 1177 | etr_perf = kzalloc_node(sizeof(*etr_perf), GFP_KERNEL, node); | 1182 | etr_perf = kzalloc_node(sizeof(*etr_perf), GFP_KERNEL, node); |
| 1178 | if (!etr_perf) | 1183 | if (!etr_perf) |
| 1179 | return ERR_PTR(-ENOMEM); | 1184 | return ERR_PTR(-ENOMEM); |
| @@ -1211,16 +1216,13 @@ done: | |||
| 1211 | 1216 | ||
| 1212 | 1217 | ||
| 1213 | static void *tmc_alloc_etr_buffer(struct coresight_device *csdev, | 1218 | static void *tmc_alloc_etr_buffer(struct coresight_device *csdev, |
| 1214 | int cpu, void **pages, int nr_pages, | 1219 | struct perf_event *event, void **pages, |
| 1215 | bool snapshot) | 1220 | int nr_pages, bool snapshot) |
| 1216 | { | 1221 | { |
| 1217 | struct etr_perf_buffer *etr_perf; | 1222 | struct etr_perf_buffer *etr_perf; |
| 1218 | struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 1223 | struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
| 1219 | 1224 | ||
| 1220 | if (cpu == -1) | 1225 | etr_perf = tmc_etr_setup_perf_buf(drvdata, event, |
| 1221 | cpu = smp_processor_id(); | ||
| 1222 | |||
| 1223 | etr_perf = tmc_etr_setup_perf_buf(drvdata, cpu_to_node(cpu), | ||
| 1224 | nr_pages, pages, snapshot); | 1226 | nr_pages, pages, snapshot); |
| 1225 | if (IS_ERR(etr_perf)) { | 1227 | if (IS_ERR(etr_perf)) { |
| 1226 | dev_dbg(drvdata->dev, "Unable to allocate ETR buffer\n"); | 1228 | dev_dbg(drvdata->dev, "Unable to allocate ETR buffer\n"); |
