From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796005806; b=tfqAY9JEpeQU/Ecsl2aC5g443cvZ8KdwXpN9Yz0gHvqjcmvhG55hThHcIxMWepg2yU4Q byU9lUhuX/y6WekGUC04sSWaDwFG/AiVWLIZPxuSw/bW0JZ/z0dC9as4bKOmPQO4lcANr 0vU9ogIFzCNEloosB48g4v8Lzrgu3NE+N5PjdqRRdGOKRSVJX6ZgvKsLwbNg5ITTmSB7J zcsmE+8pWDMyrzvimM9fRbym+b2vFL26Oj/uNDAZB6kc8YXVpbUni8mGrUiwXUfEEodEt FoW3XgPWXukVyoPkgPD579vxt2LY/PzTeuilhaxJQ5r11H1ZdvahsLTsRpHEj9nm5XA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796005806; 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:MIME-Version: Content-Transfer-Encoding; bh=V9GrOW7kJV+OAg0VTh2DpPLTpIxB8hzSYc+j+7iTvNM=; b=MT79Z87KS06xvHweiupGpoW7ukufK1T34MdeA6tYS0L1ZhJ4A56MI7opzhpC93emrru+ 9udv+jJLDO02HFsktlwN5YXKUrkOMiJK/ZMy5IZqRDkLMnnRikiOg+PMeutFjSt4tCM0Y qtPXViZ7oT3H8PSTrY6qT86bxH40y7sZXcrmUknO8ncQJN1PwXLG2nEacs5411hock8JK mpy84JyhrOqVqrmTsWhsOlNz8UW5C872tDbaAdKMZvJehDRpWZHKNOp8L0spanW7mbMiW 4ru9ysSoJQ8RD4SaG66uUKQcuO9jWm2y3y/9+cOOvenvalGYwqtFoau4xpJeSN31keQ== 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=LEKdZdA+; arc=none smtp.remote-ip=209.85.215.180 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 2F3DB606A327 for ; Mon, 30 Nov 2026 02:30:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2F3DB606A327 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=LEKdZdA+ Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-cded697ba49so910710a12.1 for ; Sun, 29 Nov 2026 18:30:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1796005804; x=1796610604; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=V9GrOW7kJV+OAg0VTh2DpPLTpIxB8hzSYc+j+7iTvNM=; b=LEKdZdA+mpzmUofXuJiufl4EjrYHqJhVpXI5CE6pgwwPyTnbK0fwCZVmpUddLK0c0P +E3l/GOGIBQVijCS2rF61gewmSmIVuotTnVIhFt5g4118N8KVdONd9IA57CRENuPDNoG LHglE+fBpYk71LtpXaNApRgNo8nFVFeJgBefcAMUKihCoy7eblg0qe1oCqsQgV6Nd+k+ J8vLFjvKEEn6/SfJE4sddZ0gugvvHnYeV0v/nR5TRXt4CtorssqnuE8CnC+snmICZtJY OF1EC7lEEJNsoAuLL1spQ/EdWZO03ZCVU86JSIjRdeHjPdqEVYeGdXHtc70pKM46bVMe 7BWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796005804; x=1796610604; h=content-transfer-encoding:mime-version: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=V9GrOW7kJV+OAg0VTh2DpPLTpIxB8hzSYc+j+7iTvNM=; b=iOW3R1Fz1Mm5eG30KoFV0jkOj0D9cJGKzT5NBBCQEbW+7nkSbWmMurfGy8ImsZAvyD h6YgU0RmcGPcNu1i2TcCiLnzKEfZ0lnOLLqP48FOR2W8InaBC2GH2/9dLAjLf9rRMKtE GL1YaOkgyf0Sr1nguMeAmFG6vm4aUX4eIfeSuApk1O7laqO82vB8CYB7u0B4Ka98oafr /f+ZtMjybPoAAKuGlGJvqRGg9z/vt/AVlu5Ps7f64yC2jJs05m+KCtPai6YUuCHdo86P tUhSnM9SjRGYd8KqMKqeoHnvexG/IKgS8ObtGT6HtEa5iSikdtupRuGtyzQdzEaSLmNX HLYw== X-Forwarded-Encrypted: i=1; AL+hErH3fuHIhGn1YQSAy3cTB3kWJxl6MdzVLYYfTBCsubQbEAT6G8qaqZlZ6juOKSonMOzhQ2emmySL07IPDpM=@vger.kernel.org X-Gm-Message-State: APuU4Z+b2sgjNt4nMz3CgzNDLh6L4x16UX02cZCgJ1a38udKH4V0/gS2 GGNBqEGy879HPA6ebXnVgjMm/tCPXZlKJ8paW70zKk0A/1qIove89EP1yKLjfm67uW8= X-Gm-Gg: AZFdTZfyleO1ukwJX0C63OyI2ZAeWfFGqXb0FA3lE5elPoIAGD31klKT6Z/5JgAINPJ oNfVKrQmGXzLkcJbfUeb2rmUesh/52DZ6OOvR/8bQ0R3fQR2lyQpUfw5a1cPPMTnUT0I03GpHxF Vb3ZuFMyrcH4rWeaPy2GUkYKrlpMiL8dHnGnFDRUI+qEouaJkCPayQhYMF6T1V/i0lzjZlCZeTp z3sKNF8n5HRtMcPpiCFbPv+9rYw9wdN65wx0t1iNYr1zIg1aNgdE8bGbof3DdaKT6pSpIvSnJTw JrIhoiJjFrWCd+JjB6okucXacUn0ycz3vV+OLkrAmQxf20W3s4fgpWn+/6nraDUxm0mkzYswYUB Z+cbfdKWcEqcxAoD9iHKR53WpY8OlItJa/2TODmQpL1lpL0efvUFGV/aOKsWXDwKLpC7G0Gxr4p gAUYOm8Uf6sM6e6mIjAtoPSLdrtfffQ4roJ+bSmPZpvRfeckPnE07nXkyK/X0MYzb9Yp3q4OYU7 TDVsJcOaLKRD2868DP4KZpzFz9TfozIo/iClMKljn9dUGKw0fYPQ5tmDNWPjHpPJSmNHm/dhSTt c63wKqfTRIcFQ0Z6YnLAJzNLVbmPEAZz2nNrLWCU5KYOKg0c6evWLZcPBimsbhJSjV0q X-Received: by 2002:a17:90b:5289:b0:3b3:8094:321d with SMTP id 98e67ed59e1d1-3b41c9080bamr31681804a91.32.1796005804265; Sun, 29 Nov 2026 18:30:04 -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.29.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 29 Nov 2026 18:30:03 -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 00/13] resctrl: Introduce a framework for logical control IDs Date: Mon, 30 Nov 2026 10:29:16 +0800 Message-Id: <20261130022929.71748-1-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) 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 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 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 -- 2.39.2 (Apple Git-143)