From patchwork Fri Oct 13 20:25:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136409vqb; Fri, 13 Oct 2023 13:26:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFy8Qx2R2Vrbm36vCWmrcwGRyveTvKLFPDc467DVOdGLxVgcKBMbXC1uWBtaS1YukC8XG50 X-Received: by 2002:a17:903:2306:b0:1bb:ac37:384b with SMTP id d6-20020a170903230600b001bbac37384bmr31028002plh.6.1697228819136; Fri, 13 Oct 2023 13:26:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228819; cv=pass; d=google.com; s=arc-20160816; b=N8Rr3EoK6Ea25jU9o0+fhEULxIK8T9G0euKDpic5oLjDUgvBdIDmRKGau7I26DhYF1 kjrb8TYAp/W9cH7BOMMm8Obs/OHWMYlY23Vb9LaMNfA0u4zaES8lp8bU9+Iwq2zePcqw aLYrPOW/jFa2AtY+GzVTIMvNiD36BC5qAbK2ZQpBOhJ1qzjlegmnX63F5vMJuVqGZJyM G0vcb52Cfl4jsthLBDG9Sxvt+SsQUpq/JvzYD/qkzmKRYI1ympRxIoeKnIbeXO+PWmI6 puvTjUrVxpS6AgqSKeRufqeCePCmlR0jxDPjtYZnVVn38geYKrV3F3XwsAg1zY/987Ty 6Gew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mCatZGSWZUcdPVlebxVWApBrEvhOCVHeak/FRA/3ww0=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=mx5hsG/ULe24BE82XHTHQYbwS/ymBkmyKMJfobE27Q6ttdGgnmHki3sZ6sFK6zdnHU 8fpHZAMsYFBJPo3ACXYmfOAf3dmMm/MSbzOW+7ISjX6iiHLmbWlCC0rdILBj1uRUn6Kp buQr8bT27klufd1gE7dqIMvz1/phOT9ikkS5/MygLsosrJoHITR8N2hj+hc9MAwedYMC NbJeuprWWJhBjgE+MZwbM9ui3J8m9QKIu2kT8bFZOWt3KfUViJvZpn1tCpxaPOzQmenU cyer9OcJAaCaZ2qyWGkK3xZz7TDK4jaoRwkVSpvJvezdabWddRUax3bsbOZPBaIqy4lP UdHA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=COdohcC0; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 19-20020a170902ee5300b001c724cd1128si4983292plo.276.2023.10.13.13.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=COdohcC0; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8F6CA8303B11; Fri, 13 Oct 2023 13:26:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232105AbjJMU0W (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232041AbjJMU0T (ORCPT ); Fri, 13 Oct 2023 16:26:19 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC0AB7; Fri, 13 Oct 2023 13:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A3lxQiX58+3luBYVR7jDHfBi7W2SuEABlw5Qx9bqKfrtkbFvgnDj88t8ptUE5nEH42IQYT7Adt1Tqx3RQQePEIDb61o0fIi9/IFz/ZCK4o3kbmnNSVFmX/qZRjChBNWWgC18+/KiO/NqNKZyvmZtFsVKVUZ9viE/G1W5VaJooR2Xtj1pXjqqupVBEuaORWW0S3jvetUYvc+pU1W1MTXVKCRJBNhvLMEQIiHCzvi86ngfkB/HyhwGfNFCK9QCN/VP6gYD8p04xMMZygywWP/F0G9d9T09xg4hugjEAtAuk3n9G3GJf5ZzvmjEkkpF+dKtRK17ER87wG5tlKG+szwrGA== 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=mCatZGSWZUcdPVlebxVWApBrEvhOCVHeak/FRA/3ww0=; b=kdV/jgxPbXKcZyUjKB3sjZ7W18jpTWNB7U3cMXHnW23hIAmdaQrqm+hW4LVk+zn5sxTKeDkixg2ArzdVXrH6DjpVTl1WrhGcIMusISW9N8BnOu3DtAxwB+5m9meEmezItqElaP6txJ7i/9bmpSFHaBYBcyTIEvN202S9GGlWqi+c8YbbipalAAVsrCdCTYgzTbaPb/lfl482dJENnJa9RdZIWYdaQY5p43Fe2V1Dc/0+ioEgsxFpKNssaKGmR7grPQ5KKUtGINyfV5YVc6y00jHYqdPIhqK6XAwdSsrEhMCTIdJB6nsWFXj0Cae61Pnd+c2B4pEvCACCX60PFl2M6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=mCatZGSWZUcdPVlebxVWApBrEvhOCVHeak/FRA/3ww0=; b=COdohcC0ds4zA4oheQxwNOElulRth9qc0LQDLwXZ2yzPnZlc8P3Uqj0jZcK27Mt6XDHYP0+29pcgL+0Hoa36duSqbI+2jA+Bwjkx8qGN+IPOBEeX5yMcTCtG4ajTEqClnzMXUHq+wfSToWTUvsGCwDi10ww/GZAvZZz29Dkw3c0= Received: from DS7PR07CA0023.namprd07.prod.outlook.com (2603:10b6:5:3af::28) by DM4PR12MB5389.namprd12.prod.outlook.com (2603:10b6:5:39e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 20:26:14 +0000 Received: from DS1PEPF0001709D.namprd05.prod.outlook.com (2603:10b6:5:3af:cafe::c5) by DS7PR07CA0023.outlook.office365.com (2603:10b6:5:3af::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Fri, 13 Oct 2023 20:26:14 +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 DS1PEPF0001709D.mail.protection.outlook.com (10.167.18.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:14 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:10 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 01/10] x86/resctrl: Add multiple tasks to the resctrl group at once Date: Fri, 13 Oct 2023 15:25:53 -0500 Message-ID: <20231013202602.2492645-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF0001709D:EE_|DM4PR12MB5389:EE_ X-MS-Office365-Filtering-Correlation-Id: 8837f41e-2c08-4603-84b4-08dbcc2aa592 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5anyITFDpSPxA4atFvXN6038GQKo50wJVu42ya/wcFpLYsePok02QetYOp3hszNnDD1VYM4l50pMAuRQ27myDi7OL0bp9MwHudvW3JXO8FM19bL3kA9S4egMLv20VnL4Rfih+zWqk/zldDwqhhS4kiCgzrlUynDz9I1xsbyRPjFubTEX8ddmJK+WcKcyJGNNM+hp831E7y5AMuicZN+uh5NVkHr4BQDXpg8GYgxKlS+si3XdNcecLzl83kKYKOTmFTJBXaKxHxgFSqMXS85dbkexYirtiNwg2M/HtURfbaUxDZ6rVz5XsClEpeJIyUyfX5OPJLl4wXHSGFZ7crSm6xclxZQyE45VI+eADG1rYghx0fH5s3Hwv8H6pCVp4I+EjRC3OClVUPe1KIPxss/L4j7Fp5LaRkyxcmprNctauk5Z7eyPg8D8zowrYCdiUkeY+VkVprnnT+zB7mkTXPhK27SfEd9bnURomf8EaGRzGhHqnPybjvERMJwh/c/sq3tCAf8Zpdg+iDDGtWP2PbyrG20M2y1oTbC5FJ/h7Ir+D2mPiJVPSGsOP3r6w2kTKZOlcCFs9jj7MtNMXaE/uXGTJq9ML9peCO3ORhnUajD53epo6K98NGLaxW5zXIHsRbl35KA45eylFYtXCUr1hu7EBgas7VK2NizvCa4EssSK+VgOpF8GTevbJ1k0Cyo6MKjTXyWC8r4PxYsMF6wFApC7IcSBElc2xc4HjZ0czp2/hDvBQwx403uqHQSSFqil71Fa48GejF1k5nX9GiOZJNA+9A== 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:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(451199024)(1800799009)(82310400011)(186009)(64100799003)(40470700004)(46966006)(36840700001)(7416002)(7406005)(6666004)(2906002)(40460700003)(478600001)(41300700001)(4326008)(5660300002)(8936002)(66899024)(8676002)(40480700001)(44832011)(316002)(54906003)(110136005)(70586007)(70206006)(7696005)(36756003)(83380400001)(47076005)(26005)(16526019)(82740400003)(336012)(66574015)(426003)(36860700001)(81166007)(356005)(86362001)(1076003)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:14.0811 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8837f41e-2c08-4603-84b4-08dbcc2aa592 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: DS1PEPF0001709D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5389 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:26:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673406553577019 X-GMAIL-MSGID: 1779673406553577019 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 Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: No changes v12: No changes --- Documentation/arch/x86/resctrl.rst | 9 ++++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 25 ++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 4c6421e2aa31..178ab1d8f747 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -306,7 +306,14 @@ 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 and + already added tasks before the failure will remain in the group. + 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/resctrl/rdtgroup.c index 09848ff11f7b..fe239691628a 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_open_file *of, char *buf, size_t nbytes, loff_t off) { struct rdtgroup *rdtgrp; + char *pid_str; int ret = 0; pid_t pid; - if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) - return -EINVAL; rdtgrp = 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; } - ret = rdtgroup_move_task(pid, rdtgrp, of); + while (buf && buf[0] != '\0' && buf[0] != '\n') { + pid_str = strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_printf("Task list parsing error pid %s\n", pid_str); + ret = -EINVAL; + break; + } + + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d\n", pid); + ret = -EINVAL; + break; + } + + ret = rdtgroup_move_task(pid, rdtgrp, of); + if (ret) { + rdt_last_cmd_printf("Error while processing task %d\n", pid); + break; + } + } unlock: rdtgroup_kn_unlock(of->kn); From patchwork Fri Oct 13 20:25:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136439vqb; Fri, 13 Oct 2023 13:27:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHA0jlqod/FyRMoOSjzuUeUxID42OcBa0fMz5WkV3aKZ4o8xxxqSQ36ndJGWQMBbedQpum7 X-Received: by 2002:a05:6a00:10c2:b0:68f:c9f6:f366 with SMTP id d2-20020a056a0010c200b0068fc9f6f366mr31306687pfu.0.1697228823129; Fri, 13 Oct 2023 13:27:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228823; cv=pass; d=google.com; s=arc-20160816; b=soSqF6990p7MNGAhtM2bOE7k5aVkqZeg+NSyLNkymaBBuUjWVWxM7djEkg/7+em5L8 R+SdKxVlQ2r/VZu26WrjgkNcOow9JyhMrqaCHg/HufncUOY/vjFSb/i6ne0f1fJqFyEi Iv6pJSlmTMrkwqBjUPVgycXyKhrWKNZNwMyOPsSdR6TclIMcxKvQWwuBgI342yXJGCc3 7uHuXT56iRL9ow83VkiQ0btVekc4E2VX8BMJ4/xnzOpYsxuqWr1nQlqe11BZbDxy6OmL n5y/m6mPZuY+tlBGk6a0vuM9Pl9Mb8Ltd5d/ElMzzWaOQR2MdS9HmJl8dwj5Kon0Tmks s5yw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=paP205jq7Mf7YYCCvKN44Nw7wgiZLx+lCH74vmNkMko=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=oApX8f6hINmPhtuJnPww7NoCKsRk7YES3P8+B4TclLitRlYUzmfuF+LFHartGBJq2J /UFhzZ4N7a4NQ+nXJtQv3IpenCBHRHaxJNblah9DWX47AS66rZWLO7icV4ZXZZE5/vQ9 dxx+jM08yUZmx9+Cn5sHx3XNZHRz6bPwL0hrSQojPDOT7LNymiu01I3jxiiPDRPju+YG EC4G8pG90Fa1lqk0h+KnqQvMSAeL4Y9aS1M64Cmr9YQnYsr/w+R8QQ6tSGXx6xvzDicH wJ+RFxXkBsFwiVowYvkTRfdXV9/EkHIgpW2Q7bCxGdBfY39QALLtys1cwTaxAwNT57SD bENA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="W/D2BeWg"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id h8-20020a631208000000b0058572c8d5d5si4878246pgl.233.2023.10.13.13.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="W/D2BeWg"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 08BDD81BD010; Fri, 13 Oct 2023 13:26:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232157AbjJMU00 (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232083AbjJMU0V (ORCPT ); Fri, 13 Oct 2023 16:26:21 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2075.outbound.protection.outlook.com [40.107.94.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E460BE; Fri, 13 Oct 2023 13:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U5JVg7AVKfyf9NH9I/2nBNIcXKfSvdC/SK0DVl9FET+wywSvrTGpHZt+cEahES8GlozCCfSckfbriXG0IYcEnscHgBZ21OEsMCBPUZzQ3zkh6Ky30CGk81S29RTg7RsVu7dbYIXd8mEF78gt8j5osnogTSE20vRrJfrIJNKalXhZcy2WgZS7CceFwiKSon4+iNIJlz//7sHVmmKZC0QIh2PZCZ3ubKkaXCDHx2ZEL3TEB8wj7l6olJPcv2qR6mMQirb1PJrsYfnoeX5KXPZL409tLT/zqeOF+jqKRQkK6CJTtmj0JxvJJT/Eq0/8VkRkMjdMTwMjXAaki7qWtl6zBQ== 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=paP205jq7Mf7YYCCvKN44Nw7wgiZLx+lCH74vmNkMko=; b=Lh/UD0R5FQ2JxGvj49+wRHXlh8vAEwy3rEILQZel1/Wdqm+Uo+EPXNxJfKMNRZVrnSRvIRz6k0lbVhrkO8ce3x05nzM5JpW1BqcyYNrmkIWwUo/fFKgftsjr4R5KTtrEfhRFeDsP+AauZrRmqRBbLqBThVOMZItGKQydANWRAXnWJzjNvjQpRNNSVAIzs81DWScK/MNIdH2KPFKAvS/KhOTrhddsszeWw+TzytL1++Zsfu3TDfs1JvRqXkB6EoFny8cbnKsqDwi70XoWHUahkncVO2joNLwjXqYoWsKaZDO3xfWrOOz1ZM+GYi2aI4QI1XE9KjQ3/Mrq7TNGZuNY7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=paP205jq7Mf7YYCCvKN44Nw7wgiZLx+lCH74vmNkMko=; b=W/D2BeWgppskLuGYhDKOGKSnTpnDas03dDO2LjlEVgPiidub7LaOgxCJiLZIqSVjZyCufpOi41skDfFLVEtOrA8horspbc6czmoWU3ZLTmv9ABEPad2Wnn82yYiaQOYAfnnqtVp28vp7n6GM7boBlYfKFGXXUDG1ZDgtf0Rzqd8= Received: from DS7PR07CA0021.namprd07.prod.outlook.com (2603:10b6:5:3af::23) by PH7PR12MB6489.namprd12.prod.outlook.com (2603:10b6:510:1f7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Fri, 13 Oct 2023 20:26:14 +0000 Received: from DS1PEPF0001709D.namprd05.prod.outlook.com (2603:10b6:5:3af:cafe::ee) by DS7PR07CA0021.outlook.office365.com (2603:10b6:5:3af::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.28 via Frontend Transport; Fri, 13 Oct 2023 20:26:14 +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 DS1PEPF0001709D.mail.protection.outlook.com (10.167.18.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:14 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:12 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 02/10] x86/resctrl: Simplify rftype flag definitions Date: Fri, 13 Oct 2023 15:25:54 -0500 Message-ID: <20231013202602.2492645-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF0001709D:EE_|PH7PR12MB6489:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bdc74b7-39d9-4296-33d8-08dbcc2aa5c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e3h7QfG8XWEPQbjehmBnzKXGjoErwMRK4p1fuuXf31uLIEvdl0HJEg1RwtlarPfqPgnwD/dlOn6shZSS3eH60CgB9EyP07jVdKAVR2dlmjTW2SLOG9H6pv9i6VKp6NrKY/XhPWybxTd8r8P2Knim6s45oF52klmt7qg/AxmZzWBaUo4jyW4l/GcCJnjBu7hT/Ws2JcWBW2zRw8BRjPhqfA5CbAdY2lyw5HT3KbCyC7ifZivq/Sc3Y/QW7b/XsESETTK6j/gJFtUGVpkoLUlZ1S5FwOEqGUpq4H4fcHQLkmCfaslfvYGNOStwfEL2ACzt0WgRdmkn3OTzQEoUr9iYu/pDQDjjtzRfgNl6dRxthYGCjZja9cUhuPT69XChNdLMSAw8u+mwFn/t8zH4aaAYI0SQyK39Ui/vAE7Bl04MzOFI/fOj81hUPr7M3MSg6rnXfLF5XCV+U/6xyd09YZ/K18r8MkDbdUxLJrGpdJxZP0rra3yufBkcrcDhj9D38dPy9HkE5ub4VA4+ukqaRCYehdBk6dDJASvouZUtGj4mBik6TCKPFjh9M5KjHNyyximV613EiuY0D4iS2fvVp2b3CAn755AXFbpaWzjYk+JsZZr8JHBxveEWTGAMyV1fM/oFQCSSwfp3l+46zyISV2tUk1CwpR6JeKHePc6Wxr7Lh+ykVZoIrHPkw+g7+2qLH7BMAEFohqM7rj+w3bTUAsQMWOt9byUfgsunyrx7RFe7bshblbNQJsOYxsu957907ipDFoH4EPssu4ZGLW9h1oaZTA== 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:(13230031)(4636009)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(186009)(82310400011)(451199024)(64100799003)(1800799009)(40470700004)(36840700001)(46966006)(70586007)(47076005)(83380400001)(316002)(40460700003)(8936002)(356005)(4326008)(8676002)(82740400003)(81166007)(110136005)(86362001)(36860700001)(70206006)(40480700001)(36756003)(54906003)(2616005)(41300700001)(2906002)(7406005)(7416002)(7696005)(6666004)(44832011)(1076003)(478600001)(336012)(426003)(5660300002)(26005)(16526019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:14.3936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bdc74b7-39d9-4296-33d8-08dbcc2aa5c2 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: DS1PEPF0001709D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6489 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:26:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673410768075766 X-GMAIL-MSGID: 1779673410768075766 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. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: No changes v12: No changes --- 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/resctrl/internal.h index c47ef2f13e8e..0ad970c5c867 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/resctrl/rdtgroup.c index fe239691628a..09141f1f0b96 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3260,7 +3260,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); + if (rtype == RDTCTRL_GROUP) + files = RFTYPE_BASE | RFTYPE_CTRL; + else + files = RFTYPE_BASE | RFTYPE_MON; + ret = rdtgroup_add_files(kn, files); if (ret) { rdt_last_cmd_puts("kernfs fill error\n"); From patchwork Fri Oct 13 20:25:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136458vqb; Fri, 13 Oct 2023 13:27:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo5a55IscabGWxRybIvLdyME4gt+0YVSIqjnL0jLuf03Ptut/nk5Cx9vg3zLwCLaOL0igX X-Received: by 2002:a05:6a20:431e:b0:13d:fff1:c672 with SMTP id h30-20020a056a20431e00b0013dfff1c672mr31395570pzk.4.1697228826033; Fri, 13 Oct 2023 13:27:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228826; cv=pass; d=google.com; s=arc-20160816; b=S5UDVH9sHcMYRW1HsXGcNdrTl+ueDcNnUSHKB/257R0v3s2mY4AVOfB844JRKmo398 lTMerv1HUyB9cW3XCI8GkDJtqvuIGquHN6t4vx6+mpQAV0OR50BoCIPmv7qA0/vstXgu YjDgax8LQBeqT79LmV9TriezhrTP1GZG7/vQ+RfYXNKdulmBoz4T58VbjBmAuLnxONbb 56pYEaoHZu0RXaUAQMqIrF6J3NJEtt8w0lLBtTvIXUs0dv8ct6oduqzIn5eR3apq2nTc ngOf0bJCSC9z/wV+WVDbN5clItQCo73PwPkOwpd8taz9x6sw837jtlWN6ccogbfPbYab CvHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xnIl4U+OW3MUJzJwILuIlJmkwXHrfA2c4XaGs2GwoCk=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=Acd/pKk4XXJNtjnQDyuVSnM/4WZTxIXggNybh1Hjy6NV5YRVd5SBQBAdhKf8JDD/AG PpVAx2FXDIUGQRIuFKN0A7zqUq2Ri84F+lWwaK11fDMWeq7SsaBkycrj0v9EFDms6FGP J/vBjWAnqhv7NCEYp28XjcsU55tbdwuqTUxb1VXLuFRVKI63FiuC4EHDjNf9E86tn5zv 4/8fRMy21+lnPqWVfUeCMLgtGWXKbJHpJoak3j4T5fnKRnpuhNBj4vQAYyY+2gZuMuAt bWbrr0Gml+MEwgqiH3fXG9GiJt7nvIfuSYy4qQC/TdvsenxGQcF7uDAHkOB5bs6TkLpy C5mQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3ZZGzxow; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id k2-20020a635a42000000b00578d1b590b0si5011746pgm.699.2023.10.13.13.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3ZZGzxow; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 21D3782D981C; Fri, 13 Oct 2023 13:26:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232229AbjJMU0c (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232091AbjJMU0V (ORCPT ); Fri, 13 Oct 2023 16:26:21 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2052.outbound.protection.outlook.com [40.107.101.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8A4EC2; Fri, 13 Oct 2023 13:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lg2rZKLOrE38ZmUBMVcWlgUxMisbMpyEy+dvjNsef3k8fQarCcAwPwOy03llWQz/CEc8Y0AfWxlIjdE5r+/XQ7k7T7gZs29chtWwg9AkJ4RC7J5aSor+N7PNHevwIh2h9o+XLcmYo0sNlkmur4OO+llUUeICTTj+r1LPdf5/jmcqWTiW6RVc6teMhjcn5msv5XgO8N8LL7K4FFzokJYqBbUhZ8ENdMS8YDxTqFjFmmJ4apkgj7cexs++WYEk9aHY4zMGjl5ihuLxCjSj7thk7/RW62W2w/M2B5kJLbLoIqPRureTknwdJ16Aeo+UvD9WLZWNlRXrzstmPmZgZQpSmg== 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=xnIl4U+OW3MUJzJwILuIlJmkwXHrfA2c4XaGs2GwoCk=; b=IP9OHah6baNY/zmsLc/QoE1Z1ys6Jk9khyQpJfvgOXPyJsIL6cDhG3M9ni+716Git9KUyXbPexINKGXK8xQcqDy9vDFvEW71jZxaeQ48ikm43KyUC97+wkcz+nk+zyPeZjztZKp5juqtHkyb+EsXViwEdgtnhZevaMMJjGnLPGc9olom7iHxNWvcNEL05gpyTJTt3avcKoBtZqhYhVaigGncLGvCjUKNzG1amesQJ4EOQ8W/4Lou4PhMgvgMDVd8dpcO1H4OuS5nGjuOFkDrJvMlTKCOPjZCyb2BeS56AvlPwxNLt0r5xojavIUMp1yCPUfy7fgm21sX5oxdkbNNAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=xnIl4U+OW3MUJzJwILuIlJmkwXHrfA2c4XaGs2GwoCk=; b=3ZZGzxowFqzp20HRnkrJtkfGGwfoRvTA4wLiQdVejWKU9zZ1J0hogOZFcL+SF5OEGlycH74Dr0cIXvR+oMgJFYnCjJWgPM6/AV2IBWqVptuHVotyCjK/oqLH+DSZcCP4C50wrQQKMUBugfQR6ioUiXWxw/Ph3qUDfVUPAjkAJMs= Received: from DS7PR03CA0358.namprd03.prod.outlook.com (2603:10b6:8:55::7) by MW4PR12MB6754.namprd12.prod.outlook.com (2603:10b6:303:1eb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.43; Fri, 13 Oct 2023 20:26:16 +0000 Received: from DS1PEPF0001709A.namprd05.prod.outlook.com (2603:10b6:8:55:cafe::8b) by DS7PR03CA0358.outlook.office365.com (2603:10b6:8:55::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Fri, 13 Oct 2023 20:26: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 DS1PEPF0001709A.mail.protection.outlook.com (10.167.18.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:15 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:13 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 03/10] x86/resctrl: Rename rftype flags for consistency Date: Fri, 13 Oct 2023 15:25:55 -0500 Message-ID: <20231013202602.2492645-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF0001709A:EE_|MW4PR12MB6754:EE_ X-MS-Office365-Filtering-Correlation-Id: 08570af6-1552-4feb-f7ff-08dbcc2aa694 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ax8PtSR8uKuynG7sJ+EX8c7QNE5f27Mb50qZCZZYiLF0zKPxx6mq992emQr1B+xOZF4VHMkzlZLzt+X87uysnTOR+DonDZ4rcX+ab++/XEKZAn4vhALlGOhfcwdbqO0yw4oVvvHLoy3BiHOe1XhfnI6kz19845nyT0hTn+wB1GF4XKBphDHVqm0FuxfNV726nWOumeBap2Q86qIwf3RNSAZ/mIlVeepf8ZdZVPPRVAbHadAKjEXjKAbjBwxhRTLibtNLv8aYK10Uaj0kV/ymjS1sRxHRHoo5DEIZIiUOqlmTdS97yY4tFY8QW/j6Nh+n5zUHj0Ej1hdDz0AnlCDnbpk7u6DgUIe2Yo0QuC0m7rEG4xCGIJPJrGifA1URlLsoHp/UPW3H3zjHWNkKx0xtwYZEsKDh2pX9V31Rxu/rNTiPnYydj80lz+VsaYE+vDDH7b/uHWSh81t4ieTQImNLcNPnR4Pr1jyKKisPideRVoETaaKlmz70JDwCJtR4KSp45uwKkv5Kdn0dtZFIe/Vd6LYRJTeB/C8SCWVVQGLCNdQk2pvzEaq8wkQ99ZXzzC7iiIWN1LX1j3gGFnCWjSikv8VMbVvKMENhooawi4N3rfl7mKcKSfb7jL4LWdOwFkJbbZOZTlVtvbxZd3KlbOpl25nY9jcqVySTfWw06Q/wH/9M2kuV+/O3S2AGtUyIWgqNlaAz+jrQhsQKrDC18zSbdVhnM01E1VXqu21whDvTSqTQxpBPVPYgRYDMjPC5VfFNSum8DKr7URloGcMtnETQrQ== 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:(13230031)(4636009)(136003)(396003)(346002)(376002)(39860400002)(230922051799003)(82310400011)(186009)(1800799009)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(16526019)(70586007)(110136005)(6666004)(2616005)(70206006)(41300700001)(1076003)(316002)(54906003)(26005)(5660300002)(83380400001)(336012)(4326008)(426003)(8936002)(66574015)(8676002)(7696005)(478600001)(44832011)(7416002)(40460700003)(7406005)(47076005)(2906002)(36860700001)(40480700001)(82740400003)(356005)(81166007)(36756003)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:15.7280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08570af6-1552-4feb-f7ff-08dbcc2aa694 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: DS1PEPF0001709A.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6754 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:26:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673413115771935 X-GMAIL-MSGID: 1779673413115771935 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. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: Changes related to rebase. New file "sparse_masks" flag has been updated. v12: Moved the RFTYPE_MON_BASE definition to patch 10. (Boris) --- arch/x86/kernel/cpu/resctrl/internal.h | 10 +++--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 44 +++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 0ad970c5c867..ba4611111212 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) /* 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/resctrl/rdtgroup.c index 09141f1f0b96..125d12d8f4b9 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1716,77 +1716,77 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_last_cmd_status_show, - .fflags = RF_TOP_INFO, + .fflags = RFTYPE_TOP_INFO, }, { .name = "num_closids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_closids_show, - .fflags = RF_CTRL_INFO, + .fflags = RFTYPE_CTRL_INFO, }, { .name = "mon_features", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_mon_features_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "num_rmids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_rmids_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "cbm_mask", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_default_ctrl_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_cbm_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_cbm_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "shareable_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_shareable_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "bit_usage", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bit_usage_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_bandwidth", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_bw_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "bandwidth_gran", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bw_gran_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "delay_linear", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_delay_linear_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, /* * Platform specific which (if any) capabilities are provided by @@ -1805,7 +1805,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = max_threshold_occ_write, .seq_show = max_threshold_occ_show, - .fflags = RF_MON_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE, }, { .name = "mbm_total_bytes_config", @@ -1852,7 +1852,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_schemata_write, .seq_show = rdtgroup_schemata_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "mode", @@ -1860,21 +1860,21 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_mode_write, .seq_show = rdtgroup_mode_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "size", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_size_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "sparse_masks", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_has_sparse_bitmasks_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, }; @@ -1931,7 +1931,7 @@ void __init thread_throttle_mode_init(void) if (!rft) return; - rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; + rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB; } void __init mbm_config_rftype_init(const char *config) @@ -1940,7 +1940,7 @@ void __init mbm_config_rftype_init(const char *config) rft = rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE; } /** @@ -2075,21 +2075,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) if (IS_ERR(kn_info)) return PTR_ERR(kn_info); - ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); + ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO); if (ret) goto out_destroy; /* loop over enabled controls, these are all alloc_capable */ list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - fflags = r->fflags | RF_CTRL_INFO; + fflags = r->fflags | RFTYPE_CTRL_INFO; ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags); if (ret) goto out_destroy; } for_each_mon_capable_rdt_resource(r) { - fflags = r->fflags | RF_MON_INFO; + fflags = r->fflags | RFTYPE_MON_INFO; sprintf(name, "%s_MON", r->name); ret = rdtgroup_mkdir_info_resdir(r, name, fflags); if (ret) @@ -3727,7 +3727,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE); + ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); if (ret) { kernfs_destroy_root(rdt_root); goto out; From patchwork Fri Oct 13 20:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136503vqb; Fri, 13 Oct 2023 13:27:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtkVpixaTaBMJmV1Z9i9XUnkaQESv1rZUfau2g6nsQpYmRxBHX4i7oYGZg8gu4+wSrBvEh X-Received: by 2002:a17:902:dac8:b0:1bf:1a9e:85f7 with SMTP id q8-20020a170902dac800b001bf1a9e85f7mr31553844plx.1.1697228831407; Fri, 13 Oct 2023 13:27:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228831; cv=pass; d=google.com; s=arc-20160816; b=04GEQfxgXF5HaUiI/EueKG0duGoFxsqfmC9tRbGXbLYquS5tSgEdqJU3n84X2XxznQ eeGVfjFPEwEtEFBvUnNNu7tja2SZjCmZInpSXB1yz2q4D+neO65nT6yTf9nEKSftmKrW DI+W5UeAKQJo0QtySCau+AKOMp9YKR5p2LtMNg+yKIC0f9hO+rx+LnLLi8G2EpVyvJjs pRhS+3kjmQGIf2EoU7m2gE/C6+MRrraZoDspWD1av3ZZ2BedGTwaovJtBnja6A5Kky5C sYbz4kqBHggsToeOnyfZHnYVdxjxc8TVKqWdrnyTQh6vh/yB6qTef99Me61pf7tqenqE g6Jg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W+cuwXqDoO6EAY1Xh2HSt3VpcRgwcwOk8iItpy7V0MI=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=lgP+4iUAt0SPjaT1oTaihvcNMVHIEGU/3DzZ7WSFzXR52MYpfJlaplSMYpK3hqgC92 cJpJwvglja5NKZa/8S0a0YzTXk3Q6GFoTJybD2kTDhvvf0AlJ9h1wBn6wm6PXufA1+Hu fjipG+ovmKtsrhcrTMWBs3A69jxJoSPF0u+1YVAgvgrrIn/Rln/BcqRkgwTtP9aUfSAt vpY9aB/e80QXNRiH3q6XrveeA26603QALesSYV0TqoQpebIdvCA+5LlJMtnvqGQE/FSf uwW/LTgSZvnnpa2KHdRKWaMuwSQF1cShuQhtRHjbkfN8L/G5HMnUP3K5V6fcVCjQgCpV M08w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HTVIWoO0; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id h6-20020a170902748600b001c3e9170068si4852071pll.61.2023.10.13.13.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HTVIWoO0; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4F3DD822B71A; Fri, 13 Oct 2023 13:27:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232200AbjJMU03 (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbjJMU0V (ORCPT ); Fri, 13 Oct 2023 16:26:21 -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 3E38883; Fri, 13 Oct 2023 13:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eCom/2oe2jO4XLcqsCEDy6PVP4bRr3HeaVa7cWSekZ1Eq1W+o6H0kItvsgIHVAPe5jOFnShqjJ/uvv0wAkSeCYroZRXyVlOJorP3Jm6GdlpjqQFsdcdcuCAmPZu1l4WRuzjZ8ZrA1RNTDdRbIGeaxgbqaMKmnHV38adqPbpvqNkAivbXb3TL9+S0n5kjXj3LP2AEjKEEQE840QuPa6jELNLMHzX+NRjKnil7xKKbJ6TkinC+9SHfwblMX0oGQVL/4B+nDv0fvMM4KUNlBxdyduliQkHTipcxU3YxxBe4EYftiy/fv6xQbnaYDntWTzshTq0M2hb0dfOVDfbPyet1rw== 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=W+cuwXqDoO6EAY1Xh2HSt3VpcRgwcwOk8iItpy7V0MI=; b=WSKU3U8YNJ6zwpOGuRB8zLV/EbmAO70jRFdwpbBf98ETuVREHlp/2Iy1ncZMH00w1TQuUoc/d2ODUDor2xTXf/dY9BUcr9mPE7ppQoMzMym6bxOgOvyNZb1BWn2Sb8WbgHEesmT8U3mVTZQg2sIwVgFn6pV6GhmgMq+uJQgEV0DfKaRu/klEpzOMuMmbPs+ED2cbM+xwpkyCpHmepoNMcjrySWnEsLKPKhB0WUk6jX/dKrVLTav3hQF3ZP737Ce/GsnZVOKrERbThVVGBbhAr4dPSGp8K4dRXTtdJtDEw1GyRU9QBUi/ieuHKulDmciKdRSY3jw6OHBQQDTcjfyyaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=W+cuwXqDoO6EAY1Xh2HSt3VpcRgwcwOk8iItpy7V0MI=; b=HTVIWoO0Qp5BK+ea5i2uIvclK81MTUpoEQEee3su6pNyo0DmxUe3JLJpVfAFFZsL7ZvrnHu0zsg7aMM1asknpYeQ2NaqbA2K9VizDzu/OocbB53H77NmbiejMW41bR9ewU1IhjF0RQxW3+AUbZqVAwFRCy9OOhDTWNkDpg2e5/0= Received: from DS7PR03CA0358.namprd03.prod.outlook.com (2603:10b6:8:55::7) by PH0PR12MB5500.namprd12.prod.outlook.com (2603:10b6:510:ef::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Fri, 13 Oct 2023 20:26:17 +0000 Received: from DS1PEPF0001709A.namprd05.prod.outlook.com (2603:10b6:8:55:cafe::68) by DS7PR03CA0358.outlook.office365.com (2603:10b6:8:55::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Fri, 13 Oct 2023 20:26:17 +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 DS1PEPF0001709A.mail.protection.outlook.com (10.167.18.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:17 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:15 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 04/10] x86/resctrl: Add comments on RFTYPE flags hierarchy Date: Fri, 13 Oct 2023 15:25:56 -0500 Message-ID: <20231013202602.2492645-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF0001709A:EE_|PH0PR12MB5500:EE_ X-MS-Office365-Filtering-Correlation-Id: 7983b7a7-44fc-4373-b2e6-08dbcc2aa772 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ceYtmxmh1aVJ1Whj95nYdhj6N5NGw+6QVjurNLpIM+P8W6aVLzoZumj0NHIphOF1gKDJEXFatF5LgrFjAeJub4Tw/rW9EG9MAcWnyrwsIJc8Sd3+rcFernZ4bIz9PRl42Jgjhy4dsdleeutRqBMl+5nhqw0FmVX6pyNKxP82qXFLBWEOEwu3sH8LeUpOUKHIpL2HhH3CFvwOgjLNtsOhR4K9uQSb1NNz/VUUXn0sTnnrTOyJfVdwZitjm+RWvRyZUZRMcIzvCDHxk17JYtgJITbfgR0YKfgcfrVaO8PvE2eCmH8T6Cg5vapEkvYCB222TMJXce/4kPmVHL+R7X1NdeaYaVe627ahxjq4TI7Gwb56mGHkCTcoQ3GOjYnZSWhGgnKuJhDhsnVShF6owxQGpj7AA3Vj4DKj09uYRIJUWmUbHsKGpGQPo9jGBq7L9HvYRavB2tBx9BwhIWoiCPdwhSjY16hDdr1GCEZrwZemh2IPzm81QuQVuxdSykpl08ZbqSy+VL77TfMcwVqQSF1TLi70LcWAW0cKGmWfaLGAejQarUeLRKPRrubkypJDovUxnvwrXgcStq7LBmYgBlZc3p0kjGWfKtzSi840j27v6W0vjmnQ0RicDSbSricZU09aQX8ghRSrY9suw1sYFxUACNEJ4Fp/fwAI1kUnBIc9VMjXCY+EjG3+yayMslUOnazN1rjBl/hBP5aH5cLbV8K470+wgScNuObGg6hDB6T/LnX8Ur5JqgLA2IWlljJvhtPkaBDBnUab0hlsax0blXjQDQ== 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:(13230031)(4636009)(346002)(396003)(376002)(136003)(39860400002)(230922051799003)(451199024)(186009)(82310400011)(64100799003)(1800799009)(40470700004)(36840700001)(46966006)(8936002)(82740400003)(36860700001)(2616005)(7696005)(6666004)(478600001)(86362001)(47076005)(336012)(426003)(110136005)(316002)(26005)(70206006)(70586007)(1076003)(16526019)(54906003)(8676002)(5660300002)(41300700001)(44832011)(7406005)(4326008)(7416002)(81166007)(40460700003)(2906002)(40480700001)(356005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:17.2280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7983b7a7-44fc-4373-b2e6-08dbcc2aa772 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: DS1PEPF0001709A.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5500 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:27:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673419194854336 X-GMAIL-MSGID: 1779673419194854336 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 --- v13: Fixed the format issues in the documentation. Needed few minor format changes to address the syntax issues.(Reinette) Removed "Reviewed-by and Tested-by" flags as the patch has changed. v12: Moved the comments from arch/x86/kernel/cpu/resctrl/internal.h to Documentation/arch/x86/resctrl.rst. (Boris) --- Documentation/arch/x86/resctrl.rst | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 178ab1d8f747..1163da74f734 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -369,6 +369,70 @@ When monitoring is enabled all MON groups will also contain: 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. +RESCTRL filesystem implementation notes +======================================= +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) + + Note: resctrl uses flags for files, not for directories. + Directories are created based on the resource type. Added + directories below for better understanding. The RFTYPE flags + are defined in arch/x86/kernel/cpu/resctrl/internal.h. + + info directory structure + + -> RFTYPE_INFO + Directory: info + + -> RFTYPE_TOP (Files in top level of info directory) + File: last_cmd_status + + -> RFTYPE_MON (Files for all monitoring resources) + Directory: L3_MON + Files: mon_features, num_rmids + + -> RFTYPE_RES_CACHE (Files for cache monitoring resources) + Directory: L3_MON + Files: max_threshold_occupancy, + mbm_total_bytes_config, + mbm_local_bytes_config + + -> RFTYPE_CTRL (Files for all control resources) + Directories: L2, L3, MB, SMBA, L2CODE, L2DATA, L3CODE, L3DATA + File: num_closids + + -> RFTYPE_RES_CACHE (Files for cache control resources) + Directories: L2, L3, L2CODE, L2DATA, L3CODE, L3DATA + Files: bit_usage, cbm_mask, min_cbm_bits, + shareable_bits + + -> RFTYPE_RES_MB (Files for memory control resources) + Directories: MB, SMBA + Files: bandwidth_gran, delay_linear, + min_bandwidth, thread_throttle_mode + + base directory structure + + -> RFTYPE_BASE (Files common for both MON and CTRL groups) + Files: cpus, cpus_list, tasks + + -> RFTYPE_CTRL (Files for CTRL group) + Files: mode, schemata, size + Resource allocation rules ------------------------- From patchwork Fri Oct 13 20:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136566vqb; Fri, 13 Oct 2023 13:27:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHlBrK0DkxPhi9QApxUHahx1U9ipnhhmcFsVmhWZtHGdM6N3wuUvt0Ei8jGBtJADnmMM37 X-Received: by 2002:a05:6a21:a5a0:b0:15d:a247:d20c with SMTP id gd32-20020a056a21a5a000b0015da247d20cmr36448639pzc.6.1697228841552; Fri, 13 Oct 2023 13:27:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228841; cv=pass; d=google.com; s=arc-20160816; b=HdwBJWKXsoK1/YyzLHPOQaXvkkXhvdTh8MfD+m4LFX6aa6hJGLYRv17ZeTu1tpVDjh qwNWKNCSuH6Jo/E/ohnvWtG5Hcva5SrJ8qLGhf4BIFfEMfRDOftW2rpjBbJUeua+bkKX LdF8nYjP3gtJgCPs3GnwhnC2qK5PX0ULBLMnBf9rS3XRaZbeJJZjQAsw2s9UVUIspX/4 FaDaScSAcYiNP8kTVbC8GTPW4Fn32vWfDaY1l6RCs1S0RztbH6gSZPWtXxs7Mh4YLjtm YFkG2zn7E/diH3O+3Snsp8NDseceE2iD1AVz8/KK3RJyjLwBEsCaw4h+tHn7dp4HN9zU Rrgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dpG86LfixhfZA2Z5Qcg7xJc1kk3UM5piBnHQAQ36ZBI=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=zYtmCCVTHqwhzCxmyvY1G5S3+CMBFq1v6N7jQy7CWarVIR3s8Pa65EXQHfzKuR9+0t 2yUDDyv9i5bwYKsIFfAQl8F7Yk9emW9gLTZZRIHQgS1U86JzoCkYCH5mTRZj6qesT5vR xFnQBJDt1t6J65hlys/qdU2AjorRznutwzn0zytTAr3DTJR6/o7PM6KriEDoQ6QHapDl HMMwh+sHgwDsaHHpBRuAJTDDOC/vUA+OgoYpQ8NivGf9FynwHiS7cP6Uu+17Z4qWu9yR fRbyBy1kd61N+lQI9HkJOSyUNr9af4ss1s6lg/Tlf+Z26biz6kY+FTw/YcXpfvSoVipz V4GA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RmvlmSlt; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id r69-20020a632b48000000b0057751b7788esi5351150pgr.488.2023.10.13.13.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RmvlmSlt; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E2B4680AE80B; Fri, 13 Oct 2023 13:27:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232242AbjJMU0f (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232124AbjJMU0Z (ORCPT ); Fri, 13 Oct 2023 16:26:25 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2084.outbound.protection.outlook.com [40.107.220.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 926DCD9; Fri, 13 Oct 2023 13:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hutBAgPQfPJwS8RS21lj+//HDHXFj/eGbZ7IGAcEqLNagoClEStOJX5MjExbWar9bASodPzVETTtIWtJtZTtNA1Dpog/0/6Pdmy+kJn51UXIe1G7aekJYg0AY9Hc9/cg9oi9gzoHtS4y4seYtU79jtTLx3j89cz2Htjnl1KWAjhYngiARx/yObOYCJTWnaZmD/rZ8/tGhiJAVCsJjGEwcHVMkdO0+AQqKIqlaqqOCa3aWzlMoKvbHjo7VFtZcNwPbSB9j/d/1lyFeEUblyb5YNQbfOLxalJQ2Yi/VMfdeCuRf385JZ2TBMmdrgX2/qYP1w6UGIg7jp1JCILtCYnYZg== 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=dpG86LfixhfZA2Z5Qcg7xJc1kk3UM5piBnHQAQ36ZBI=; b=XLiomrK6HSyJ1xu2OeE4Uw1r8FDZKZzzhx76MvevUPRSqoIJSbKaNGkDaKophjx8i7FGfPCTjQjfcQMtR8z40DBTq+wzXrIlwHNGGXSF5XPAGPRMUHiI1B6RFkVC3EJ6Su1dg5aoc+AHHiPy9fMpBbMFPuWX6ipQu5XIzKl7+NeJur97AywLJqKS+JqeN3QIherFccs98AnMo2mGQTACkAAjy0KF8ibih2LCUAQos9Gdls3QC2529BcAmAE/RdiYJCTTqCUfLotngNV/OtCnjXlipW7m1KS8eNPPJbPMk7cvu+jOtPwygaza2afhFmcQd7mZoiFZT6p8LnVpQjUcGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=dpG86LfixhfZA2Z5Qcg7xJc1kk3UM5piBnHQAQ36ZBI=; b=RmvlmSltmOFgZDl0hN5DrS5ADRM8JQnr2vjdj9qtyPVm+ESxIwdJTLy+acf6J/c6fcz7dSKkOCL+H8yCFFxsrUXqTOtRfU1EN39Izqrl9DHneVpN5dQ5KM5E2cwww35Qv63N8O53tHg5sxQBmE6MiBR9SVxQpdZx/Y3vkB6hJg4= Received: from DS7P222CA0006.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::23) by PH7PR12MB5653.namprd12.prod.outlook.com (2603:10b6:510:132::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Fri, 13 Oct 2023 20:26:19 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:8:2e:cafe::e1) by DS7P222CA0006.outlook.office365.com (2603:10b6:8:2e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Fri, 13 Oct 2023 20:26:19 +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 DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:19 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:17 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 05/10] x86/resctrl: Unwind the errors inside rdt_enable_ctx() Date: Fri, 13 Oct 2023 15:25:57 -0500 Message-ID: <20231013202602.2492645-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF00017096:EE_|PH7PR12MB5653:EE_ X-MS-Office365-Filtering-Correlation-Id: 73fe8f57-d24e-42a8-bdc7-08dbcc2aa895 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MSBG9hWwM0wUrhXE73bEuwszL5wUEBnJWx7ZPmJJPmrPOMWAsei3dyEJlRMJGKM7npnHZZi5KyutiSahe8XrRUitUK5lFu+s1IhG/RpE3ZZ+hCApyagvOwdkKjeoSZnVIUVObQR3bOd4V+1jPC4hNCTzSQfbwCMHXwiBzZGykzTaGTJNaIwjONb0jRWc9eykvUIhVfSqlSp34Ty1fjzDO7a+U6YCgMzB8OT2nFORqxWNI8YKOnZVbg3UqQJHeuofhs3pIgILyQlycFXowEuSDTXTofY6ygCPqS8tiMN0cF0G1gTBTQcYGSyKe7m1FngsVx1e5Cd8VBH4eIqMX6tU9JV1APZvDdM8VIPralfdiIXS1EWnx9weYG5XpAMCqksU4xX5+oDupbFrjcl9r1k21kCBG7bf0xRPMQCqBCWhyjH0aMcJWOCyxO1yzlbpsDcnrdU7B1Dl08aRTOwHWK+6iQ2pogMNJFwNXeNqQbC0W2792j7K4skZH+V8xYukaPZI9KwIjd94bVy3uP4FMIAP0I2huzxNpvQlmXMLG9d1Wfqr/ZtOY0g/LKJDLzmcS7z4GugiyDEGZlUUSghMz0piT/CfmElqIwxuQXe3h+893sx80+u4E597lOA1XbFlPuBGLarEfrAB9eXk58BsBsGZf0vB3WvkGHJnUOTuRDQJMEwkQDe1fwpbzsd9alH7f4qGh/fCcqQvDM/15Tvky2+G6nZjiq1J9riy6K59AreXm33T9JhoHssuxIM2wYlIG9Q0MRgBjtXxPkDC46owPrCyzQ== 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:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(64100799003)(82310400011)(186009)(1800799009)(451199024)(46966006)(40470700004)(36840700001)(40460700003)(2616005)(1076003)(41300700001)(66574015)(26005)(7696005)(6666004)(2906002)(478600001)(7416002)(426003)(47076005)(7406005)(83380400001)(70206006)(16526019)(70586007)(5660300002)(336012)(54906003)(8676002)(8936002)(110136005)(4326008)(316002)(36860700001)(81166007)(82740400003)(40480700001)(44832011)(36756003)(356005)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:19.1198 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73fe8f57-d24e-42a8-bdc7-08dbcc2aa895 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: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5653 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:27:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673430174397429 X-GMAIL-MSGID: 1779673430174397429 rdt_enable_ctx() enables the features provided during resctrl mount. Additions to rdt_enable_ctx() are required to also modify error paths of rdt_enable_ctx() callers to ensure correct unwinding if errors are encountered after calling rdt_enable_ctx(). This is error prone. Introduce rdt_disable_ctx() to refactor the error unwinding of rdt_enable_ctx() to simplify future additions. This also simplifies cleanup in rdt_kill_sb(). Suggested-by: Reinette Chatre Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: No changes. v12: Removed the redundant comment about cdp_disable_all().(Boris) --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 125d12d8f4b9..d1b5fd70ccbb 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2308,14 +2308,6 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable) return 0; } -static void cdp_disable_all(void) -{ - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L3)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L2)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); -} - /* * We don't allow rdtgroup directories to be created anywhere * except the root directory. Thus when looking for the rdtgroup @@ -2395,19 +2387,42 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, struct kernfs_node **mon_data_kn); +static void rdt_disable_ctx(void) +{ + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); + set_mba_sc(false); +} + static int rdt_enable_ctx(struct rdt_fs_context *ctx) { int ret = 0; - if (ctx->enable_cdpl2) + if (ctx->enable_cdpl2) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, true); + if (ret) + goto out_done; + } - if (!ret && ctx->enable_cdpl3) + if (ctx->enable_cdpl3) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); + if (ret) + goto out_cdpl2; + } - if (!ret && ctx->enable_mba_mbps) + if (ctx->enable_mba_mbps) { ret = set_mba_sc(true); + if (ret) + goto out_cdpl3; + } + + 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_done: return ret; } @@ -2515,13 +2530,13 @@ static int rdt_get_tree(struct fs_context *fc) } ret = rdt_enable_ctx(ctx); - if (ret < 0) - goto out_cdp; + if (ret) + goto out; ret = schemata_list_create(); if (ret) { schemata_list_destroy(); - goto out_mba; + goto out_ctx; } closid_init(); @@ -2580,11 +2595,8 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_info); out_schemata_free: schemata_list_destroy(); -out_mba: - if (ctx->enable_mba_mbps) - set_mba_sc(false); -out_cdp: - cdp_disable_all(); +out_ctx: + rdt_disable_ctx(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2816,12 +2828,11 @@ static void rdt_kill_sb(struct super_block *sb) cpus_read_lock(); mutex_lock(&rdtgroup_mutex); - set_mba_sc(false); + rdt_disable_ctx(); /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); - cdp_disable_all(); rmdir_all_sub(); rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; From patchwork Fri Oct 13 20:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136530vqb; Fri, 13 Oct 2023 13:27:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHS4cSHG7yN1rlZx3gbdqyw3DW7HltxHzL3WWp3DijbjoDxeH5UuHhLicgx1pmK5JmC3/FN X-Received: by 2002:a05:6a21:197:b0:14e:2c56:7b02 with SMTP id le23-20020a056a21019700b0014e2c567b02mr34602070pzb.0.1697228836444; Fri, 13 Oct 2023 13:27:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228836; cv=pass; d=google.com; s=arc-20160816; b=vhwIf1EVGHjv1PF64Ef2Sgc0hlLC2XQ57eCfMaeD3FE6y4MkaN5eWqDtbg3Z1b0PZW gsXGq6m6pR9QCHg743qV6yT9QBTqQjQz3apTYGBlNQ/OYfK9AVBi/47VEQx9Opk1KhU0 n6RLg22GfaRZFYRiNE5zXgIbCsAvKaOmbKAufoONCF7DUJ7DL84qfLQSQEV5C/QpvP/F G+J/XJ4oIMKTvxPq9W4C7wFwyyororL5wHjWXSDpfDgTRfaZZrap/xKk9VGSGMyvDgSw SiA/QpeqDEWIc1LK4QzKvbvjKP5MIhGsVSdx5RGGKMbLLYV7yVvezEudMTCEQAlysOxZ XpMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cd6tdTcU3TIUkjXSphXUPjL4BOn/PCWoK4hUkNiM8zc=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=mwAfsce/hDSssGOiogS64Jec5NfQW5N3kJtxQrJ39O9x5UBdlC4C5De/s2amr0oqFF wV5uHfvqcYGshEQpPcUrQYOEfJf8deOS53k0EixwpBWhjZqQUOh3xIWpAxTAMtaQp4G4 txYxNNA6rMzAeXZODU4OoJuLd9Fm4DrfHOD7FzkPSbJftFHv/y1xjKmEqmtbl/AxCzG7 b/6A2fdCuzLC/Kd0Axp0x2WCe3/Du18jXeDq5kDxlMBzbQyNmokysGrR6Su2YKxtaq12 DX3sPLhNtKGpInqWWDKDPkgXb58XkT2yAJkalZ8qDyzcCLcK/0DlOSWmxoq5CzllJf1Q zvfQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JcgDFeMJ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id oc7-20020a17090b1c0700b002777081181fsi932003pjb.51.2023.10.13.13.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JcgDFeMJ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 595AA82D981A; Fri, 13 Oct 2023 13:27:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232346AbjJMU0j (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232250AbjJMU0c (ORCPT ); Fri, 13 Oct 2023 16:26:32 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2040.outbound.protection.outlook.com [40.107.95.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AB47F0; Fri, 13 Oct 2023 13:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YnQfQAiDRqGOCj5EQkehFN+QnE2eMqz6H+44xYjchIl83xSgoDPiWqnrsajOb5IVcT6D/sJUshmrQCK8L4nXESJM2cCxlHhS1UDE1PpDei7Vf0ttSPrfeI/vaCmPNteHHGjlH4rpBln3JQixf6vaK1fbi2ysxeLcxN7Kd+Yy+QNuYjh2SFXGz+aB5bh9YZL/ii7uwiYcfiVyo4L+wMNdpiEsmb42PtTKCumMGKd/vT3qhQZOkay3jgDD+mBO1L8MBORTbU0ZyFlK8V6cNMB1ylg+s3zNLbyECPC3LAENkngxnOVTF1xImruJK5e919mCjxhEaV2XmgtUZ+czHjI/Lw== 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=cd6tdTcU3TIUkjXSphXUPjL4BOn/PCWoK4hUkNiM8zc=; b=TMMYH4g0wp9PemoWB80d4j1/KaX/kXcTRC1v8aAyLuQjzzCh8BuPA9IiViThqqO3Am1wtflWdi/r98M2tiMPC7CdopHsPcWEzO+TB3cPSPlHTIvx4vdTG0cN/dAzOq2cqdZEg/LFedl7Yxa0RzhOrwNtXawCS5WJ7JRITHuhpYr+5UX2Qw/d77onqtyz2r9/3uyLdvpSEdkh3XtAKRtjf8sXz7ZEXU+ZQbaPOxTBjDR6YauHRlzw8vaJyP0ynu/K7Xcq+eA+5Cb5t23BzsBU3f/yiTfZViQc4qcklkT454cWxWwL/6dI+VTS703KXXrLcF+WjccjfuRhjzBRtMB7eA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=cd6tdTcU3TIUkjXSphXUPjL4BOn/PCWoK4hUkNiM8zc=; b=JcgDFeMJfYMtwv03NyvLPz9LlG8bwfGvjprAQLYQOOxHSXBDnp7J3S/cUBN5+028FiYXFq6wgH61s0gkmLgWl5U74ZT7InXM2vELVPnNYrgNdCLl8OyIYub1ml6jdxC8flxrFEj20+uiIYzfdhg9dzMH5ieMVYpMPzBOJqU3mAA= Received: from DS7PR06CA0008.namprd06.prod.outlook.com (2603:10b6:8:2a::15) by LV8PR12MB9261.namprd12.prod.outlook.com (2603:10b6:408:1ed::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 20:26:23 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::9d) by DS7PR06CA0008.outlook.office365.com (2603:10b6:8:2a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.29 via Frontend Transport; Fri, 13 Oct 2023 20:26:23 +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 DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:22 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:18 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 06/10] x86/resctrl: Move default group file creation to mount Date: Fri, 13 Oct 2023 15:25:58 -0500 Message-ID: <20231013202602.2492645-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF00017097:EE_|LV8PR12MB9261:EE_ X-MS-Office365-Filtering-Correlation-Id: f14f7718-d857-4c44-bf66-08dbcc2aaad2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kU5NMHmlBRbEMaZTQ841x16o97ivj6ZCjd+leLKO6h3QkMRxMbubycpmL8XJjUOTeSIajrko+KVnLhWQCx6ptQztgVQQNWAAfBti1fDeEUMI2Tk99JgVrokMBEzqLLnROJl79Yj+EpsboW0YUbmMUkEW27vr+HoxoQYDmnx6bHg4mbXMjswmzy1m3RKAYDdIMb8z3rGBbKi+fVEmGhQ/gpGoNOM/CF0Sa7K1+b0BXXnO2K8nTGDX2rPwjZgsGe4rYQePyvAU5t3hnF3d/ZGOsdy+pLBGYyhE2wU43UTDK4X86e9yW3ZBRgmp94QqgdIjqdwz9J9H0BaOlShFqmvmSByIljCaZyh3n4pYL36pOSphOaiqWxt2MLJKqH25EPgCfbW1tPHHYas9BSmGEITRPAwGPyLG0wHQO5HDjBGAT9Bdzu3mhORMg29Z1nqQhHeUI56ycgCvUdDXHaPvk0U0BCHH+B87PvPWHQTJwJMNAVC1L5ink5uy3VcbBs/nuCePrpm4anMpgS6NzPMRTZBe5dpQkEX9aVCNWDZoHWVKm1iHv7OCdEio2jaNG8QDOlpi8kWii/bjpTG7dd2t6JQruszqeZL+KWTWrUpUNcWR3mzXxp444PzUXiCuX/kvqUowuA5TWg5GFC9ddwVYL1kwnWzNfsSRJrC1z/+nK43Zc/OP4IcVNqUog1DLCosG7gOm6oM5L0OP4YARZ0tft9ABfL2UpKs/pOyhSvpTPEC4Gip/9is/UOLlVlzv33EqKCcfUlzF9aMYdQWdKUwLPn2rbg== 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:(13230031)(4636009)(376002)(346002)(396003)(39860400002)(136003)(230922051799003)(82310400011)(451199024)(186009)(64100799003)(1800799009)(36840700001)(40470700004)(46966006)(7696005)(2616005)(7416002)(2906002)(6666004)(7406005)(41300700001)(4326008)(44832011)(478600001)(426003)(66574015)(336012)(16526019)(5660300002)(26005)(1076003)(83380400001)(316002)(40460700003)(47076005)(36860700001)(36756003)(54906003)(70206006)(40480700001)(110136005)(356005)(8676002)(8936002)(82740400003)(81166007)(86362001)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:22.8906 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f14f7718-d857-4c44-bf66-08dbcc2aaad2 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: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9261 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:27:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673424703596446 X-GMAIL-MSGID: 1779673424703596446 The default resource group and its files are created during kernel init time. Upcoming changes will make some resctrl files optional based on a mount parameter. If optional files are to be added to the default group based on the mount option, then each new file needs to be created separately and call kernfs_activate() again. Create all files of the default resource group during resctrl mount, destroyed during unmount, to avoid scattering resctrl file addition across two separate code flows. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: No changes v12: No changes --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 58 +++++++++++++++----------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index d1b5fd70ccbb..55da93b5ca53 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -54,6 +54,9 @@ static struct kernfs_node *kn_mondata; static struct seq_buf last_cmd_status; static char last_cmd_status_buf[512]; +static int rdtgroup_setup_root(struct rdt_fs_context *ctx); +static void rdtgroup_destroy_root(void); + struct dentry *debugfs_resctrl; void rdt_last_cmd_clear(void) @@ -2529,10 +2532,14 @@ static int rdt_get_tree(struct fs_context *fc) goto out; } - ret = rdt_enable_ctx(ctx); + ret = rdtgroup_setup_root(ctx); if (ret) goto out; + ret = rdt_enable_ctx(ctx); + if (ret) + goto out_root; + ret = schemata_list_create(); if (ret) { schemata_list_destroy(); @@ -2541,6 +2548,12 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); + ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (ret) + goto out_schemata_free; + + kernfs_activate(rdtgroup_default.kn); + ret = rdtgroup_create_info_dir(rdtgroup_default.kn); if (ret < 0) goto out_schemata_free; @@ -2597,6 +2610,8 @@ static int rdt_get_tree(struct fs_context *fc) schemata_list_destroy(); out_ctx: rdt_disable_ctx(); +out_root: + rdtgroup_destroy_root(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2667,7 +2682,6 @@ static int rdt_init_fs_context(struct fs_context *fc) if (!ctx) return -ENOMEM; - ctx->kfc.root = rdt_root; ctx->kfc.magic = RDTGROUP_SUPER_MAGIC; fc->fs_private = &ctx->kfc; fc->ops = &rdt_fs_context_ops; @@ -2837,6 +2851,7 @@ static void rdt_kill_sb(struct super_block *sb) rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; schemata_list_destroy(); + rdtgroup_destroy_root(); static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); static_branch_disable_cpuslocked(&rdt_enable_key); @@ -3718,10 +3733,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { .show_options = rdtgroup_show_options, }; -static int __init rdtgroup_setup_root(void) +static int rdtgroup_setup_root(struct rdt_fs_context *ctx) { - int ret; - rdt_root = kernfs_create_root(&rdtgroup_kf_syscall_ops, KERNFS_ROOT_CREATE_DEACTIVATED | KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, @@ -3729,6 +3742,20 @@ static int __init rdtgroup_setup_root(void) if (IS_ERR(rdt_root)) return PTR_ERR(rdt_root); + ctx->kfc.root = rdt_root; + rdtgroup_default.kn = kernfs_root_to_node(rdt_root); + + return 0; +} + +static void rdtgroup_destroy_root(void) +{ + kernfs_destroy_root(rdt_root); + rdtgroup_default.kn = NULL; +} + +static void __init rdtgroup_setup_default(void) +{ mutex_lock(&rdtgroup_mutex); rdtgroup_default.closid = 0; @@ -3738,19 +3765,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); - if (ret) { - kernfs_destroy_root(rdt_root); - goto out; - } - - rdtgroup_default.kn = kernfs_root_to_node(rdt_root); - kernfs_activate(rdtgroup_default.kn); - -out: mutex_unlock(&rdtgroup_mutex); - - return ret; } static void domain_destroy_mon_state(struct rdt_domain *d) @@ -3872,13 +3887,11 @@ int __init rdtgroup_init(void) seq_buf_init(&last_cmd_status, last_cmd_status_buf, sizeof(last_cmd_status_buf)); - ret = rdtgroup_setup_root(); - if (ret) - return ret; + rdtgroup_setup_default(); ret = sysfs_create_mount_point(fs_kobj, "resctrl"); if (ret) - goto cleanup_root; + return ret; ret = register_filesystem(&rdt_fs_type); if (ret) @@ -3911,8 +3924,6 @@ int __init rdtgroup_init(void) cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); return ret; } @@ -3922,5 +3933,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 patchwork Fri Oct 13 20:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136596vqb; Fri, 13 Oct 2023 13:27:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExpFKk+S1Gc0mckM5gvsgjY5Zdfgi28HZdBVcIvs6+5dZwOzt7wxoWAZz/uzdkkoe3sJO0 X-Received: by 2002:a17:90a:4d88:b0:263:730b:f568 with SMTP id m8-20020a17090a4d8800b00263730bf568mr26038043pjh.3.1697228846508; Fri, 13 Oct 2023 13:27:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228846; cv=pass; d=google.com; s=arc-20160816; b=e/UJRlmOn4L6bmZ7civdRscTbV0fhGgPE+rITW42K1Otu7NbBZf6QFNo0LqX+B+hTP M4BspdPd/jEGBGr+Lqs8YrgwFzEWAjADhnxi6jn5TObT2li2Jb8OKx0A2LGiyP4lBvNm waYlH4S5GpzlwqPQBlN7ds4mgrG6usvviNSOAJtnKJj199Ir3mVzZDWtWhvQQEpfBxB2 PxD874abBzxGx5Sl8VIpRjUxHXth6x1TGSFY5eEpjujj4UlmryYzyr9k85bEZD/dpcye sccdkcUMmqt9i3uQgmlDRU+TRqUZd8BNoUi4yjWrmBqvSWhVlOtujO8KfSHSmijP0CJk 9/Kg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Eh2ZbCL1qrBxYbPD4V7VGUGFUq5KHRz0TKDp8EeQwBw=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=jAQKwaoDlCZO+gDlkpkRKWRto6d3ximJHWXjSxHwxRuO5BQ9GS8CPgUSVDYlfv9tKZ Ln9a4JtFlLi5JxrrJ2B8tJZGJkJ3sG0/pfYekL4rXpfSHGg1UYSPLwasoL/OulS9dZlS Mdcu4Cu+kXK/vxxZ/KC3dg6gG+aWAkj/YqoAruMpjetv48Q2/znEfQpvHI3qX9GDn4tp M38THMqYCgIkKbvOY6Q0SPIBNDZ7XR/rMrpjUfMXNa8Q4SX9MwAW3Lk6tMcGojeBP+Pn i5iMtsOjrpwNvVQ+6PA5XttBTl0C1IbNYvpmlKz04pgZYJSmvcsZrVwxqhWlj0JTeyyc pbJQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=eJjewEM9; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id by1-20020a056a02058100b005a99db74448si3204781pgb.266.2023.10.13.13.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=eJjewEM9; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 60C8181BD003; Fri, 13 Oct 2023 13:27:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232194AbjJMU0v (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232119AbjJMU0d (ORCPT ); Fri, 13 Oct 2023 16:26:33 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2074.outbound.protection.outlook.com [40.107.244.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE9F5B7; Fri, 13 Oct 2023 13:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AwuHu0ohqaKq2Q+qkC0A7GelfKV0UA3J7/FA4MgOHTVaq3azGX+wlc5D2QekC2NAbSLkQUOeUTCp0enysFb5/4efC4ys/Kx9n5gkaZLgrHW3MxaE58+JLVLB7LiFqf+s4R8PpZVmRXeRDVHTXiqpPr5yD6+382WZuuWx7/neQVPF3EDkBi5T1Xbh8mT9Dvo9VH6ztBJLN9N4bAl6LLwGv9Wf2Rdx1DtAeCnLlWTgRwsX1WTGD+Fjgrz0w5ofmBPZ8juSiFp6EeXf4k6vpr98uWwWJZEDwnG95aHSgcfKcWx1aKyfOmkP7TZO+oVpnM9rEx7CHl2hJBCiCUKYoxBWxw== 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=Eh2ZbCL1qrBxYbPD4V7VGUGFUq5KHRz0TKDp8EeQwBw=; b=mubaacMmPmVE2DGzLTu7bYgoBPzkHbd8J3IkCuDWiK9+0/nbLweAvh4VgPq+js29Us/aDSmT1fIc3t1hP62ZnbyzuJ+TAGiUHoaTy9ThHXEP1XlDpuCKkB5SAja0MXhTkvtG0O2d3LjJZsBvszdSEJ7SIYYiShu5jkAMzLZT50sGyNI38YBEPGGbh08SKnxCGNsZLNmVkV5MqLdtAfLjwgz0/SrvrozW04DKchepXxtzy3itDrj+Dc2rW0XTM1jpdWd9ix6C4loSMxG07Wv55nXLPa9SG2fQYdzgiqfJa8OuClDUyOYHriI/USuu9bX/BuVWYLwc+72bRbUYi1ZmBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=Eh2ZbCL1qrBxYbPD4V7VGUGFUq5KHRz0TKDp8EeQwBw=; b=eJjewEM9Pr4mRIlWQe+WpypOdARuu9HTjByuIjHJK6jt8Sjrj3u3GHD+kAFjqUHLHsIgHPCKpv2T4WbuSA4eUZM2e3OpX5/M401huMyVf8EVWcam3QdNoRJslKnibF757r7KYpplrw5dK0MY5ohQSVEptxGh9fAjIh24KdR+Fs8= Received: from DS7PR06CA0006.namprd06.prod.outlook.com (2603:10b6:8:2a::7) by PH0PR12MB7470.namprd12.prod.outlook.com (2603:10b6:510:1e9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Fri, 13 Oct 2023 20:26:25 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::3b) by DS7PR06CA0006.outlook.office365.com (2603:10b6:8:2a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Fri, 13 Oct 2023 20:26:24 +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 DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:24 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:20 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 07/10] x86/resctrl: Introduce "-o debug" mount option Date: Fri, 13 Oct 2023 15:25:59 -0500 Message-ID: <20231013202602.2492645-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF00017097:EE_|PH0PR12MB7470:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ab9cd68-3225-474b-f217-08dbcc2aab87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2OG20YBpgIYWKb7R+84CWVE8a60tvAwkSK9S/38x5YAkRV4s9FpSEC5XnzzG9fjAH+qd2hp3oo+O29mo7ovA9ZKkFjS4OAPOBIGnV5bIBT61DNqWrsety2DduZZYdpfD9dO5VgwZqTle/6koYk212q3jl2m8zenfdsFcT598cJOwUClkp6iFRK2DjL/KfucvtbUYLipbwF5viA/UwFVVgsCsYubCO4yQavqMhRWIBLHs8hdPIPIYSCpaGDI9jLNzzOUVDPfyjLS55+nQKuQ5T/h39vf/AymDxctAf1hWS1qeY5j3sj+BNns4GfDvgN76gCtGq6OHHawE9d7NdFBLc2f7mzo4xo2B1jVFRsnjJ4IwP3067ItK/tV4kFQtpEucEef3lVSzNy0eCHwG2dq3bYl7fz/nhI7TlcQsCh/eZZj8E8l5RLBNtz8Z98zivB2oT0a146cF70/Mn9lTKdYqmIvrpCgvSYsrfAqMksF706BikMxS/a+dwXh2fOtK6hvRN8WdqkJswHaICeQzGLlPUV+zGvc34RfV9OHCdqTUji74N4iHYFkPIL6Gu+Umx5e7mXcGPMTak0iB/nSX32HLW6hhsRLDeEtq27XWgAyDxE258ncLckCFEMX20NVpUEgVZMcPBg0sRwIq2TMpJ1fvI8jpB2rocVnpTK7vR+34qxJbdNXEBuKzRUPvrFJBKcRFlwuzAspBmgpJLnTjvpjGADycBhSfy/FG4df2+oqur/0vv1RyWTj7FeC7TFwqqgVU53oh8DZPETp/giK9GRqw6w== 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:(13230031)(4636009)(396003)(346002)(376002)(39860400002)(136003)(230922051799003)(82310400011)(64100799003)(186009)(451199024)(1800799009)(40470700004)(46966006)(36840700001)(47076005)(7696005)(83380400001)(36860700001)(82740400003)(26005)(40460700003)(81166007)(66574015)(336012)(426003)(40480700001)(7406005)(7416002)(2906002)(44832011)(5660300002)(8676002)(4326008)(16526019)(110136005)(6666004)(86362001)(316002)(70206006)(70586007)(54906003)(41300700001)(36756003)(8936002)(1076003)(2616005)(356005)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:24.0781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ab9cd68-3225-474b-f217-08dbcc2aab87 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: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7470 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:27:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673434695183683 X-GMAIL-MSGID: 1779673434695183683 Add "-o debug" option to mount resctrl filesystem in debug mode. When in debug mode resctrl displays files that have the new RFTYPE_DEBUG flag to help resctrl debugging. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: No changes v12: No changes --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 1163da74f734..0438880e38c5 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. To use the feature mount the file system:: - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl mount options are: @@ -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". L2 and L3 CDP are controlled separately. diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index ba4611111212..b816b902b5c0 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; }; static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) @@ -248,6 +249,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/resctrl/rdtgroup.c index 55da93b5ca53..84e0f45578dd 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -59,6 +59,8 @@ static void rdtgroup_destroy_root(void); struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -1892,6 +1894,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) lockdep_assert_held(&rdtgroup_mutex); + if (resctrl_debug) + fflags |= RFTYPE_DEBUG; + for (rft = rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) == rft->fflags)) { ret = rdtgroup_add_file(kn, rft); @@ -2395,6 +2400,8 @@ static void rdt_disable_ctx(void) resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); set_mba_sc(false); + + resctrl_debug = false; } static int rdt_enable_ctx(struct rdt_fs_context *ctx) @@ -2419,6 +2426,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_cdpl3; } + if (ctx->enable_debug) + resctrl_debug = true; + return 0; out_cdpl3: @@ -2623,6 +2633,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2630,6 +2641,7 @@ static const struct fs_parameter_spec rdt_fs_parameters[] = { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; @@ -2655,6 +2667,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) return -EINVAL; ctx->enable_mba_mbps = true; return 0; + case Opt_debug: + ctx->enable_debug = true; + return 0; } return -EINVAL; @@ -3723,6 +3738,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"); + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; } From patchwork Fri Oct 13 20:26:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136535vqb; Fri, 13 Oct 2023 13:27:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxBBAEVGXO43DKTMpazi60DJboMrwgz5ROlv3dznSeKm00houBL6iPeL3ncQIsqnfo5vlp X-Received: by 2002:a92:d9c4:0:b0:349:4e1f:e9a0 with SMTP id n4-20020a92d9c4000000b003494e1fe9a0mr27738307ilq.2.1697228837138; Fri, 13 Oct 2023 13:27:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228837; cv=pass; d=google.com; s=arc-20160816; b=Qvh+TXRksgVItfC4mBk0IRkLy8T42LUwtYTMIezTsLIJmAoNymZKpx//poy9ttVLNf N/fjHDm8WHc2dhYq8cNpZI94FLNg8UX+z/Pdob1Z1tM48PylIlS0ltZOteDIs0DrTiwx e0XTle+hTbMB9KtSJpHGI0If5o+1wl+JEqaOCYaGPaLPskMx5+asT43oI01Tvxy7GxmC A+4ufZeHJxfYTDiDIVbgIHJ618Zxu2pyiMaAjmoGl0ixcdfCCpt4EJIkoRoReK3/RHMl ZqWCMAor69jowKZ9wJZlxWHGiRZ85t481jkfhLlgPW5zgDzoZruAPDwptA+29iNL6Ma3 YvIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JFonQe0XfEvp5dRKc2OGMGwdvIAjBDZfX35rnrN8fcg=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=UK2BYXgZWEWcj+eesIvxykZ+AJNzr/PrqEyvE8yLX43leBlFXTPi3hCp1TvVwHB33k sf8XnEPM+Cz7PM+mZJ2cnC8cYlM+Gwr07TvuP2vw4w4OEx+PxI+sPiU0KfyKIi/mH7S/ RHtKFPvPqJctKfzK4NoauXpCnPQ9/B/R+kPeosx0+DC0uPuahETB2GL/NMt77I2fB+Rs kIU1xVJngR57muCiWqeqVZdNCA8V5P0VZvJkejbLntWd7DQkKyQGjQGUhfUSzYhZmozf LdmsiV+1EloHcwSP21JOTxgDXvQyhlYGboUfNyeLaj8UHZs7vIur/l49ZwTqM6/9bgH5 fGWw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=MvWt3L1s; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id m29-20020a637d5d000000b005ad11a5ac8fsi1526723pgn.323.2023.10.13.13.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=MvWt3L1s; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id D973A822B706; Fri, 13 Oct 2023 13:27:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232157AbjJMU0z (ORCPT + 19 others); Fri, 13 Oct 2023 16:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbjJMU0e (ORCPT ); Fri, 13 Oct 2023 16:26:34 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2086.outbound.protection.outlook.com [40.107.237.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE179D9; Fri, 13 Oct 2023 13:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qm6gW7rzwTZHcTKyo9VjKiTbnejik9JGkP/IfljXnmpfyNYKHv0yNLCSbEP7W6VxxXEUOeqmRH7TT0bqvgn3R6aN01MjVH2KSGVfieZtF4yo1coFd09sJIiiVjitzW2xM+5pQKSVNMcMVDGppcciMJmAjR9/DzHDuJ6AtS7xkngC+hT3UdXL5ndzKtnd6HMKzDGutyOkIPaJk6brApGhc49pVYHHvnc7j2Np3WK2bYAaILDSmJazhaER/uX+ha4J1fVcwJ2SXAPPWznY6viuNy48TBNCixhW2NVNLMRdsDeEloQx0Aw0fVbOEkfTHfo0h+fRebl8uSUbLxUvp8Aq1Q== 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=JFonQe0XfEvp5dRKc2OGMGwdvIAjBDZfX35rnrN8fcg=; b=QByY1SWVvmfTrX+ApT1KV9XRWjpZZju0VwyyBjl5WCOczWMG2sjJHKeRC9nOtXFdXf9UrR//zq0HCJYd8mdNstXNPTecFisQ5FUBx3WYmvUz5jI3CHPwWIHvTs/OY318UNteTG6qh9ohHeP49cPR1dXDbs5ruPh8AZ23xDr1huQZfGkmJx21RJuI4oHKQVtfuXKq+K4XGZnkCHLjyb9aJtn/InD153UW0qtAn9habbIH6KH3Z8F8rad+wlblILGPmOTcKUb1W1iUCu0943J/xC2JulVrmlzBlbmicLEebgB5ts5P22TRLHAyX/MGbVFZziv8lTij7g5j8Tsrh9QqAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=JFonQe0XfEvp5dRKc2OGMGwdvIAjBDZfX35rnrN8fcg=; b=MvWt3L1sT4BzoMV1XKPkL226VUYsd9xnSccXHniDmzaAbTo5iaQ4QnMXWqsegloUk9IfDBBiEcNX7zcVx3+jePcWgUD/WjYSpOOuvC6yfx7dB35AplOL9zQelYouz0AxcoALOUeKhFphRdEB0RRsjjrurRzFMenUiz1uLp+EP+8= Received: from DS7PR06CA0010.namprd06.prod.outlook.com (2603:10b6:8:2a::17) by SA3PR12MB9129.namprd12.prod.outlook.com (2603:10b6:806:397::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 20:26:26 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::78) by DS7PR06CA0010.outlook.office365.com (2603:10b6:8:2a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Fri, 13 Oct 2023 20:26:26 +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 DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:26 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:22 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 08/10] x86/resctrl: Display CLOSID for resource group Date: Fri, 13 Oct 2023 15:26:00 -0500 Message-ID: <20231013202602.2492645-9-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF00017097:EE_|SA3PR12MB9129:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a6f77b9-2dd8-4e88-31c6-08dbcc2aaccc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WSbtofK0AXZI7MOvhwluvdZexu0W2MljX3czrO1c+UUdOYclD5GwDH4kc3qahUAuHwUyq+5OtuO3ZcM9CZ3awHIcI91juJCnCNt3d5dxi37aLiOBg2g/UBvZOjqCBqiUTStAoOXDSs5fi6BiYYE6h6HwzuoKP9eos9YQ/m4R5gskrEbVZrtAMEQO1+aflAimpBT1szvidTf/UKBuTHQgXv5o3/H105MYLus0gU2oSRoKNM//RehHQlmnJHpkNQWeUp47ufbB3MH+NRkDy6plDtVPSHVICEvbo2EZLTq3mX8j2uDj4xIt7IgHG0BT/Qa+At0c+GDe6rAazXdFCIYgjP3UsQL/iNV+j+BCm516DUN2ffFFrfyk22sW5JrG6UP9p2wGku1qLvj+4QMoWP4Hj/3cMdoBj22AHCt312V5pBFttTAa2vo8r6SoiXAuAOfTRhnjMmcZVaVd3ISqgcf2eGSi2HxG0vL1ye0FpeWLSDQfFw8DWGvAZGOluS8UuGaXBzGS/qi3x3rmMseZjWYp1kCRzmqCsRhgNt1Gn2I6A9oMNQfqqh1i15w6vvtEhOLnjE7lrFTRNqoJ+wsveAo59QzlNZZTDNn72SkXJ/SXz96IvmHpiWc6Qb7mjkNk5ramQHADzhwnPDqnxsMrmp+wTfo/owXzwI9Z3AXA7xdgQ6K0P1D96rCMarmFq9tD0MUhvXPhDlnpEI1XDd9iGZbhIOkCnGzvGTSMFMmFNPI5nt5CPxJS4cldJRSiIZUlhNg88XrgwX0gHUiN98UWXBzFIA== 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:(13230031)(4636009)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(186009)(1800799009)(82310400011)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(26005)(16526019)(47076005)(82740400003)(426003)(66574015)(336012)(41300700001)(83380400001)(36756003)(2616005)(81166007)(356005)(1076003)(86362001)(36860700001)(6666004)(7696005)(2906002)(7416002)(7406005)(5660300002)(44832011)(40480700001)(54906003)(70586007)(110136005)(316002)(70206006)(40460700003)(478600001)(4326008)(8936002)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:26.2031 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a6f77b9-2dd8-4e88-31c6-08dbcc2aaccc 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: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9129 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:27:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673424939235738 X-GMAIL-MSGID: 1779673424939235738 In x86, hardware uses CLOSID to identify a control group. When a user creates a control group this information is not visible to the user. It can help resctrl debugging. Add CLOSID(ctrl_hw_id) to the control groups display in resctrl interface. Users can see this detail when resctrl is mounted with "-o debug" option. Other architectures do not use "CLOSID". Use the names ctrl_hw_id to refer to "CLOSID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: No changes. v12: Moved the comments about RFTYPE_DEBUG to resctrl.rst. (Boris) --- Documentation/arch/x86/resctrl.rst | 7 +++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 0438880e38c5..07225d9c0b0f 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -359,6 +359,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". +"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: "mon_data": @@ -436,6 +440,9 @@ RESCTRL filesystem has two main components -> RFTYPE_CTRL (Files for CTRL group) Files: mode, schemata, size + -> RFTYPE_DEBUG (Files to help resctrl debugging) + File: ctrl_hw_id + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 84e0f45578dd..5814a0bf3cea 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -779,6 +779,22 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_closid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->closid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1881,6 +1897,13 @@ static struct rftype res_common_files[] = { .seq_show = rdt_has_sparse_bitmasks_show, .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, }; From patchwork Fri Oct 13 20:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136611vqb; Fri, 13 Oct 2023 13:27:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH98W/c/hYFOVctm1gBcu8VK30Ju8JT39G71P51evxxTecn9805iiL3lfk8XQIOKeCY8Fgl X-Received: by 2002:a17:90b:1496:b0:27c:f88f:11a5 with SMTP id js22-20020a17090b149600b0027cf88f11a5mr10359475pjb.2.1697228849534; Fri, 13 Oct 2023 13:27:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228849; cv=pass; d=google.com; s=arc-20160816; b=iY5DMAKstWXK2yD+BiXFxItuqhcA5XSQq3KD3Bki+N4BDL5+A0QprZ6ZjdVURHuHNr XdK9Ee5EjSlNs+NlU4sbiaJ4e7texztHLsQueDyEGnmzgQLxJV3qedmmFfuKVtSSnbAG 1QY/Yf03haRWrkzBUwUgJSK+XIVJzvE0ri48XPiymjVdqk+89NK8EkcuP70rY+4OME9v 7v1GN/dXILkyfiOHRbVnOct4XT+ul6PFf8R1wEp+YqaUfMTTtJpq4KfHJ7+JfbfCj0Jq FdFdplD275ObyllabCslD86ejuQZOU47gUbmYbFU7LSupVdxdlXwpdsIWaXjpLN3e7Cp 7cEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xI4Po2AfLnVcMKXyHhFEAUfQWHHP8gOxU+wkEOUYopY=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=bWMp7nbaLULoJ0U4sRZfVAKRPkmQi8HAMn2gFOZkQ8aNte80FOPNnDLg1YJDQJp3WR OFOkcZgYaFr63kHQFtCSmCnzm2H4S6kgE8ULGY5Z9cUDMBmboXvLqlLFzshRLUJXm9Tx +KJ9gcSVhPAccYJ7AEkgz3fFCazE0X5ohO5JNT6E3EnK5F0d8ppqULB6h6J89rUDp5h6 LHDmeRj84C3UiYr7vnyvc6r0VBH1Qb4a4dvPSYtz9wpbQwszCttgXMYtiowp28bbyBX9 PLHEZ5CfbULG2xqBt7jBPa+2CM3I97N9ECB1mjWU4s2mguiMSJsToxJyJkGEHdt0+6Ye /mXg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=vc734Wda; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id mp24-20020a17090b191800b00274e5b20e65si721922pjb.50.2023.10.13.13.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=vc734Wda; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 81FDF82D980D; Fri, 13 Oct 2023 13:27:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232597AbjJMU1A (ORCPT + 19 others); Fri, 13 Oct 2023 16:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232159AbjJMU0e (ORCPT ); Fri, 13 Oct 2023 16:26:34 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6168119; Fri, 13 Oct 2023 13:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OBNDsGalF/9EHevjk4IioVauV+Q+n2rOS4MKj9btbfNL7l1e7ifd0lHIGKhDFPlnCJyTSoeDH2Lp77Juq939mkMrp8Bq/yPHd/A+HigEzcDGxrAefqgAkzF/f3REPxJZKF0848yOJN2byym6cFw5TRoyxukvUsHiEOQmCVyq3fOGBF7Y8wcgdW7YFJu66/0iCmdl1xGd80pHzCtfbrxfUCyZpn2ST3KuwLHosShECnHsKVIP/WVqxros1jAYZi4IbdYWC1Yw+Ad7Sh+nBv88Qfz4tcKHixgd08H01UXZ2Mnmxfz0V7DeAg0vU55+GF/Wf7gbMtkU6kINvK5DduNcCQ== 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=xI4Po2AfLnVcMKXyHhFEAUfQWHHP8gOxU+wkEOUYopY=; b=PV7uL4p5NSm3Da0MyC/p0aoemA5iaDVhDL+Z1nrpWKn+MtbotmoA5292BaK1S5V0rFEDsXdsJR0sP+m3+JUzmrSJTIiiC0+LPZDzBSG/0t1bZLUKl4rPGlIw8o7sqDd0euL429dgg4LsmX5weKc9IvqIcKnD6hselQjUHujPClxD9vH/SODoHNvdC+kOime2ut7dkr6Zj/aF7M8Q1xAwIz5QVm8tUlp7AYKMqYy6ZYxJeqbXOJZfYgpBbPgSs+WE/Pf7RDkf0+V9CZ4c7yf4mXp/UDn5vezrrPy5g5+yRmqKG8DjNoWWMv9zeV3xhZMYfI+pjSJJdDvEwJDxIEGMbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=xI4Po2AfLnVcMKXyHhFEAUfQWHHP8gOxU+wkEOUYopY=; b=vc734WdaSHURNQK0syNd9MmhI4cp56c0f6WPG1ZFlgWBzfkWTECKVtVfDJekMbOH+f9Q6S2HkFsmVPPXbqveBc4yQkpv+k9G9eRLpwnLQKShOo33bqx+xJ1mqRYPNEtTqkENS+FsiYtN0iNjP60Qa4mbM/vS0gMIbl33MDfL70I= Received: from DS7PR06CA0006.namprd06.prod.outlook.com (2603:10b6:8:2a::7) by PH0PR12MB5647.namprd12.prod.outlook.com (2603:10b6:510:144::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Fri, 13 Oct 2023 20:26:26 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::64) by DS7PR06CA0006.outlook.office365.com (2603:10b6:8:2a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Fri, 13 Oct 2023 20:26:26 +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 DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:26 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:23 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 09/10] x86/resctrl: Add support for the files for MON groups only Date: Fri, 13 Oct 2023 15:26:01 -0500 Message-ID: <20231013202602.2492645-10-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF00017097:EE_|PH0PR12MB5647:EE_ X-MS-Office365-Filtering-Correlation-Id: ee8ab584-dc86-4408-f389-08dbcc2aad0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BvVQFt0GCFOt+Gzp49yMxsUy/GYtlcCxlbGwaS8U27jJE3beAmDMIRrAbBx35McsRDDHvWURwlf1SpsrIMyODOsIXUIfrgbazQiTcH04TaZWtKrIUSAdQbGdx1e5vQmcyE/7Up2eI9byf2WeHHuSuvfbEjMIIwfodgvTsHUMKSKsUAvfGKG1fCg/kFHPAgrFJs8MTEZ44Rqq6wtFM/evN0UxM6rYYeEITZ6oO+jnr01kn0gv2IQ/qpIUjOUiHihR+4q3YYQ87JE80JG+IUznwcKv0iNCeYWe/z9f7X1m51MiUVP2HGjoxdxAYYZCik+dLZP7a/crOjJur8hkW0cjCQxCMxORSiALM4z3dGCr5px7aGYmvQpyw2Is+0982D3bCxeVjuy6upCgFLp7IrvjvdQv0GVlsRD1PLXfvivRByoor3ZWNMPdxfRC5Vk94M78PRpv3UCd9bR4AYnq++3LMTa9vqOYNueYeapuLjP4tbGs/cpzrCDE8OBlLOhuLE7++eB5LsWqxd884tRlYgVIlpIVvN40syJrqfuW7RWNfJqKsIsPcYQP+JdNBJ8vafpwcA7KnU2TuP4A5DMgJLIG68LU0FL03FxD1W+unr73fRPskJ7xctSGAoc3HYuHjJH2Ur+COgL24i++DEx3WQbax7ZD1mq5hK+Z5aqc2O5uiZNOZpLmGS/++pioWYdWIL8iwk3MvseGx5BW5GmzqstzOXIExdzvEQAk5T6QzDU01tf02rWEwmxMQHneQ0X4+Uh3mI3ENgfPoGFNs9x3PnfF9w== 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:(13230031)(4636009)(346002)(396003)(39860400002)(136003)(376002)(230922051799003)(64100799003)(1800799009)(186009)(451199024)(82310400011)(40470700004)(46966006)(36840700001)(6666004)(41300700001)(7696005)(1076003)(2616005)(82740400003)(40480700001)(44832011)(316002)(86362001)(36756003)(478600001)(36860700001)(81166007)(356005)(40460700003)(7416002)(336012)(2906002)(7406005)(66574015)(47076005)(70586007)(426003)(83380400001)(26005)(16526019)(4326008)(5660300002)(70206006)(54906003)(8936002)(110136005)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:26.6406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee8ab584-dc86-4408-f389-08dbcc2aad0e 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: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5647 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:27:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673437731199895 X-GMAIL-MSGID: 1779673437731199895 Files unique to monitoring groups have the RFTYPE_MON flag. When a new monitoring group is created the resctrl files with flags RFTYPE_BASE (files common to all resource groups) and RFTYPE_MON (files unique to monitoring groups) are created to support interacting with the new monitoring group. A resource group can support both monitoring and control, also termed a CTRL_MON resource group. CTRL_MON groups should get both monitoring and control resctrl files but that is not the case. Only the RFTYPE_BASE and RFTYPE_CTRL files are created for CTRL_MON groups. Ensure that files with the RFTYPE_MON flag are created for CTRL_MON groups. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Ilpo Järvinen Reviewed-by: Reinette Chatre --- v13: Commit message update(adds a blank line). (Reinette) v12: Removed the comments about the later patch. The text is moved to patch 10. (Boris) --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5814a0bf3cea..5f6d6ba63a2e 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2551,6 +2551,7 @@ static void schemata_list_destroy(void) static int rdt_get_tree(struct fs_context *fc) { struct rdt_fs_context *ctx = rdt_fc2context(fc); + unsigned long flags = RFTYPE_CTRL_BASE; struct rdt_domain *dom; struct rdt_resource *r; int ret; @@ -2581,7 +2582,10 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); - ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (rdt_mon_capable) + flags |= RFTYPE_MON; + + ret = rdtgroup_add_files(rdtgroup_default.kn, flags); if (ret) goto out_schemata_free; @@ -3271,8 +3275,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, enum rdt_group_type rtype, struct rdtgroup **r) { struct rdtgroup *prdtgrp, *rdtgrp; + unsigned long files = 0; struct kernfs_node *kn; - uint files = 0; int ret; prdtgrp = rdtgroup_kn_lock_live(parent_kn); @@ -3324,10 +3328,13 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - if (rtype == RDTCTRL_GROUP) + if (rtype == RDTCTRL_GROUP) { files = RFTYPE_BASE | RFTYPE_CTRL; - else + if (rdt_mon_capable) + files |= RFTYPE_MON; + } else { files = RFTYPE_BASE | RFTYPE_MON; + } ret = rdtgroup_add_files(kn, files); if (ret) { From patchwork Fri Oct 13 20:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 152724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2136643vqb; Fri, 13 Oct 2023 13:27:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7rJheqOorw6OkGYZSKnApKxYV+hSkOTq0y6a4SA2qd5ZoWb96MN0YLzlzPTZXjpDPTMqe X-Received: by 2002:a17:90a:4ca4:b0:274:99ed:a80c with SMTP id k33-20020a17090a4ca400b0027499eda80cmr25480553pjh.3.1697228855429; Fri, 13 Oct 2023 13:27:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697228855; cv=pass; d=google.com; s=arc-20160816; b=fuTSOHWT1VPQBeU4LJC36K0ZhTMvh3AYPqOcMVm93fgdY0bX1eJ4L1Xb0P5MY8s9bu I3ReMq9d9mSjNWV0Y7DJb7WvFmz/zLLFVtIbAkqEO6TtCliPtj5fEeTTPbsmu0J+7uYb PXW2gyLhVZBJ6uKEuuzne3fjde6TyBU7cHpH3SWfTkjnK3L4QYm1jEQUG2Cn4FDUDBmf ag6XLdNWmwI2giP9obiw8IBYHJg6kL0wo+8qWw1nNuo20+OD4h6sBTQMdZ4y/hfWDrru LgOgjdvClKAPj1AbDcg4ckWjrjIFXDaOYeSii1QDAYlRcHhdL2ZtDvMfujDfFxuJt1nC 7YgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zzARhYoRMczK9QFOxyv7dr4AjVgu5stMp6ji1D6r8gU=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=aGDsfSdiOQH24FbLaHIVKPFAB61pL61BadUkdKdiPTtsXL5Ov/B8zOaQppV90eClKn MRjCUP81uPrSLTSjyR9SVvjAx5LC2f75komHrWHdYtJaR9sZM46+QaP/17Pv8BAig9x2 uCq12nZokkG8ejwQZDf4ibkSkkJ6VNIuIH4qbKutGj9vPg6Bzsxo+ZnVga2zTBT1Mbz3 hB+vaiqDA0+mRZ4OYP4GGAVWYvXIMSdmTifasKVQLD6WX87Co8QHvtBPdwV4nBQEOZVn 4n5q6xpDqe3jchhww4Uyj7C35eJ13JkvSskgXslkbPWGw97I2YbCh6HenFpzRj0JT3Yl 9YRQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=y1D4R2s3; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id ci8-20020a17090afc8800b0027b348ac5c2si789651pjb.50.2023.10.13.13.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:27:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=y1D4R2s3; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id BB3E98303B1E; Fri, 13 Oct 2023 13:27:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232200AbjJMU1F (ORCPT + 19 others); Fri, 13 Oct 2023 16:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232402AbjJMU0t (ORCPT ); Fri, 13 Oct 2023 16:26:49 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A84E123; Fri, 13 Oct 2023 13:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YeNZLJipuSNDLFagKsN5x+Qj0gWKlym+ujRepUm+M7QF8Vo170gf6H0Pe74LoEz5GZvbdRsSCQUWaISFnLdHy4OredoJa9GD6M4c5ZEan+0GD6JEpNyMmrDFFtK+hsoluIrLaLrPSK0iPpB+Q7WpVp7ha29vuabyAjY5itUmq9ZdQb55CEpBI5GWLiSkHQpEQsodeCf2g02Mo8wf8bCApTrmxeeO52RFlvHNSm5sRRJTruZrDyrMKxTG3PwPStrzUa/OkrF3JSv6eteJFqJHCeLY6YkhU10/XvCybxvqg145lm69WcXOTz1OB59prdhCESon7iOU5jhNdlz/lg1ALw== 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=zzARhYoRMczK9QFOxyv7dr4AjVgu5stMp6ji1D6r8gU=; b=InG6LTE2gjKkPe+6OuyOEacmKQ2XZAE78NOHUiFQ5OGh2FeImhz3BqpJGiYttwTjWjiaTzBnse7Lu1MrgTRdr8XIQm3CyYRL57NCe71VfxaoSY7Yiq+PX247xPsZxm0qliY5fK68M0l8EHTUF6dzFq9nctVVhyJcY/boZFvxuJQtZYBX+9zWDaoyu/IVNTnCGAmibriyHGTAtzRTpDPevbY2kFyWAnrXvbHLhAkWXtgTUL7yRxgoejGLMdKnJEibiZb6peIDEgh0gvK/mCtmAxONy3D3uX9i0g32OipOLhml2B/tsjiVy1WHbIR3Z0pEkj2don0C+3TLtwYrcLk9ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=zzARhYoRMczK9QFOxyv7dr4AjVgu5stMp6ji1D6r8gU=; b=y1D4R2s3gBdm53SB+WmfemTdhuQMCbejUCxowrVH+arKqjEQ4SxU6F0pAMtRwdP4dZZ8X5n43CScx530IeTmaOk+TYeLEgEhVOtGNEricBQ3EX0as5yP2+UIQKsTLD0agnc7+SOnKxWXxEJdfhKjA2f/sSOVeTU/EpXtBeYwmws= Received: from DS7PR06CA0004.namprd06.prod.outlook.com (2603:10b6:8:2a::19) by SJ0PR12MB5407.namprd12.prod.outlook.com (2603:10b6:a03:3ac::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Fri, 13 Oct 2023 20:26:28 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::8a) by DS7PR06CA0004.outlook.office365.com (2603:10b6:8:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.29 via Frontend Transport; Fri, 13 Oct 2023 20:26: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 DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 20:26:28 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 13 Oct 2023 15:26:25 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 10/10] x86/resctrl: Display RMID of resource group Date: Fri, 13 Oct 2023 15:26:02 -0500 Message-ID: <20231013202602.2492645-11-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013202602.2492645-1-babu.moger@amd.com> References: <20231013202602.2492645-1-babu.moger@amd.com> MIME-Version: 1.0 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: DS1PEPF00017097:EE_|SJ0PR12MB5407:EE_ X-MS-Office365-Filtering-Correlation-Id: 5767d053-29b3-4268-0f13-08dbcc2aae0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aVVN/rE2DclXL80gzo/Tg1Etcycz+ZzA2A/1wcTAWgZfcY3v2VmiqVaMa5+hExbUjllXvCE+Pa65tQupiBgPj4hqWHwEZRIBOeTHONh2Yf8GyOoLXQfb46JlE0Rfbg1QnOQ7SPY28vwdNW95MvD/tNe6XO73Gqjl5hS3OHiEEBWT9U0larRFA5wVm5VoYe7DgPsz8oa2ipxckBmDpZ3Zo3h5j8VNrbiw2VVqmvYhjGm1LyZwe7VEYy4bZwSMSwC+XRROZlvWp5SgFBHOiucXcECbcDIBtV6NzoST0IbGoNcu7KTQPLoDKsBvtQ7o1m9FApuEyUlHMYvpezhnS3VqujGeTb6gZFYsCF6RyYM+Dfz5KvqsXf7XLWBmE+XFk1lwXWTA6Vj507li4NwPO3Atl2dt2cq1jaG6Wwdv07abq10PURo9Q5duNq6isZHwEs4KNPKoZCJT3gl02Bb46tKiyam3J9MJfUNzyLAo7jAAOid4zHmXJKL6vfQ6ng2/aE8OdnseJMaxozcSPH7g0rr3DIMW0XfJvSRBipUr33i1/UW/2vI0IFVj3A2ccK4c8EodjE/ioEQLnqRn6ZW7o040cx9XembJtDTG5Np8mJvCrEgYxQA6IF/yIYaQZp3DKRBzT5kyn3TlqLTEN8Op9WybinAiCi+Y63O2kxpUTPZqeUbUx/3087Hk1awv6Ha2sRCuNM25QUmAiG6xVsTNnU/n5F0B965xA+mgBDpSo3ykn8j86SOSsikh0M8OOJA0jqRj+uvnYPFmKYv/AjsNXvrGOw== 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:(13230031)(4636009)(396003)(346002)(376002)(39860400002)(136003)(230922051799003)(82310400011)(451199024)(186009)(1800799009)(64100799003)(46966006)(36840700001)(40470700004)(7696005)(6666004)(356005)(81166007)(82740400003)(36860700001)(40460700003)(47076005)(86362001)(16526019)(66574015)(336012)(83380400001)(426003)(1076003)(2616005)(26005)(44832011)(8676002)(7406005)(8936002)(41300700001)(316002)(7416002)(2906002)(4326008)(5660300002)(110136005)(70586007)(54906003)(70206006)(36756003)(40480700001)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 20:26:28.2969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5767d053-29b3-4268-0f13-08dbcc2aae0e 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: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5407 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:27:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779673444315128268 X-GMAIL-MSGID: 1779673444315128268 In x86, hardware uses RMID to identify a monitoring group. When a user creates a monitor group these details are not visible. These details can help resctrl debugging. Add RMID(mon_hw_id) to the monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Add RFTYPE_MON_BASE that complements existing RFTYPE_CTRL_BASE and represents files belonging to monitoring groups. Other architectures do not use "RMID". Use the name mon_hw_id to refer to "RMID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v13: Minor commit message update. (Reinette). v12: Moved the comments from arch/x86/kernel/cpu/resctrl/internal.h to Documentation/arch/x86/resctrl.rst. (Boris) Moved RFTYPE_MON_BASE definition here where it is being used. (Boris) --- Documentation/arch/x86/resctrl.rst | 12 ++++++++++++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 07225d9c0b0f..d1538b480b22 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -376,6 +376,10 @@ When monitoring is enabled all MON groups will also contain: 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. +"mon_hw_id": + Available only with debug option. The identifier used by hardware + for the monitor group. On x86 this is the RMID. + RESCTRL filesystem implementation notes ======================================= RESCTRL filesystem has two main components @@ -440,6 +444,14 @@ RESCTRL filesystem has two main components -> RFTYPE_CTRL (Files for CTRL group) Files: mode, schemata, size + -> RFTYPE_MON (Files for MON group) + + -> RFTYPE_DEBUG (Files to help resctrl debugging) + File: mon_hw_id + + -> RFTYPE_CTRL (Files for CTRL group) + Files: mode, schemata, size + -> RFTYPE_DEBUG (Files to help resctrl debugging) File: ctrl_hw_id diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index b816b902b5c0..a4f1aa15f0a2 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -254,6 +254,7 @@ struct rdtgroup { #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) #define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) /* List of all resource groups */ extern struct list_head rdt_all_groups; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5f6d6ba63a2e..69a1de92384a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1867,6 +1883,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "mon_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + .fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG, + }, { .name = "schemata", .mode = 0644,