From: Reinette Chatre <reinette.chatre@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: <tony.luck@intel.com>, <james.morse@arm.com>,
<Dave.Martin@arm.com>, <babu.moger@amd.com>, <tglx@linutronix.de>,
<dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
<ben.horgan@arm.com>, <fustini@kernel.org>, <fenghuay@nvidia.com>,
<peternewman@google.com>, <yu.c.chen@intel.com>,
<linux-kernel@vger.kernel.org>, <patches@lists.linux.dev>
Subject: Re: [PATCH v5 02/10] x86/resctrl: Protect against bad shift
Date: Tue, 21 Jul 2026 09:14:20 -0700 [thread overview]
Message-ID: <2184678d-1b67-4d2f-94a3-c4bb22823cd6@intel.com> (raw)
In-Reply-To: <20260721015959.GEal7SnxxR8D3801cr@fat_crate.local>
Hi Boris,
On 7/20/26 6:59 PM, Borislav Petkov wrote:
> On Tue, Jun 30, 2026 at 09:27:02PM -0700, Reinette Chatre wrote:
>> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
>> index bca782050198..9b9495174041 100644
>> --- a/arch/x86/kernel/cpu/resctrl/core.c
>> +++ b/arch/x86/kernel/cpu/resctrl/core.c
>> @@ -247,7 +247,11 @@ static __init bool __rdt_get_mem_config_amd(struct rdt_resource *r)
>>
>> cpuid_count(0x80000020, subleaf, &eax, &ebx, &ecx, &edx);
>> hw_res->num_closid = edx + 1;
>> - r->membw.max_bw = 1 << eax;
>> + if (BITS_PER_TYPE(r->membw.max_bw) <= eax) {
>> + pr_warn("Unable to support hardware's maximum bandwidth\n");
>> + return false;
>> + }
>> + r->membw.max_bw = BIT(eax);
>
> Why?
>
> Why go all the effort if the field can be 64 bits?
>
> Why not make max_bw u64 and handle *all* possible values naturally?
>
resctrl does not support values larger than u32.
The value represented by max_bw provides the upper limit of control values that
user space can configure via the schemata file, which in turn represents the
control value programmed to hardware.
u32 is expected in several places:
- Parsing of user input in bw_validate() is done via kstrtou32() placing result in
"u32 bw". It is this value that is compared against max_bw and would thus need to
change as a consequence.
- Parsing of user input to schemata file via parse_bw() places parsed bandwidth in
"u32 bw_val".
- Upon successful parsing the control value is staged by resctrl fs in
resctrl_staged_config::new_ctrl that is u32.
- On receipt of programming request from resctrl fs, the x86 architectural specific
code programs the control value to rdt_hw_ctrl_domain::ctrl_val[] that are u32.
resctrl, from fs to x86 architecture and now also MPAM, would thus require changes to
support these AMD systems. If I get the math right this will be systems that support
1073741823.875GB/s and up?
If resctrl is required to support AMD hardware that can return up to 64bits here
then that requires more changes than what I am able to take on at this time. From
my side I prefer to stick to this resctrl safeguard for the scenario and leave support
for this hardware to AMD.
Reinette
next prev parent reply other threads:[~2026-07-21 16:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 4:27 [PATCH v5 00/10] x86,fs/resctrl: Improve resctrl quality and consistency Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 01/10] fs/resctrl: Use correct format specifier for printing error pointers Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 02/10] x86/resctrl: Protect against bad shift Reinette Chatre
2026-07-21 1:59 ` Borislav Petkov
2026-07-21 16:14 ` Reinette Chatre [this message]
2026-07-21 23:15 ` Borislav Petkov
2026-07-21 23:50 ` Reinette Chatre
2026-07-22 0:50 ` Borislav Petkov
2026-07-22 15:59 ` Reinette Chatre
2026-07-22 20:03 ` Borislav Petkov
2026-07-22 21:07 ` Reinette Chatre
2026-07-22 21:11 ` [PATCH v5.1 " Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 03/10] fs/resctrl: Change pattern used to track number of entries in enum Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 04/10] fs/resctrl: Use accurate type for rdt_resource::rid Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 05/10] fs/resctrl: Pass error reading event through to user space Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 06/10] fs/resctrl: Use accurate and symmetric exit flows Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 07/10] fs/resctrl: Change last_cmd_status custom during input parsing Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 08/10] fs/resctrl: Add last_cmd_status support for writes to max_threshold_occupancy Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 09/10] fs/resctrl: Communicate resource group deleted error via last_cmd_status Reinette Chatre
2026-07-01 4:27 ` [PATCH v5 10/10] fs/resctrl: Inform user space when status buffer overflowed Reinette Chatre
2026-07-14 17:49 ` [PATCH v5 00/10] x86,fs/resctrl: Improve resctrl quality and consistency Reinette Chatre
2026-07-20 17:16 ` Borislav Petkov
2026-07-14 22:45 ` Moger, Babu
2026-07-15 0:00 ` 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=2184678d-1b67-4d2f-94a3-c4bb22823cd6@intel.com \
--to=reinette.chatre@intel.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=ben.horgan@arm.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=fenghuay@nvidia.com \
--cc=fustini@kernel.org \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=peternewman@google.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=yu.c.chen@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
all inboxes | Powered by JetHome®