perf arm-spe: Only warn once for each unsupported address packet

Message ID 20230127205546.667740-1-robh@kernel.org
State New
Headers
Series perf arm-spe: Only warn once for each unsupported address packet |

Commit Message

Rob Herring Jan. 27, 2023, 8:55 p.m. UTC
  Unknown address packet indexes are not an error as the Arm architecture
can (and has with SPEv1.2) define new ones and implementation defined
ones are also allowed. The error message for every occurrence of the
packet is needlessly noisy as well. Change the message to print just
once for each unknown index.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 tools/perf/util/arm-spe-decoder/arm-spe-decoder.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Leo Yan Jan. 30, 2023, 2:13 a.m. UTC | #1
On Fri, Jan 27, 2023 at 02:55:46PM -0600, Rob Herring wrote:
> Unknown address packet indexes are not an error as the Arm architecture
> can (and has with SPEv1.2) define new ones and implementation defined
> ones are also allowed. The error message for every occurrence of the
> packet is needlessly noisy as well. Change the message to print just
> once for each unknown index.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

Reviewed-by: Leo Yan <leo.yan@linaro.org>

> ---
>  tools/perf/util/arm-spe-decoder/arm-spe-decoder.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> index 091987dd3966..40dcedfd75cd 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> @@ -68,7 +68,11 @@ static u64 arm_spe_calc_ip(int index, u64 payload)
>  		/* Clean highest byte */
>  		payload = SPE_ADDR_PKT_ADDR_GET_BYTES_0_6(payload);
>  	} else {
> -		pr_err("unsupported address packet index: 0x%x\n", index);
> +		static u32 seen_idx = 0;
> +		if (!(seen_idx & BIT(index))) {
> +			seen_idx |= BIT(index);
> +			pr_warning("ignoring unsupported address packet index: 0x%x\n", index);
> +		}
>  	}
>  
>  	return payload;
> -- 
> 2.39.0
>
  
Arnaldo Carvalho de Melo Feb. 2, 2023, 1:14 a.m. UTC | #2
Em Mon, Jan 30, 2023 at 10:13:52AM +0800, Leo Yan escreveu:
> On Fri, Jan 27, 2023 at 02:55:46PM -0600, Rob Herring wrote:
> > Unknown address packet indexes are not an error as the Arm architecture
> > can (and has with SPEv1.2) define new ones and implementation defined
> > ones are also allowed. The error message for every occurrence of the
> > packet is needlessly noisy as well. Change the message to print just
> > once for each unknown index.
> > 
> > Signed-off-by: Rob Herring <robh@kernel.org>
> 
> Reviewed-by: Leo Yan <leo.yan@linaro.org>

Thanks, applied.

- Arnaldo

 
> > ---
> >  tools/perf/util/arm-spe-decoder/arm-spe-decoder.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> > index 091987dd3966..40dcedfd75cd 100644
> > --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> > +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> > @@ -68,7 +68,11 @@ static u64 arm_spe_calc_ip(int index, u64 payload)
> >  		/* Clean highest byte */
> >  		payload = SPE_ADDR_PKT_ADDR_GET_BYTES_0_6(payload);
> >  	} else {
> > -		pr_err("unsupported address packet index: 0x%x\n", index);
> > +		static u32 seen_idx = 0;
> > +		if (!(seen_idx & BIT(index))) {
> > +			seen_idx |= BIT(index);
> > +			pr_warning("ignoring unsupported address packet index: 0x%x\n", index);
> > +		}
> >  	}
> >  
> >  	return payload;
> > -- 
> > 2.39.0
> >
  

Patch

diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
index 091987dd3966..40dcedfd75cd 100644
--- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
+++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
@@ -68,7 +68,11 @@  static u64 arm_spe_calc_ip(int index, u64 payload)
 		/* Clean highest byte */
 		payload = SPE_ADDR_PKT_ADDR_GET_BYTES_0_6(payload);
 	} else {
-		pr_err("unsupported address packet index: 0x%x\n", index);
+		static u32 seen_idx = 0;
+		if (!(seen_idx & BIT(index))) {
+			seen_idx |= BIT(index);
+			pr_warning("ignoring unsupported address packet index: 0x%x\n", index);
+		}
 	}
 
 	return payload;