mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Dave Hansen <dave.hansen@intel.com>, linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hpa@zytor.com, corbet@lwn.net,
	jgross@suse.com, andrew.cooper3@citrix.com, peterz@infradead.org,
	Jason@zx2c4.com, thomas.lendacky@amd.com, puwen@hygon.cn,
	x86@kernel.org, linux-doc@vger.kernel.org,
	oleksandr@natalenko.name, bagasdotme@gmail.com
Subject: Re: [PATCH v2 2/2] x86/Documentation: Add documentation about cluster
Date: Fri, 14 Apr 2023 08:07:27 +0530	[thread overview]
Message-ID: <225bdcc0-9351-63a7-f071-5536d495ada6@amd.com> (raw)
In-Reply-To: <1ea129d9-19cc-5f33-fc10-3e832679c5a2@intel.com>

Hello Dave,

Thank you for taking a look at the series.

On 4/13/2023 11:27 PM, Dave Hansen wrote:
> On 4/13/23 10:29, K Prateek Nayak wrote:
>> +  - cluster_id:
>> +
>> +    A per-CPU variable containing:
>> +
>> +      - On Intel, the common upper bits of APIC ID of the list of CPUs sharing
>> +        the L2 Cache with lower bits set to 0.
>> +
>> +      - On AMD and Hygon, with Topology Extension, the common upper bits of the
>> +        Extended APIC ID of the list of CPUs sharing the L2 Cache, left shifted
>> +        to remove trailing 0s.
> 
> I think this is too much detail for Documentation.  We have the code if
> anyone cares _this_ much.

Yes, I agree. I'll reword this as you suggested.

> 
> Also, I'm perplexed by the "left shifted" comment.  I don't see a lot of
> left shifting in the patch.  Am I just missing it?

In Patch1, cacheinfo_topoext_init_l2c_id() sets l2c_id as follows for AMD
and Hygon processors:

  bits = get_count_order(num_sharing_cache);
  per_cpu(cpu_l2c_id, cpu) = c->apicid >> bits;

For Intel, in init_intel_cacheinfo(), l2c_id is set as follows:

  index_msb = get_count_order(num_threads_sharing);
  l2_id = c->apicid & ~((1 << index_msb) - 1);
  ...
  per_cpu(cpu_l2c_id, cpu) = l2_id;

In the former, only the upper bits that are same for all the threads in a
cluster are retained, shifting out the lower bits, whereas in the latter
the lower bits are set to 0s keeping the upper bits, common to all the
threads on the cluster, as is. Let me know if I'm missing something.

> 
> Further, this makes it sound like all Intel CPUs have the cluster_id
> populated.  I'm also not sure that folks reading this will have any
> worldly idea what "Topology Extension" is.

I agree, it becomes too technical.

> 
> Why don't we just say that some CPUs don't have this info?  That way we
> don't need to spell out AMD vs. Intel or expect our users to go figuring
> out of their CPU has "Topology Extension" or leaf 3 or wherever this
> info is on Intel.
> 
> How about:
> 
> A per-CPU variable containing:
> 
>    - Some upper bits extracted from the APIC ID.  CPUs which have the
>      same value in these bits share an L2 and have the same cluster_id.
> 
>      CPUs for which L2 cache information is unavailable will show 65535
>      as the cluster_id.

I'll reword the description based on your suggestion in the next version.

--
Thanks and Regards,
Prateek

  reply	other threads:[~2023-04-14  2:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 17:29 [PATCH v2 0/2] arch/x86: Set L2 Cache ID on AMD and Hygon processors K Prateek Nayak
2023-04-13 17:29 ` [PATCH v2 1/2] " K Prateek Nayak
2023-04-13 17:29 ` [PATCH v2 2/2] x86/Documentation: Add documentation about cluster K Prateek Nayak
2023-04-13 17:57   ` Dave Hansen
2023-04-14  2:37     ` K Prateek Nayak [this message]
2023-04-14  3:17   ` [PATCH v2.1 " K Prateek Nayak
2023-04-15  2:24     ` Bagas Sanjaya
2023-04-17  0:23       ` Dave Hansen
2023-04-18  2:19         ` Bagas Sanjaya
2023-05-18  2:27 ` [PATCH v2 0/2] arch/x86: Set L2 Cache ID on AMD and Hygon processors K Prateek Nayak

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=225bdcc0-9351-63a7-f071-5536d495ada6@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=Jason@zx2c4.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bagasdotme@gmail.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleksandr@natalenko.name \
    --cc=peterz@infradead.org \
    --cc=puwen@hygon.cn \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@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

all inboxes | Powered by JetHome®