mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunhui Cui <cuiyunhui@bytedance.com>
To: tony.luck@intel.com, reinette.chatre@intel.com,
	ben.horgan@arm.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
Cc: Yunhui Cui <cuiyunhui@bytedance.com>
Subject: [RFC PATCH 13/13] docs/resctrl: Document logical control IDs and hardware entries
Date: Mon, 30 Nov 2026 10:29:29 +0800	[thread overview]
Message-ID: <20261130022929.71748-14-cuiyunhui@bytedance.com> (raw)
In-Reply-To: <20261130022929.71748-1-cuiyunhui@bytedance.com>

Document how logical control IDs map to controller-local hardware entries.

Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 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)


  parent reply	other threads:[~2026-11-30  2:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  2:29 [RFC PATCH 00/13] resctrl: Introduce a framework for logical control IDs Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 01/13] resctrl: Introduce interfaces " Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 02/13] resctrl: Add prepare, commit and abort hooks for control updates Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 03/13] resctrl: Add a release hook before logical control ID reuse Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 04/13] arm_mpam: Record PARTID narrowing capacity per MSC Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 05/13] arm_mpam: Select PARTID narrowing per component Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 06/13] arm_mpam: Add an internal PARTID allocator Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 07/13] arm_mpam: Add request-to-internal PARTID mapping Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 08/13] arm_mpam: Apply PARTID narrowing to resctrl control groups Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 09/13] arm_mpam: Separate request and internal PARTID limits Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 10/13] arm_mpam: Map CDP data and code defaults separately Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 11/13] arm_mpam: Add kunit tests for PARTID narrowing Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 12/13] selftests/resctrl: Add a test for control ID allocation and reuse Yunhui Cui
2026-11-30  2:29 ` Yunhui Cui [this message]
2026-11-30  6:15 ` [RFC PATCH 00/13] resctrl: Introduce a framework for logical control IDs Jinjie Ruan
2026-11-30  6:56   ` [External] " yunhui cui
2026-11-30  7:29     ` Jinjie Ruan
2026-11-30 11:22   ` Ben Horgan
2026-11-30 12:09     ` Jinjie Ruan
2026-11-30 14:09     ` [External] " yunhui cui
2026-11-30 15:22       ` Ben Horgan

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=20261130022929.71748-14-cuiyunhui@bytedance.com \
    --to=cuiyunhui@bytedance.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=fustini@kernel.org \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mingo@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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®