All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>
Cc: qemu-devel@nongnu.org, Yanan Wang <wangyanan55@huawei.com>,
	Zhao Liu <zhao1.liu@intel.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH v2 01/10] i386/cpu: Extract a common fucntion to setup value of MSR_CORE_THREAD_COUNT
Date: Tue, 7 Jan 2025 12:31:21 +0800	[thread overview]
Message-ID: <bf435f2e-5cfb-411d-937a-6c686a0530dd@intel.com> (raw)
In-Reply-To: <902568a2-8160-4265-9e2c-c4465eaa62d4@linaro.org>

On 1/3/2025 4:52 PM, Philippe Mathieu-Daudé wrote:
> On 28/12/24 18:37, Philippe Mathieu-Daudé wrote:
>> On 19/12/24 12:01, Xiaoyao Li wrote:
>>> There are duplicated code to setup the value of MSR_CORE_THREAD_COUNT.
>>> Extract a common function for it.
>>>
>>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>>> ---
>>> Changes in v2:
>>> - move the implementation of cpu_x86_get_msr_core_thread_count() to
>>>    target/i386/cpu-sysemu.c;
>>> ---
>>>   target/i386/cpu-sysemu.c             | 11 +++++++++++
>>>   target/i386/cpu.h                    |  2 ++
>>>   target/i386/hvf/x86_emu.c            |  3 +--
>>>   target/i386/kvm/kvm.c                |  5 +----
>>>   target/i386/tcg/sysemu/misc_helper.c |  3 +--
>>>   5 files changed, 16 insertions(+), 8 deletions(-)
>>
>>
>>> +uint64_t cpu_x86_get_msr_core_thread_count(X86CPU *cpu)
>>> +{
>>> +    CPUState *cs = CPU(cpu);
>>> +    uint64_t val;
>>> +
>>> +    val = cs->nr_threads * cs->nr_cores;  /* thread count, bits 
>>> 15..0 */
>>> +    val |= ((uint32_t)cs->nr_cores << 16); /* core count, bits 
>>> 31..16 */
>>> +
>>> +    return val;
>>
>> Alternatively:
>>
>>         return deposit64(cs->nr_threads * cs->nr_cores, 16, 16,
>>                          cs->nr_cores);

I would rather keep it as-is as suguested by Philippe[1].

(deposit64() is really a new thing for i386)

[1] 
https://lore.kernel.org/qemu-devel/20241210173524.48e203a3@imammedo.users.ipa.redhat.com/

>>> +}
>>
> 
> Typo "function" in patch subject.

thanks for catching it!



  reply	other threads:[~2025-01-07  4:32 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 [this message]
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
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=bf435f2e-5cfb-411d-937a-6c686a0530dd@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.