On Fri, Mar 15, 2019 at 05:19:30PM +0000, Suzuki K Poulose wrote:
Hi Mathieu,
On 06/03/2019 22:57, Mathieu Poirier wrote:
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: Mathieu Poirier mathieu.poirier@linaro.org
.../hwtracing/coresight/coresight-etm-perf.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index b8ca3800b56b..806b3dd5872d 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -120,22 +120,34 @@ static int etm_event_init(struct perf_event *event) 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;
I think it may be a good idea to keep the check as they were. i.e, we check for the snk_config, followed by empty cpumask. It is perfectly valid for an event_data to have an empty sink_config and and empty cpumask.
I must admit you lost me here. Here in order to proceed we need a event_data->snk_config and a mask. In fact not having a ->snk_config should also be a WARN_ON() since etm_setup_aux() ensures one is valid. As for having an empty cpumask, that can't happen either since it is explicitly set in alloc_event_data().
With that:
Reviewed-by: Suzuki K Poulose suzuki.poulose@arm.com