The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Srikar Dronamraju <srikar@linux.ibm.com>
To: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	driver-core@lists.linux.dev, christophe.leroy@csgroup.eu,
	maddy@linux.ibm.com, gregkh@linuxfoundation.org,
	rafael@kernel.org, dakr@kernel.org, johan@kernel.org,
	sudeep.holla@kernel.org, ritesh.list@gmail.com,
	tim.c.chen@linux.intel.com, yu.c.chen@intel.com
Subject: Re: [PATCH 4/5] powerpc/cacheinfo: Move to generic cacheinfo
Date: Thu, 19 Nov 2026 13:54:15 +0530	[thread overview]
Message-ID: <av6yL-zYc6-EZN9S@linux.ibm.com> (raw)
In-Reply-To: <20261118163639.890546-5-sshegde@linux.ibm.com>

* Shrikanth Hegde <sshegde@linux.ibm.com> [2026-11-18 22:06:38]:

> PowerPC maintains an architecture-specific implementation of the CPU
> cache sysfs interface. Replace it with the generic cacheinfo
> infrastructure.
> 
> On a dedicated Power11 LPAR, the generic implementation preserves the
> existing L1 data, L1 instruction, L2 and L3 sizes, associativity, set
> counts and shared CPU maps. The two SMT4 groups continue to appear as
> separate cache instances.
> 
> [Both draft changelog and code are written by LLM]
> Assisted-by: LLM
> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> ---
> -
> -static void do_subsidiary_caches_debugcheck(struct cache *cache)
> +int cacheinfo_get_arch_id(unsigned int cpu, unsigned int level,
> +			  unsigned int *id)
>  {
> -	WARN_ONCE(cache->level != 1,
> -		  "instantiating cache chain from L%d %s cache for "
> -		  "%pOFP instead of an L1\n", cache->level,
> -		  cache_type_string(cache), cache->ofnode);
> -	WARN_ONCE(!of_node_is_type(cache->ofnode, "cpu"),
> -		  "instantiating cache chain from node %pOFP of type '%s' "
> -		  "instead of a cpu node\n", cache->ofnode,
> -		  of_node_get_device_type(cache->ofnode));
> -}
> +	const struct cpumask *mask = NULL;
>  
> -/*
> - * If sub-groups of threads in a core containing @cpu_id share the
> - * L@level-cache (information obtained via "ibm,thread-groups"
> - * device-tree property), then we identify the group by the first
> - * thread-sibling in the group. We define this to be the group-id.
> - *
> - * In the absence of any thread-group information for L@level-cache,
> - * this function returns -1.
> - */
> -static int get_group_id(unsigned int cpu_id, int level)
> -{
>  	if (has_big_cores && level == 1)
> -		return cpumask_first(per_cpu(thread_group_l1_cache_map,
> -					     cpu_id));
> +		mask = per_cpu(thread_group_l1_cache_map, cpu);
>  	else if (thread_group_shares_l2 && level == 2)
> -		return cpumask_first(per_cpu(thread_group_l2_cache_map,
> -					     cpu_id));
> +		mask = per_cpu(thread_group_l2_cache_map, cpu);
>  	else if (thread_group_shares_l3 && level == 3)
> -		return cpumask_first(per_cpu(thread_group_l3_cache_map,
> -					     cpu_id));
> -	return -1;
> -}
> -
> -static void do_subsidiary_caches(struct cache *cache, unsigned int cpu_id)
> -{
> -	struct device_node *subcache_node;
> -	int level = cache->level;
> +		mask = per_cpu(thread_group_l3_cache_map, cpu);
>  
> -	do_subsidiary_caches_debugcheck(cache);
> +	if (!mask || cpumask_empty(mask))
> +		return -ENOENT;

So if we are here, then we are saying, the generic way of figuring out the
cache-id should work. Guess, we should come here for P7/P8 systems.
Have we tried with a P8 system to see if things work as expected?

-- 
Thanks and Regards
Srikar Dronamraju

  reply	other threads:[~2026-11-19  8:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 16:36 [PATCH 0/5] cacheinfo, powerpc: Move powerpc to generic cacheinfo Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 1/5] cacheinfo: Allow architectures to provide custom cache IDs Shrikanth Hegde
2026-11-19  6:36   ` Srikar Dronamraju
2026-11-19  9:21     ` Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 2/5] cacheinfo: Support unified caches described by d-cache properties Shrikanth Hegde
2026-11-19  6:44   ` Srikar Dronamraju
2026-11-19  9:22     ` Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 3/5] cacheinfo: Add teardown and rebuild helpers Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 4/5] powerpc/cacheinfo: Move to generic cacheinfo Shrikanth Hegde
2026-11-19  8:24   ` Srikar Dronamraju [this message]
2026-11-19  9:25     ` Shrikanth Hegde
2026-11-18 16:36 ` [PATCH 5/5] sched/topology: Remove stale comment around llc_bytes on powerpc Shrikanth Hegde
2026-11-19  9:30 ` [PATCH 0/5] cacheinfo, powerpc: Move powerpc to generic cacheinfo Shrikanth Hegde

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=av6yL-zYc6-EZN9S@linux.ibm.com \
    --to=srikar@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=rafael@kernel.org \
    --cc=ritesh.list@gmail.com \
    --cc=sshegde@linux.ibm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=yu.c.chen@intel.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