diff mbox series

[v10,08/24] coresight: etm: perf: Fix warning caused by etm_setup_aux failure

Message ID 20200821034445.967-9-tingwei@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series coresight: allow to build coresight as modules | expand

Commit Message

Tingwei Zhang Aug. 21, 2020, 3:44 a.m. UTC
When coresight_build_path() fails on all the cpus, etm_setup_aux
calls etm_free_aux() to free allocated event_data.
WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty.
Check event_data->snk_config is not NULL first to avoid this
warning.

Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mathieu Poirier Sept. 10, 2020, 10:28 p.m. UTC | #1
On Fri, Aug 21, 2020 at 11:44:29AM +0800, Tingwei Zhang wrote:
> When coresight_build_path() fails on all the cpus, etm_setup_aux
> calls etm_free_aux() to free allocated event_data.
> WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty.
> Check event_data->snk_config is not NULL first to avoid this
> warning.
> 
> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
> Reviewed-by: Mike Leach <mike.leach@linaro.org>
> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

What happend to the Fixed tag that was in V8?  This is casting doubts on the
reset of this set.  

> ---
>  drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
> index dcb0592418ae..3728c44e5763 100644
> --- a/drivers/hwtracing/coresight/coresight-etm-perf.c
> +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
> @@ -126,10 +126,10 @@ static void free_sink_buffer(struct etm_event_data *event_data)
>  	cpumask_t *mask = &event_data->mask;
>  	struct coresight_device *sink;
>  
> -	if (WARN_ON(cpumask_empty(mask)))
> +	if (!event_data->snk_config)
>  		return;
>  
> -	if (!event_data->snk_config)
> +	if (WARN_ON(cpumask_empty(mask)))
>  		return;
>  
>  	cpu = cpumask_first(mask);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
Tingwei Zhang Sept. 11, 2020, 2:49 a.m. UTC | #2
On Fri, Sep 11, 2020 at 06:28:40AM +0800, Mathieu Poirier wrote:
> On Fri, Aug 21, 2020 at 11:44:29AM +0800, Tingwei Zhang wrote:
> > When coresight_build_path() fails on all the cpus, etm_setup_aux
> > calls etm_free_aux() to free allocated event_data.
> > WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty.
> > Check event_data->snk_config is not NULL first to avoid this
> > warning.
> > 
> > Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
> > Reviewed-by: Mike Leach <mike.leach@linaro.org>
> > Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> > Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> 
> What happend to the Fixed tag that was in V8?  This is casting doubts on
> the
> reset of this set.  
> 
Hi Mathieu,

Sorry about the mess here. I pushed the change to Android mainline and missed
fix tag when making V10.

To make sure there's no other missing, I compared all V8 and V10 patches and
rechecked all comments on V8.

Two issues were found.
1. Reviewed-by from you on [patch 5/24] should not be added.
2. MODULE_LICENSE("GPL v2") was missed in V10.

I'll fix all issues on V11.

Shall I send V11 when it's ready or wait for your comments on other patches?

Thanks,
Tingwei

> > ---
> >  drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c
> b/drivers/hwtracing/coresight/coresight-etm-perf.c
> > index dcb0592418ae..3728c44e5763 100644
> > --- a/drivers/hwtracing/coresight/coresight-etm-perf.c
> > +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
> > @@ -126,10 +126,10 @@ static void free_sink_buffer(struct etm_event_data
> *event_data)
> >  	cpumask_t *mask = &event_data->mask;
> >  	struct coresight_device *sink;
> >  
> > -	if (WARN_ON(cpumask_empty(mask)))
> > +	if (!event_data->snk_config)
> >  		return;
> >  
> > -	if (!event_data->snk_config)
> > +	if (WARN_ON(cpumask_empty(mask)))
> >  		return;
> >  
> >  	cpu = cpumask_first(mask);
> > -- 
> > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum,
> > a Linux Foundation Collaborative Project
> >
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index dcb0592418ae..3728c44e5763 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -126,10 +126,10 @@  static void free_sink_buffer(struct etm_event_data *event_data)
 	cpumask_t *mask = &event_data->mask;
 	struct coresight_device *sink;
 
-	if (WARN_ON(cpumask_empty(mask)))
+	if (!event_data->snk_config)
 		return;
 
-	if (!event_data->snk_config)
+	if (WARN_ON(cpumask_empty(mask)))
 		return;
 
 	cpu = cpumask_first(mask);