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=1796037728; b=JThGJjs03vdR3y76Kvm75cPVcjX9ZoF6H8o3XRMmw0/OLvrT0df0T8vb3Nr5VzW51LWL oJOwb2qBXI238i10ai/dgz45vEneH/h93NUStiSWAEFZWDVi+U9rv1gMdD5yeQ44zYj06 17bjcc+sFQYrIA7fMmcnRae71N34/Yp7AfVoT0MNrF0Znv5PkBUOjwPGeRMPkwiUIBdZ8 OPHLDV4dnxYE9Tlu61ctJLhBeGpRm6H8gaXFDG9DmAJjdZYfd1KBpe2jqL/Y4jk2jHpwE 2aGAMZVCKMfFhufkSMO3sPlx5JzNZIx6lBEnSAN7yhYCP/bObvgJsDHI0qrBdjSTMBQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796037728; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:References:Content-Language:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=Kk8OeprNegg++zdMhi0c9O16nNE6Bs8hq0vVZOH3Fx8=; b=HM8Ys2UKoSN/jmI3v/Alc0p8IGSIvLlbNIjAWQmGVuUX1dYAeZOzM9MpuYiO+U56xRkJ ce7xQk3KRPSNlH0ZXfMfRB0omcEun5kt4enF7K9BAuaGPwpVnRtbJQNcvNpeGmsqglYtA vITMN8RdUCYEQhHQNkJKDd70SZTLtN5/EEnjFSKECtAeRB0XKxtNafxcez8d9UsTbNxNU iq+uOZEvQ2myMpXo2U6pRu/9Le24fRP3hWPgWWLUO9E/At0TnyPUSXYoqyb3vKCBapvqc WLefszOIctvYGQBSVQ6QniGIcATpIdDfa/WesRvWYQX50cQ7I3JYTo28hMHHliNwcyA== 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=X54iGbuT; 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 46E0B606A31C; Mon, 30 Nov 2026 11:22:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 46E0B606A31C 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) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=X54iGbuT 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 BB1AD1570; Mon, 30 Nov 2026 03:22:04 -0800 (PST) Received: from [10.2.212.8] (e134344.arm.com [10.2.212.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8DFC03F86F; Mon, 30 Nov 2026 03:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796037727; bh=Avw1C5I1RNIiemuyfRPtBk21BwOX2dvBBC/LN9XzEYc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=X54iGbuT66MroN8qA6Gq5z8OuD9Nu2Cpx0ykoynumuKlESDlBQsMZx5G2o5lHPWxu osKvf5NU9NF6dsFmkmUD/FySD/gwUDh0n+N6BrD4TMQQErAN90o5DZ+Ptpvkp2Oo8E PYiZsJmVhbB9QptMd3A5QxruCVVMwLHlqtpVLFqE= Message-ID: <668e9486-6671-42c9-a2f4-ff1149e40b4e@arm.com> Date: Mon, 30 Nov 2026 11:22:03 +0000 X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 00/13] resctrl: Introduce a framework for logical control IDs To: Jinjie Ruan , Yunhui Cui , 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> Content-Language: en-US From: Ben Horgan In-Reply-To: <0c2c448b-0726-4ea5-b772-70646d8b51c9@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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? [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 >> >