From nobody Mon Feb 9 03:15:48 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DB3FC001DE for ; Wed, 19 Jul 2023 23:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbjGSXVg (ORCPT ); Wed, 19 Jul 2023 19:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjGSXVc (ORCPT ); Wed, 19 Jul 2023 19:21:32 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8FCA19BC; Wed, 19 Jul 2023 16:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ne5kQlhSYZTjxCRITS/m5i7kyggViAIc2rJGDC6qXlgPHSHFwD3XCdmvMxcZiw5f1pj6x1qSHh9HW/V9+er1s7yMi91H+WcWfZievAmX4ZumiiUcHlXcP34YWMa2o/sq71zi0tSD2KiuLQ5MXJgeARcequXncfTMZXmFyvS2hSuF7xwVxiQqhnAhgmUHqppSyzOm+7NJ+TPUulLQo1BG7kwZSYXEphb9zVm5xjk6SSy0sdoO1ppNbs/sC5KBf2fI2IHB/GGPYQkycBIHm0ua11z39G5HZyPglAZCTo+uSH0jq+SQ/gRxKsdX2ZsImofs5w3FlHbIacvTQoVOx9FlmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=61Al6Z6LQLHeKfkTRNM6veo5Vu35Uwnfb24p/WvWesA=; b=kMsUByR7CRgFKB5W2K6/dEtjnfNVTaislE62PxtnHsQmHXWmnDX1k75+cyJatnmaVcj3x7OWQchh9r/fbLy9GnTKD0I7RezVnXT6jyzeb8OjkOhM3Zh+0dd9R5Hp/aiCdR8dWymRnbZ2HX30o0ZcsXjEc6Cwqv37sj58oUOgsc6LMwMlttOR97HZEcHCnvP6RKCO13PMm6jroEWcWM/K/yQ4Aj1ziL2Lwqc4HaBmd6KdNPmWgFozuiuN0kXkoMWrbv2zmnUSNlyhwE4LK2p3hYbBBm0dDVtBlE4tLaA0hqjHoidA/tllW5Ippc10SQNXQ5co2cNMQGsrazr2erlJXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=61Al6Z6LQLHeKfkTRNM6veo5Vu35Uwnfb24p/WvWesA=; b=4OQW55QjIXZ2NfcMeRydYFRLyJBHMrlLcS2B0+jpl4v1hKZcn8YgFSHYaQVY4vfGRsVQTj8vTSx2zkK55LBAvmZnmpiFXwkuKNsyYvq2hb1UL9dhHXN6Ncat455GR4kz45P4nKPowLLnMF3vPJj++m4tRqHAkhV1p+FjRJMl9SM= Received: from DS7PR03CA0337.namprd03.prod.outlook.com (2603:10b6:8:55::25) by SJ1PR12MB6220.namprd12.prod.outlook.com (2603:10b6:a03:455::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Wed, 19 Jul 2023 23:21:29 +0000 Received: from DM6NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::e9) by DS7PR03CA0337.outlook.office365.com (2603:10b6:8:55::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:21:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT104.mail.protection.outlook.com (10.13.173.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:21:28 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:21:26 -0500 Subject: [PATCH v6 1/8] x86/resctrl: Add multiple tasks to the resctrl group at once From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:20 -0500 Message-ID: <168980888032.1619861.1165593867700435801.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT104:EE_|SJ1PR12MB6220:EE_ X-MS-Office365-Filtering-Correlation-Id: 96af125d-1238-4855-d82d-08db88aee148 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B1f9Q4CMFvA2wcK+oaNgQURFQ+NA9c6KvM1fUMni5Tra6r80sG5TTDjkZ2N7J33J8JE8kWLHjqqbzL+uOgRue9W4/N3mLKFCrMLgTgR6wo2tHcxYcAa4hvQgV91xayxBnbQaQh8WCgwAg27lizTPfv4RN3AKWG11gk2nFOBnkzpFJzR7b5PYsYyJwwmy0MCCY+5LTqMjK5LkJQdxZN5OU3sbTqBXrizBAH7bSkd1ka1brFGU58QqdXcAf1SCoihVYewXh2FMqKg3CjS41IahB7paMlYmK2fxcCmxLJDaZEIN/RHpHOAR7SC/z38/6/Ev8NYT6Lx16Pi/uKyqXPTYcXj8XfeFkgOc9iHYDwIUuMvvu52iB87cG/U8rtqtMzc3qfzUaH18/87ezAtDLPjyJydtBFjRJJ9JT214s6Aoc0y+eH+mPassDE6eVr06vItFiCy2ahdYqegYPULCEYq/aIzEuhtffGOL+jZ8p9/IOgqTCQ34mMveN4EZbpp0dkaom0Z4KHNbaTU06Xqc9/S9snpi3H3iim82wtVKuaNqsp0IPmRcsd1H7jF53sJ5G0t0V0+wFUe87SVAFtpxWOPqsK5f+Qi191t/rkJWxSqTUu1KiyZQOSRyWAQdDzD5MQeglI22ES568oURkOqYC8PRKeAHrl0LULGSH57yPeLC9Kl5SZj9ZGeqPHsbidKm9jhVe4J3UXLx5gFADxvgSP9owVvh4F9vrsBnfV7/VJjUeo2IbqJGKt32x3Z1RAhoabG1w4t5w04XiT9v5LrwtdPWez4sQinCJxs4/JhUymg7oFY= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(346002)(376002)(396003)(39860400002)(136003)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(66899021)(4326008)(54906003)(6666004)(478600001)(110136005)(83380400001)(82740400003)(36860700001)(426003)(47076005)(40460700003)(86362001)(103116003)(40480700001)(336012)(356005)(2906002)(33716001)(70586007)(44832011)(186003)(16526019)(26005)(316002)(9686003)(70206006)(81166007)(7406005)(16576012)(8676002)(41300700001)(5660300002)(8936002)(7416002)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:28.7610 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96af125d-1238-4855-d82d-08db88aee148 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6220 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The resctrl task assignment for monitor or control group needs to be done one at a time. For example: $mount -t resctrl resctrl /sys/fs/resctrl/ $mkdir /sys/fs/resctrl/ctrl_grp1 $echo 123 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 456 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 789 > /sys/fs/resctrl/ctrl_grp1/tasks This is not user-friendly when dealing with hundreds of tasks. Support multiple task assignment in one command with tasks ids separated by commas. For example: $echo 123,456,789 > /sys/fs/resctrl/ctrl_grp1/tasks Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 8 +++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/re= sctrl.rst index cb05d90111b4..af234681756e 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -299,7 +299,13 @@ All groups contain the following files: "tasks": Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the - group. If the group is a CTRL_MON group the task is removed from + group. Multiple tasks can be added by separating the task ids + with commas. Tasks will be assigned sequentially. Multiple + failures are not supported. A single failure encountered while + attempting to assign a task will cause the operation to abort. + Failures will be logged to /sys/fs/resctrl/info/last_cmd_status. + + If the group is a CTRL_MON group the task is removed from whichever previous CTRL_MON group owned the task and also from any MON group that owned the task. If the group is a MON group, then the task must already belong to the CTRL_MON parent of this diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 725344048f85..8c91c333f9b3 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -696,11 +696,10 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_ope= n_file *of, char *buf, size_t nbytes, loff_t off) { struct rdtgroup *rdtgrp; + char *pid_str; int ret =3D 0; pid_t pid; =20 - if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) - return -EINVAL; rdtgrp =3D rdtgroup_kn_lock_live(of->kn); if (!rdtgrp) { rdtgroup_kn_unlock(of->kn); @@ -715,7 +714,27 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open= _file *of, goto unlock; } =20 - ret =3D rdtgroup_move_task(pid, rdtgrp, of); + while (buf && buf[0] !=3D '\0' && buf[0] !=3D '\n') { + pid_str =3D strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_puts("Task list parsing error\n"); + ret =3D -EINVAL; + break; + } + + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d\n", pid); + ret =3D -EINVAL; + break; + } + + ret =3D rdtgroup_move_task(pid, rdtgrp, of); + if (ret) { + rdt_last_cmd_printf("Error while processing task %d\n", pid); + break; + } + } =20 unlock: rdtgroup_kn_unlock(of->kn); From nobody Mon Feb 9 03:15:48 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C14F5C001DE for ; Wed, 19 Jul 2023 23:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230112AbjGSXVz (ORCPT ); Wed, 19 Jul 2023 19:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjGSXVx (ORCPT ); Wed, 19 Jul 2023 19:21:53 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2079.outbound.protection.outlook.com [40.107.100.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B3B22103; Wed, 19 Jul 2023 16:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HDrXR2rO5CMDCzaSzMa+HXOSYoqOvmV89aCPO9H+zcrNWnTN5ubXeNiy2bEwIjNaFgaTjeFd6Gr3ZvND34EfKpqPD+BDLAOobuIom+Kc9QBDVLYtPswft6MaILlEKMoYz0BYN/NZBxGrdPuSst0WNwY18/GFVBO+dCL/ID3s1gTnHKEy2YNstUzwNk+YcP+RrGKjIhNZNnegIjqMS1hzUOkq2bfhqgdlkqrUYLIdkhLgUVyxXrWomPRFpqCx8vO0w2Vu3j+Qe02C2kzpHkXDQQlT2AVIkBn/6DPRouwkyeWFMOHT+SbVjVOTQlyg7GabRLelz+Cnv0ROHK2Ii+PJug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UjCNKrhhNf0pmqvwTZRd9NA4wMpFYN1ufrYeBdf3TY4=; b=QdrkzXfHLCM3P8u6Dzy6HlLw7bWiE/gAg6jJaDGWaDtQnOI7FKxTcaOe5vuxJIusq7oTEB3IgEBZ7oeCZ272bdhZ2dpFbAtVUQocqji3P6+A/KOwKomhSO/7jvhs2gDyQ0Q3TgmZPkdvgC8ln6TKog3nGsDFdhpPgMCUnaPfc1zHonQsbzMH/YnE1wkpW9bH8Wz0OMBHL/iAfu46VW1Ap1TftrO5WWBwlav/IDe6U+mGeCwW48Abx9yLeLGzhlq53ib8ssDswZDKMUgsYufC+ioh1+DikPxW/eH8k4CBz0VKvNBpG/AnEbeDdU1w534tOuwlRNg7y5pnp6EqLa8UHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UjCNKrhhNf0pmqvwTZRd9NA4wMpFYN1ufrYeBdf3TY4=; b=EVZKWxgkL04XXWGnfhMI5MfUcmthD84YA7oGhdwjaSkBb9+WJFtVXHBQumOSj4U5PidW3O279toVzpwUR31ATRJrrhSc8pLf1yw7MXcyAmPFrMbCwIlF9hahnwwsuMfDyEWs3uokOopwecusz1hpY59no2zvRnIUG042WVTl5t4= Received: from BYAPR03CA0023.namprd03.prod.outlook.com (2603:10b6:a02:a8::36) by DM4PR12MB7719.namprd12.prod.outlook.com (2603:10b6:8:101::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Wed, 19 Jul 2023 23:21:43 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:a02:a8:cafe::e1) by BYAPR03CA0023.outlook.office365.com (2603:10b6:a02:a8::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:21:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.35 via Frontend Transport; Wed, 19 Jul 2023 23:21:42 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:21:39 -0500 Subject: [PATCH v6 2/8] x86/resctrl: Simplify rftype flag definitions From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:33 -0500 Message-ID: <168980889343.1619861.8836711283953792286.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT026:EE_|DM4PR12MB7719:EE_ X-MS-Office365-Filtering-Correlation-Id: 91472890-a00b-4cc3-5a6d-08db88aee94a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9IFqKvEPW4HWMnUQlHCqdMTIw1rHM2wUHYy/wZcuCdIFJWiZpDlvIkN2QK7jiSlmGGXjF02Xmmxh36wnI+3rXSUvDQonMh+sjD8pteWWTash1ZiuYsdXxhN0TxSJPMHWqOzEYPuicBBEg8MZcMgYqubLuCae9A/+75L8hRGd9JC+z5BMZBvq2rEvrdX6k+5ekUev62SSrGO9vHGORUm7BVO+sriX8KmWJam5uhfENXJ7Z9yMocn3JGp9L95YDFx+jAL+M8v3k3i7myQBIdGj33GZRzbqCfR5Uz7ntUDkk5XHsxJehuUFOcXopoqFrEMSY0ji7QyKqjHoYxIcSkD++ZETRRelWGdgIOiPQt2DWmRU9SYonWL1faSoA0tGjbvcBOG4GYwIGPHFcNRIpK1fOvFsmbfjyEXduSULJ2Xwwe3HF9wr3ll0MOJbhsZ/Fq8hnJ0edIllQnX56TGoSUgU4GnzFH1BVg5eMGWv5KpPxIlZbgDZyHhpAFXD30yEMIy6lWXiYxTbnhBDP+bGJQe9SlvcfQQQrgAtxM1f6mmh/ylqsrDxhaAAc03ouAMFyQ1wZ97mg5F051BK67flfvOxv6e0LTE4EjGl7kGU17anbhvkwYCakWflDfvzg8MZLWojkCU3oDnFgxuWsHyfSCxtPIJXf5ggq3uQeZzDbeCOkBvA8a81qaTrhvAY0BX6fBt/3p/57C+FeAlMmIdKXnKL2WRxP3siNG3g2FyoHcsB0cS1srk4iHH+Sf27hgSKrGyQSCFqN3TNAlHE1lfmCYd+LE2WRqCtC5vNkCe7+gubT80= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(396003)(346002)(376002)(136003)(39860400002)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(81166007)(356005)(103116003)(82740400003)(33716001)(86362001)(40460700003)(6666004)(9686003)(110136005)(478600001)(2906002)(36860700001)(426003)(26005)(186003)(336012)(47076005)(16526019)(7406005)(54906003)(16576012)(8936002)(41300700001)(7416002)(70206006)(70586007)(4326008)(316002)(40480700001)(5660300002)(8676002)(83380400001)(44832011)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:42.1927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91472890-a00b-4cc3-5a6d-08db88aee94a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7719 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rftype flags are bitmaps used for adding files under resctrl filesystem. Some of these bitmaps have one extra level of indirection which is not necessary. Make them all direct definition to be consistent and easier to read. Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/internal.h | 9 +++------ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 85ceaf9a31ac..62767774810d 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -243,12 +243,9 @@ struct rdtgroup { */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) -#define RF_CTRLSHIFT 4 -#define RF_MONSHIFT 5 -#define RF_TOPSHIFT 6 -#define RFTYPE_CTRL BIT(RF_CTRLSHIFT) -#define RFTYPE_MON BIT(RF_MONSHIFT) -#define RFTYPE_TOP BIT(RF_TOPSHIFT) +#define RFTYPE_CTRL BIT(4) +#define RFTYPE_MON BIT(5) +#define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) #define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 8c91c333f9b3..2f1b9f69326f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3242,7 +3242,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *par= ent_kn, goto out_destroy; } =20 - files =3D RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); + if (rtype =3D=3D RDTCTRL_GROUP) + files =3D RFTYPE_BASE | RFTYPE_CTRL; + else + files =3D RFTYPE_BASE | RFTYPE_MON; + ret =3D rdtgroup_add_files(kn, files); if (ret) { rdt_last_cmd_puts("kernfs fill error\n"); From nobody Mon Feb 9 03:15:48 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4400C001DC for ; Wed, 19 Jul 2023 23:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjGSXWH (ORCPT ); Wed, 19 Jul 2023 19:22:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjGSXWF (ORCPT ); Wed, 19 Jul 2023 19:22:05 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2080.outbound.protection.outlook.com [40.107.243.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEE76E53; Wed, 19 Jul 2023 16:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dLK9Lw3auvgXwOr+rbO7u5NpMYZUeYIc5Nz3lGKBnzmBW1KooQgc4O9iYGFDW+1/na8IA5/MiUWfc5ANOr5/yRFZ3moM7EZk4EyW3Ixi2Ev0VC15rkmOHE6OfD1y8qeS5S02JD3SY8KexrMgVWU8dPHVX5qXB+7Fpbm8HhIH0mWi6pZGwJNQREykanMTp71YM7Ix5uxJbER1jzbKEIdiIqBBLnkp5vcur255JOUyolI6fqOW/mdVz0Ei017ontINX0swhJ1pAkuQX1YUGAlkXBgxXagLNrfztMtJdpUR/qJ8qhMwvzm2eG+QcsiEPQyXs/nfGUhldB4khVqp2sbDvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jqYCi8ldNKkURthjbG3PWbyXcm2Z9fqG5Z7innpufOw=; b=KmuBeJ2uszGNHyrYIt5R3hRmjHrw0hM5IUlhMm7D6AmHHzg1VbXtizXFVH3HWuCwGY/2Q48ZJZFMlhOO/uHXf0saTt3YqK+5537VcGdVUJ84corzXUipUjey/nZy5YrWBPD7Cu+FKdmvmnV9jgWyjH483q6+PxJUeMnAslqImpNEvvfLGHx9xctMPZlTom/PrbPv5hP5kcNZSBgyy5MPn1oUBwGAaaGdBhc+c7mDEhFNfnNj3pzMLEzXqUfa1iSd7uQd4q9ZmQ8K5iP4v0kU55KA0cCmFyKJXP9JP69MK76hJzTNRKW4ASVJhKTo5zD6koEI0SlKxKbOzv2sjoAXlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jqYCi8ldNKkURthjbG3PWbyXcm2Z9fqG5Z7innpufOw=; b=hZa+ackwChZn0lWGYWnXZQE+7EKPfuw+TAx4QgXyqZJHDxPu1UhqUSyE3D+BCUinq0wTUUdH4H7xj/BYMbs3KJ5Z9Ko9bWYfg4dqu4XpuGUvIFl9pfTdxCQKk5knOLI70tdQxj4Y86/MUGLfqhSPF16XYrCFEu5E7gkrDbHaNco= Received: from SJ0PR03CA0162.namprd03.prod.outlook.com (2603:10b6:a03:338::17) by MN2PR12MB4549.namprd12.prod.outlook.com (2603:10b6:208:268::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Wed, 19 Jul 2023 23:21:51 +0000 Received: from DM6NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:338:cafe::de) by SJ0PR03CA0162.outlook.office365.com (2603:10b6:a03:338::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23 via Frontend Transport; Wed, 19 Jul 2023 23:21:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT053.mail.protection.outlook.com (10.13.173.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:21:50 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:21:48 -0500 Subject: [PATCH v6 3/8] x86/resctrl: Rename rftype flags for consistency From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:46 -0500 Message-ID: <168980890686.1619861.10667395157566002978.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT053:EE_|MN2PR12MB4549:EE_ X-MS-Office365-Filtering-Correlation-Id: 3dc1ecec-12fe-46a5-b85c-08db88aeee48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fxU8qj+7B/fBlKMso1zIHQgyz219R6rOatqUpuBtZZYZMSZSQ9ig3A9r+H6sLH7nUoPu4DS4xSkzLgjvB8fntt1BlL1BGhUmMD8nd+GZcuFoZBrWFDC98qJIUAjdgm4mRZcY59PvS2c27kbGMXATASPm/2QjtzodCwgWuHgyiDyPIkvmsWHAZKb4g30I3o8STMS1qfAYSb3VnVic2veRyhNLaDGc44VHChQQH933wLzFhkGr+vLP4E1q09wJ5M4V6ajCKqa+o1QJ29Ypp+nLzzxlws5zuKGqSjCpxTbXdcQGZhzLrKFrP1h4xDG+zjxoEOjVXB9tuARmexXliCSTgYH+ErXcZF1NJbqflo4jQEMEZaLHA7+d2uyp7rlw1lqO78e4WIhzmmX8QOByOkWReiPi/gBef202pfThT5+KaKTXubcVtKQ+eGBFBdc5XSHyJzq78SX9uenzlgyMXagAauZ2wPzoLGrYpbwcq2/SsLCYy5MrLe3b/2qPmJjhLg/nn6zaxZohsDORfHPAe1DY0u2EZL4FzjJ4YNzFdZf254jicJ5CM8q8EvEuRRFaRbwmGihV8L/4kaqg4Xf3CjwO/rLUgChU3WcL2sG7mmLNtbJ/vfe3/hN6dyNnX3i0X7Rr8yNujCuVPMyN7WHYsFJNwe0XpQHG5GGv0w6T7TDRiwAR5w5BNxWetLLXbxdNm3F5TyZ0GJ2TpZKddGAUm+NhOQ8sRtpDiUz0eCSgJt7Re+gD58D0AhV38VlDMyeBdDEJyRXncsSHDUG/aV36HkGDbXBr09mDPSyTEoKYZqmQC10= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(376002)(136003)(39860400002)(396003)(346002)(451199021)(82310400008)(46966006)(40470700004)(36840700001)(40460700003)(336012)(16526019)(426003)(26005)(186003)(36860700001)(47076005)(83380400001)(70586007)(70206006)(16576012)(4326008)(316002)(7406005)(8676002)(8936002)(7416002)(44832011)(41300700001)(5660300002)(9686003)(2906002)(478600001)(54906003)(110136005)(40480700001)(33716001)(356005)(81166007)(103116003)(86362001)(82740400003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:50.5706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dc1ecec-12fe-46a5-b85c-08db88aeee48 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4549 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org resctrl associates rftype flags with its files so that files can be chosen based on the resource, whether it is info or base, and if it is control or monitor type file. These flags use the RF_ as well as RFTYPE_ prefixes. Change the prefix to RFTYPE_ for all these flags to be consistent. Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/internal.h | 10 ++++---- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 ++++++++++++++++------------= ---- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 62767774810d..2051179a3b91 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,10 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) -#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) =20 /* List of all resource groups */ extern struct list_head rdt_all_groups; @@ -267,7 +267,7 @@ void __exit rdtgroup_exit(void); * @mode: Access mode * @kf_ops: File operations * @flags: File specific RFTYPE_FLAGS_* flags - * @fflags: File specific RF_* or RFTYPE_* flags + * @fflags: File specific RFTYPE_* flags * @seq_show: Show content of the file * @write: Write to the file */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 2f1b9f69326f..3010e3a1394d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1705,77 +1705,77 @@ static struct rftype res_common_files[] =3D { .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_last_cmd_status_show, - .fflags =3D RF_TOP_INFO, + .fflags =3D RFTYPE_TOP_INFO, }, { .name =3D "num_closids", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_num_closids_show, - .fflags =3D RF_CTRL_INFO, + .fflags =3D RFTYPE_CTRL_INFO, }, { .name =3D "mon_features", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_mon_features_show, - .fflags =3D RF_MON_INFO, + .fflags =3D RFTYPE_MON_INFO, }, { .name =3D "num_rmids", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_num_rmids_show, - .fflags =3D RF_MON_INFO, + .fflags =3D RFTYPE_MON_INFO, }, { .name =3D "cbm_mask", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_default_ctrl_show, - .fflags =3D RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name =3D "min_cbm_bits", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_min_cbm_bits_show, - .fflags =3D RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name =3D "shareable_bits", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_shareable_bits_show, - .fflags =3D RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name =3D "bit_usage", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_bit_usage_show, - .fflags =3D RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name =3D "min_bandwidth", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_min_bw_show, - .fflags =3D RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name =3D "bandwidth_gran", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_bw_gran_show, - .fflags =3D RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name =3D "delay_linear", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdt_delay_linear_show, - .fflags =3D RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, /* * Platform specific which (if any) capabilities are provided by @@ -1794,7 +1794,7 @@ static struct rftype res_common_files[] =3D { .kf_ops =3D &rdtgroup_kf_single_ops, .write =3D max_threshold_occ_write, .seq_show =3D max_threshold_occ_show, - .fflags =3D RF_MON_INFO | RFTYPE_RES_CACHE, + .fflags =3D RFTYPE_MON_INFO | RFTYPE_RES_CACHE, }, { .name =3D "mbm_total_bytes_config", @@ -1841,7 +1841,7 @@ static struct rftype res_common_files[] =3D { .kf_ops =3D &rdtgroup_kf_single_ops, .write =3D rdtgroup_schemata_write, .seq_show =3D rdtgroup_schemata_show, - .fflags =3D RF_CTRL_BASE, + .fflags =3D RFTYPE_CTRL_BASE, }, { .name =3D "mode", @@ -1849,14 +1849,14 @@ static struct rftype res_common_files[] =3D { .kf_ops =3D &rdtgroup_kf_single_ops, .write =3D rdtgroup_mode_write, .seq_show =3D rdtgroup_mode_show, - .fflags =3D RF_CTRL_BASE, + .fflags =3D RFTYPE_CTRL_BASE, }, { .name =3D "size", .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D rdtgroup_size_show, - .fflags =3D RF_CTRL_BASE, + .fflags =3D RFTYPE_CTRL_BASE, }, =20 }; @@ -1913,7 +1913,7 @@ void __init thread_throttle_mode_init(void) if (!rft) return; =20 - rft->fflags =3D RF_CTRL_INFO | RFTYPE_RES_MB; + rft->fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_MB; } =20 void __init mbm_config_rftype_init(const char *config) @@ -1922,7 +1922,7 @@ void __init mbm_config_rftype_init(const char *config) =20 rft =3D rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags =3D RF_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags =3D RFTYPE_MON_INFO | RFTYPE_RES_CACHE; } =20 /** @@ -2057,21 +2057,21 @@ static int rdtgroup_create_info_dir(struct kernfs_n= ode *parent_kn) if (IS_ERR(kn_info)) return PTR_ERR(kn_info); =20 - ret =3D rdtgroup_add_files(kn_info, RF_TOP_INFO); + ret =3D rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO); if (ret) goto out_destroy; =20 /* loop over enabled controls, these are all alloc_capable */ list_for_each_entry(s, &resctrl_schema_all, list) { r =3D s->res; - fflags =3D r->fflags | RF_CTRL_INFO; + fflags =3D r->fflags | RFTYPE_CTRL_INFO; ret =3D rdtgroup_mkdir_info_resdir(s, s->name, fflags); if (ret) goto out_destroy; } =20 for_each_mon_capable_rdt_resource(r) { - fflags =3D r->fflags | RF_MON_INFO; + fflags =3D r->fflags | RFTYPE_MON_INFO; sprintf(name, "%s_MON", r->name); ret =3D rdtgroup_mkdir_info_resdir(r, name, fflags); if (ret) @@ -3709,7 +3709,7 @@ static int __init rdtgroup_setup_root(void) =20 list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); =20 - ret =3D rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE); + ret =3D rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BAS= E); if (ret) { kernfs_destroy_root(rdt_root); goto out; From nobody Mon Feb 9 03:15:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2D1CC0015E for ; Wed, 19 Jul 2023 23:22:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbjGSXWR (ORCPT ); Wed, 19 Jul 2023 19:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbjGSXWN (ORCPT ); Wed, 19 Jul 2023 19:22:13 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EEAD2123; Wed, 19 Jul 2023 16:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZY7Xc5bLQiS+lSBnCtR21Y+qpo+r2yyVTh7rKtxsMn8HapYX8CejZTmp6qGit+MUHVDfXLMJ9Epefl6B2iNSseGwvHTFvYTprTMj4IGpEEnLJuirMGgM+0kuZ+wtoABoT361EdF/mGaTSZUNokssn5OueEK9RBawUXnVtAfJO/NkGWqVci9vdP+P/3Onxv7YVqbUdBn5j0Z7DPRvADYvJ42L7qNJqVAvzenxuFAl6poGitK1xa/CVwS2Gk+BSZMCLU1JWMEZrjY1G6ruj7xom93/bwQ8wrL0CytKdeoBIz//H/d/JUJbfzA7d2fSAqsdAvMn+92hKwDTFtdlT1RToQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sb12peGDFs/wQKrqWuRnsyseXFMg7ZiqzMWBfgnQtXw=; b=kMzmQzL1VUjgFfsadZ6EDJUwgCRHY85lfc7NbsxYTux7JypaD+77kL2EG0UgXRrgxAkWAc3LCnm6GWCkJiISMkM6f2tIY4VlFtkNLJ4zHUnUwIXgXZSYg1mq4KPDZPhAjlDr2IImD02o1WpxZGNqeL/ATWqrv4j/OxU2DwQqFA8v3NZK0q+R1IN1GCUOkmPwKcFK5HvzNpyvaIVIVeChPEze1SUW/CD28To5CuKhvqEwmSP5Vqn40HjFImpaTff965T2HJ8rbxAcme7tkWDG7UjTaheffdk6//HrDJ1ZKilznQvD3JU+8FSGpFtlE9EQ3Z2xNw6bYWVbXZV/BOgJNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sb12peGDFs/wQKrqWuRnsyseXFMg7ZiqzMWBfgnQtXw=; b=1RWuwZ5oH040weJW5dpTLmoO5XJcIW5cUT5yJRIege4KHSamHKyNgdPfjx1kYm58xGxL8ng8GuQjDd19wvsEOnejceqSSuRLJqne3Rc570YyNQ8gpUpXkSzfDZLSZnVG/+HJpwR0ZREyqq5kjsP1g+2AW647ZTPb1CahvZJCWzs= Received: from DS7PR05CA0107.namprd05.prod.outlook.com (2603:10b6:8:56::25) by DS0PR12MB6487.namprd12.prod.outlook.com (2603:10b6:8:c4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Wed, 19 Jul 2023 23:21:58 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::c5) by DS7PR05CA0107.outlook.office365.com (2603:10b6:8:56::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:21:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:21:58 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:21:56 -0500 Subject: [PATCH v6 4/8] x86/resctrl: Add comments on RFTYPE flags hierarchy From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:55 -0500 Message-ID: <168980891501.1619861.11056885467637617879.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT064:EE_|DS0PR12MB6487:EE_ X-MS-Office365-Filtering-Correlation-Id: fb15e83a-b1c1-4c00-3f71-08db88aef318 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: flZ1IBDDmBEY+p+kjZGitUdeMLtoRBvda7xQYFgZ03Ax5eWX9cPthPuvTPc1F4bggEiQQFamXgIHdvIv+j1g0Xm1OEveVG+SEn9IccHqO5B/uHTlAwAfPxEdu+bYfPTCftiOpVeCWGBBvWyG+BBYxvuUkpVktbC3GdYa+eLTHsO6zmw6Nd9G+DJ0LaqNUFRNahhHi0P3j4pqBl1PzZ32QFP02/u7I7b2RtjRvgN6IrIcYKwXBlPd11eStT/x0blXPNbm35PutETKhGs47toCMsip2Yrvae78Gu9NleMtsw3cE/eDQZQuYxWmNUueSjKDk1qYoPzBVwGol2ywDlMHDYb0EJR0c2jy62DSR8KLU8ThfHSPOdBadbPXxmHjsgMqcVOHnAjx5fPhF7gKq4AGzQs8ARIGrvLaN+gTLr9Uu4PXlJxAgT0FrtH2Wm4G2BgxZuMamxEIcNWjA1wuAbtUTeVqgeaMPLvJxRMupa4+3f/KOdVBUrBWtqCbD5uZX8tD8ntPjFanvp7WxNQIC7XqdiBfbqq4r+AT02nGvVICtj0r5nEF4q+bJAep6dTGhvri2dHRYjKAzkUfRqAsiCXy7deUQxAjtGHq0Rg5UeqJoPuPih3rQ8FrtuerxZBzYMjrOL7tR5Gud8EfixX+QkbswKIUM9ODsAfE005t8y+mI0xHDkeUCHfTnHl5F296B5F2XEyjoqqgXzAjHpYQ+fVTPT+YRTcTGKDi08EAgOAVDvKUrS81Lmq7zbE5Pu0wIxhUwCmGFX0f3vzpfSFSKXsQfAKz+dOxp0TAl+l6ypC7qcY= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(396003)(346002)(39860400002)(376002)(136003)(82310400008)(451199021)(40470700004)(36840700001)(46966006)(33716001)(2906002)(478600001)(54906003)(7416002)(44832011)(7406005)(40460700003)(316002)(16576012)(8676002)(70206006)(41300700001)(70586007)(4326008)(110136005)(336012)(47076005)(86362001)(81166007)(36860700001)(8936002)(426003)(82740400003)(356005)(9686003)(5660300002)(103116003)(16526019)(186003)(26005)(40480700001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:58.6415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb15e83a-b1c1-4c00-3f71-08db88aef318 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6487 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org resctrl uses RFTYPE flags for creating resctrl directory structure. Definitions and directory structures are not documented. Add comments to improve the readability and help future additions. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 48 ++++++++++++++++++++++++++++= ++++ 1 file changed, 48 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 2051179a3b91..783c3e36633c 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,6 +240,54 @@ struct rdtgroup { =20 /* * Define the file type flags for base and info directories. + * + * RESCTRL filesystem has two main components + * a. info + * b. base + * + * /sys/fs/resctrl/ + * | + * --> info (Top level directory named "info". Contains files that + * | provide details on control and monitoring resources.) + * | + * --> base (Root directory associated with default resource group + * as well as directories created by user for MON and CTRL + * groups. Contains files to interact with MON and CTRL + * groups.) + * + * info directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_INFO + * --> directory + * --> RFTYPE_TOP_INFO + * Files: last_cmd_status + * + * --> RFTYPE_MON_INFO + * --> directory + * Files: max_threshold_occupancy, mon_features, + * num_rmids, mbm_total_bytes_config, + * mbm_locat_bytes_config + * + * --> RFTYPE_CTRL_INFO + * --> RFTYPE_RES_CACHE + * --> directory + * Files: bit_usage, cbm_mask, min_cbm_bits, + * num_closids, shareable_bits + * + * --> RFTYPE_RES_MB + * --> directory + * Files: bandwidth_gran, delay_linear, + * min_bandwidth, num_closids, + * thread_throttle_mode + * + * base (root) directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_BASE (Files common for both MON and CTRL groups) + * Files: cpus, cpus_list, tasks + * + * --> RFTYPE_CTRL_BASE (Files only for CTRL group) + * Files: mode, schemata, size + * */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) From nobody Mon Feb 9 03:15:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECFE9C001DC for ; Wed, 19 Jul 2023 23:22:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbjGSXW2 (ORCPT ); Wed, 19 Jul 2023 19:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjGSXWZ (ORCPT ); Wed, 19 Jul 2023 19:22:25 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2083.outbound.protection.outlook.com [40.107.102.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2F43268D; Wed, 19 Jul 2023 16:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lAehErivdl0MnBQQuBctUXbMWuJqMmkPP/sR4EN3R7QUOaJzo1QXm61nzjMXk/DrDyQXW94OlSQfZpZ3Jr8t9AymupHQE6ZIvxf5A4vF7doIi8qcEf9zoe2PdK//yv/H63cO7DLku/hV7QCK+TTxdaGhuxLqm0jkGsBdcW/LDLPF1e7kkpjrGwY6Nw6ZylqsOwwbAuCsIcN91gBpFGeWlHEtz+Y4IrNQ6u1IlUgRjDEsPYJrJJe2Q8HCe4y7CNOjW6WZFLVKp52JLABc6YT//J23liM5MZswiIpKss+AwA67d/ZEFpoMGMGlvHqDJaXQcSJI9EOjutg2c5UWBoITIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Th6/t3mREpZEsSW4UhPaIsUf+aPY0ugCbYGGZAF13nI=; b=g7LsqhF5foAb2VUYNroKt7PHpuT4hwsMO9G1vPWAislrBoWGlJlyQv4VutFzSodKyj3+XA9100jL3nXZMC2Z+xMyvXbX1In3nS4YwOYReMws9umAtIlYSGSlrqoZBrjlYFpNpht92AV62jIfWYQ13xLpON8qi8nJAcV5t29BEuWwYQtHa1Ji4e4biWz6+MYIAKVvTSgUpgXORBUlB+gnOg9PfKszyfHmKG/t/JPdOtJllE1Uv+66R7L0Q8kBkVZfZnIvzxmLEcT+cDN6RkDrui92HHPS2EHLUCnk0gUcrtcB57LgNYclRtzX38Tefi5/+ok9vhKL4vcUMD6dAKcmew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Th6/t3mREpZEsSW4UhPaIsUf+aPY0ugCbYGGZAF13nI=; b=RgXEcUugFTlIPxzQq2rcerrioJIW83v7Utn1ZZzsObrgojD2p5lVpiUk8OIux6Xp1JsQvIaMFvzVY8IunqZJLMBOhXiQugy0zxjiguY1SGxQqt+RDMT0JQsfcYYiuKhwdsATv19p5r4UlG1FqXGjNZcLvpREdTVs6Gp6Xv6najU= Received: from DM6PR02CA0062.namprd02.prod.outlook.com (2603:10b6:5:177::39) by DM4PR12MB5231.namprd12.prod.outlook.com (2603:10b6:5:39b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23; Wed, 19 Jul 2023 23:22:07 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::1c) by DM6PR02CA0062.outlook.office365.com (2603:10b6:5:177::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:22:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:22:07 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:22:04 -0500 Subject: [PATCH v6 5/8] x86/resctrl: Unwind the errors inside rdt_enable_ctx From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:03 -0500 Message-ID: <168980892326.1619861.2405779251348138586.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT051:EE_|DM4PR12MB5231:EE_ X-MS-Office365-Filtering-Correlation-Id: cac4c581-50c2-4519-b385-08db88aef86f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LQHIaSHsrAzt2Lt+PNg6amcJX6kxOmTc8Wf817vCRAkC4s255yLHX26qvOK7Lb3S8On1GaUjgzzRiNxYIqzmKE9Q+BwHaRJCcg4YPn2k6aOZdfMukqzlu06IR0ABB43skT6kS36gyMRgDxj7ZAsPDdT7SHcZ0A0lhZQAAC9e0YCj+MPJWXiW8h2TTSn4sQ0owotR/0Q0IFIFCByIiKSMDXl7/mbvtooI+l5vcnpu8iABb3z+r55JCKBqJINbpC04cKkhyNtBD/deN3UqbaPiP119KGE1xXqAdPee4MX12hZYIwxrkTNTHAegmPklGH8tsM3HSIl44L2xgGc10xMFyubiLXuG0SBVoNaVPbU09DtJMuxohQYbES5bgjaNufPgjiqyG5YywqIYyCeiBiDBm7OyDryiBmDzQGSvT0Os7epulshujQKc3Bgwx/MIR73BL3w8H1NpMiQQiMp/6NQE5aRP+r6GNSMe3U+J9EwxFVP3cbEECKF85pNzNKyw+NH8r1EzOi4uZDxvkoC+uIzdUcuQ91Hyz1iv+HkObTC74dCCsWyysHnrA4+/SqmkVs3V/85G1lyP1hLquiPZX+6nPY9TH7YchQqv5YI0OsLTN5BS+XuOHEG6pUHuXwOGIzIHjDgnD7HtvuMq7V7YS+cLrgW7GgIbE0PXurBg6AKjvLyjAoIoHffOsbh9p0Dnuv7o/K0lf1PuPYaWvboRg9Mpm0zZgzA4k55Ih+8747hS8Jmg0I2SYI0fP9hetnqbzoIAz0o1lUBqHJkdZYxv8Oo9LV/PxQU9bCXFhSSy5eiM1SA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(103116003)(16526019)(110136005)(478600001)(54906003)(186003)(26005)(336012)(9686003)(83380400001)(2906002)(70586007)(33716001)(41300700001)(5660300002)(8936002)(7406005)(8676002)(40480700001)(44832011)(7416002)(16576012)(356005)(81166007)(82740400003)(70206006)(36860700001)(47076005)(426003)(86362001)(4326008)(316002)(66899021)(40460700003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:07.5720 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cac4c581-50c2-4519-b385-08db88aef86f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5231 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org rdt_enable_ctx() takes care of enabling the features provided during resctrl mount. The error unwinding of rdt_enable_ctx is done from the caller rdt_get_tree. This is not ideal and can cause some error unwinding to be omitted. Fix this by moving all the error unwinding inside rdt_enable_ctx. Suggested-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 31 +++++++++++++++++++++++-----= --- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 3010e3a1394d..9a7204f71d2d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2381,15 +2381,31 @@ static int rdt_enable_ctx(struct rdt_fs_context *ct= x) { int ret =3D 0; =20 - if (ctx->enable_cdpl2) + if (ctx->enable_cdpl2) { ret =3D resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, true); + if (ret) + goto out; + } =20 - if (!ret && ctx->enable_cdpl3) + if (ctx->enable_cdpl3) { ret =3D resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); + if (ret) + goto out_cdpl2; + } =20 - if (!ret && ctx->enable_mba_mbps) + if (ctx->enable_mba_mbps) { ret =3D set_mba_sc(true); + if (ret) + goto out_cdpl3; + } =20 + return 0; + +out_cdpl3: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); +out_cdpl2: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); +out: return ret; } =20 @@ -2497,13 +2513,13 @@ static int rdt_get_tree(struct fs_context *fc) } =20 ret =3D rdt_enable_ctx(ctx); - if (ret < 0) - goto out_cdp; + if (ret) + goto out; =20 ret =3D schemata_list_create(); if (ret) { schemata_list_destroy(); - goto out_mba; + goto out_ctx; } =20 closid_init(); @@ -2562,10 +2578,9 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_info); out_schemata_free: schemata_list_destroy(); -out_mba: +out_ctx: if (ctx->enable_mba_mbps) set_mba_sc(false); -out_cdp: cdp_disable_all(); out: rdt_last_cmd_clear(); From nobody Mon Feb 9 03:15:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03F60C001DC for ; Wed, 19 Jul 2023 23:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230336AbjGSXWi (ORCPT ); Wed, 19 Jul 2023 19:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbjGSXWf (ORCPT ); Wed, 19 Jul 2023 19:22:35 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2082.outbound.protection.outlook.com [40.107.92.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E841FF9; Wed, 19 Jul 2023 16:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OzwR/WxAJb8trhv8YHGD3/vEPsMp49LYmEhSHpECkkBkJDShVVLcams2HAzrrvS0euZPtfga3nRJpp3Ra/ThXGcFe8we+ca5cWXBI3l1JcD5X3Piq3LQ+iNIcTCLCFfV07zUoEzadNAffPODONFPCXu+Tvr/ivki1oQxY9r9DtL6Ed9oaJJS0qO1BZz/bUzUJI49AHhVrFxfhmd+1URYKIqb0w1jguQGTUNYaHv4ETg0QkcGNy1U55FemO3q3/l+ane5yYGXemwW/XgmP2OXHTMFwRWrTE4v6ldhgIpp3W9yVl7lKUh6oNFdTNWaKeMOdZfXuR3w3F7fSYfQ9w2lNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QrD9V2/prOMs2/duKMdtxaSRbb0w0K/uqb3zoiUjYlg=; b=MBWO4z1p9w7vg/55/lNcMEnRqN52Nka4N8dKehg51Vq0K9/M9dPTtHUjCTB4kBcOnFtkVX6xqmQxctN9iRtG916xqBSHg8N535lhMkWntjxGj4AcPZZRgvXt1xDEAqwrVU1wmsCHBlZEsWT7a5Vrvs0QmBr/4EZM11K1QgAiuT4uvw3yL4cYQN+7a6j9UQGDsiLE0QQXFsNSDmRTPtqndqw0g5j+8N69aezAf1dVe2Db5kLneSCjiphsWd78DiStupiDZVkJnPKFhdWtim2N7NabaXKecUR1vWERFeSp3/MUBWZzaWFkVROpmzkdNNr21aaDhZd7fQ021GDFCGGPlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QrD9V2/prOMs2/duKMdtxaSRbb0w0K/uqb3zoiUjYlg=; b=JifsHEmMMFrEfyDp4GM2y+5FliKNFZa4UZjHSNJqOwGRX14rp5rA8p4mCW9sWFGNkH9kuzSGK9CZZxorS6LTG+bONAkyrilo0Z1gTcdpSPHXURbByvwvaK3h4SHg6ghCWILjndgm13PPV9Rp9Yk9wiLHbWlyiMPM6gzFBuknx4I= Received: from DM5PR07CA0098.namprd07.prod.outlook.com (2603:10b6:4:ae::27) by IA0PR12MB8301.namprd12.prod.outlook.com (2603:10b6:208:40b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Wed, 19 Jul 2023 23:22:16 +0000 Received: from DM6NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ae:cafe::f8) by DM5PR07CA0098.outlook.office365.com (2603:10b6:4:ae::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:22:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT073.mail.protection.outlook.com (10.13.173.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:22:15 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:22:12 -0500 Subject: [PATCH v6 6/8] x86/resctrl: Move default control group creation during mount From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:11 -0500 Message-ID: <168980893158.1619861.8945141367681744527.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT073:EE_|IA0PR12MB8301:EE_ X-MS-Office365-Filtering-Correlation-Id: 48509f08-1341-4f2c-e3b2-08db88aefd39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CSH5z4GsSB0gEfynm4UUe7x2nJDTxt0pFhm0uQHx++ucEK8tO8ly36qiRzCkJuQ9SfYFSJdM4VZ9Z7+5jv4vDF4syH4jf2Cnm9xvukRkQUv4VcaPNcGxRQ1F3Wfg5F29oGoSxxXvp9xVAPZMOXQyFSequr/K+xZe1JNn+uNUEOOTu0EPtPJFmsziuAAQOcBK3u5/hozlTYyZ7eN1qeANurNNpD/g9qnaEIe7w58E2/jkXTUSMsSKgYlorbEpDiTBskThHdxnU0PNaV6c0qK2O6H0cCHynTCet4b7gPhAw/3GKthPBMJzqaFg18aKYZK5Q5M5D56np2+LHNPYX+meEQhOfLDaH8qv//VHW8gbDXjQri25Tdgtfbs0gAsPSdi46wf5wNw6nAO8O/d8fwm6Gv9Jf4ba36wSuZLyAd1GhrzcSIwTxU8xO/pl1UN49uhmUM6FSBF4sOkcNQ82+vmJOxhWCDoNLo5XDfjHYbpNQN3LBBD4/X5CsBdE6vNmE4C6W23IMpSGhlDItsMWJ//QoGTwgzNxn0jFtNBNWStJ4lLrQqE+TpLF/0cyDj2WLK0YPwNGVA5zDwuxa4dczpLdEg6Az7J5+15bMdMe79YkD3OedC1/wkBUs90b+29uiTtQ6yli1R7D3hrQniEUGqSlJenMDCkODKCAgc2QcTC9EUkQXKhkND0Y0u3/LJefgGuR8eNEi3Zh1zf71pHXc+SMzSI7ePowEt1Dxdx0McD/Dn8jHWr4+vn2F9VpcSutKts7k9xMbreH3Q7JzfgrH/pOy3Q33ASmPDAa/dY1XJQOI4U= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(39860400002)(376002)(136003)(396003)(346002)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(7416002)(86362001)(2906002)(33716001)(103116003)(7406005)(44832011)(40460700003)(40480700001)(36860700001)(186003)(16526019)(336012)(83380400001)(426003)(9686003)(47076005)(26005)(82740400003)(81166007)(356005)(16576012)(110136005)(70206006)(54906003)(70586007)(478600001)(4326008)(5660300002)(316002)(41300700001)(8936002)(8676002)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:15.5611 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48509f08-1341-4f2c-e3b2-08db88aefd39 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8301 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The resctrl default control group is created during kernel init time. If the new files are to be added to the default group during the mount based on the mount option, then each file needs to be created separately and call kernfs_activate. This can avoided if all the files are created during the mount and destroyed during the umount. Move the root and default group creation in rdt_get_tree and removal in rdt_kill_sb. Suggested-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 51 ++++++++++++++--------------= ---- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 783c3e36633c..885b656d1088 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -601,5 +601,6 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *r); void __init thread_throttle_mode_init(void); void __init mbm_config_rftype_init(const char *config); void rdt_staged_configs_clear(void); +int rdtgroup_setup_root(void); =20 #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 9a7204f71d2d..e0570bce76a2 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2512,10 +2512,16 @@ static int rdt_get_tree(struct fs_context *fc) goto out; } =20 - ret =3D rdt_enable_ctx(ctx); + ret =3D rdtgroup_setup_root(); if (ret) goto out; =20 + ctx->kfc.root =3D rdt_root; + + ret =3D rdt_enable_ctx(ctx); + if (ret) + goto out_root; + ret =3D schemata_list_create(); if (ret) { schemata_list_destroy(); @@ -2524,6 +2530,12 @@ static int rdt_get_tree(struct fs_context *fc) =20 closid_init(); =20 + ret =3D rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (ret) + goto out_schemata_free; + + kernfs_activate(rdtgroup_default.kn); + ret =3D rdtgroup_create_info_dir(rdtgroup_default.kn); if (ret < 0) goto out_schemata_free; @@ -2582,6 +2594,9 @@ static int rdt_get_tree(struct fs_context *fc) if (ctx->enable_mba_mbps) set_mba_sc(false); cdp_disable_all(); +out_root: + list_del(&rdtgroup_default.rdtgroup_list); + kernfs_destroy_root(rdt_root); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2652,7 +2667,6 @@ static int rdt_init_fs_context(struct fs_context *fc) if (!ctx) return -ENOMEM; =20 - ctx->kfc.root =3D rdt_root; ctx->kfc.magic =3D RDTGROUP_SUPER_MAGIC; fc->fs_private =3D &ctx->kfc; fc->ops =3D &rdt_fs_context_ops; @@ -2821,7 +2835,9 @@ static void rdt_kill_sb(struct super_block *sb) cdp_disable_all(); rmdir_all_sub(); rdt_pseudo_lock_release(); - rdtgroup_default.mode =3D RDT_MODE_SHAREABLE; + /* Remove the default group and cleanup the root */ + list_del(&rdtgroup_default.rdtgroup_list); + kernfs_destroy_root(rdt_root); schemata_list_destroy(); static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); @@ -3704,10 +3720,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall= _ops =3D { .show_options =3D rdtgroup_show_options, }; =20 -static int __init rdtgroup_setup_root(void) +int rdtgroup_setup_root(void) { - int ret; - rdt_root =3D kernfs_create_root(&rdtgroup_kf_syscall_ops, KERNFS_ROOT_CREATE_DEACTIVATED | KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, @@ -3715,28 +3729,17 @@ static int __init rdtgroup_setup_root(void) if (IS_ERR(rdt_root)) return PTR_ERR(rdt_root); =20 - mutex_lock(&rdtgroup_mutex); - rdtgroup_default.closid =3D 0; rdtgroup_default.mon.rmid =3D 0; rdtgroup_default.type =3D RDTCTRL_GROUP; + rdtgroup_default.mode =3D RDT_MODE_SHAREABLE; INIT_LIST_HEAD(&rdtgroup_default.mon.crdtgrp_list); =20 list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); =20 - ret =3D rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BAS= E); - if (ret) { - kernfs_destroy_root(rdt_root); - goto out; - } - rdtgroup_default.kn =3D kernfs_root_to_node(rdt_root); - kernfs_activate(rdtgroup_default.kn); =20 -out: - mutex_unlock(&rdtgroup_mutex); - - return ret; + return 0; } =20 static void domain_destroy_mon_state(struct rdt_domain *d) @@ -3858,13 +3861,9 @@ int __init rdtgroup_init(void) seq_buf_init(&last_cmd_status, last_cmd_status_buf, sizeof(last_cmd_status_buf)); =20 - ret =3D rdtgroup_setup_root(); - if (ret) - return ret; - ret =3D sysfs_create_mount_point(fs_kobj, "resctrl"); if (ret) - goto cleanup_root; + return ret; =20 ret =3D register_filesystem(&rdt_fs_type); if (ret) @@ -3897,9 +3896,6 @@ int __init rdtgroup_init(void) =20 cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); - return ret; } =20 @@ -3908,5 +3904,4 @@ void __exit rdtgroup_exit(void) debugfs_remove_recursive(debugfs_resctrl); unregister_filesystem(&rdt_fs_type); sysfs_remove_mount_point(fs_kobj, "resctrl"); - kernfs_destroy_root(rdt_root); } From nobody Mon Feb 9 03:15:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90474C001DE for ; Wed, 19 Jul 2023 23:23:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbjGSXXC (ORCPT ); Wed, 19 Jul 2023 19:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjGSXXA (ORCPT ); Wed, 19 Jul 2023 19:23:00 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::600]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 288742708; Wed, 19 Jul 2023 16:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SaIXTEyDdlNvyFRL8GJQuAeihiQ6SgjN418fgkdCgN8ABD+nJuQ1e5LD0KEEERlUdMIA1tLZRf3eoWrybrsozlVvOVbls/11/XgWxiSbypMewk1M7AY6xxeSxbehdp+y1kSnruj9TFsRIWwBROAnZnyFjlbECu7C9QW0Ui46y7HwSzgKsHF12CHDEduY7040p+yQWb8F/jwlB5l5lmkDF3ztdn9gqOUTkii3ChZ8lklvz9RFB7cTQyjJJw7UKTs2IGoIXRN5aDmr2VkYIWruQ7ugNeNFI6OhgnmBa6h0U1gZsmo9OozBufoLuZnq2IYBf89FN17hDLXe5HCauHgI9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k6dT+F33syFlQ2/KFTWohshO77y0qLiFpqKxl8jvpp4=; b=V3dhp1bwuk/mKFH53mBqytNp96jwco/mXHCVe8W/erXm6k5+EpPSMJDlAhnCMUDFOVGIVGh4chex8Qt/T/lGMXctKdsk1wcR2btI31uLWwwFn1eKfCi/Dg9G6tTeTjjvnR2+//vDo1n5Ofm4NUO2fMBTtGF7kQB0Pi20gvhbO+rnF8B7Z/gmG5PJtOSqh4HY8LxKRPnU5D5aMQhashkR48gaBc7RxWm5H8rPxl1KKDdgg8OAEYkmsSw3tXyBVbQkshwU9UeYQnNnxFmUrnMqH5+gkBlwMHFyS5/aL0pHEy3FCNkEZd8KvXFIGmDQlimX52Ge2YSme3Cnn83i+95HhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k6dT+F33syFlQ2/KFTWohshO77y0qLiFpqKxl8jvpp4=; b=fbELrNnkNdLBnY4Rjf4kx2Ke1gAqewrKcVNmIHDl3OFJSZenFn0LR0zIKBkjvXQ1svSMMhZmJGpQk1azIBZR7L6eN9rkIhRshIY8cm+wyptabl3v33tr5zaC1Oi80P9WDpVJ9AxQfCDIdQ+JZMjucFfAbQzSSZicL452wFYOblE= Received: from DM6PR06CA0053.namprd06.prod.outlook.com (2603:10b6:5:54::30) by MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23; Wed, 19 Jul 2023 23:22:29 +0000 Received: from DM6NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::25) by DM6PR06CA0053.outlook.office365.com (2603:10b6:5:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:22:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT034.mail.protection.outlook.com (10.13.173.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6609.25 via Frontend Transport; Wed, 19 Jul 2023 23:22:28 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:22:26 -0500 Subject: [PATCH v6 7/8] x86/resctrl: Introduce "-o debug" mount option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:19 -0500 Message-ID: <168980893967.1619861.7249871216790436466.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT034:EE_|MW4PR12MB7031:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d9abe14-372a-42c1-e62a-08db88af04dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mmDWzIM/sgigR++mULfOJfVO4MOiRW6O4pgzpsu/lDv8uXs89B1DhnC50B4y1U8nkSo0Wn9qTzOr+jG9GrvOkum/vRK1ZyNhgXBU48Jyw2qvCaQUJv+VdG/T12KCEbbzPk9sLavQum2FgsqPK4fsAiHv9bGvZBW1VCF9kYCLQF47H3nrPNE0WaVXxHCV1jcleI5ArlIRuHY3Z8cFdTpNPj1rh4XsBqkxtr5i6SOru5aWPSOvpMTf1ardRRqyHUPulawCSKvL09HaypY+uTMdGXVMiQbD78ZRJODaqJBhMyW2ovfUpqVlGJ9OuNCXInQRxlhZSEl3oqDiOQij3CtuuKw+fFVDBNhaXBiJ0qsshw28p3WpsGCgVlzOAuPY/YDviBD/IIc0LqYZmTITerUPFI39sHJmhqVnmrertzsx0/Lr5ErW6NXvGqO6/Al7mVUQwMuWCS9UPgCA+WaCprNslFD3hGloOom71RqNkkMqm6JEgIEiwhy4NfWKCe04XlprLkAfiH8wFg0jNUIZx6k6B/v5fiL6949PKsfiGOJxM63hGA9TAu2iLaaapIi2dVLd8VRymj5GItnzycZtlGAnvTaMsH9qVMSI4uUF58d7EyqzBzmbjIczxoofRuQc7pc+pJcN5fpbYbNtPHj1/kO6LuyDlOmaWx8Hki50Qt3cA15azfsLitCudrTIG1kSdzze7QURp08SsgvwqZ7l7VmdnhnkocpRSLYrYgL/zSgoZTZi5V/26Mi5a1qGDsW3SKstd9AJ7bNqmScNIyBMWEgEGW7GrHjyKiphH73wrwkQLFA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(346002)(376002)(396003)(39860400002)(136003)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(186003)(336012)(16526019)(103116003)(86362001)(40460700003)(40480700001)(81166007)(82740400003)(356005)(2906002)(47076005)(9686003)(110136005)(26005)(44832011)(7416002)(7406005)(426003)(36860700001)(478600001)(33716001)(54906003)(4326008)(8936002)(8676002)(83380400001)(16576012)(316002)(70206006)(41300700001)(70586007)(5660300002)(6666004)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:28.4516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d9abe14-372a-42c1-e62a-08db88af04dc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7031 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add "-o debug" option to mount resctrl filesystem in debug mode. This option is used for adding extra files to help resctrl debugging. Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/re= sctrl.rst index af234681756e..5a2346d2c561 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -35,7 +35,7 @@ about the feature from resctrl's info directory. =20 To use the feature mount the file system:: =20 - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/re= sctrl =20 mount options are: =20 @@ -46,6 +46,9 @@ mount options are: "mba_MBps": Enable the MBA Software Controller(mba_sc) to specify MBA bandwidth in MBps +"debug": + Make debug files accessible. Available debug files are annotated with + "Available only with debug option". =20 L2 and L3 CDP are controlled separately. =20 diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 885b656d1088..5bc18accb887 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -59,6 +59,7 @@ struct rdt_fs_context { bool enable_cdpl2; bool enable_cdpl3; bool enable_mba_mbps; + bool enable_debug; }; =20 static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) @@ -296,6 +297,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index e0570bce76a2..058c1dedb2d7 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -56,6 +56,8 @@ static char last_cmd_status_buf[512]; =20 struct dentry *debugfs_resctrl; =20 +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -1871,6 +1873,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn,= unsigned long fflags) =20 lockdep_assert_held(&rdtgroup_mutex); =20 + if (resctrl_debug) + fflags |=3D RFTYPE_DEBUG; + for (rft =3D rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) =3D=3D rft->fflags)) { ret =3D rdtgroup_add_file(kn, rft); @@ -2399,6 +2404,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_cdpl3; } =20 + if (ctx->enable_debug) + resctrl_debug =3D true; + return 0; =20 out_cdpl3: @@ -2591,6 +2599,8 @@ static int rdt_get_tree(struct fs_context *fc) out_schemata_free: schemata_list_destroy(); out_ctx: + if (ctx->enable_debug) + resctrl_debug =3D false; if (ctx->enable_mba_mbps) set_mba_sc(false); cdp_disable_all(); @@ -2608,6 +2618,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; =20 @@ -2615,6 +2626,7 @@ static const struct fs_parameter_spec rdt_fs_paramete= rs[] =3D { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; =20 @@ -2640,6 +2652,9 @@ static int rdt_parse_param(struct fs_context *fc, str= uct fs_parameter *param) return -EINVAL; ctx->enable_mba_mbps =3D true; return 0; + case Opt_debug: + ctx->enable_debug =3D true; + return 0; } =20 return -EINVAL; @@ -2829,6 +2844,8 @@ static void rdt_kill_sb(struct super_block *sb) =20 set_mba_sc(false); =20 + resctrl_debug =3D false; + /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); @@ -3710,6 +3727,9 @@ static int rdtgroup_show_options(struct seq_file *seq= , struct kernfs_root *kf) if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl)) seq_puts(seq, ",mba_MBps"); =20 + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; } =20 From nobody Mon Feb 9 03:15:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A199C001DE for ; Wed, 19 Jul 2023 23:23:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230154AbjGSXX3 (ORCPT ); Wed, 19 Jul 2023 19:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjGSXX1 (ORCPT ); Wed, 19 Jul 2023 19:23:27 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2089.outbound.protection.outlook.com [40.107.237.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C955172D; Wed, 19 Jul 2023 16:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mr3PsYlPJPT40QGh1Q5+tWdo3tJZ6wTcxQFIgQzjQVHRd3+Pa/JdUkTidfAKFwnehm7JaeIbAM24xZJgmi8RwCZLZg1JsrJsv4EtOIT1MnQK/U3NiA8y+Y7pocuEZdvENgty3OpKQOJajFVwc+WCwcUez/XheXaUlvQbLzE6Hv7kN91p3YDkQTTFg+5KWwDVZcLJNBwq79IKh1xp6gZuF9e+8+bMBtJcYyu6z6Iy8m2nKTcxbZYGAPRaOPgCM7RjK74CmXorshn8HgldN5B2qbevnNtR0vZITeEBEQZA9JY9RFWo90iI/0pErAYRHyme8gCYA3TVTiAdcih/e1Vm9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; b=d/UIwHGLS0GZ3wgt+DHJmpEE8A+yX8gG8KfKyybU5pKLfXOieHRN/P812+q8CAVKAlOfRp7wn7hgDm49InrioAQtL1No6J93Hwc2e2RqSkTgw1ayHputnFu8zXsqO3YcdT2DNUxxRfqvldDrQ3dDE9eDm6++DwypkNE/iN8RrQpGXd6MigiwTLAGQqPZLyaL1RnmB3VDDcKIas/zdO+soofX/jy3pzQchazuXGXSMs+ES1vmdb8VugOym8+p0jDByO3s/mRNFOQpRBdsjx3CvfdiMoyT12H60vtaGTmQ5LiHLv8PXS1QefL6CvHsj2onDnZEh5WdX+y96AFghitSUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; b=uuDtBnO53EgLY0lAUFuNHQf6EETNGxPCxDxs7UZF//1d7YNmHbtSuULt14hQTecRsJQVMa9KR+CPJmtSMSKwRUGAKsmlMJa1HqikQ+CCOa2Pl9UVscpUNFkMFvYbp8Q9x1m4hcZWftxIbc3RyOjbMtwQYv9A31KuYqAtY+QDZh0= Received: from BY3PR03CA0025.namprd03.prod.outlook.com (2603:10b6:a03:39a::30) by BL1PR12MB5826.namprd12.prod.outlook.com (2603:10b6:208:395::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Wed, 19 Jul 2023 23:22:42 +0000 Received: from DM6NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:39a:cafe::2) by BY3PR03CA0025.outlook.office365.com (2603:10b6:a03:39a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23 via Frontend Transport; Wed, 19 Jul 2023 23:22:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT094.mail.protection.outlook.com (10.13.172.195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:22:41 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 18:22:39 -0500 Subject: [PATCH v6 8/8] x86/resctrl: Display hardware ids of resource groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:33 -0500 Message-ID: <168980895303.1619861.15190945847281698454.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT094:EE_|BL1PR12MB5826:EE_ X-MS-Office365-Filtering-Correlation-Id: 7861284d-c289-4c43-babc-08db88af0cdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fXlzLOBc4zRU6lr/SNxddMN4wqJPvLEFBcP5nYtOLqc8K3dS5WbmWFIHHwFAtAxdVKtoMC4FG0XNPIwXSiWb5dmWYwph6RduWJlvRTcjXtUw+I1Usm3QKng/7hcjrcHkyfXV2ZYgc29OSstcUKxqQ0m4llVD2pvIGxW8NKPnaarvJcKry3/g6W113YEJT0OoHiObU/FmrmCxkbXVot30yjx/inlxtgxW5TZSGZtSDtOzw1B6FHY2RaTJZ4bM59tkTrnwoUgsLEpC56EdGo6kloU41u+K9Pmm9ok9AOP8OGvavYTKOgEIgS+A6ZXR8iUvxcBLiG4CnBkBYoMypUAlkvWdBvh0rcfthR6fVLVDysiPSSJfm3+KwmOMlzLsNjYISK33a0FsMcp6shzwmMp3K6BiXCjubXWZxt85n8M58QqaaZRodca6XHW0as9HTqzLCN9aHmpSn9/qgq/aq1znaTqRG+Exrvei3pkJ0gktiMG82BCwfcTzyHVRfGmdrGUtRvicQJJouOQyQGBMW9gz9e8RVyFPglREXVOiLO2/NILBCam4q7FpkagQtMBbwkM38DIb2vUFsNq2D/0iIhDNxVCH5nq5Lk6HG8DBDf9Izs6VbnUajzj9og/9nOTlyTJvkMqBSYeZ1UL5VFfh6jXM/AAeDOMV4IeumbutLzdPsCfdYYb4qBdMtC2oxtLTZy9b53S1vuu3yfnfdv08ydjm6CoJXx4LY4LxdiIUTjSCQhVb5yooQigJo9FE+7+B3R7E+1q7ikG+dnMDhVHBmfATLjygMiJilab8eeE51ox/xuE= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(376002)(136003)(346002)(39860400002)(396003)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(36860700001)(8676002)(40460700003)(8936002)(47076005)(83380400001)(2906002)(103116003)(82740400003)(426003)(81166007)(33716001)(356005)(86362001)(7416002)(7406005)(40480700001)(5660300002)(26005)(44832011)(16526019)(336012)(70586007)(6666004)(186003)(316002)(16576012)(70206006)(4326008)(478600001)(41300700001)(9686003)(110136005)(54906003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:41.8919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7861284d-c289-4c43-babc-08db88af0cdf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5826 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In x86, hardware uses CLOSID and an RMID to identify a control group and a monitoring group respectively. When a user creates a control or monitor group these details are not visible to the user. These details can help debugging. Add CLOSID(ctrl_hw_id) and RMID(mon_hw_id) to the control/monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Other architectures do not use "CLOSID" and "RMID". Use the names ctrl_hw_id and mon_hw_id to refer "CLOSID" and "RMID" respectively in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 8 ++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 46 ++++++++++++++++++++++++++++= ++++ 2 files changed, 54 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/re= sctrl.rst index 5a2346d2c561..41ad9b1f0c6a 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -351,6 +351,10 @@ When control is enabled all CTRL_MON groups will also = contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". =20 +"ctrl_hw_id": + Available only with debug option. The identifier used by hardware + for the control group. On x86 this is the CLOSID. + When monitoring is enabled all MON groups will also contain: =20 "mon_data": @@ -364,6 +368,10 @@ When monitoring is enabled all MON groups will also co= ntain: the sum for all tasks in the CTRL_MON group and all tasks in MON groups. Please see example section for more details on usage. =20 +"mon_hw_id": + Available only with debug option. The identifier used by hardware + for the monitor group. On x86 this is the RMID. + Resource allocation rules ------------------------- =20 diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 058c1dedb2d7..e8b35013d7c1 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -776,6 +776,38 @@ static int rdtgroup_tasks_show(struct kernfs_open_file= *of, return ret; } =20 +static int rdtgroup_closid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret =3D 0; + + rdtgrp =3D rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->closid); + else + ret =3D -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + +static int rdtgroup_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret =3D 0; + + rdtgrp =3D rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + else + ret =3D -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL =20 /* @@ -1837,6 +1869,13 @@ static struct rftype res_common_files[] =3D { .seq_show =3D rdtgroup_tasks_show, .fflags =3D RFTYPE_BASE, }, + { + .name =3D "mon_hw_id", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D rdtgroup_rmid_show, + .fflags =3D RFTYPE_BASE | RFTYPE_DEBUG, + }, { .name =3D "schemata", .mode =3D 0644, @@ -1860,6 +1899,13 @@ static struct rftype res_common_files[] =3D { .seq_show =3D rdtgroup_size_show, .fflags =3D RFTYPE_CTRL_BASE, }, + { + .name =3D "ctrl_hw_id", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D rdtgroup_closid_show, + .fflags =3D RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, =20 }; =20