linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR
@ 2019-10-21  7:48 Leo Yan
  2019-10-21 17:42 ` Mathieu Poirier
  2019-11-12 11:18 ` [tip: perf/core] " tip-bot2 for Leo Yan
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Yan @ 2019-10-21  7:48 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Mathieu Poirier, Suzuki K Poulose,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-arm-kernel, linux-kernel,
	Coresight ML
  Cc: Leo Yan

Macro TO_CS_QUEUE_NR definition has a typo, which uses 'trace_id_chan'
as its parameter, this doesn't match with its definition body which uses
'trace_chan_id'.  So renames the parameter to 'trace_chan_id'.

It's luck to have a local variable 'trace_chan_id' in the function
cs_etm__setup_queue(), even we wrongly define the macro TO_CS_QUEUE_NR,
the local variable 'trace_chan_id' is used rather than the macro's
parameter 'trace_id_chan'; so the compiler doesn't complain for this
before.

After renaming the parameter, it leads to a compiling error due
cs_etm__setup_queue() has no variable 'trace_id_chan'.  This patch uses
the variable 'trace_chan_id' for the macro so that fixes the compiling
error.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/util/cs-etm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 4ba0f871f086..f5f855fff412 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -110,7 +110,7 @@ static int cs_etm__decode_data_block(struct cs_etm_queue *etmq);
  * encode the etm queue number as the upper 16 bit and the channel as
  * the lower 16 bit.
  */
-#define TO_CS_QUEUE_NR(queue_nr, trace_id_chan)	\
+#define TO_CS_QUEUE_NR(queue_nr, trace_chan_id)	\
 		      (queue_nr << 16 | trace_chan_id)
 #define TO_QUEUE_NR(cs_queue_nr) (cs_queue_nr >> 16)
 #define TO_TRACE_CHAN_ID(cs_queue_nr) (cs_queue_nr & 0x0000ffff)
@@ -819,7 +819,7 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,
 	 * Note that packets decoded above are still in the traceID's packet
 	 * queue and will be processed in cs_etm__process_queues().
 	 */
-	cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_id_chan);
+	cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_chan_id);
 	ret = auxtrace_heap__add(&etm->heap, cs_queue_nr, timestamp);
 out:
 	return ret;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR
  2019-10-21  7:48 [PATCH] perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR Leo Yan
@ 2019-10-21 17:42 ` Mathieu Poirier
  2019-10-21 20:18   ` Arnaldo Carvalho de Melo
  2019-11-12 11:18 ` [tip: perf/core] " tip-bot2 for Leo Yan
  1 sibling, 1 reply; 4+ messages in thread
From: Mathieu Poirier @ 2019-10-21 17:42 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Suzuki K Poulose, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-arm-kernel, Linux Kernel Mailing List,
	Coresight ML

On Mon, 21 Oct 2019 at 01:48, Leo Yan <leo.yan@linaro.org> wrote:
>
> Macro TO_CS_QUEUE_NR definition has a typo, which uses 'trace_id_chan'
> as its parameter, this doesn't match with its definition body which uses
> 'trace_chan_id'.  So renames the parameter to 'trace_chan_id'.
>
> It's luck to have a local variable 'trace_chan_id' in the function
> cs_etm__setup_queue(), even we wrongly define the macro TO_CS_QUEUE_NR,
> the local variable 'trace_chan_id' is used rather than the macro's
> parameter 'trace_id_chan'; so the compiler doesn't complain for this
> before.
>
> After renaming the parameter, it leads to a compiling error due
> cs_etm__setup_queue() has no variable 'trace_id_chan'.  This patch uses
> the variable 'trace_chan_id' for the macro so that fixes the compiling
> error.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/util/cs-etm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 4ba0f871f086..f5f855fff412 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -110,7 +110,7 @@ static int cs_etm__decode_data_block(struct cs_etm_queue *etmq);
>   * encode the etm queue number as the upper 16 bit and the channel as
>   * the lower 16 bit.
>   */
> -#define TO_CS_QUEUE_NR(queue_nr, trace_id_chan)        \
> +#define TO_CS_QUEUE_NR(queue_nr, trace_chan_id)        \
>                       (queue_nr << 16 | trace_chan_id)
>  #define TO_QUEUE_NR(cs_queue_nr) (cs_queue_nr >> 16)
>  #define TO_TRACE_CHAN_ID(cs_queue_nr) (cs_queue_nr & 0x0000ffff)
> @@ -819,7 +819,7 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,
>          * Note that packets decoded above are still in the traceID's packet
>          * queue and will be processed in cs_etm__process_queues().
>          */
> -       cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_id_chan);
> +       cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_chan_id);
>         ret = auxtrace_heap__add(&etm->heap, cs_queue_nr, timestamp);
>  out:
>         return ret;

Really good catch - Arnaldo please consider.

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR
  2019-10-21 17:42 ` Mathieu Poirier
@ 2019-10-21 20:18   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-10-21 20:18 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Leo Yan, Suzuki K Poulose, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-arm-kernel, Linux Kernel Mailing List, Coresight ML

Em Mon, Oct 21, 2019 at 11:42:21AM -0600, Mathieu Poirier escreveu:
> On Mon, 21 Oct 2019 at 01:48, Leo Yan <leo.yan@linaro.org> wrote:
> >
> > Macro TO_CS_QUEUE_NR definition has a typo, which uses 'trace_id_chan'
> > as its parameter, this doesn't match with its definition body which uses
> > 'trace_chan_id'.  So renames the parameter to 'trace_chan_id'.
> >
> > It's luck to have a local variable 'trace_chan_id' in the function
> > cs_etm__setup_queue(), even we wrongly define the macro TO_CS_QUEUE_NR,
> > the local variable 'trace_chan_id' is used rather than the macro's
> > parameter 'trace_id_chan'; so the compiler doesn't complain for this
> > before.
> >
> > After renaming the parameter, it leads to a compiling error due
> > cs_etm__setup_queue() has no variable 'trace_id_chan'.  This patch uses
> > the variable 'trace_chan_id' for the macro so that fixes the compiling
> > error.
> >
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > ---
> >  tools/perf/util/cs-etm.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > index 4ba0f871f086..f5f855fff412 100644
> > --- a/tools/perf/util/cs-etm.c
> > +++ b/tools/perf/util/cs-etm.c
> > @@ -110,7 +110,7 @@ static int cs_etm__decode_data_block(struct cs_etm_queue *etmq);
> >   * encode the etm queue number as the upper 16 bit and the channel as
> >   * the lower 16 bit.
> >   */
> > -#define TO_CS_QUEUE_NR(queue_nr, trace_id_chan)        \
> > +#define TO_CS_QUEUE_NR(queue_nr, trace_chan_id)        \
> >                       (queue_nr << 16 | trace_chan_id)
> >  #define TO_QUEUE_NR(cs_queue_nr) (cs_queue_nr >> 16)
> >  #define TO_TRACE_CHAN_ID(cs_queue_nr) (cs_queue_nr & 0x0000ffff)
> > @@ -819,7 +819,7 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,
> >          * Note that packets decoded above are still in the traceID's packet
> >          * queue and will be processed in cs_etm__process_queues().
> >          */
> > -       cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_id_chan);
> > +       cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_chan_id);
> >         ret = auxtrace_heap__add(&etm->heap, cs_queue_nr, timestamp);
> >  out:
> >         return ret;
> 
> Really good catch - Arnaldo please consider.
> 
> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: perf/core] perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR
  2019-10-21  7:48 [PATCH] perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR Leo Yan
  2019-10-21 17:42 ` Mathieu Poirier
@ 2019-11-12 11:18 ` tip-bot2 for Leo Yan
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Leo Yan @ 2019-11-12 11:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Leo Yan, Mathieu Poirier, Alexander Shishkin, Jiri Olsa,
	Mark Rutland, Namhyung Kim, Peter Zijlstra, Suzuki Poulouse,
	coresight ml, linux-arm-kernel, Arnaldo Carvalho de Melo,
	Ingo Molnar, Borislav Petkov, linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     9d604aad4bb022e848dec80d6fe5f73fe87061a2
Gitweb:        https://git.kernel.org/tip/9d604aad4bb022e848dec80d6fe5f73fe87061a2
Author:        Leo Yan <leo.yan@linaro.org>
AuthorDate:    Mon, 21 Oct 2019 15:48:08 +08:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Wed, 06 Nov 2019 15:43:05 -03:00

perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR

Macro TO_CS_QUEUE_NR definition has a typo, which uses 'trace_id_chan'
as its parameter, this doesn't match with its definition body which uses
'trace_chan_id'.  So renames the parameter to 'trace_chan_id'.

It's luck to have a local variable 'trace_chan_id' in the function
cs_etm__setup_queue(), even we wrongly define the macro TO_CS_QUEUE_NR,
the local variable 'trace_chan_id' is used rather than the macro's
parameter 'trace_id_chan'; so the compiler doesn't complain for this
before.

After renaming the parameter, it leads to a compiling error due
cs_etm__setup_queue() has no variable 'trace_id_chan'.  This patch uses
the variable 'trace_chan_id' for the macro so that fixes the compiling
error.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: coresight ml <coresight@lists.linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lore.kernel.org/lkml/20191021074808.25795-1-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/cs-etm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 4ba0f87..f5f855f 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -110,7 +110,7 @@ static int cs_etm__decode_data_block(struct cs_etm_queue *etmq);
  * encode the etm queue number as the upper 16 bit and the channel as
  * the lower 16 bit.
  */
-#define TO_CS_QUEUE_NR(queue_nr, trace_id_chan)	\
+#define TO_CS_QUEUE_NR(queue_nr, trace_chan_id)	\
 		      (queue_nr << 16 | trace_chan_id)
 #define TO_QUEUE_NR(cs_queue_nr) (cs_queue_nr >> 16)
 #define TO_TRACE_CHAN_ID(cs_queue_nr) (cs_queue_nr & 0x0000ffff)
@@ -819,7 +819,7 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,
 	 * Note that packets decoded above are still in the traceID's packet
 	 * queue and will be processed in cs_etm__process_queues().
 	 */
-	cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_id_chan);
+	cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_chan_id);
 	ret = auxtrace_heap__add(&etm->heap, cs_queue_nr, timestamp);
 out:
 	return ret;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-12 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21  7:48 [PATCH] perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR Leo Yan
2019-10-21 17:42 ` Mathieu Poirier
2019-10-21 20:18   ` Arnaldo Carvalho de Melo
2019-11-12 11:18 ` [tip: perf/core] " tip-bot2 for Leo Yan

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).