From: Zhao Liu <zhao1.liu@intel.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Chuang Xu <xuchuangxclwt@bytedance.com>,
pbonzini@redhat.com, imammedo@redhat.com,
xieyongji@bytedance.com, chaiwen.cc@bytedance.com,
qemu-stable@nongnu.org, Guixiong Wei <weiguixiong@bytedance.com>,
Yipeng Yin <yinyipeng@bytedance.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v6] i386/cpu: fixup number of addressable IDs for logical processors in the physical package
Date: Tue, 3 Dec 2024 23:35:34 +0800 [thread overview]
Message-ID: <Z08lRiqdjca2Tcn9@intel.com> (raw)
In-Reply-To: <f59cd973-b38b-4ee6-8baf-70019c26122e@intel.com>
On Tue, Dec 03, 2024 at 11:04:12PM +0800, Xiaoyao Li wrote:
> Date: Tue, 3 Dec 2024 23:04:12 +0800
> From: Xiaoyao Li <xiaoyao.li@intel.com>
> Subject: Re: [PATCH v6] i386/cpu: fixup number of addressable IDs for
> logical processors in the physical package
>
> On 12/3/2024 3:33 PM, Zhao Liu wrote:
> > > However, back to the patch, I think we cannot change it as this patch
> > > directly. Instead, we need a compat_props for the changed behavior, because
> > > this isn't a bug fix and it introduces guest-visible differences.
> >
> > This is a fix, not a new feature, so compat_props is not needed.
>
> Fix what? QEMU behaves as it for so many years and if the guest OS uses the
> algorithm recommended by SDM, there is no issue.
I've spent a lot time to explain why current behavior doesn't match the
SDM and real machine's implementation.
> > > For ancient Intel CPUs, EBX[23:16] did represent the number of Logical
> > > processor per package. I believe this should be the reason why QEMU
> > > implemented it as is:
> > >
> > > - on SDM version 013, EBX[23:16]: Number of logical processors per
> > > physical processor; two for the Pentium 4 processor supporting
> > > Hyper-Threading Technology.
> > >
> > > - on SDM version 015, it changed to: Number of initial APIC IDs reserved
> > > for this physical package. Normally, this is the number of logical
> > > processors per physical package.
> > >
> > > - on SDM version 016, it changed to: Maximum number of logical processors
> > > in this physical package.
> > >
> > > - finally, starting from SDM version 026, it changed to what reads now:
> > > Maximum number of addressable IDs for logical processors in this physical
> > > package.
> >
> > And this is an architecturally defined CPUID, so SDM ensures backward
> > compatibility.
>
> SDM ensure the backwards compatibility by recommending to round the number
> up to the power-of 2 when using it to calculate the topology with legacy
> method.
Please, *always* refer the latest SDM.
Regarding historical changes, older machines didn't have spare APIC ID
slots, so the actual number is the same as the maximum number of
addressable IDs.
next prev parent reply other threads:[~2024-12-03 15:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 3:56 [PATCH v6] i386/cpu: fixup number of addressable IDs for logical processors in the physical package Chuang Xu
2024-10-09 4:21 ` Zhao Liu
2024-10-12 7:13 ` Xiaoyao Li
2024-10-12 8:10 ` Chuang Xu
2024-10-12 8:32 ` Xiaoyao Li
2024-10-12 8:56 ` Zhao Liu
2024-10-12 8:21 ` Xiaoyao Li
2024-10-12 9:28 ` Zhao Liu
2024-10-12 9:35 ` Chuang Xu
2024-10-14 0:36 ` Xiaoyao Li
2024-10-14 1:32 ` Xiaoyao Li
2024-10-14 3:36 ` Zhao Liu
2024-10-17 8:18 ` Xiaoyao Li
2024-10-17 9:03 ` Zhao Liu
2024-10-28 16:07 ` Xiaoyao Li
2024-12-03 7:33 ` Zhao Liu
2024-12-03 15:04 ` Xiaoyao Li
2024-12-03 15:35 ` Zhao Liu [this message]
2024-12-03 15:29 ` Daniel P. Berrangé
2024-12-03 7:36 ` Zhao Liu
2024-12-03 7:29 ` Chuang Xu
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=Z08lRiqdjca2Tcn9@intel.com \
--to=zhao1.liu@intel.com \
--cc=chaiwen.cc@bytedance.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=weiguixiong@bytedance.com \
--cc=xiaoyao.li@intel.com \
--cc=xieyongji@bytedance.com \
--cc=xuchuangxclwt@bytedance.com \
--cc=yinyipeng@bytedance.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;
as well as URLs for NNTP newsgroup(s).