From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Qian Wen <qian.wen@intel.com>, qemu-devel@nongnu.org
Cc: zhao1.liu@intel.com, pbonzini@redhat.com,
richard.henderson@linaro.org, babu.moger@amd.com
Subject: Re: [PATCH v3 2/2] target/i386: Avoid overflow of the cache parameter enumerated by leaf 4
Date: Thu, 17 Aug 2023 10:07:18 +0800 [thread overview]
Message-ID: <2fe588e7-7121-f279-fa50-0e7743585d68@intel.com> (raw)
In-Reply-To: <20230816080658.3562730-3-qian.wen@intel.com>
On 8/16/2023 4:06 PM, Qian Wen wrote:
> According to SDM, CPUID.0x4:EAX[31:26] indicates the Maximum number of
> addressable IDs for processor cores in the physical package. If we
> launch over 64 cores VM, the 6-bit field will overflow, and the wrong
> core_id number will be reported.
>
> Since the HW reports 0x3f when the intel processor has over 64 cores,
> limit the max value written to EBX[31:26] to 63, so max num_cores should
> be 64.
>
> Signed-off-by: Qian Wen <qian.wen@intel.com>
> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> target/i386/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 5c008b9d7e..3b6854300a 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -248,7 +248,7 @@ static void encode_cache_cpuid4(CPUCacheInfo *cache,
> *eax = CACHE_TYPE(cache->type) |
> CACHE_LEVEL(cache->level) |
> (cache->self_init ? CACHE_SELF_INIT_LEVEL : 0) |
> - ((num_cores - 1) << 26) |
> + ((MIN(num_cores, 64) - 1) << 26) |
> ((num_apic_ids - 1) << 14);
>
> assert(cache->line_size > 0);
next prev parent reply other threads:[~2023-08-17 2:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 8:06 [PATCH v3 0/2] Fix overflow of the max number of IDs for logic processor and core Qian Wen
2023-08-16 8:06 ` [PATCH v3 1/2] target/i386: Avoid cpu number overflow in legacy topology Qian Wen
2023-08-17 2:04 ` Xiaoyao Li
2023-08-17 19:33 ` Isaku Yamahata
2023-08-16 8:06 ` [PATCH v3 2/2] target/i386: Avoid overflow of the cache parameter enumerated by leaf 4 Qian Wen
2023-08-17 2:07 ` Xiaoyao Li [this message]
2023-08-17 19:34 ` Isaku Yamahata
2023-08-17 19:33 ` [PATCH v3 0/2] Fix overflow of the max number of IDs for logic processor and core Isaku Yamahata
2023-08-22 7:56 ` Wen, Qian
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=2fe588e7-7121-f279-fa50-0e7743585d68@intel.com \
--to=xiaoyao.li@intel.com \
--cc=babu.moger@amd.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qian.wen@intel.com \
--cc=richard.henderson@linaro.org \
--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 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).