From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Zhao Liu <zhao1.liu@intel.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, "Yanan Wang" <wangyanan55@huawei.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcelo Tosatti" <mtosatti@redhat.com>
Subject: Re: [PATCH v2 05/10] i386/topology: Introduce helpers for various topology info of different level
Date: Tue, 7 Jan 2025 15:12:14 +0800 [thread overview]
Message-ID: <49b6cf3f-21a2-4e2b-b2cf-a57e76c9b89e@intel.com> (raw)
In-Reply-To: <Z25cmxkmzQ9cXash@intel.com>
On 12/27/2024 3:51 PM, Zhao Liu wrote:
>> +static inline unsigned x86_module_per_pkg(X86CPUTopoInfo *topo_info)
>> +{
>> + return topo_info->modules_per_die * topo_info->dies_per_pkg;
>> +}
>> +
>> +static inline unsigned x86_cores_per_pkg(X86CPUTopoInfo *topo_info)
>> +{
>> + return topo_info->cores_per_module * x86_module_per_pkg(topo_info);
>> +}
>
> The above helpers can be ignored this time until someone wants them...
x86_cores_per_pkg() will be used in next patch (06).
So the only one without a real user is x86_module_per_pkg(). We can drop
it, and implement x86_cores_per_pkg() as
return topo_info->cores_per_module * topo_info->modules_per_die
* topo_info->dies_per_pkg;
However, I don't see no real user as a big concern and I think current
implementation looks more consistent and complete.
>> +static inline unsigned x86_threads_per_pkg(X86CPUTopoInfo *topo_info)
>> +{
>> + return topo_info->threads_per_core * x86_cores_per_pkg(topo_info);
>> +}
>
> ...then this can be x86_threads_per_die(topo_info) * topo_info->dies_per_package
>
>> +static inline unsigned x86_threads_per_module(X86CPUTopoInfo *topo_info)
>> +{
>> + return topo_info->threads_per_core * topo_info->cores_per_module;
>> +}
>> +
>> +static inline unsigned x86_threads_per_die(X86CPUTopoInfo *topo_info)
>> +{
>> + return x86_threads_per_module(topo_info) * topo_info->modules_per_die;
>> +}
>> +
>>
next prev parent reply other threads:[~2025-01-07 7:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 11:01 [PATCH v2 00/10] i386: Track X86CPUTopoInfo in CPUX86State and track features in env->features[] Xiaoyao Li
2024-12-19 11:01 ` [PATCH v2 01/10] i386/cpu: Extract a common fucntion to setup value of MSR_CORE_THREAD_COUNT Xiaoyao Li
2024-12-27 7:22 ` Zhao Liu
2024-12-28 17:37 ` Philippe Mathieu-Daudé
2025-01-03 8:52 ` Philippe Mathieu-Daudé
2025-01-07 4:31 ` Xiaoyao Li
2025-01-07 4:34 ` Xiaoyao Li
2025-01-07 7:23 ` Philippe Mathieu-Daudé
2024-12-19 11:01 ` [PATCH v2 02/10] i386/cpu: Drop the variable smp_cores and smp_threads in x86_cpu_pre_plug() Xiaoyao Li
2024-12-27 7:41 ` Zhao Liu
2024-12-19 11:01 ` [PATCH v2 03/10] i386/cpu: Drop cores_per_pkg in cpu_x86_cpuid() Xiaoyao Li
2024-12-27 7:39 ` Zhao Liu
2024-12-19 11:01 ` [PATCH v2 04/10] i386/topology: Update the comment of x86_apicid_from_topo_ids() Xiaoyao Li
2024-12-19 11:01 ` [PATCH v2 05/10] i386/topology: Introduce helpers for various topology info of different level Xiaoyao Li
2024-12-27 7:51 ` Zhao Liu
2025-01-07 7:12 ` Xiaoyao Li [this message]
2024-12-19 11:01 ` [PATCH v2 06/10] i386/cpu: Track a X86CPUTopoInfo directly in CPUX86State Xiaoyao Li
2024-12-27 8:01 ` Zhao Liu
2024-12-19 11:01 ` [PATCH v2 07/10] i386/cpu: Hoist check of CPUID_EXT3_TOPOEXT against threads_per_core Xiaoyao Li
2024-12-27 8:07 ` Zhao Liu
2025-01-07 7:03 ` Xiaoyao Li
2024-12-19 11:01 ` [PATCH v2 08/10] cpu: Remove nr_cores from struct CPUState Xiaoyao Li
2024-12-19 11:01 ` [PATCH v2 09/10] i386/cpu: Set up CPUID_HT in x86_cpu_expand_features() instead of cpu_x86_cpuid() Xiaoyao Li
2024-12-19 11:01 ` [PATCH v2 10/10] i386/cpu: Set and track CPUID_EXT3_CMP_LEG in env->features[FEAT_8000_0001_ECX] Xiaoyao Li
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=49b6cf3f-21a2-4e2b-b2cf-a57e76c9b89e@intel.com \
--to=xiaoyao.li@intel.com \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@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 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.