Commit f5200aa9 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Greg Kroah-Hartman

coresight: perf: Refactor function free_event_data()

Function free_event_data() is already busy and is bound to become
worse with the addition of CPU-wide trace scenarios.  As such spin
off a new function to strickly take care of the sink buffers.
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
Tested-by: default avatarRobert Walker <robert.walker@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 02d5c897
...@@ -120,22 +120,34 @@ static int etm_event_init(struct perf_event *event) ...@@ -120,22 +120,34 @@ static int etm_event_init(struct perf_event *event)
return ret; return ret;
} }
static void free_sink_buffer(struct etm_event_data *event_data)
{
int cpu;
cpumask_t *mask = &event_data->mask;
struct coresight_device *sink;
if (WARN_ON(cpumask_empty(mask)))
return;
if (!event_data->snk_config)
return;
cpu = cpumask_first(mask);
sink = coresight_get_sink(etm_event_cpu_path(event_data, cpu));
sink_ops(sink)->free_buffer(event_data->snk_config);
}
static void free_event_data(struct work_struct *work) static void free_event_data(struct work_struct *work)
{ {
int cpu; int cpu;
cpumask_t *mask; cpumask_t *mask;
struct etm_event_data *event_data; struct etm_event_data *event_data;
struct coresight_device *sink;
event_data = container_of(work, struct etm_event_data, work); event_data = container_of(work, struct etm_event_data, work);
mask = &event_data->mask; mask = &event_data->mask;
/* Free the sink buffers, if there are any */ /* Free the sink buffers, if there are any */
if (event_data->snk_config && !WARN_ON(cpumask_empty(mask))) { free_sink_buffer(event_data);
cpu = cpumask_first(mask);
sink = coresight_get_sink(etm_event_cpu_path(event_data, cpu));
sink_ops(sink)->free_buffer(event_data->snk_config);
}
for_each_cpu(cpu, mask) { for_each_cpu(cpu, mask) {
struct list_head **ppath; struct list_head **ppath;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment