linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Leo Yan <leo.yan@arm.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Besar Wicaksono <bwicaksono@nvidia.com>,
	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>,
	John Garry <john.g.garry@oracle.com>,
	Will Deacon <will@kernel.org>, Mike Leach <mike.leach@linaro.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 4/7] perf arm-spe: Use metadata to decide the data source feature
Date: Thu, 10 Oct 2024 14:53:38 +0100	[thread overview]
Message-ID: <555fbea8-7103-4de1-bcd5-accc9c649e62@linaro.org> (raw)
In-Reply-To: <20241003185322.192357-5-leo.yan@arm.com>



On 03/10/2024 7:53 pm, Leo Yan wrote:
> Use the info in the metadata to decide if the data source feature is
> supported. The CPU MIDR must be in the CPU list for the common data
> source encoding.
> 
> For the metadata version 1, it doesn't include info for MIDR. In this
> case, due to absent info for making decision, print out warning to
> remind users to upgrade tool and returns false.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
>   tools/perf/util/arm-spe.c | 67 +++++++++++++++++++++++++++++++++++++--
>   1 file changed, 64 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index 587943b6bdb8..9221b2f66bbe 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -278,6 +278,20 @@ static int arm_spe_set_tid(struct arm_spe_queue *speq, pid_t tid)
>   	return 0;
>   }
>   
> +static u64 *arm_spe__get_metadata_by_cpu(struct arm_spe *spe, u64 cpu)
> +{
> +	u64 i;
> +
> +	if (!spe->metadata)
> +		return NULL;
> +
> +	for (i = 0; i < spe->metadata_nr_cpu; i++)
> +		if (spe->metadata[i][ARM_SPE_CPU] == cpu)
> +			return spe->metadata[i];
> +
> +	return NULL;
> +}
> +
>   static struct simd_flags arm_spe__synth_simd_flags(const struct arm_spe_record *record)
>   {
>   	struct simd_flags simd_flags = {};
> @@ -520,10 +534,57 @@ static void arm_spe__synth_memory_level(const struct arm_spe_record *record,
>   		data_src->mem_lvl |= PERF_MEM_LVL_REM_CCE1;
>   }
>   
> -static u64 arm_spe__synth_data_source(const struct arm_spe_record *record, u64 midr)
> +static bool arm_spe__is_common_ds_encoding(struct arm_spe_queue *speq)
> +{
> +	struct arm_spe *spe = speq->spe;
> +	bool is_in_cpu_list;
> +	u64 *metadata = NULL;
> +	u64 midr = 0;
> +
> +	/*
> +	 * Metadata version 1 doesn't contain any info for MIDR.
> +	 * Simply return false in this case.
> +	 */
> +	if (spe->metadata_ver == 1) {
> +		pr_warning_once("The data file contains metadata version 1, "
> +				"which is absent the info for data source. "
> +				"Please upgrade the tool to record data.\n");
> +		return false;
> +	}
> +
> +	/* CPU ID is -1 for per-thread mode */
> +	if (speq->cpu < 0) {
> +		/*
> +		 * On the heterogeneous system, due to CPU ID is -1,
> +		 * cannot confirm the data source packet is supported.
> +		 */
> +		if (!spe->is_homogeneous)
> +			return false;

Technically you could look at timestamps and context switches to find 
the CPU for non-homogeneous per-thread mode. But it's such an edge case 
I'm not sure it's even worth leaving a TODO for.


  reply	other threads:[~2024-10-10 13:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 18:53 [PATCH v3 0/7] perf arm-spe: Refactor data source encoding Leo Yan
2024-10-03 18:53 ` [PATCH v3 1/7] perf arm-spe: Rename arm_spe__synth_data_source_generic() Leo Yan
2024-10-03 18:53 ` [PATCH v3 2/7] perf arm-spe: Rename the common data source encoding Leo Yan
2024-10-03 18:53 ` [PATCH v3 3/7] perf arm-spe: Introduce arm_spe__is_homogeneous() Leo Yan
2024-10-03 18:53 ` [PATCH v3 4/7] perf arm-spe: Use metadata to decide the data source feature Leo Yan
2024-10-10 13:53   ` James Clark [this message]
2024-10-10 14:58     ` Leo Yan
2024-10-03 18:53 ` [PATCH v3 5/7] perf arm-spe: Remove the unused 'midr' field Leo Yan
2024-10-03 18:53 ` [PATCH v3 6/7] perf arm-spe: Add Neoverse-V2 to common data source encoding list Leo Yan
2024-10-03 18:53 ` [PATCH v3 7/7] perf arm-spe: Add Cortex CPUs " Leo Yan
2024-10-10 13:54 ` [PATCH v3 0/7] perf arm-spe: Refactor data source encoding James Clark
2024-10-16 17:12 ` Namhyung Kim

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=555fbea8-7103-4de1-bcd5-accc9c649e62@linaro.org \
    --to=james.clark@linaro.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bwicaksono@nvidia.com \
    --cc=irogers@google.com \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@arm.com \
    --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=namhyung@kernel.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).