From: Barret Rhoden <brho@google.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: Tony Luck <tony.luck@intel.com>,
Dave Martin <Dave.Martin@arm.com>,
James Morse <james.morse@arm.com>,
linux-kernel@vger.kernel.org, "x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86/resctrl: avoid divide by 0 num_rmid
Date: Tue, 22 Jul 2025 14:51:21 -0400 [thread overview]
Message-ID: <dcc38ba0-cbb4-494e-bc10-2df2b4aa2cb0@google.com> (raw)
In-Reply-To: <c4518fe2-dce3-46d1-8d79-cd63377bdcad@intel.com>
On 7/22/25 2:19 PM, Reinette Chatre wrote:
> Hi Barret,
>
> On 7/21/25 11:00 AM, Barret Rhoden wrote:
>> x86_cache_max_rmid's default is -1. If the hardware or VM doesn't set
>> the right cpuid bits, num_rmid can be 0.
>>
>> Signed-off-by: Barret Rhoden <brho@google.com>
>>
>> ---
>> I ran into this on a VM on granite rapids. I guess the VMM told the
>> kernel it was a GNR, but didn't set all the cache/rsctl bits.
>>
>
> The -1 default of x86_cache_max_rmid is assigned if the hardware does not
> support *any* L3 monitoring. Specifically:
>
> resctrl_cpu_detect():
> if (!cpu_has(c, X86_FEATURE_CQM_LLC)) {
> c->x86_cache_max_rmid = -1;
> ...
> }
>
> The function modified by this patch, rdt_get_mon_l3_config() only runs if
> the hardware supports one or more of the L3 monitoring sub-features
> (X86_FEATURE_CQM_OCCUP_LLC, X86_FEATURE_CQM_MBM_TOTAL, or
> X86_FEATURE_CQM_MBM_LOCAL) that depend on X86_FEATURE_CQM_LLC per cpuid_deps[].
>
> I tried to reproduce the issue on real hardware by using clearcpuid to
> disable X86_FEATURE_CQM_LLC and the CPUID dependencies did the right thing
> by automatically disabling X86_FEATURE_CQM_OCCUP_LLC, X86_FEATURE_CQM_MBM_TOTAL,
> X86_FEATURE_CQM_MBM_LOCAL, not running rdt_get_mon_l3_config() at all, and
> not even attempt to enumerate any of the L3 monitoring details.
>
> What are the symptoms when you encounter this issue?
Linux crashes during boot with a divide error, and the splat backtrace
is in rdt_get_mon_l3_config().
> Would it be possible to send me the CPUID flags of leaf 7, subleaf 0 as
> well as all sub-leaves of leaf 0xF?
# ./cpuid 0x7 0
CPUID for Leaf 0x00000007, Sublevel 0x00000000:
eax: 00000002
ebx: f1bf2ffb
ecx: 1b415f7e
edx: bc814410
# ./cpuid 0x7 1
CPUID for Leaf 0x00000007, Sublevel 0x00000001:
eax: 00201c30
ebx: 00000000
ecx: 00000000
edx: 00084000
# ./cpuid 0x7 2
CPUID for Leaf 0x00000007, Sublevel 0x00000002:
eax: 00000000
ebx: 00000000
ecx: 00000000
edx: 0000003f
> Could you please also elaborate what the impact of this issue is? Is this
> a VM that has been released with many users impacted or something encountered
> during development of this VM?
This is with cloud-hypervisor. We do have a couple of local patches for
running on machines with more than 256 cpus. I didn't see anything in
our changes related to cpuid 0x7, but maybe it's on our end.
But I imagine the problem isn't widespread and could be considered
developmental.
I'll keep poking on my end - maybe I had some other cruft in my system
(in the kernel build or in cloud_hypervisor).
Thanks,
Barret
next prev parent reply other threads:[~2025-07-22 18:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 18:00 Barret Rhoden
2025-07-22 18:19 ` Reinette Chatre
2025-07-22 18:51 ` Barret Rhoden [this message]
2025-07-22 21:16 ` Reinette Chatre
2025-07-22 21:33 ` Reinette Chatre
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=dcc38ba0-cbb4-494e-bc10-2df2b4aa2cb0@google.com \
--to=brho@google.com \
--cc=Dave.Martin@arm.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.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®