From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796120300; b=h3m1QmbwYovNUBz1CLL+yjNWN+wsPXSD+V7FfmH/GR/giA4UTDio7zm6XSeEQBYssZYW xkSsXKnXGXGSQim5e5+C827CfmlD40NLmdIMXJ3cX4a7SbrRYchweu9Gf+6NQAAa+8fXi 6301h+CHqhWGjdOhJ6Vghu3et0uZN1en02xbfpzTdDm9kfpfoAkRbd4XLuPFIfGWZjQ9N Y5an4yBHaobX0wkPGo14FtPTXtltRKc7Z8BHM7FttbijG9443WGoBgHQ1OEo7TDyVUcWx IB0E/OUVe5wqz65A6SClokWuMMXGmuyOkFC5YCeSw9noEIWrc2HtfeEeKuHZjaY9QHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796120300; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=n4cGy74uDEPF1mNyOUzBtZJoc7lVN3QRIA8qrDALLx4=; b=UYAb70QcuqBrS3w5Au/3IywB1oJJP4oKhhl1pio/zvbTVAZW+QPgVWpY6P2BSqQF6luK QJswdrwUfUaGglpjUzj6NGNMqrQcrT0CjLaDzDMeTtK3EwretrDnizZ9VJin/34KhSKh2 J+eW9AhizqBoQrzUyGKKjwW+ePAihYbHUE6fHwyPmXj/vxSc+t0otLzmQwNnukaB59qvJ 1aLd96qfZmFzrdODGeyyGXmGh0uVByRUD1o9cJ4INVEKxoPxuqV1w5P1e/TYb1h1R5VGE wh/zpxyi12gf8HYdiJvjwzTvVCJq5fiRiL8Jl5wjJRDqmirjmr6yJqs5sRhqwoX+1Wg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b="u2hbhX/p"; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B99C606A320; Tue, 1 Dec 2026 10:18:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B99C606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=u2hbhX/p Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 058D61570; Tue, 1 Dec 2026 02:18:15 -0800 (PST) Received: from [10.211.55.3] (unknown [10.57.91.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CAE303F86F; Tue, 1 Dec 2026 02:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796120297; bh=UhbFThh4nKSVrGRXbuPTuGZ03YCf6qkaP9T8KQUHIMY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=u2hbhX/p48/ERgL/G6VAhGa2fTiiM9xlImkWYY4pYb9YoM5Uc5lxwhiL/kSvL5vzG +skD8reId1GLYpg3ZGWSG7l9TIO1stf+NV2yrLCtDekfeqRZWEOintU9Afd/ozcCf9 AuuJn1I/WCIayhd2QX9H0jqj7hWFGp8NZWokRYJo= Message-ID: Date: Tue, 1 Dec 2026 10:18:03 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Thunderbird Daily Subject: Re: [External] Re: [RFC PATCH 00/13] resctrl: Introduce a framework for logical control IDs To: yunhui cui Cc: Jinjie Ruan , tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, fustini@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, fenghuay@nvidia.com, shuah@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org References: <20261130022929.71748-1-cuiyunhui@bytedance.com> <0c2c448b-0726-4ea5-b772-70646d8b51c9@huawei.com> <668e9486-6671-42c9-a2f4-ff1149e40b4e@arm.com> <86781f35-9427-4584-ac39-8d05881e4b9c@arm.com> Content-Language: en-US From: Ben Horgan In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Yunhui, On 01/12/2026 06:28, yunhui cui wrote: > Hi Ben, > > On Mon, Nov 30, 2026 at 11:23 PM Ben Horgan wrote: >> >> Hi Yunhui, >> >> On 30/11/2026 14:09, yunhui cui wrote: >>> Hi Ben, >>> >>> On Mon, Nov 30, 2026 at 7:22 PM Ben Horgan wrote: >>>> >>>> Hi Jinjie, Yunhui, >>>> >>>> On 30/11/2026 06:15, Jinjie Ruan wrote: >>>>> >>>>> >>>>> 在 2026/11/30 10:29, Yunhui Cui 写道: >>>>>> Some resource controllers can accept a wider request-ID namespace than >>>>>> the number of configuration entries they provide. Arm MPAM PARTID >>>>>> narrowing is one example: requests carry a PARTID, while an MSC maps it >>>>>> to a smaller internal PARTID table. A future RISC-V CBQRI backend is >>>>> >>>>> We have been working on narrow partid for a long time. Could you please >>>>> drop the patches related to MPAM narrow partid? >>>>>> Link: >>>>> https://lore.kernel.org/all/20261020134239.3921377-1-ruanjinjie@huawei.com/ >>>> >>>> As I see it, there are 3 different options for the use of PARTID narrowing: >>>> >>>> Static mapping. >>>> >>>> A static MPAM PARTID narrowing mapping. Jinjie's existing PARTID narrowing series [1], is the latest >>>> posting on this. This is an internal mechanism to the MPAM driver to provide more RMIDs to resctrl. >>>> The MPAM driver uses (reqPARTID, PMG) for RMID and intPARTID for CLOSID. This works, without >>>> altering the user interface, resctrl itself or the interface between resctrl and the MPAM driver. >>>> James also has a prototype branch [2] which has some known problems but demonstrates that only the >>>> MPAM driver needs to change. >>>> >>>> At components without PARTID narrowing non-aliasing controls have to be hidden, e.g. any MIN or MAX >>>> controls. The number of controls needs to be sanitized to the smallest number of intPARTID in any MSC. >>>> >>>> The static mapping is useful for existing systems without many PMG in hardware and that don't have >>>> important non-aliasing controls on the MSC without PARTID narrowing. If monitors just match on PMG >>>> rather than (PARTID, PMG) as will mostly be the case in MPAMv2 then the static mapping doesn't give >>>> us anything over the default MPAM driver policy of a 1-1 static mapping. >>>> >>>> Dynamic mapping. >>>> >>>> A dynamic MPAM PARTID narrowing mapping. Again the MPAM driver uses (reqPARTID, PMG) for RMID and >>>> intPARTID for CLOSID but it changes the mapping at monitor group creation to allow more flexible >>>> placement of monitor groups. >>>> >>>> This was prototyped here [3]. Similar to the static mapping in that it provides PMG constrained >>>> MPAMv1 systems a way of having more monitor groups. resctrl would need to have an arch hook to call >>>> into the architecture on monitor group creating so that the MPAM driver can create the mapping. >>>> Similar to the static mapping, the non-aliasing controls at MSC without narrowing must be hidden, >>>> the same intPARTID sanitization is needed and is only relevant for MPAMv1. >>>> >>>> User-controlled mapping. >>>> >>>> The MPAM driver uses reqPARTID for CLOSID and lets resctrl control the mapping. >>>> >>>> To make full use of MPAM PARTID narrowing the mapping of the request control ID (reqPARTID) to the >>>> internal control configuration (intPARTID) would need to be made visible to the user. For each >>>> resctrl resource (L2, L3, MB, MB_NODE)* there could be a set of internal configuration, e.g. for L2: >>>> red, green, yellow and for L3: owl, robin, nightingale and for MB_NODE: wolf, dog, fox... The >>>> internal configuration would determine the actual hardware values, e.g. red could be the cache >>>> bitmap L2=0xff00. And in the schemata file you would specify the internal configurations, e.g. >>>> L2:0=red;1=blue >>>> L3:0=owl;1=nightingale >>>> MB_NODE:32=wolf;64=fox >>>> >>>> *L3 and MB will need the same mapping if they are backed by the same MPAM class. >>>> >>>> With a user-controlled mapping there is no need to sanitize to the smallest number of intPARTID as >>>> each resource/mpam component can have a separate mapping. This allows having a heteregeneous number >>>> of controls at different points int the system. Non-aliasing controls, on MSC without PARTID >>>> narrowing, don't need to be hidden. >>>> >>>> The user-controlled mapping still makes sense when RMID is not scoped to CLOSID and so the only one >>>> of these proposals than is potentially useful across architectures. It is however a big change to >>>> the resctrl interface and would need some good justification. >>>> >>>> From an MPAM driver point of view the static mapping makes sense to concentrate on first. Any >>>> changes here can be fully within the MPAM driver. After this we can consider whether a dynamic >>>> mapping would be useful or if a user-controlled option supersedes this. The MPAM policy for when we >>>> make use of the static mapping and if we need any flags will need to be carefully considered so that >>>> we don't make future options harder. >>>> >>>> Yunhui, does your series fall into one of these categories? I haven't looked in any detail but it >>>> looks to me to be a constrained version of the user controlled mapping. What's are the motivating >>>> usecases for this series? >>> >>> Thank you for laying out the three options in detail. >>> >>> As I understand it, the existing Narrow-PARTID work primarily uses >>> additional request PARTIDs to expand the monitoring-group namespace. >>> Please correct me if I have misunderstood or missed anything. >>> >>> The use case I am trying to address is the control-group limit imposed >>> by the smallest internal PARTID table. Consider a simple example where >>> the request PARTID range is 0..31, and both A and B support >>> controller-local mapping but have different internal table sizes: >>> >>> Controller A: 32 internal entries >>> Controller B: 8 internal entries >>> >>> The control-group ID is currently tied to the hardware entry number, >>> so the whole system is limited by the smaller table: >>> >>> num_closids = min(32, 8) = 8 >>> >>> This allows only the root group and g1..g7 to be created. >>> >>> Under the current model, g8, which uses ID 8, would need to select >>> entry 8 in both A and B. A has that entry, but B does not, so simply >>> increasing num_closids to >>> 32 would not be sufficient. >>> >>> Similarly, if only B is configured for g1, the desired result would be: >>> >>> A: g1 -> root entry 0 >>> B: g1 -> private entry 1 >>> >>> The current ID 1 instead selects entry 1 in both A and B. Although A's >>> entry 1 can be initialized with the same value as the root entry, it >>> remains a separate >>> entry and consumes capacity. >>> >>> The approach in this RFC is to treat the resctrl control ID as a >>> logical ID. On controllers that support mapping, all logical IDs >>> initially map to root entry 0. >>> Creating a control group allocates only a logical ID, and a private >>> entry is allocated on a controller only when that controller is first >>> explicitly configured through schemata. >>> >>> This would allow g1..g7 to configure only B and g8..g31 to configure only A: >>> >>> Controller A: >>> g1..g7 -> root entry 0 >>> g8..g31 -> private entries 1..24 >>> >>> Controller B: >>> g1..g7 -> private entries 1..7 >>> g8..g31 -> root entry 0 >>> >>> In this case: >>> >>> A uses the root entry plus 24 private entries: 25 entries in total >>> B uses the root entry plus 7 private entries: 8 entries in total >>> >>> Neither controller exceeds its local capacity, so all 32 logical >>> control IDs could be provided: >>> >>> Current: num_closids = 8 >>> This RFC: num_closids = 32 >>> >>> My intention is not to expose internal configurations to users. The >>> existing control-group and schemata interfaces remain unchanged, and >>> the kernel establishes the mappings in response to policy writes. >>> >>> Controllers without mapping support would retain their existing >>> limits. The intended change is only that the internal-table size of a >>> mapped controller would no longer impose a global limit on the whole >>> system. >> >> Thanks for the explanation. If I've understood correctly, please correct me if not, you're always >> creating 1-1 mappings between reqPARTID and intPARTID except for when you are mapping to the default >> intPARTID. At control group creation the mapping is reqPARTID to 'default intPARTID' and the mapping >> for a resource is changed to reqPARTID->'private intPARTID' when the schemata is written. Once >> you've exhausted the intPARTID for one control then that control can't be configured away from the >> intPARTID. Assuming that is the case, this breaks the user expectations of resctrl of always being >> able to write to and configure the schemata file when its there. I would consider this an ABI break. >> >> I do see value in supporting different number of controls for different MPAM components or resctrl >> resources but I think we need to be very careful not to break the ABI here and to create a good >> interface. > > Yes, that is how the current RFC behaves. At control group creation, > the request PARTID maps to the default internal PARTID. When a policy > is first written for a controller, a private internal PARTID is > allocated for that group. Once the controller's internal entries are > exhausted, the first private-policy write from another group returns > -ENOSPC. > > I think your ABI concern is fair. Although this behavior is introduced > only when exposing additional logical groups beyond the previous > global limit, changing the default meaning of num_closids and schemata > could still be surprising to existing users. > > One possibility would be to preserve the existing behavior by default. > num_closids would continue to reflect the number of control groups > that all relevant controllers can guarantee, without introducing a new > failure caused by controller-local entry exhaustion. > > The allocation of controller-local entries only when a policy is first > written could then be enabled explicitly through a mount option. In > that mode: > > - num_closids would describe the logical/request-ID namespace; > - a new group would initially select the root entry on mapped controllers; > - the first private-policy write for a controller would allocate an > internal entry; > - if the controller's entry pool were full, the write would return > -ENOSPC, and last_cmd_status would identify the affected > resource/domain. > > The default mount would therefore retain the existing behavior, while > users who explicitly select the new mode would also accept > controller-local capacity limits and the corresponding -ENOSPC > behavior. I'm still not a fan of this. I think the abi issue still stands and you only support one-to-one mappings rather than many-to-one.it is not a full solution for supporting PARTID Narrowing or mapping schemes in other architectures. Having an incomplete solution makes it harder to add a more complete solution later. > > Would this seem like a reasonable way to address the ABI concern? Do > you have any suggestions for a better interface? To make full use of PARTID Narrowing on a system with varying number of intPARTID at different resources I think the mapping would have to under user control. You need some way of configuring the internal controls (perhaps a new set of schemata files) and some way of making the mapping to them from the existing schemata files. There is lots more to think about but that's where I'd start. Thanks, Ben > > Thanks, > Yunhui > >> >> Thanks, >> >> Ben >> >>> >>> I hope this clarifies the use case I am trying to address. I would >>> appreciate your thoughts on whether this distinction makes sense. >>> >>> Thanks, >>> Yunhui >>> >>>> >>>> [1] https://lore.kernel.org/all/20261020134239.3921377-1-ruanjinjie@huawei.com/ >>>> (Same link as in Jinjie's message) >>>> [2] https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpam/narrowing/v0 >>>> [3] https://lore.kernel.org/all/20260413085405.1166412-1-zengheng4@huawei.com/ >>>> >>>> Thanks, >>>> >>>> Ben >>>> >>>>> >>>>> >>>>>> expected to need a similar mapping from request RCIDs to controller-local >>>>>> entries. Resctrl currently uses one ID both to identify a control group >>>>>> and to select its hardware entry, so the smallest table limits the number >>>>>> of groups exposed to user space. >>>>>> >>>>>> The framework uses a logical control ID in generic resctrl while each >>>>>> architecture selects a hardware entry according to its own model: >>>>>> >>>>>> generic resctrl >>>>>> logical control ID >>>>>> | >>>>>> +------------------+------------------+ >>>>>> | | | >>>>>> x86 arm64 MPAM RISC-V CBQRI >>>>>> direct index MSC mapping mapping (proposed) >>>>>> | | | >>>>>> hardware entry internal PARTID controller entry >>>>>> >>>>>> Without controller-local request-ID mapping, the same request ID directly >>>>>> indexes every controller. If g1 configures only A and g2 only B, g1 >>>>>> cannot select its private entry in A and B's root entry while g2 makes >>>>>> the opposite selection. Each group therefore consumes an entry in both >>>>>> controllers. Controller-local mapping makes these selections independent, >>>>>> so A needs entries only for the root group and g1 while B needs only the >>>>>> root group and g2. >>>>>> >>>>>> This series gives control groups logical IDs. A new group initially >>>>>> selects the root policy and consumes no private entry on a narrowing >>>>>> controller. Its first explicit policy write allocates and programs an >>>>>> entry only on the affected controllers, then publishes the >>>>>> request-to-internal ID mapping. Controllers that have not been configured >>>>>> continue to follow the root policy. A same-value write still creates a >>>>>> private policy, so a later root update does not change it. >>>>>> >>>>>> Entry reservation is completed before a multi-controller policy update >>>>>> and mapping changes are published only after the entries are programmed. >>>>>> Group removal maps requests back to the root entry before an internal >>>>>> entry or logical ID can be reused. CDP keeps separate data and code root >>>>>> entries so the default policies remain distinct. >>>>>> >>>>>> Identity-mapped architectures retain their current behavior, and I/O >>>>>> allocation continues to address a hardware entry directly. The generic >>>>>> framework supports both direct-index and mapped controllers. The RISC-V >>>>>> backend itself is outside this series. >>>>>> >>>>>> Base: next-20261127 >>>>>> >>>>>> Yunhui Cui (13): >>>>>> resctrl: Introduce interfaces for logical control IDs >>>>>> resctrl: Add prepare, commit and abort hooks for control updates >>>>>> resctrl: Add a release hook before logical control ID reuse >>>>>> arm_mpam: Record PARTID narrowing capacity per MSC >>>>>> arm_mpam: Select PARTID narrowing per component >>>>>> arm_mpam: Add an internal PARTID allocator >>>>>> arm_mpam: Add request-to-internal PARTID mapping >>>>>> arm_mpam: Apply PARTID narrowing to resctrl control groups >>>>>> arm_mpam: Separate request and internal PARTID limits >>>>>> arm_mpam: Map CDP data and code defaults separately >>>>>> arm_mpam: Add kunit tests for PARTID narrowing >>>>>> selftests/resctrl: Add a test for control ID allocation and reuse >>>>>> docs/resctrl: Document logical control IDs and hardware entries >>>>>> >>>>>> Documentation/filesystems/resctrl.rst | 88 ++ >>>>>> arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 38 +- >>>>>> drivers/resctrl/mpam_devices.c | 857 +++++++++++++++++- >>>>>> drivers/resctrl/mpam_internal.h | 25 +- >>>>>> drivers/resctrl/mpam_resctrl.c | 288 +++++- >>>>>> drivers/resctrl/test_mpam_devices.c | 619 ++++++++++++- >>>>>> drivers/resctrl/test_mpam_resctrl.c | 172 ++++ >>>>>> fs/resctrl/ctrlmondata.c | 28 +- >>>>>> fs/resctrl/rdtgroup.c | 18 +- >>>>>> include/linux/resctrl.h | 17 +- >>>>>> .../testing/selftests/resctrl/ctrl_id_test.c | 380 ++++++++ >>>>>> tools/testing/selftests/resctrl/resctrl.h | 1 + >>>>>> .../testing/selftests/resctrl/resctrl_tests.c | 1 + >>>>>> 13 files changed, 2470 insertions(+), 62 deletions(-) >>>>>> create mode 100644 tools/testing/selftests/resctrl/ctrl_id_test.c >>>>>> >>>>> >>>> >>>> >>