[RFC PATCH 13/13] docs/resctrl: Document logical control IDs and hardware entries
From: Yunhui Cui
Date: Sun Nov 29 2026 - 21:32:06 EST
Document how logical control IDs map to controller-local hardware entries.
Signed-off-by: Yunhui Cui <cuiyunhui@xxxxxxxxxxxxx>
---
Documentation/filesystems/resctrl.rst | 88 +++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index 2750f2eabf70e..64c207d17e214 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -541,6 +541,94 @@ conveyed in the error returns from file operations. E.g.
# cat info/last_cmd_status
mask f7 has non-consecutive 1-bits
+Logical control IDs and hardware entries
+========================================
+
+With direct indexing, a control group's CLOSID also selects its hardware
+allocation entry. The smallest controller table therefore limits the number
+of groups, even when most groups only need a private policy on another
+resource.
+
+Controllers with request-ID mapping can accept more identifiers than they
+have hardware entries. Separating the logical control ID from these entries
+allows one group to have a private policy in one mapping table while sharing
+the root policy in another. Each independent mapping table allocates its
+entries separately::
+
+ generic resctrl
+ logical control ID
+ |
+ +------------------+------------------+
+ | | |
+ x86 arm64 MPAM RISC-V CBQRI
+ direct index MSC mapping mapping (proposed)
+ | | |
+ hardware entry internal PARTID controller entry
+
+Direct-index controllers retain their existing behavior. For MPAM, all RIS
+in an MSC share one PARTID mapping table. A component uses narrowing only if
+every MSC serving it supports PARTID narrowing. Components that
+share an MSC cannot mix narrowing and direct indexing; if one requires direct
+indexing, all components connected to that MSC retain direct indexing and its
+safe limits. The proposed CBQRI mapping extension can use the same model, but
+its RISC-V backend is outside this patchset.
+
+The logical ID range remains bounded by the identifiers that all requesters
+and controllers can accept. ``num_closids`` does not guarantee enough
+hardware entries for every group to have a private policy in every mapping
+table.
+
+Group policy lifetime
+---------------------
+
+Creating a group assigns a logical control ID but does not allocate private
+entries in mapped controllers. Until a policy using a mapping table is
+written, the group's requests use that table's root entry and follow the root
+policy.
+
+The first policy written for a mapped controller allocates a private entry in
+its mapping table, even if the policy equals the root policy. resctrl
+initializes the entry for every controller sharing that table, then maps the
+logical control ID to it. The configured controller receives the group's
+policy; the others are initialized from their corresponding root policies.
+Controllers backed by other mapping tables continue using their root entries.
+
+For example, if controllers A and B use independent mapping tables, ``g1`` may
+configure only A while ``g2`` configures only B. A maps ``g1`` to a private
+entry and ``g2`` to its root entry; B maps ``g2`` to a private entry and
+``g1`` to its root entry. A therefore needs entries only for the root group
+and ``g1``, while B needs entries only for the root group and ``g2``.
+
+This arrangement requires hardware support for controller-local request-ID
+mapping. Without it, a request ID directly selects the same-numbered entry in
+A and B, so ``g1`` cannot select its private entry in A and B's root entry,
+nor can ``g2`` make the opposite selection. Both groups then require private
+entries in both controllers.
+
+Direct-index controllers retain their existing group initialization; later
+root updates do not change those groups' policies. A mapped controller that
+shares a newly allocated entry with a configured controller also stops
+following later root updates because both use the same mapping table.
+
+If an entry is unavailable, the write returns ``ENOSPC``. The group keeps its
+logical ID, and the write can be retried after another group releases an
+entry. Exhausting logical IDs instead causes group creation to fail.
+
+Mappings are published only after their entries have been configured. Tasks
+and CPUs return to the default group before entries are retired and logical
+IDs become reusable. A failed removal retains the group and ID for retry;
+entries whose state cannot be recovered must remain unavailable.
+
+CDP uses separate request PARTIDs and default entries for data and code. An
+explicitly configured data or code policy consumes its own entry on a mapped
+controller. Monitoring ID limits are unchanged; RMID exhaustion can also
+prevent group creation.
+
+Updates across controllers are not globally atomic. In-place updates to
+existing entries do not guarantee rollback of all controls on a hardware
+failure.
+
+
Resource alloc and monitor groups
=================================
--
2.39.2 (Apple Git-143)