All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Yicong Yang <yangyicong@huawei.com>
Cc: <will@kernel.org>, <mark.rutland@arm.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<yangyicong@hisilicon.com>, <hejunhao3@huawei.com>,
	<linuxarm@huawei.com>, <wangyushan12@huawei.com>,
	<prime.zeng@hisilicon.com>
Subject: Re: [PATCH 2/8] drivers/perf: hisi: Improve the detection of associated CPUs
Date: Fri, 18 Oct 2024 13:48:26 +0100	[thread overview]
Message-ID: <20241018134826.00000841@Huawei.com> (raw)
In-Reply-To: <20241018095745.57057-3-yangyicong@huawei.com>

On Fri, 18 Oct 2024 17:57:39 +0800
Yicong Yang <yangyicong@huawei.com> wrote:

> From: Yicong Yang <yangyicong@hisilicon.com>
> 
> Currently we detect the associated CPUs in the cpuhp online callback.
Should really avoid we in patch descriptions.

Currently associated CPUs are detected in the cphup online callback.
etc

> If the CPU's sccl_id or the ccl_id matches the PMU's, they're
> associated. There's an exception that some PMUs locate on the SICL
> and will match no CPUs. The events of these PMUs can be opened on
> any online CPUs. To handle this we just check whether the PMU's
> sccl_id is -1, if so we know it locates on SICL and make any CPU
> associated to it.
> 
> This can be tweaked so in this patch just do the below changes:
> - If the PMU doesn't match any CPU then associated it to online CPUs
> - Choose the target CPU according to the NUMA affinity for opening
>   events
> 
> The function is implemented by hisi_pmu_init_associated_cpus() and
> invoked in hisi_pmu_init().
> 
> Also we maintained the associated_cpus with all the online CPUs. This
> is redundant since we'll always schedule the events on the online CPUs.
> Get rid of this and make associated_cpus contain offline CPUs as well.
> 
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>

One trivial comment inline otherwise LGTM

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

>  /*
>   * The Super CPU Cluster (SCCL) and CPU Cluster (CCL) IDs can be
> @@ -446,10 +467,6 @@ static bool hisi_pmu_cpu_is_associated_pmu(struct hisi_pmu *hisi_pmu)
>  {
>  	int sccl_id, ccl_id;
>  
> -	/* If SCCL_ID is -1, the PMU is in a SICL and has no CPU affinity */
> -	if (hisi_pmu->sccl_id == -1)
> -		return true;
> -
>  	if (hisi_pmu->ccl_id == -1) {
>  		/* If CCL_ID is -1, the PMU only shares the same SCCL */
>  		hisi_read_sccl_and_ccl_id(&sccl_id, NULL);
> @@ -467,13 +484,29 @@ int hisi_uncore_pmu_online_cpu(unsigned int cpu, struct hlist_node *node)
>  	struct hisi_pmu *hisi_pmu = hlist_entry_safe(node, struct hisi_pmu,
>  						     node);
>  
> -	if (!hisi_pmu_cpu_is_associated_pmu(hisi_pmu))
> -		return 0;
> +	/*
> +	 * If the CPU is not in the associated_cpus, it maybe a new CPU we didn't
> +	 * access. Test whether it's associated or not.
it maybe a new CPU.  Test whether...

I'm not sure what the "didn't access" adds.

> +	 */
> +	if (!cpumask_test_cpu(cpu, &hisi_pmu->associated_cpus)) {
> +		if (!hisi_pmu_cpu_is_associated_pmu(hisi_pmu))
> +			return 0;
> +
> +		/*
> +		 * We found an associated CPU so we don't need to use the dummy
> +		 * associated CPUs. Update it.
> +		 */
> +		if (hisi_pmu->dummy_associated_cpus) {
> +			cpumask_clear(&hisi_pmu->associated_cpus);
> +			hisi_pmu->dummy_associated_cpus = false;
> +		}
>  
> -	cpumask_set_cpu(cpu, &hisi_pmu->associated_cpus);
> +		cpumask_set_cpu(cpu, &hisi_pmu->associated_cpus);
> +	}


  reply	other threads:[~2024-10-18 12:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18  9:57 [PATCH 0/8] Refactor the common parts to the HiSilicon Uncore PMU core and cleanups Yicong Yang
2024-10-18  9:57 ` [PATCH 1/8] drivers/perf: hisi: Define a symbol namespace for HiSilicon Uncore PMUs Yicong Yang
2024-10-18 12:43   ` Jonathan Cameron
2024-10-21 12:39     ` Yicong Yang
2024-10-18  9:57 ` [PATCH 2/8] drivers/perf: hisi: Improve the detection of associated CPUs Yicong Yang
2024-10-18 12:48   ` Jonathan Cameron [this message]
2024-10-21 12:41     ` Yicong Yang
2024-10-18  9:57 ` [PATCH 3/8] drivers/perf: hisi: Extract topology information to a separate structure Yicong Yang
2024-10-18 12:54   ` Jonathan Cameron
2024-10-21 12:44     ` Yicong Yang
2024-10-18  9:57 ` [PATCH 4/8] drivers/perf: hisi: Add a common function to retrieve topology from firmware Yicong Yang
2024-10-18 12:58   ` Jonathan Cameron
2024-10-18  9:57 ` [PATCH 5/8] drivers/perf: hisi: Refactor the attributes creation Yicong Yang
2024-10-18 13:47   ` Jonathan Cameron
2024-10-21 12:54     ` Yicong Yang
2024-10-18  9:57 ` [PATCH 6/8] drivers/perf: hisi: Export associated CPUs of each PMU through sysfs Yicong Yang
2024-10-18 13:19   ` Jonathan Cameron
2024-10-18  9:57 ` [PATCH 7/8] drivers/perf: hisi: Fix incorrect variable name "hha_pmu" in DDRC PMU driver Yicong Yang
2024-10-18 13:20   ` Jonathan Cameron
2024-10-18  9:57 ` [PATCH 8/8] drivers/perf: hisi: Delete redundant blank line of DDRC PMU Yicong Yang
2024-10-18 13:21   ` Jonathan Cameron

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=20241018134826.00000841@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=hejunhao3@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=wangyushan12@huawei.com \
    --cc=will@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.