From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796005921; b=3SQbxeb2GDDRYtQwZI0yQUvQdDh9MXk4MFARzNgnxYYQwrWSg91tSapT5Flm7S8zwEsn eMCJocEnNC4etx4nbauWNjplkazhy9ta0PlV0Hs5E7kKPcWtLv+SSR6TM84h6ZZgLkem5 bPZ+aMPRXXoQlFq0fEwXPi4OMQLDauWLdXOIBGVF0CNv2k3/uum7xfnIknXaqprv15Cpi attg7Kj4JO3DxU9BuAkfnanzSsXONjpUEOUyhyvnyqFWGy0hOzEl89UvjjslSSaR8Vyln sI1SNj0mAmBLPOeNrwe3YTuf1bxpbT2ASrI01P1BrtUnL/s5Pbw0u3vkFnOrSxBlDsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796005921; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=dQAlFM3lxUIhGhp2fWYLmP7HN7Xc2F3DC33/eAcdLnE=; b=evWAC3WfABwch4u4a+cj8phuuKa0jqH/3ZBnG6e1B6OceakN6kbBDXHbl4MU4Bd1JTq1 g3tD9neYPyhXd54N3DUiLIhSeCYNM6XSnRzYJK6oh6+49yAbWIiYcm7YdF1fuCy7OAH2n elCUb6H/95jnTQ/G66bKKSvjwOXBZchO5b2XYdVMXSBprp4cbirJ+di1mvV5n/M7PfMda AnFa6wNi1yAPOyHUzkrsVrWW9ani5HE1ni5VGuTwDgiwQtzz5Z1JTipmixdEgio4pxPFq LaefjmVT3+nBDfVJzADbC3X805X909tNIhqeQul5l6fUa6EfqpQ+sFKr3SAv8u/tXVw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=google header.b=KIeWvy7q; arc=none smtp.remote-ip=209.85.216.54 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 072F6606A31D for ; Mon, 30 Nov 2026 02:32:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 072F6606A31D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=google header.b=KIeWvy7q Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-3b520f1604fso1366047a91.2 for ; Sun, 29 Nov 2026 18:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1796005920; x=1796610720; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dQAlFM3lxUIhGhp2fWYLmP7HN7Xc2F3DC33/eAcdLnE=; b=KIeWvy7qQ3hORSTt+6GFEq45zTcRO6nWJVj04i+rWw3Uv1OjEWaL+wvmbuhhae9/af cb0ADzouWREfpfDVBe9rLUXZ91Ja+NFs3i8Hsiokb5l/s9Pacv7vxN47tj+69sDHVwZE KXhl6PsedRZoGnnyb4Ls7of2gYnouT3NLwP5GmMpTFO0F3F5HsoayUxhxLM29bWzGD5J 7hsIozjjpVToTqPAn24Bt6v1A0S7MV/IKG1NIZ7cdhY5gLXRLBsHQ0tmF8ijM5le29yu 33jqSICq0mGg9ILeBaTIQGLEWSrcWNb0QucZZKql1eM9yP+KSEHuwPIHK85urOtCvDah hIIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796005920; x=1796610720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=dQAlFM3lxUIhGhp2fWYLmP7HN7Xc2F3DC33/eAcdLnE=; b=TP9+JbImkSGEYN8nLqa008xtEMTGWHGq6VjqmvS7qPEWvfFdUzCcKTc5aaWdhLRrUw RaBYeSHHivrfhp1ubL1s19bs1hiXpddfwwWqhZKeTBwT/QqMJ+ORdXsENW4kPnPGKDbw 2dvc0HRThtdZtmZNZqHvjHZhw6ShLpPWzoY9BmkQ7tB6PZBjMlPygZH8Y6h/hycVZaTM 5E/FonIYFz5q9hsIjp7PKMyiGvUd/1ezAL+6uDQGFCl7X6fyb6TzWqXnY730kgYYwOFR RxfV4Gam4gotmKehmR+mTdoexAuTxmanvsrtiqQMtlJU+BDKntsuZcYPeNRl5bEiClB5 Ws+Q== X-Forwarded-Encrypted: i=1; AL+hErHW+CGwzfdD3kMt33fEKCQhEB3D0L/Vux0M9TjTjfTw+Lq5NcBeccOvVl50XpX3+T/6jkokDB54RChMLOQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+ZeunTuzo917GiJnei/xdt61HRxztEJkIuOUWjfLupYJnIDCIy +zYEr4+kXpb+8NFEJPrv6mlQ5o0VJJRGeBpFvi0qx3JQC7WrR4FP3sLLzqE1GWCILck= X-Gm-Gg: AZFdTZeUMwnQ64Bev3sVrvOPoZHozZ5HBA+KG+h8iX76RifV4R9ip+ofGzY3NLofQgc cR1dVPUzSr1EwFPdkAbR5vyI7UHJjCrvNjYioc8KQVwXGB6Z9KzdbLH+nW65yd6ctPoI9ZBw8NP B08Rsi4ezVT0afrnwkCpf2nOK0saXbJge1ohsrLjPow6gIxSVFIR05Zvv6LNl8iOo+YCtvbrDzZ 0G8SmN5+tXDSuv33l104HWHCwwU/A4aW2ssZ39dpkgHQv8woLEnz/btyxu28cjtRouBpxywy8Lo UPAtuAsLcOYBxNAQARXWzzRJtKDY5k2fklfLOCQMdYWnEKrV394AIGzttoW16F5EOjnmisPftBp p9IxqLR86NOxSppK/V8j+WjwG4hOUCg/+R0BIYNsJALbrf29GTyj8D3s95boD/PkiLjEz1lN7h5 SxYkdbW//gW9WiZMjAI41R2BI0Flr/U77ZgskiB9viPXs/St8PKaVlYeuARq3p8D4C1Fw7QIAE7 miijUYYfdAxB+xcgWPTcEu/p6GC52Xao6Yv49ONmcVHFyHULF41loGH3604CcJwQr9jAF19WSiN XDpHfvDkD2HPiATWqkbrQPApfzDEwR4TiOi8/+hIWXcT1rQvArAasR9rkMKY7OuI5NKLGQ== X-Received: by 2002:a17:90b:5289:b0:3b3:8094:321d with SMTP id 98e67ed59e1d1-3b41c9080bamr31687756a91.32.1796005920236; Sun, 29 Nov 2026 18:32:00 -0800 (PST) Received: from FR9WL0RHKY.bytedance.net ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b495035339sm37055744a91.0.2026.11.29.18.31.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 29 Nov 2026 18:31:59 -0800 (PST) From: Yunhui Cui 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 Subject: [RFC PATCH 13/13] docs/resctrl: Document logical control IDs and hardware entries Date: Mon, 30 Nov 2026 10:29:29 +0800 Message-Id: <20261130022929.71748-14-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20261130022929.71748-1-cuiyunhui@bytedance.com> References: <20261130022929.71748-1-cuiyunhui@bytedance.com> 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 Content-Transfer-Encoding: 8bit Document how logical control IDs map to controller-local hardware entries. Signed-off-by: Yunhui Cui --- 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)