Re: [PATCH v10 05/12] x86/resctrl: Parse ACPI ERDT table and save CACD cpumask per RMD

From: Reinette Chatre

Date: Thu Dec 03 2026 - 16:44:01 EST


Hi Chenyu,

On 12/3/26 7:50 AM, Chen Yu wrote:
> On Wed, Dec 02, 2026 at 11:12:26AM -0800, Reinette Chatre wrote:
>> On 11/26/26 6:44 AM, Chen Yu wrote:
>>> On Wed, Nov 25, 2026 at 11:04:38AM -0800, Reinette Chatre wrote:
>>>> On 11/5/26 2:08 AM, Chen Yu wrote:
>>>> ...
>>>>
>>>>> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
>>>>> index b5a86e5aa4e3..2b9a13be5975 100644
>>>>> --- a/arch/x86/kernel/cpu/resctrl/core.c
>>>>> +++ b/arch/x86/kernel/cpu/resctrl/core.c
>>>>> @@ -1018,11 +1018,18 @@ static __init void check_quirks(void)
>>>>>
>>>>> static __init bool get_rdt_resources(void)
>>>>> {
>>>>> + bool ret;
>>>>> +
>>>>> snc_nodes_per_l3_cache = snc_get_config();
>>>>> + erdt_init();
>>>>> rdt_alloc_capable = get_rdt_alloc_resources();
>>>>> rdt_mon_capable = get_rdt_mon_resources();
>>>>>
>>>>> - return (rdt_mon_capable || rdt_alloc_capable);
>>>>> + ret = (rdt_mon_capable || rdt_alloc_capable);
>>>>> + if (!ret)
>>>>> + erdt_exit();
>>>>> +
>>>>> + return ret;
>>>>> }
>>>>
>>>> Looking at the solution as a whole I do not think that this enumeration is
>>>> ideal. erdt_init() sets erdt_enabled irrespective of
>>>> erdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC) being true. Specifically, a user
>>>> may boot with "rdt=!cmt", which is the only ERDT enabled feature, and that
>>>> will result in erdt_enabled being true but that does not actually mean "ERDT
>>>> is in use".
>>>>
>>>> I think there is a real problem because of this when looking at the CPU
>>>> online code that gates the domain binding and configuration on erdt_enabled.
>>>> If I understand correctly a CACD inconsistency drops the CPU out of _every_
>>>> L3 CAT, L2 CAT, MBA and MBM domain, even though no ERDT data is ever read.
>>>>
>>>> This looks to be a recurring problem and so far the solution has been to
>>>> add additional gates based on erdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC) at various places,
>>>> but I wonder if this can be simplified by changing the contract.
>>>>
>>>> Instead of erdt_enabled meaning:
>>>> /* True when the ERDT ACPI table describes at least one domain with at least one CPU. */
>>>> could it mean (something like)
>>>> /* ERDT is in use */ ?
>>>>
>>>
>>> OK, does "ERDT is in use " stand for:
>>>
>>> At least one ERDT feature in "MMIO-based CMT, region-aware MBM, region-aware MBA"
>>> is enabled on this system?
>>
>> That is more accurate, yes. I do not know how you intend to use this list, if it
>> is just to replace the existing comment it may be something that could easily become
>> out of date as new features are added.
>>
>
> OK, to keep it non-feature-dependent, let me rephrase it to
> " True when ERDT is in use, i.e. at least one feature is backed by ERDT. "

I think that states the same thing twice. Could it be simplified to:
/* True when at least one feature is backed by ERDT. */

>>
>> One option to deal with this may be something like:
>>
>> /*
>> * ERDT can only be used for a feature that the CPU enumerates and the user has
>> * not disabled. Keep in sync with erdt_in_use().
>> */
>> static __init bool erdt_may_be_used(void)
>> {
>> return rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC);
>> }
>>
>> /* ERDT is in use when at least one feature is backed by ERDT. */

Note how the two comments would tie erdt_enabled and erdt_in_use() together.

>> static __init bool erdt_in_use(void)
>> {
>> return erdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC);
>> }
>>

...

>> One issue that remains seems unlikely? When more ERDT features are supported
>> then an issue during parsing of a user-disabled feature would impact all ERDT
>> features. One option here is to move the rdt_cpu_has() check into parse_rmdd_table()
>> so that the feature specific table is only parsed when the CPU enumerates the feature.
>>
>
> If I understand correctly, what you mean is a case like below.
> Say ERDT later also backs MBM (via MMRC table):
> 1. The user boots with rdt=!mbmtotal,!mbmlocal.
> 2. CMT is still wanted, so erdt_may_be_used() is true and the whole
> ERDT table is parsed.
> 3. The MMRC is broken, so mmrc_init() fails.
> 4. parse_rmdd_table() fails and ERDT is torn down completely, so victim
> CMT loses its MMIO support.

Right.

>
> I'm thinking of adding this erdt_may_be_used() check in erdt_init() in
> the current commit, but in a later commit, when CMRC parsing is introduced
> in ("x86/resctrl: Parse ACPI CMRC table"), remove this erdt_may_be_used()
> in erdt_init(), and delegate to parse_rmdd_table() to skip the CMRC if the
> user asks to do so:

Can this be avoided? Ideally the patches in the series should build on each
other and later patches are not expected to undo changes made earlier in series.

>
> case ACPI_ERDT_TYPE_CMRC:
> + if (!rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC))
> + break;
> +
> if (subtbl_mask & BIT(ACPI_ERDT_TYPE_CMRC))
> break;
>
> if (!cmrc_init(subtbl, domain_info))
> goto cleanup;
>
> subtbl_mask |= BIT(ACPI_ERDT_TYPE_CMRC);
> break;
>
> By the way, since current commit needs to use erdt_cpu_has(), I'm also
> thinking of moving the commit "x86/resctrl: Introduce erdt_cpu_has() and
> erdt_support()" before current commit.
Sounds like this is needed, yes.

Thank you.

Reinette