linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: James Clark <james.clark@linaro.org>
Cc: Yicong Yang <yangyicong@huawei.com>,
	jonathan.cameron@huawei.com, hejunhao3@huawei.com,
	linuxarm@huawei.com, wangyushan12@huawei.com,
	caijingtao@huawei.com, xueshan2@huawei.com,
	prime.zeng@hisilicon.com, yangyicong@hisilicon.com,
	acme@kernel.org, namhyung@kernel.org, catalin.marinas@arm.com,
	will@kernel.org, peterz@infradead.org, mingo@redhat.com,
	mark.rutland@arm.com, jolsa@kernel.org, john.g.garry@oracle.com,
	leo.yan@linux.dev, irogers@google.com,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf arm-spe: Add support for SPE Data Source packet on HiSilicon HIP12
Date: Tue, 22 Apr 2025 11:29:52 +0100	[thread overview]
Message-ID: <20250422102952.GD28953@e132581.arm.com> (raw)
In-Reply-To: <89741897-6c8f-4b75-8ec3-675111ea60a1@linaro.org>

On Tue, Apr 22, 2025 at 10:16:40AM +0100, James Clark wrote:
> > 
> > Add data source encoding for HiSilicon HIP12 and coresponding mapping
> > to the perf's memory data source. This will help to synthesize the data
> > and support upper layer tools like perf-mem and perf-c2c.
> > 
> > Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
> > ---
> >   arch/arm64/include/asm/cputype.h              |   2 +
> >   tools/arch/arm64/include/asm/cputype.h        |   2 +

Please split into two patches.  One is a kernel patch and another is a
tool patch.

[...]

> > --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> > +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> > @@ -82,6 +82,23 @@ enum arm_spe_ampereone_data_source {
> >   	ARM_SPE_AMPEREONE_L2D                           = 0x9,
> >   };
> > +enum arm_spe_hisi_hip_data_source {
> > +	ARM_SPE_HISI_HIP_PEER_CPU		= 0,
> > +	ARM_SPE_HISI_HIP_PEER_CPU_HITM		= 1,
> > +	ARM_SPE_HISI_HIP_L3			= 2,
> > +	ARM_SPE_HISI_HIP_L3_HITM		= 3,
> > +	ARM_SPE_HISI_HIP_PEER_CLUSTER		= 4,
> > +	ARM_SPE_HISI_HIP_PEER_CLUSTER_HITM	= 5,
> > +	ARM_SPE_HISI_HIP_REMOTE_SOCKET		= 6,
> > +	ARM_SPE_HISI_HIP_REMOTE_SOCKET_HITM	= 7,
> > +	ARM_SPE_HISI_HIP_LOCAL			= 8,
> > +	ARM_SPE_HISI_HIP_REMOTE			= 9,
> > +	ARM_SPE_HISI_HIP_NC_DEV			= 13,
> > +	ARM_SPE_HISI_HIP_L2			= 16,
> > +	ARM_SPE_HISI_HIP_L2_HITM		= 17,
> > +	ARM_SPE_HISI_HIP_L1			= 18,
> > +};
> > +
> >   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 2a9775649cc2..eceae4219601 100644
> > --- a/tools/perf/util/arm-spe.c
> > +++ b/tools/perf/util/arm-spe.c
> > @@ -571,6 +571,11 @@ static const struct midr_range ampereone_ds_encoding_cpus[] = {
> >   	{},
> >   };
> > +static const struct midr_range hisi_hip_ds_encoding_cpus[] = {
> > +	MIDR_ALL_VERSIONS(MIDR_HISI_HIP12),
> > +	{},
> > +};
> > +
> >   static void arm_spe__sample_flags(struct arm_spe_queue *speq)
> >   {
> >   	const struct arm_spe_record *record = &speq->decoder->record;
> > @@ -718,9 +723,105 @@ static void arm_spe__synth_data_source_ampereone(const struct arm_spe_record *re
> >   	arm_spe__synth_data_source_common(&common_record, data_src);
> >   }
> > +static void arm_spe__synth_data_source_hisi_hip(const struct arm_spe_record *record,
> > +						union perf_mem_data_src *data_src)
> > +{
> > +	/* Use common synthesis method to handle store operations */
> > +	if (record->op & ARM_SPE_OP_ST) {
> > +		arm_spe__synth_data_source_common(record, data_src);
> > +		return;
> > +	}
> > +
> > +	switch (record->source) {
> > +	case ARM_SPE_HISI_HIP_PEER_CPU:
> > +		data_src->mem_lvl = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT;
> > +		data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;
> > +		data_src->mem_snoop = PERF_MEM_SNOOP_NONE;
> > +		data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;

Seems it is conflict to set both 'PERF_MEM_SNOOP_NONE' and
'PERF_MEM_SNOOPX_PEER'.

Remove setting 'PERF_MEM_SNOOP_NONE' in this case?

> > +		break;
> > +	case ARM_SPE_HISI_HIP_PEER_CPU_HITM:
> > +		data_src->mem_lvl = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT;
> > +		data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;
> > +		data_src->mem_snoop = PERF_MEM_SNOOP_HITM;
> > +		data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;
> > +		break;
> > +	case ARM_SPE_HISI_HIP_L3:
> > +		data_src->mem_lvl = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT;
> > +		data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;
> > +		data_src->mem_snoop = PERF_MEM_SNOOP_NONE;
> > +		break;
> > +	case ARM_SPE_HISI_HIP_L3_HITM:
> > +		data_src->mem_lvl = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT;
> > +		data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;
> > +		data_src->mem_snoop = PERF_MEM_SNOOP_HITM;
> > +		data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;
> > +		break;
> > +	case ARM_SPE_HISI_HIP_PEER_CLUSTER:
> > +		data_src->mem_lvl = PERF_MEM_LVL_REM_CCE1 | PERF_MEM_LVL_HIT;
> > +		data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;

Seems to me, a CPU has L3 cache, would the cluster has a higher level's
cache?

> > +		data_src->mem_snoop = PERF_MEM_SNOOP_NONE;
> > +		data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;

Ditto for the confliction for the two flags 'SNOOP_NONE' and
'SNOOPX_PEER'.

> > +		break;
> > +	case ARM_SPE_HISI_HIP_PEER_CLUSTER_HITM:
> > +		data_src->mem_lvl = PERF_MEM_LVL_REM_CCE1 | PERF_MEM_LVL_HIT;
> > +		data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;
> > +		data_src->mem_snoop = PERF_MEM_SNOOP_HITM;
> > +		data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;
> > +		break;
> > +	case ARM_SPE_HISI_HIP_REMOTE_SOCKET:
> > +		data_src->mem_lvl = PERF_MEM_LVL_REM_CCE2;
> > +		data_src->mem_lvl_num = PERF_MEM_LVLNUM_ANY_CACHE;
> > +		data_src->mem_remote = PERF_MEM_REMOTE_REMOTE;
> > +		data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;
> 
> Hi Yicong,
> 
> Is the mem_snoop setting missing from this one?

The field 'mem_snoopx' is an extension to the field 'mem_snoop'.

If the field 'mem_snoopx' is set, it is no need to set 'mem_snoop'.

Thanks,
Leo


  parent reply	other threads:[~2025-04-22 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 12:28 [PATCH] perf arm-spe: Add support for SPE Data Source packet on HiSilicon HIP12 Yicong Yang
2025-04-22  9:01 ` Yicong Yang
2025-04-22  9:16 ` James Clark
2025-04-22 10:11   ` Yicong Yang
2025-04-22 10:29   ` Leo Yan [this message]
2025-04-22 12:31     ` Yicong Yang
2025-04-22 13:20       ` Leo Yan
2025-04-23  7:57         ` Yicong Yang
2025-04-24 11:57           ` Yicong Yang
2025-04-24 12:48             ` Leo Yan

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=20250422102952.GD28953@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=caijingtao@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=hejunhao3@huawei.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=leo.yan@linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=prime.zeng@hisilicon.com \
    --cc=wangyushan12@huawei.com \
    --cc=will@kernel.org \
    --cc=xueshan2@huawei.com \
    --cc=yangyicong@hisilicon.com \
    --cc=yangyicong@huawei.com \
    /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).