linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Cc: John Garry <john.g.garry@oracle.com>,
	Will Deacon <will@kernel.org>,
	James Clark <james.clark@linaro.org>,
	Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linux.dev>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Liang, Kan" <kan.liang@linux.intel.com>,
	Graham Woodward <graham.woodward@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] perf arm-spe: Add support for SPE Data Source packet on AmpereOne
Date: Fri, 8 Nov 2024 14:51:38 +0000	[thread overview]
Message-ID: <20241108145138.GF47850@e132581.arm.com> (raw)
In-Reply-To: <20241108010911.58412-3-ilkka@os.amperecomputing.com>

On Fri, Nov 08, 2024 at 01:09:11AM +0000, Ilkka Koskinen wrote:
> 
> Decode SPE Data Source packets on AmpereOne. The field is IMPDEF.
> 
> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>

Reviewed-by: Leo Yan <leo.yan@arm.com>

> ---
>  .../util/arm-spe-decoder/arm-spe-decoder.h    |  9 ++++
>  tools/perf/util/arm-spe.c                     | 44 +++++++++++++++++++
>  2 files changed, 53 insertions(+)
> 
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> index 358c611eeddb..4bcd627e859f 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> @@ -67,6 +67,15 @@ enum arm_spe_common_data_source {
>         ARM_SPE_COMMON_DS_DRAM          = 0xe,
>  };
> 
> +enum arm_spe_ampereone_data_source {
> +       ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE    = 0x0,
> +       ARM_SPE_AMPEREONE_SLC                           = 0x3,
> +       ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE             = 0x5,
> +       ARM_SPE_AMPEREONE_DDR                           = 0x7,
> +       ARM_SPE_AMPEREONE_L1D                           = 0x8,
> +       ARM_SPE_AMPEREONE_L2D                           = 0x9,
> +};
> +
>  struct arm_spe_record {
>         enum arm_spe_sample_type type;
>         int err;
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index dfb0c07cb7fe..df84933b673d 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -455,8 +455,14 @@ static const struct midr_range common_ds_encoding_cpus[] = {
>         {},
>  };
> 
> +static const struct midr_range ampereone_ds_encoding_cpus[] = {
> +       MIDR_ALL_VERSIONS(MIDR_AMPERE1A),
> +       {},
> +};
> +
>  static const struct data_source_handle data_source_handles[] = {
>         DS(common_ds_encoding_cpus, data_source_common),
> +       DS(ampereone_ds_encoding_cpus, data_source_ampereone),
>  };
> 
>  static void arm_spe__sample_flags(struct arm_spe_queue *speq)
> @@ -548,6 +554,44 @@ static void arm_spe__synth_data_source_common(const struct arm_spe_record *recor
>         }
>  }
> 
> +/*
> + * Source is IMPDEF. Here we convert the source code used on AmpereOne cores
> + * to the common (Neoverse, Cortex) to avoid duplicating the decoding code.
> + */
> +static void arm_spe__synth_data_source_ampereone(const struct arm_spe_record *record,
> +                                                union perf_mem_data_src *data_src)
> +{
> +       struct arm_spe_record common_record;
> +
> +       switch (record->source) {
> +       case ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE:
> +               common_record.source = ARM_SPE_COMMON_DS_PEER_CORE;
> +               break;
> +       case ARM_SPE_AMPEREONE_SLC:
> +               common_record.source = ARM_SPE_COMMON_DS_SYS_CACHE;
> +               break;
> +       case ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE:
> +               common_record.source = ARM_SPE_COMMON_DS_REMOTE;
> +               break;
> +       case ARM_SPE_AMPEREONE_DDR:
> +               common_record.source = ARM_SPE_COMMON_DS_DRAM;
> +               break;
> +       case ARM_SPE_AMPEREONE_L1D:
> +               common_record.source = ARM_SPE_COMMON_DS_L1D;
> +               break;
> +       case ARM_SPE_AMPEREONE_L2D:
> +               common_record.source = ARM_SPE_COMMON_DS_L2;
> +               break;
> +       default:
> +               pr_warning_once("AmpereOne: Unknown data source (0x%x)\n",
> +                               record->source);
> +               return;
> +       }
> +
> +       common_record.op = record->op;
> +       arm_spe__synth_data_source_common(&common_record, data_src);
> +}
> +
>  static void arm_spe__synth_memory_level(const struct arm_spe_record *record,
>                                         union perf_mem_data_src *data_src)
>  {
> --
> 2.47.0
> 
> 

  reply	other threads:[~2024-11-08 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  1:09 [PATCH v4 0/2] perf arm-spe: Add support for SPE Data Source packet on AmpereOne Ilkka Koskinen
2024-11-08  1:09 ` [PATCH v4 1/2] perf arm-spe: Prepare for adding data source packet implementations for other cores Ilkka Koskinen
2024-11-08 14:50   ` Leo Yan
2024-11-08 20:24     ` Ilkka Koskinen
2024-11-08  1:09 ` [PATCH v4 2/2] perf arm-spe: Add support for SPE Data Source packet on AmpereOne Ilkka Koskinen
2024-11-08 14:51   ` Leo Yan [this message]
2024-12-09 15:26     ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241108145138.GF47850@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=graham.woodward@arm.com \
    --cc=ilkka@os.amperecomputing.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).