From patchwork Fri Aug 11 20:08:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1337444vqi; Fri, 11 Aug 2023 13:26:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGuWpoHz+kIwUZlW2rq2z7BNY+SqhAYyzrighIvfrUsLmGrTPM3aPDSelcLG3UdfcORB/E X-Received: by 2002:a05:6512:78c:b0:4fe:db6:cb3a with SMTP id x12-20020a056512078c00b004fe0db6cb3amr2119532lfr.22.1691785610503; Fri, 11 Aug 2023 13:26:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691785610; cv=pass; d=google.com; s=arc-20160816; b=mHlE7bUbXjZ+YTiFvpv41dbSac7A0zRDyG2cCiwShax6r4fq1PJZMZDp/lY4tD8NZV WF7dpJTLG5+oeRnw2uWJW0Iz9viZTT13n2ghl9tvs4EMZYLR5Otq5eGMtdN3hsieImUO yFiLA5vdqPrERqxM4cH3GgiiCy0RQU8dqbKzp7fXxeikOZGud6R0KUGI+ROS9qvWiHBG 0PuGbVtzMlFQVWduvE56jWurlUFsJpY8EH93qEZmBMvqraHLa/ROiuHLMQhwTVKAcQwF y5SynHlLxBgU7AaV23RvleYOhfNZZC1fRzX1yDzbjs8fND5Sx5x19mbF216+C4CBTU76 giFg== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=U5U4v7REjseNyp8szDNRtG7x0pMTTwGKkVR2CiMPjyg=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=Wii/7T/5QFsQ5Amk78qSoIysy6x6VkElAI9O2yPkDbeCFba6tV46tRtbJIRuQh/s65 jinmRqdzZWyqd0Lmd6+zxGDWBwubDp+lg3a7dot5R+91DXeqhFL0FSwSbCzGg2RI5T0u WZD/JTyZoKa9pizz5zLAR8z1nwPaCF1cSHb6mUb5HNTTEpqpHUTdsiqMg0RxwiqC6h2L wQiigFSP7HbBGUtDklu/CE2s3z5Cca5gGoGkIKQ/oTU2jUEfxk78v2zurpvP7pIbSYFp YFH0/5WPo3P8rhyvctBVu7gPNgqnH/+gR2nV58TnM1beDJzQ4KU5gmDe820fZSZoTY7q fcTQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=naBOIk9l; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a50fc0e000000b005230e273470si4095811edr.253.2023.08.11.13.26.26; Fri, 11 Aug 2023 13:26:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=naBOIk9l; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235507AbjHKUIk (ORCPT + 99 others); Fri, 11 Aug 2023 16:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbjHKUIj (ORCPT ); Fri, 11 Aug 2023 16:08:39 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2089.outbound.protection.outlook.com [40.107.243.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C81730F8; Fri, 11 Aug 2023 13:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5AYe56Fgx38hrjxYKGriijby5VoDJvb50VH8BzEh5HCIYih/eU6jBT+YJrSqUEqi/l+EaxpBtxLadHGYJ3mw9njH2Co0gSqdbrXTMsvF441IAdaYGGLmawPZ+oKUtAMQUch6gDKT48dE8fs5rjZAzL2sr7muDD8o4yFl6Mg7CGVnAB/YaJGb83vovgDLQTh/yTt3dhweovdtlKU/LvJwRRdrz43ZRfMrNzzoRfh5vu4Cc5KVgj5SwGOJiOvyn9IItUNBFIxk03KUfgX3fir7316BvvT4n9Jpx6Fg8QJxuxTQx7mByU2dHn8SzY8c5GE7yA060zxQz8ISVhFkoDfKw== 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=U5U4v7REjseNyp8szDNRtG7x0pMTTwGKkVR2CiMPjyg=; b=Zn54HZKGzJajuExXZJp9elnIf30YSGXvFWAnJOMaWFVW5bycJdXzhWBZtYy8Mnzo7jLHSCEwStc9qrXN9iKr4IOZlcf6DBX5B1ERfZAc2JjQL5brgDEX2YAJFd+MehGAdPx5+clsHxE/Ult6yk6Mv7dFxjPoQ2Hl+LO/xXmZxEkcDluJQiMclfK9K1Xl6LAPe7lANX2L0ca6aKaVKwcOdM0ftfRsl5Hm/tyr6dWOf42MRcf2qtX6LSAdg9Elu6DTxl9/I/zKyg/X7qw44el5wQ091ijKbgaqIL6bZx/sXDqoVKULsDPGbvgHAUOzTODjtbCHVnqKI2R4Oseica/9WQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=U5U4v7REjseNyp8szDNRtG7x0pMTTwGKkVR2CiMPjyg=; b=naBOIk9l2oHQkboehBCRR4HQzzVrq7sUII2vN8qbMgVf9kZKbmxEr4+k2Q/uejlQ2kMD0HIA7RVcbn+MIMX5gEzs6XCkyU6E/a5cwp7nhBQ1R79acZx4BR3OOJEmifiJON7UPbAlGocy1Rkgh0lWGkV4vjStI5qU627SIRiDnio= Received: from MW4PR04CA0267.namprd04.prod.outlook.com (2603:10b6:303:88::32) by DM4PR12MB5261.namprd12.prod.outlook.com (2603:10b6:5:398::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 20:08:35 +0000 Received: from MWH0EPF000971E7.namprd02.prod.outlook.com (2603:10b6:303:88:cafe::f) by MW4PR04CA0267.outlook.office365.com (2603:10b6:303:88::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.31 via Frontend Transport; Fri, 11 Aug 2023 20:08:35 +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 MWH0EPF000971E7.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.20 via Frontend Transport; Fri, 11 Aug 2023 20:08:34 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:08:24 -0500 Subject: [PATCH v7 1/8] x86/resctrl: Add multiple tasks to the resctrl group at once From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:08:18 -0500 Message-ID: <169178449820.1147205.3688106607892992826.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E7:EE_|DM4PR12MB5261:EE_ X-MS-Office365-Filtering-Correlation-Id: 0123427f-177e-45b5-b42b-08db9aa6be0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1U3QJXG3KnFR61H1YnxmceKnWHKg8hKLcRV9hRuFIpmgJ8OBh34Wm2ecvoOSPtfc/JMYA/Zxk63BkyJEOCCrNVJd2uj5znd+CiDtn7NnDqPePSpMvxoFwyZ9k6w2wOsWiKwHSjV9nfigKds892E75Mv5uOrpXmhP4bsQ2ZCBlBEDb1n3DCxGTNpna6eYjNuQnMFqiPugDrpWDmUH0qdLTY21PND7Tcz49iG4IVXbyPttyZdpVAHwg0CY7cM0EE6GEvJzFFePr9GoDwpsNpnjtZHLX6423GkFg+4CMc4eFBiJOpJyXj8Si9oIY4mBxmeMQA/V6Rqh2tNrpyM4H7JOgME6H5CvvGmMGzYi4kgc+ibHhjxW83yu7yTN4WSHjyMpFoLPOSms+jmwLEqKP93fBRmtzacgMKa0lxPeEM74vIbKkPQQmCyu0wo2+NhC/qTGZejJnHr+h5G/3XZS8viuYNg2TTJHbe1cjxr17VNO0S8s9tYE3hEk6CyDRkRzv+mf0xAS/68/NIEYwKsU7H9C73YZMMlbZm7zkA/G/IaUVjZG4Spj3Bp9noRVN1aNCLPxSS5+Yvi2G1NleDAgg/DgTxzwYQ25DPkzsOt4dXhMe3FeeVBBr+6C38fuNRqT8kFm4eVjqOvKOpwvgjCmV1JinaM1W10sdDIKACZLcBS2fxvdWa0F1nh4T77WjkH3Nq4Dtzd0U9VWBfJaa/4s0cp+iB6JtjXrqWInrJSE5/hiDEHVPuFK5urbUO4ST5ZATtwRXDtfmoqvUVAHM85jZhZbH361AR8DRHfS4TttwKwedK0= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199021)(186006)(1800799006)(82310400008)(46966006)(36840700001)(40470700004)(40460700003)(66899021)(40480700001)(54906003)(110136005)(16526019)(26005)(70206006)(336012)(6666004)(478600001)(70586007)(103116003)(86362001)(426003)(47076005)(83380400001)(36860700001)(16576012)(33716001)(44832011)(316002)(41300700001)(7406005)(7416002)(4326008)(9686003)(356005)(2906002)(81166007)(8676002)(82740400003)(5660300002)(8936002)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:08:34.4959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0123427f-177e-45b5-b42b-08db9aa6be0a 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: MWH0EPF000971E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5261 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773965788553148981 X-GMAIL-MSGID: 1773965788553148981 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 Reviewed-by: Tan Shaopeng Tested-by: Tan Shaopeng Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- Documentation/arch/x86/resctrl.rst | 8 +++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index cb05d90111b4..af234681756e 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -299,7 +299,13 @@ All groups contain the following files: "tasks": Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the - group. If the group is a CTRL_MON group the task is removed from + group. Multiple tasks can be added by separating the task ids + with commas. Tasks will be assigned sequentially. Multiple + failures are not supported. A single failure encountered while + attempting to assign a task will cause the operation to abort. + Failures will be logged to /sys/fs/resctrl/info/last_cmd_status. + + If the group is a CTRL_MON group the task is removed from whichever previous CTRL_MON group owned the task and also from any MON group that owned the task. If the group is a MON group, then the task must already belong to the CTRL_MON parent of this diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 725344048f85..8c91c333f9b3 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -696,11 +696,10 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_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_puts("Task list parsing error\n"); + 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 Aug 11 20:08:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1360306vqi; Fri, 11 Aug 2023 14:16:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEM49NaRdL4JUDRMJrp4rz5VMfDOcfnes3o/5dG+pkkfq2zwycjSuBqXLx9k5CEMfhttbns X-Received: by 2002:a05:6a20:8e06:b0:135:8a65:a772 with SMTP id y6-20020a056a208e0600b001358a65a772mr4688813pzj.50.1691788582653; Fri, 11 Aug 2023 14:16:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691788582; cv=pass; d=google.com; s=arc-20160816; b=ZO4QtRghAsneLWdtLScwmH9X6mUyacAWbSVaXWHpL+d2k1Kha2my6+ArCCJXEqCu0k a81LRXZY27WPQIUgNwlrvR0P9A3O+WbsYg0BDJKSqdlyxneTrbx6HcSWWXjRD95bUcP1 i4pgM4+/b6lkr5zlH4uik5rRfwKXqxeYGpciBsHo6Kc1w6D9NNg9y2xVc5I8iQObIq33 JWXcZF9z9JwO+04UFSPclofqw3N+9CMfepk+7xo2y3IhVBN5eSRUmGjBzRUUfSYkwMdt 2t8yBkJYjfJESbvm5nCusjv+3JpXFDGq/H96HQAs38d60Y2I8eQ2EVUuYjqJikXv053z FQEQ== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=g8el2da/9RO2c6hM6AU3CGQgm/f4ArVbL9fHz+gLBZU=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=iGdDtKILydEgD1/aSVetrK3m15g/1mzIP6KjRX9bVtgG8irqogT+YNSYfCAvQiNxI+ NyIJXewEFPcc9H9p4qezVXRdFDKU7vhA7yPbSmA4XmdW4X1Lr16pOvJ8y0IcOLQP4Q+6 tOlO9KCsJxjEAKsOS3x5uvrBsQrstreqLq9MeBHChSK4L9A9TNOKCMhYBCeL6O1lD+OU 3M+vHp4oNULjOXA1ru1S3GRkRiK2nliQpSnqCyJEBdkYSU6fLzjL1VLSfFuxNlUG8M3j 49nFAhvAzGzx33CXgDZQtXsnOavAxncgj9zm+PijjP+aiqFvMCCNcfXk2h3fSb1cL2Jv a2lQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="P2E474/j"; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id az1-20020a056a02004100b0055c07307e5bsi4026437pgb.64.2023.08.11.14.16.09; Fri, 11 Aug 2023 14:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="P2E474/j"; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235546AbjHKUJj (ORCPT + 99 others); Fri, 11 Aug 2023 16:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235819AbjHKUJi (ORCPT ); Fri, 11 Aug 2023 16:09:38 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E54B30FF; Fri, 11 Aug 2023 13:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S+bp3fXyqCw10ZW5/w8MIodCPuJKrrvdF53hjmDXDSVoLIaeoG2lpbI24uMHHb9yQ3bQkiF9jq30nM13uKnEkCgQ0WY6yZ6VLLoatCtdbygdEbK7dqMWmXDomk5M3RaWGMMcQhUpPQG0BX0gF8eyWaHd77ZDmhtCOCQNhwFfCeFWjscKFu5pLzyUq5V92fGFNTAST7Jn4KxvTWgeXzJact+yuHVjIOMAcmcfCnFCUkvAhs+ISDlWfFEFTu95rczbc3fw9LYhG+OS8eRn3kra6qQum3YioWam5GcVIMN3pPJ81LR/AValq56mLvBqt4mkuhC3wRK9APS3iW1dT1cRnw== 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=g8el2da/9RO2c6hM6AU3CGQgm/f4ArVbL9fHz+gLBZU=; b=hhi/5KiGKjYcVUT1Bj8jyLDH7X5fHIHxHuDKpqzKtheE2oqc3R57VuXnUcZFEEkAtnrCIX1XkYpRB0rLmlLSkCaxOk8U6oCMQmP0SXkTGRDs+Ut83Y6eHn7m4w59zX1PhwzdS2gtBtmiCmD2/+yFRgREXkeRepvEsmPTH3TC4p49Pd3CCI+3qbzS1grbQHId5ZmAWvoY4dORHhnp9bWyKM8GPubh52Vj2yCGcewQXBoJcQ5aDy3jwrm1RHEZjHfPaVajDnR0ND5Gl9O2MGSmYFXBVcquEK4wO64c5q2rBdXvvp1CqEvx6BwFZmewxFKmeuic7C5KLE0snTOsPFkvtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=g8el2da/9RO2c6hM6AU3CGQgm/f4ArVbL9fHz+gLBZU=; b=P2E474/jnqtM2/CuFvVrzUdveAp2K2BsefhEXGic1sB7D0RAWZzbQawLvVENz7vdRDSHNlSH8aRkq0in5DAo1ipVYNRB3umSSqfC+rZlEJqhJZsA/37th0p/d58Qki7J9pZVJIdW7Xc1c1wW9HBB8pVctzKvc7K6yIfidjowUL4= Received: from MW4PR04CA0256.namprd04.prod.outlook.com (2603:10b6:303:88::21) by DS7PR12MB5984.namprd12.prod.outlook.com (2603:10b6:8:7f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 20:09:35 +0000 Received: from MWH0EPF000971E7.namprd02.prod.outlook.com (2603:10b6:303:88:cafe::92) by MW4PR04CA0256.outlook.office365.com (2603:10b6:303:88::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.31 via Frontend Transport; Fri, 11 Aug 2023 20:09:35 +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 MWH0EPF000971E7.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.20 via Frontend Transport; Fri, 11 Aug 2023 20:09:34 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:08:39 -0500 Subject: [PATCH v7 2/8] x86/resctrl: Simplify rftype flag definitions From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:08:37 -0500 Message-ID: <169178451786.1147205.17416534865851883140.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E7:EE_|DS7PR12MB5984:EE_ X-MS-Office365-Filtering-Correlation-Id: b5d58944-47ba-4a67-1806-08db9aa6e200 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hcUzEqBjQyX/US9pHIt1DFet3ho2/P1Di9T6KLUH+SgmOvyOObJ2mdnE0nGXOw52Dda4tavjXTPkfFCRl1JOFtuMOYrOvK5WM9ZpqXyHZG6Qj0vz3UfmIc9x4hk4hUoRXKOngS2nxPXZvtmikfpTy5JfG3UXWb3e5HNvLTXgdtZVF/aad7vWuNuTqvY1kAtPgXdArnElBxMrXeb+tCM9z2OEcYuRRbqZing8xejlAoc9nBxKCspMtrWfdQ7TPQ+8ktE9nqcoDjVb1IvyDXqztlpc7Ee/Wb4sjHzkCHUFR+L9Gogj0+xjPov7XfoqnNI/7O8FjYq6VzCcfSk9RSSgOmay1rzJb2otTl5lcsSpA4/BxYZEmydCPSoqqKoow1KcunqWpi5KK+XqXBU6RAl/QcrOe3LAysnHTlB6uhsHNC3+vFya6WZ3MQSCNKgRGtJKLjik9Yr0azAie9c/4JTheKr2YNvw+k6zUNDXMSh7z8MsSi6vvtOHdpDJsmar56/WYdA/9ZCFEG2YYKRZupWy+0r93qtVhlbUrmxyqrwmgY6gGBt0OXg+ZS3qnZV9zktoeOLS5Zabw7LHmFRD9my3zjX/Uti5fkDcWobtGAfebVwX90gPs4nwIvuUScujtcXscGp8oQ8tQ9mRo68PjLUB1i1B/kGjrC3GUkxCXItpcmbaY1StkcHnsSqa0sR4EzAi1AUnRsDTyye2UbkSZtRpL4MHbEW6096N4PPYKzPW09jPKw3B9v4+iUPxOh+HjDCUm1G8J5DVvzTWbn8cuDZ2kBHuB1I84UEy5VZPSum8oHw= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(39860400002)(376002)(136003)(346002)(396003)(451199021)(186006)(82310400008)(1800799006)(36840700001)(40470700004)(46966006)(40460700003)(40480700001)(336012)(70206006)(26005)(54906003)(478600001)(110136005)(103116003)(70586007)(16526019)(47076005)(36860700001)(83380400001)(426003)(44832011)(8676002)(41300700001)(33716001)(7406005)(316002)(4326008)(9686003)(2906002)(7416002)(86362001)(16576012)(81166007)(5660300002)(82740400003)(8936002)(356005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:09:34.8400 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5d58944-47ba-4a67-1806-08db9aa6e200 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: MWH0EPF000971E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5984 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773968904662746868 X-GMAIL-MSGID: 1773968904662746868 The rftype flags are bitmaps used for adding files under resctrl filesystem. Some of these bitmaps have one extra level of indirection which is not necessary. Make them all direct definition to be consistent and easier to read. Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- 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 85ceaf9a31ac..62767774810d 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -243,12 +243,9 @@ struct rdtgroup { */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) -#define RF_CTRLSHIFT 4 -#define RF_MONSHIFT 5 -#define RF_TOPSHIFT 6 -#define RFTYPE_CTRL BIT(RF_CTRLSHIFT) -#define RFTYPE_MON BIT(RF_MONSHIFT) -#define RFTYPE_TOP BIT(RF_TOPSHIFT) +#define RFTYPE_CTRL BIT(4) +#define RFTYPE_MON BIT(5) +#define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) #define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 8c91c333f9b3..2f1b9f69326f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3242,7 +3242,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *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 Aug 11 20:09:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1367089vqi; Fri, 11 Aug 2023 14:32:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUeJCCzKPTjKtTn68tC51OnHklVAJjKg0I2CQITxIM2vrTTAC3VkPtP5gCJ3TNXZAlSTW7 X-Received: by 2002:a17:90a:a117:b0:267:8012:b393 with SMTP id s23-20020a17090aa11700b002678012b393mr2588814pjp.34.1691789541681; Fri, 11 Aug 2023 14:32:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691789541; cv=pass; d=google.com; s=arc-20160816; b=k9UYOGof7onkU8WDVG3ibvn0Zjm90qRMMpkkO6XYyc3RB1+2W0wROqxRoBTSwKNNXH gg3zo3CH3hdoMMz5xJRREOwkK6dEz5tnpUJcw89fHrr+N55cRxlkJlhxPRbuLr4Ab5Kr wi+sxjrQR2U5WUZ3BW3sv8vBgDqkNDH7BbdBJaw/o8PGLLogAHgXDpMVQWFl8ByGfZ+l a+VSu2p46Ntu8329SczQytPK7i/uinB5gtQ1Ga5HQQUO422RuRPJwrWYlQlNscY01bGS L1UhT3ncqt7eNvSOOyU0tKYIUGCFIw6fb9xO09i37k8HkN59Yluu4jzBAMmM9CDx/xqO RK3g== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=NuEnOFEyu1DSfIuALeQr57ZKwBzWcxoQIVgTeYOQnyk=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=FTi7+uCkZIGhTM6XWOGB0Tj/WzIk2HwnO6JpzKqAyJGeeJz938SRvFrhdZ+YqXcOfY QsV1Rnkua5SCZpeTav/L+gnSryMSSivnTQ3O4eZRnR3vmSVaBy41PfASekXpk64Fh5c7 8ahjV1x3wYi1htUDN/JZ61hW7R1H6QwgHDGKGKLmPL30jiMUmmr1+qjdEF8ekZTtbMoP MdXaPpD8qjZQYSqUuUiqqT7WcklpQGzekQE2zkqaplJncNc7VL6fKYP2awAj9tYry281 00b8Wqv68aAVaLxdaj8N55ZTb5sbvedwctF7+6buSZF2YYQ3FKKKFNNut06A3+h9PreV CTDw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GIuYvvsC; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a170902c9c400b001b3eeaad177si3892617pld.99.2023.08.11.14.32.06; Fri, 11 Aug 2023 14:32:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GIuYvvsC; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236598AbjHKUJu (ORCPT + 99 others); Fri, 11 Aug 2023 16:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235650AbjHKUJs (ORCPT ); Fri, 11 Aug 2023 16:09:48 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0533E30F8; Fri, 11 Aug 2023 13:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AoHDhCgztulUx2EgSOSvA35bxwgf0Y/cDSCEpfGhwC3lDbG9OTDg/kW/gMRCdZKfXgNwl6Bbb6Qc0f06SEoR/ADH+oyMHhpuOn35AR/RWt2gJS9JdezLfDXMN+C1zx9ZNVD3C5rqslk4afNJguewyKap0lNRC0NTC9CWfB2enGIVgv6iaRsLwiY0ALXiw5hLwoilRR0QgWNbdRUvd/F7AviUKg/vcj/a0bbKkYPPvyl/JRBHRlBpW68NOt2MOxoNfVa8z+3XOdcGHvSASG+s5p1JFI5C1AUlJucoE2Q3LvgJBfKx8bFT8kWPyaFyKnLveqHVhHOzmgL3/LbcMcSokg== 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=NuEnOFEyu1DSfIuALeQr57ZKwBzWcxoQIVgTeYOQnyk=; b=CfLuaH380dVwwIcmUKbePDChvrHaxA2zGy0uhfRUa5srFTAb6Teu/FMqitH9/TyDVU9kr9O8vTYdAoy1209+wXOEm3DHMri0VjjJ/ZKIVIil6JDK9R6R7hEC1YAOKZ+4EUhqXy8Ecr1KSReAJA/0CUyRluqIf4p0KYFjx6J0vk10yK7bA3SdvCeDnJh2HKC1WaTiTsRXTg/nM0CN0wfYI1s6mrZIS3vAKs8D+a3MTrj5nDvMDVDCz4DoTV/wSAwfCc9zc0YwEyawckBSHrvpysUFqaLS+0+OnbuLeFirRcWW+VaBLeYHDt2Zu5OFqT4/+ev9VAK8A52Rh8a7J0gfVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=NuEnOFEyu1DSfIuALeQr57ZKwBzWcxoQIVgTeYOQnyk=; b=GIuYvvsCWnXttqDgDjDaciH5GHFHSB3WoC5rln0NKbNhg098lYOhDYXQSYQ+FlQ4o5kqvocuZYB8HRS8S19hgPVwCX7yl8kdWegXS/R80VQbzayh38U1B9pJ/Sfvkbo2Hr7BzH7zs9j5OYOlJzcEqEz/7oISH2mO1W0mZSIjAms= Received: from BYAPR04CA0033.namprd04.prod.outlook.com (2603:10b6:a03:40::46) by DM6PR12MB4497.namprd12.prod.outlook.com (2603:10b6:5:2a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.19; Fri, 11 Aug 2023 20:09:43 +0000 Received: from MWH0EPF000971E8.namprd02.prod.outlook.com (2603:10b6:a03:40:cafe::f7) by BYAPR04CA0033.outlook.office365.com (2603:10b6:a03:40::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27 via Frontend Transport; Fri, 11 Aug 2023 20:09:43 +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 MWH0EPF000971E8.mail.protection.outlook.com (10.167.243.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.20 via Frontend Transport; Fri, 11 Aug 2023 20:09:42 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:09:39 -0500 Subject: [PATCH v7 3/8] x86/resctrl: Rename rftype flags for consistency From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:09:38 -0500 Message-ID: <169178457798.1147205.16211900713494712341.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E8:EE_|DM6PR12MB4497:EE_ X-MS-Office365-Filtering-Correlation-Id: f3002ab3-6210-46ef-0da0-08db9aa6e6b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7K8/aklYzRx966TjkJXqndQ5SkFDknEi3RtuE1/d0j1/J8CMeSEUy+NuxYqBcWDcGK16BCIA+YwWT257kHPwWv++wtMhaEXuQx1Xw7wbQ+mT4vX375v+4JBrrNDmXd+LcJeF31TaYGeVHGXGgRtKyeKcyzh1WCYMZ31ypJgnX714rnN4lXfQjRaGaoE6X4RsvbMu+yD7Ve7R4Qa+G/IyV9+pwNPTm6e2tWM+9vbHTY9Fl6ycluxJRswC43sjooSTBMMmKttrd88JEVI0QChhMBiaQJMnPqvel2eYy7GFxS3+7ouPtUuubguMJah1yKTJRVKb/O/KDC45NQCgcDfZrG+FEH5sYafd0IV+dYgYfUyzNozaNOwSVx8PWgvS3Pqri/PSjjkmbQ6oicjVN3Bpeud1kjUk1cqUZxH7TUzRUuKqqkjYoimzuA+MY9rFqkRQRo1Wq3BZslq1iATdmmavDOA4ptmG8z7UlvN/NqldoC2zh5uTaOTgW+G6b7CjvEF7giwpjbRlBrjW9EkAI11x7bMt30W0+Cr5uf+s/r0XGAwNzr/OCx7Jetk2JYXZjnsHzF5GIRQGvcqI7dslB01KLMTF+BK9dvPLtyNpnGYaSnNv3+JKwfErts4xCls3ASd9ydb8ONNNoCVLlUSp3Fd8cu84pnxKrhSpN/BWPV8qOiN1AbUNzEO4a2kBJH34+Pc244K74IPjR2IvXL6FghxNwlbVwaAFUFhXhCrUbMnJzq6PqsuhnUtL7rCDJ+mbTksuztWMxHjk7geD9XYRbDkt7uNQ7OW0nA/7RdZ9pWUKcF8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(136003)(376002)(39860400002)(396003)(346002)(451199021)(82310400008)(1800799006)(186006)(46966006)(36840700001)(40470700004)(44832011)(40460700003)(2906002)(16576012)(316002)(8936002)(8676002)(7406005)(7416002)(5660300002)(41300700001)(103116003)(33716001)(40480700001)(86362001)(4326008)(9686003)(26005)(16526019)(82740400003)(356005)(81166007)(83380400001)(47076005)(336012)(110136005)(36860700001)(426003)(54906003)(478600001)(70586007)(70206006)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:09:42.7459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3002ab3-6210-46ef-0da0-08db9aa6e6b4 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: MWH0EPF000971E8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4497 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773969910308228279 X-GMAIL-MSGID: 1773969910308228279 resctrl associates rftype flags with its files so that files can be chosen based on the resource, whether it is info or base, and if it is control or monitor type file. These flags use the RF_ as well as RFTYPE_ prefixes. Change the prefix to RFTYPE_ for all these flags to be consistent. Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 10 ++++---- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 ++++++++++++++++---------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 62767774810d..2051179a3b91 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,10 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) -#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) /* 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 2f1b9f69326f..3010e3a1394d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1705,77 +1705,77 @@ static struct rftype res_common_files[] = { .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 @@ -1794,7 +1794,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", @@ -1841,7 +1841,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", @@ -1849,14 +1849,14 @@ 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, }, }; @@ -1913,7 +1913,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) @@ -1922,7 +1922,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; } /** @@ -2057,21 +2057,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) @@ -3709,7 +3709,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 Aug 11 20:09:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1359751vqi; Fri, 11 Aug 2023 14:15:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7/ZKocNxs4xRPzWrQK6REkKwINj5BZOSFeWueQeD7McTPsw1UrRfhlkKX7ug28d03/u2t X-Received: by 2002:a19:5004:0:b0:4fb:5dd5:715c with SMTP id e4-20020a195004000000b004fb5dd5715cmr1870531lfb.4.1691788525636; Fri, 11 Aug 2023 14:15:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691788525; cv=pass; d=google.com; s=arc-20160816; b=QHaSJxjkCzYgiC7aS3LzWzdk/YhYQ8KeP3lW4kDrgQktspwmMtUcTLE5XytcBSPTOH dRDh49GrZxl33eDZaaNoZCggpqLg0yMZLtwBD1np0guGl8IagsxqA8q5Ke3iwh5u/heO gYAH6Kr7vJx8EBUcnMJf7ykSD8SQK5ZriXQ6iR+VQ4i4IVdkAWUq3YsWfOr8Gi4dnqZV QCYUP/Q5ijcEM/BawhO3AbYuHdifsLz0y3pOWEvODmk75/XP7fIP+MkWXCeZE7Ko96Uo 0ousRiO0WjQ4zPfUNqH7gGsNxM5QDmrta7YVBJzPjct/6P8QndJmjjS6QEOIte5hX0dq eOvQ== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=P+DSIBfIYdaBQQoN1Aahql3oHTBoBm0oXqwHDD+PRts=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=NC/xDMx+Xc2VQP7gyL6mQdXXfVT61iJicc7un/WmPpCugBInZd/KeUwE6fbZdb3/wA nsgHsknSqjTCTQXzyJKBS6/PW6b/0pWZ0LdZAdi4t4XZe8Y4M/Pp1aaNYLBnbcof/dSs ummSNZZVqTVEEP8zraWMv0XB5n3jAAOTh8o6r92Dwu836oTwV+I+9iN3Vre1i3zchwA5 y1NtsDfguWowiFgXJyDfP6WSJ51Hp/97xMXp/BB99mH9zF2A8y1JMEUwJfihlPkLVh39 iTU86YYZQJahU228A6FlsqVN7LZQqhD7YHVqBiEQvFWGZcMzPugKjlTIila6di3qQh7m 3ASA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ggcPmUjc; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g4-20020aa7d1c4000000b005222b4faaf1si4144476edp.356.2023.08.11.14.15.02; Fri, 11 Aug 2023 14:15:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ggcPmUjc; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236451AbjHKUJ6 (ORCPT + 99 others); Fri, 11 Aug 2023 16:09:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236323AbjHKUJ4 (ORCPT ); Fri, 11 Aug 2023 16:09:56 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2068.outbound.protection.outlook.com [40.107.220.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 905E230FC; Fri, 11 Aug 2023 13:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZXKwQ+o6JoTEB3dmwmEJ25zOc6KtmG7D3RJeBX3QMUXEx5Pyon+V3tjMkLRp3ITL7B4PTEFtaAuU7FjGxGgA8RLx7vsPjSxShMW2+7ZenQ7v9r20lF/AN+x/Lm5nFS3AfCTKMDGxeGQQ7GozKz/0CGFPp65On2JPo/Ec4Llcq9ue0cBrLHmXZk3xhtcxxqNZ03STw4B43NcMy5vDRFxXZrhb7gb6McTx7xKsvSaxeT0RagiWzH/FpiTtqZJTixNA0ymdQD43MCdX1yEuqLQvhZiyFTZdnwMrU0yEGaGR53D9wPSZjtyssrJKXHylHfR13+KE52MlAgjzfcPtjbJRg== 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=P+DSIBfIYdaBQQoN1Aahql3oHTBoBm0oXqwHDD+PRts=; b=l0Y9+VoZTclE328xGP2QOrM03dPy+aH6B54dfXKZPDK/gJ48vdyE1qSkmCoromS0UR92aqIEOLgNjNavDvnXAG7DRr84nlvoX3NvOg8SVSa6n8LzmR4yfqNuskPwJwCl5MpZL0GRZ4IyxWUdk7bH5mCSVEzGGnXek7u46yqlchi/xKXt/71MipjTkmDlDozT8AVea9oViIeBgs6BFb0wzA1c3Jv73+YiMVicxsHYru9Pa6bVL2g/naYIofwUHE0q2pMIISyn8ZnqdFAVi+wbiwHunlVsSrykcEKbKgDtE9kbQ/cN8XgUJxZO1++m/rnlL3gzQeWc1XCwbcaQ9N+OzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=P+DSIBfIYdaBQQoN1Aahql3oHTBoBm0oXqwHDD+PRts=; b=ggcPmUjcXT9UBnB0uFRBTReUfM6kfZ0BdDwr4E3orfGV4MiyqEVMddJaRcrW8yzyvZS2Z5ldWiRL8dKmnEqc0cIvDjeGAobhilejVTWTHLZkuUfVR5LXwm8Z/QqTN9Jn3uwl7VFulZdM1KCNn0DMJiAYTUF40/Bcm9vQAxVmhFA= Received: from BYAPR04CA0025.namprd04.prod.outlook.com (2603:10b6:a03:40::38) by SA1PR12MB7040.namprd12.prod.outlook.com (2603:10b6:806:24f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 20:09:51 +0000 Received: from MWH0EPF000971E8.namprd02.prod.outlook.com (2603:10b6:a03:40:cafe::69) by BYAPR04CA0025.outlook.office365.com (2603:10b6:a03:40::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27 via Frontend Transport; Fri, 11 Aug 2023 20:09:51 +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 MWH0EPF000971E8.mail.protection.outlook.com (10.167.243.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.20 via Frontend Transport; Fri, 11 Aug 2023 20:09:51 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:09:46 -0500 Subject: [PATCH v7 4/8] x86/resctrl: Add comments on RFTYPE flags hierarchy From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:09:45 -0500 Message-ID: <169178458575.1147205.16331131496340363561.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E8:EE_|SA1PR12MB7040:EE_ X-MS-Office365-Filtering-Correlation-Id: 13ef6f07-2d4c-4b0d-bdea-08db9aa6ebd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZHxqMyMD2TTB9H4BOc/NHLiiWk87PIiZ4izraOSNKOykEiA2IzUp++w548om+e4D99zFEnOPjKRNRwHzDA5vVjoy6uOgIRcmlgyGkeIrSO50f+LQPqL8k1+MkfF9V6MMsv9SrIcdDJFUPFpgX5xfyz3aEwdBXuhsiqWG/QOUWfma+4EF6GMWB9533NblXNiHoS1EiDE2SMt8ZmdT/eJ9q8WtGb10JWU8Wv68EQjqkIzTWPOITG6ElWb3I5XPlG1QKB3odWm+SCK+ueVz/IC+DbRYC7Rp/LWW7hNyynZmgp8cbB0MnGbFnTKLLzOgsJ8ClbzooYG0gQ+uMBGZDlXibyv9Yo10eNYE3HPfTkvFU7PTx137V/RskZHOEVIWwoCNcMsKLe7xiMDuS4oKtj5KPtejJcvW2STbiO1c7R7OZFsZhVKF3uwS+ftNT+WF/T/4MIW7YEUi90O7dGptdtg1i4J+4Bms+984uLtcVpbbWV89mkcjQ3s2s5SqIcaLGGmyeTrICFOdyYKtOsAuumZk1kMX3EbTDsDhIavRAJdeY0RQzGvmfnwv7KwDU9HfKf7IaDIH/y6ylBEMezT3B4iKgxmxfXeUImRO6XK11acomJFFvmqdX3q1d2o4aT2gXNE1HUJznxhcn2y3ROxEOcvJT4BRPYdMbC+1463wXZVYWKuKrs0WjTdbvlAUziAvvv78hR9pnXCoo4ZKRLPqorCRWriIAGcP3hB2nuz0PRsLuc9sFGgTbULiIUCzWf3gxIQVd4y6rdMWC4T+UlSS0FDHJgR93x8aP23eQCEOxv6Rlm4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(39860400002)(136003)(346002)(376002)(396003)(186006)(82310400008)(1800799006)(451199021)(46966006)(36840700001)(40470700004)(40480700001)(9686003)(54906003)(110136005)(4326008)(5660300002)(70586007)(70206006)(316002)(16576012)(478600001)(41300700001)(40460700003)(82740400003)(8676002)(26005)(8936002)(44832011)(86362001)(7416002)(33716001)(336012)(7406005)(16526019)(103116003)(47076005)(36860700001)(356005)(81166007)(2906002)(426003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:09:51.3396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13ef6f07-2d4c-4b0d-bdea-08db9aa6ebd5 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: MWH0EPF000971E8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7040 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773968845228704621 X-GMAIL-MSGID: 1773968845228704621 resctrl uses RFTYPE flags for creating resctrl directory structure. Definitions and directory structures are not documented. Add comments to improve the readability and help future additions. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 2051179a3b91..37800724e002 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,6 +240,55 @@ struct rdtgroup { /* * Define the file type flags for base and info directories. + * + * RESCTRL filesystem has two main components + * a. info + * b. base + * + * /sys/fs/resctrl/ + * | + * --> info (Top level directory named "info". Contains files that + * | provide details on control and monitoring resources.) + * | + * --> base (Root directory associated with default resource group + * as well as directories created by user for MON and CTRL + * groups. Contains files to interact with MON and CTRL + * groups.) + * + * info directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_INFO + * --> directory + * --> RFTYPE_TOP_INFO + * Files: last_cmd_status + * + * --> RFTYPE_MON_INFO + * --> directory + * Files: max_threshold_occupancy, mon_features, + * num_rmids, mbm_total_bytes_config, + * mbm_local_bytes_config + * + * --> RFTYPE_CTRL_INFO + * Files: num_closids + * + * --> RFTYPE_RES_CACHE + * --> directories + * Files: bit_usage, cbm_mask, min_cbm_bits, + * shareable_bits + * + * --> RFTYPE_RES_MB + * --> directories + * 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_BASE (Files only for CTRL group) + * Files: mode, schemata, size + * */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) From patchwork Fri Aug 11 20:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1369051vqi; Fri, 11 Aug 2023 14:36:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKHP4hDOw4a5uX7OEf1YPfNvim0CoX2p/pZoc4Qgm8NthTiu34VF9ehMEPRq4mbH8cH01m X-Received: by 2002:a17:902:7405:b0:1b2:1a79:147d with SMTP id g5-20020a170902740500b001b21a79147dmr3016737pll.2.1691789799606; Fri, 11 Aug 2023 14:36:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691789799; cv=pass; d=google.com; s=arc-20160816; b=Cdb68pseSCy9SmfDDntbddvY64P7Glbm0Lk2vYv/uH2qOkpumFr6USJ1CADWh0HO3/ mSzE/Ext7QYkDpjz4MEk0KpmQ757DZ18Lk7GmFYjQ8zVtveoepZfufmZZxntM42HrMTS vz2aQOUDvoS310o8N3XIbZu70rwxK8DVBQu/1dQ2y+ookVU8FjIxG14n7ue11iR3712R +uFRvMMDwjO1Uht0zsbyzWIpMOQB5sJldkg+GF2bnpEdQxZx++qlkrkEqI3cd3f5xKJ9 3reBVa1ULv0VtE93ANAf0Q7GY0hw0pBoGODr6A/+NmuELvN2ho/j5bynblArc+4r9yEx F3lg== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=pmP59P+VoRcJuuAk9hmDW41PRaO7VF5n6xJW5fOcJVc=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=N6j7XhZL4Xad9kl1PkeTKuo0PoG/bH7XEBMU1pFE+zoBDQUeMjwTRjpKAr06uETq8k LMvZ7FGH7rSD3h4FDXkZr/I11N/6f/6l09pJ3EQHWLUJpxaqLQrUa/ujTzhNwUNo19El SvrNWbAUHakhlRJ0LGwtK80BthyMyTpA4q5qUBp3sCvTpXc1CPcHpoD4fYfJDDoR70/v sQ1+tIBoAnA+/Wh0m3iIE4Dm3TPI/Gf+FDrtvkAYe39IM4C5Eea3C3Bb8daY3BVuipj4 aIZ/CkWdKObkhcN6xIfjryFMNBEoQ0l6yn1UwIQFFZH5YPpht/dwRAk9NRniVjHTFzwp XABw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=mGsAvfZp; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc7-20020a170902fa8700b001b8c6890612si3727693plb.594.2023.08.11.14.36.27; Fri, 11 Aug 2023 14:36:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=mGsAvfZp; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235394AbjHKUKk (ORCPT + 99 others); Fri, 11 Aug 2023 16:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234770AbjHKUKj (ORCPT ); Fri, 11 Aug 2023 16:10:39 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2077.outbound.protection.outlook.com [40.107.237.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD57430C8; Fri, 11 Aug 2023 13:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SyR8FrULCpaLzDAgp9009e993JSMiJT7+GIvNvGOiYTm1Yc/c82WPwMFV+J5v0sogRwd+be6xoPjJ9Nu77U0ydNZXxNmlroMCTi52VSHVDtu14MYT+KQFku3GNN9LTGhj/AkYsKyYnSZHiS/RqMvKni5xh5zYxbsva4cS/H0peoItVUZDdY4ikGW6erhE5WMVCLJFyb9Rf2iMmBbOwCz8a4qV99W3hVTkbyN/2Cx2qjiAgDo5GAY0tH6mkEzJZfoEgk9Zsas2qgPy49jYLctoYuKagUGclt9IJrxrxvh5LVWXiTl7QF1jC/Splp3Jj9VBWIpbgFll94Bac7U+bexMw== 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=pmP59P+VoRcJuuAk9hmDW41PRaO7VF5n6xJW5fOcJVc=; b=nX3UH1q60ldgTKrVid3NR9UJbRRYJ5TFJ0yNpS/6TBfsifCNLjeNWh761VX7m/81FAg0xIrj6Xqi318Pr+KQOShoutqKEigS8VKaRGpdj8VeSdD7MxPdooNtJcvBQF2HGtqYXJFM2TN4njDK22ZMhR8eDaJwcdUjCwux8FR/a4JLJzgc/4V3vlsGl+ZtZeI7sI4b2y28YaOUuUCWpaeSoz/aI2dEnG6vnwBpea+SiMwhKK8nTnbvlkCgAMVM3yh4VNHd+nysacLyzcbYTFw9cZdMgdGH8CJr6GGdt211xlYu2EGNIiK3j2wq8mZHta07R6hwmx35KD7d83qCCSwAiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=pmP59P+VoRcJuuAk9hmDW41PRaO7VF5n6xJW5fOcJVc=; b=mGsAvfZpdab+ye+vdFOfeCwCSTnQRyo50QHACx/r6lMZl6TfPoWgORoV6TEH1IG/AkCYezh8/HAjwybiyu8dF349WPZuSUrHFCY8jCTjzWNqjd38HlzVBCEzT0uZbmowVich+XHVbvT3T8YFPuptv6PpP4tJSZh8sH8yWHTNTeU= Received: from SJ0PR05CA0109.namprd05.prod.outlook.com (2603:10b6:a03:334::24) by PH7PR12MB7330.namprd12.prod.outlook.com (2603:10b6:510:20d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 20:10:36 +0000 Received: from MWH0EPF000971E7.namprd02.prod.outlook.com (2603:10b6:a03:334:cafe::7) by SJ0PR05CA0109.outlook.office365.com (2603:10b6:a03:334::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.18 via Frontend Transport; Fri, 11 Aug 2023 20:10:36 +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 MWH0EPF000971E7.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.20 via Frontend Transport; Fri, 11 Aug 2023 20:10:36 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:10:29 -0500 Subject: [PATCH v7 5/8] x86/resctrl: Unwind the errors inside rdt_enable_ctx() From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:09:53 -0500 Message-ID: <169178459367.1147205.14975628669652538089.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E7:EE_|PH7PR12MB7330:EE_ X-MS-Office365-Filtering-Correlation-Id: 668a550d-66f6-4143-7546-08db9aa70690 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ePde88xC62ieSkVvBG/8kIyM+Cr73Hyld77lRL+o5sWzV3eISpiW0DBM7BvhFYUdOAVbnWkNhslhMzx03olQP7CCw5DGGsE0I7oeCGUn97eBy0rM0b6/7bIenHtYb2dobEgHzJsZAG1Vx+xGbSd+mKVk/cze44Z4LjcRCdKLI7R2Z6V4ZVDtlBy1wzzu8zd3VzmQjeHclsHL0OXRgr1ws6y5JLcjQwTLhZkKk2/Zq1OT2P9h8PYw5J2KsrljXpn7ruHxCne4eoCIl0i3Zs/y2trPaj0YRMUAPiAzHgUj8HlMTaBVx/DlZ0rt0y3P99UikfuVwFSzVUfTi6dQBJLJWIFYpW5vXIHMWhmQ4FxnuYTaH0g6voVTMyxFg61zDs6Gdm8twBieXJyzSh4zeGAQw/V6RetFO6uKc4ju+eDWWPMCBTZBOwsApTYn36+wjoXtT0+QFw8uCOuaSjxKa9z+YHPq1W5Gvk8l4NMBPq70Wit+cyJlo09UnzGS5eETYcaXPx7yR07BcMzziSxHvde9abRMaKkcey9djLpY5Mtcc4pV9sHvNFi7giD0g9Skjbe30q3wKQhrFshsBgcmv3HIFZxjgvsLYbhX/WcP7TDxhmIX6mGgWcU8s4517DzkLRflfzw9C9G74GVy9imo3NKBqWK0cJQQe1MTp9uYVT/A5+xS9lSp0p8ZofK9zWyxYBv4wYCIY2QHo3XE8oKfA7ONncnae5n6l2sSlAYwv/rWxLASN8BvMBzz4Kqhlb3hALtX+PtywZrewTvXtUQ97PJvsJmwUvwnBc/W12KTHX+5Zqs= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(39860400002)(136003)(376002)(346002)(396003)(451199021)(82310400008)(1800799006)(186006)(36840700001)(46966006)(40470700004)(40460700003)(4326008)(7416002)(356005)(16526019)(7406005)(81166007)(336012)(33716001)(41300700001)(44832011)(426003)(70206006)(36860700001)(47076005)(70586007)(40480700001)(5660300002)(82740400003)(83380400001)(6666004)(316002)(54906003)(110136005)(103116003)(8936002)(8676002)(2906002)(86362001)(16576012)(26005)(478600001)(9686003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:10:36.1997 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 668a550d-66f6-4143-7546-08db9aa70690 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: MWH0EPF000971E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7330 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773970181208989723 X-GMAIL-MSGID: 1773970181208989723 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. Suggested-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 44 ++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 3010e3a1394d..0805fac04401 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2377,19 +2377,44 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, struct kernfs_node **mon_data_kn); +static void rdt_disable_ctx(struct rdt_fs_context *ctx) +{ + if (ctx->enable_cdpl2) + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); + + if (ctx->enable_cdpl3) + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); + + if (ctx->enable_mba_mbps) + 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_disable; + } - if (!ret && ctx->enable_cdpl3) + if (ctx->enable_cdpl3) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); + if (ret) + goto out_disable; + } - if (!ret && ctx->enable_mba_mbps) + if (ctx->enable_mba_mbps) { ret = set_mba_sc(true); + if (ret) + goto out_disable; + } + + return 0; +out_disable: + rdt_disable_ctx(ctx); return ret; } @@ -2497,13 +2522,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(); @@ -2562,11 +2587,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(ctx); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); From patchwork Fri Aug 11 20:10:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1338957vqi; Fri, 11 Aug 2023 13:30:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEu01J+W9ATCm3KPc5LvY8ExTOulocozfl6ES9uFMJ0T7kvw7Kt1vswvOxlB8KwekeKPUDA X-Received: by 2002:a17:907:7859:b0:994:4e9c:30c6 with SMTP id lb25-20020a170907785900b009944e9c30c6mr2427561ejc.57.1691785819700; Fri, 11 Aug 2023 13:30:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691785819; cv=pass; d=google.com; s=arc-20160816; b=PIVNRYIXapSOePHlCZWtiOxt19PVekCBPsFgN89Zauvevts/WKCrwIwPR5r6tM055q EVE5pASE9XBe2rFHNBwBuBvUEUJasURAHX1/VJu3h9Czg7tr84/FLVEvn5gg+GGlvBxz k0HFzOzuxaYvfuntwhlQtiyPc7EqYtA9mSmsvovCrNUVjsSf3uhRyhX8ZwFUN3Cd79On AD/rJloMP9f6zN5SPRW5ksJ6UMcIwSk0xXwACQNXmt7tdzt7UwfuBcJFnFeNFzCJ/4Bu EkOEc9MjN+h0mXj9ZFoJg6PQtyo8VImSdGL+3TaIHAEYCxWKLcaZ3z1nhtYxb004ovRZ wl7w== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=PfgYOsCGtiaBFc0QyKVPj6KYurATlWLcaOnrA1ibq6o=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=uBK4He8r5vxIu8AJzG/iLAc6D4aG2GXsNEZE/JL4p1hFn3CybPDzExYEOFlD50q6DP sruJOINzaNlQPqtRRd1BDBJ6NN+6Vlcykbl4lGDgTW27WhGC+5J+Ps7OsORYp13PZjwP P4twS/BnD/+42OkBe525ItmMhLRi86d37h3WDEgv414VgpCg0obKT5Z+uLFBAJqHqx8d uzsXxRheYUeCijsvmlkjrNiP1IWU+uTJYc4zQuGbH5AFPtZsBdX125dV7HG1nGI+/hCd UKxCezYJ3wsBLMM/QRWQUaVoyCT47XGjZVxUppjtFurFTdKlH4eSA5bF4KVkzYC8tgfj ljcA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="cI0nl/Eq"; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o2-20020a170906358200b00992e0e54464si3694576ejb.254.2023.08.11.13.29.54; Fri, 11 Aug 2023 13:30:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="cI0nl/Eq"; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236424AbjHKUKw (ORCPT + 99 others); Fri, 11 Aug 2023 16:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbjHKUKu (ORCPT ); Fri, 11 Aug 2023 16:10:50 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2041.outbound.protection.outlook.com [40.107.223.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 172A730C8; Fri, 11 Aug 2023 13:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TohYvuRzy0colFOGkylCp0sL9OPyy9kSrYi6yvsv0Q421yUZ1zwaxmYuAr0xpgnylTSgy65Mh7vJOctc9dO+5IXWgtOlqpl1+R/tO4ePKkubHOaN3J9GmjBHjQKF+4tASWDwHTAmOaUNOpNvA5HXz16yv7Glvhx1Hhj+qdWAfIzPK9c8zePBHSqUaMnN/Kt8jRMP9qDbBUxwefY6y+lb2rCkZUa/m5aJ3VUnKOOh6oT0xj1+quTYnq5OilOWRSEd5JakeQeet89DXlorMYAN/HYpBsEsV1Rz2vkMnEgEKLPibUEmOaaPeBenqcrL29d//v7yaHppoYHP4hy4oxO1zQ== 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=PfgYOsCGtiaBFc0QyKVPj6KYurATlWLcaOnrA1ibq6o=; b=OgUUG2UyfwSKOm+X05fm761f4BhumpuByLxcUyLbTUtcqWzmJnOfUlintLk58NSsLOy5c717yVTX1AqPd1+EpBQxND2sVCBT71CYoNGnMpaxp//DWTnmz/OXZR18/VhdJLWJno/ngCw6xLrSxWzhQCX5VXjd6wh7ngFiIbUF3+8xY8xLF7XDCgEzO0TZ+NAHFUPv/cnJkU5p05lBIO5gYo0iihVDMXOlG7eriBvUIv0AAVPE7aC6BqkAauLvi1WorINWtGqt9HhZeRly+VIXaMjuXwcHEzbVCa46hKoceYv9AmaJmsZSd3/8EX9UP9sMOtk3ZkFKOOoPJqw32mbFJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=PfgYOsCGtiaBFc0QyKVPj6KYurATlWLcaOnrA1ibq6o=; b=cI0nl/Eq9K+c0L4uhZwq5adBLgW3qBwuAO03lbPGbJW4S0xQ8b7JsQktzXMeHybHBcFv4Ml1Y79xzYcrjMDS/j3q1ZIN3RhPYYqlH1NAvtRVzDnpdWo1Dg+RV4GXhAY7Gas+ZAfC6IL+ayeMJZZ+knImtm8VyJlQIgWlyTI6SJ4= Received: from BYAPR05CA0052.namprd05.prod.outlook.com (2603:10b6:a03:74::29) by IA1PR12MB7613.namprd12.prod.outlook.com (2603:10b6:208:42a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 20:10:46 +0000 Received: from MWH0EPF000971E5.namprd02.prod.outlook.com (2603:10b6:a03:74:cafe::c1) by BYAPR05CA0052.outlook.office365.com (2603:10b6:a03:74::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.15 via Frontend Transport; Fri, 11 Aug 2023 20:10:46 +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 MWH0EPF000971E5.mail.protection.outlook.com (10.167.243.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 11 Aug 2023 20:10:45 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:10:42 -0500 Subject: [PATCH v7 6/8] x86/resctrl: Move default control group creation during mount From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:10:36 -0500 Message-ID: <169178463637.1147205.7411319721706077266.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E5:EE_|IA1PR12MB7613:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bf14f01-f2d0-437a-a155-08db9aa70c2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hZSUqi3/lsNHBMuA2zbvsGw6Hv/pQJEAaCthU6I+kfAebe/9PL65fDqk7NzGQaTpKchDZdXPH0kO+cW59UFlYqgiAHJF/MWpYirXGBR0h2j7eatMlNh1Hcj5ODie0WXeaGW7HNap7ZJLnd3h51NFxCeGXMt7d9AYVKGuAdA4gEeqR+exDW3rRZ4b2L3FoMaIL9FPEyhVFjZ66SajdErOBZP6JBb6HrZLnbxrWL7vcoeWd+D6BB4WhgCG8U8AUKfeEt4vNbXeCtCMnw0cVvslO543S2mFmcacOg0Vg7x1TGPaVAhTpnzp9WDGUJVYAiVgtECUiUzY8/6iHWSSBsu6DP5d3MNwCwi8CKx+9AG/6bW+WRj+MLBRoCrzUST5PQTq4dbl1mOVh/P6i0d/aROFHW9+x0BC5zD0EkgOKhevENr8RJpOkO77hfvvABralwKg+fqX28n+FkfIU0+3RdT0wLl0sc+/FEWBksApV67B3Jp1LX4h0Coq0toXyDUOHd6jA4Z3XplRW1N4tEZplg+FdLZztpfqB/oU1KzQLXxbcv/WxLuyt8xN/d+Fgdep6MEuApvBQe2PApCy06fBKLEzd3TIEDQJziFjzdOak+yp7UFTP8OHj3ly6/PSu2KykdzONvjfkNwvoPGyCmyENSdSgWzgKe51plIp3ABZGRoiPJOCR6Qg8rEtyup+n8ikzqFlmr4+p1r0/ktVTPZMU4LzRWmvlWA1g/gyhvxHWnhKNAonvzAvOkLEo+kleKXiTNZRVrBueKdbOdLg80mOi2OzjRu6lqcXSFkLcbNFz3nt9DE= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(396003)(136003)(39860400002)(346002)(376002)(82310400008)(451199021)(186006)(1800799006)(46966006)(40470700004)(36840700001)(36860700001)(2906002)(54906003)(7406005)(7416002)(9686003)(4326008)(47076005)(70206006)(70586007)(110136005)(83380400001)(478600001)(86362001)(426003)(356005)(82740400003)(40460700003)(81166007)(40480700001)(316002)(103116003)(8676002)(8936002)(5660300002)(41300700001)(44832011)(16576012)(336012)(16526019)(6666004)(33716001)(26005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:10:45.5674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bf14f01-f2d0-437a-a155-08db9aa70c2a 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: MWH0EPF000971E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7613 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773966007645981544 X-GMAIL-MSGID: 1773966007645981544 The resctrl default control group is created during kernel init time. If the new files are to be added to the default group based on the mount option, then each file needs to be created separately and call kernfs_activate() again. This can be avoided if all the files are created during the mount and destroyed during the umount. So, move the default group creation in rdt_get_tree() and removal in rdt_kill_sb(). Suggested-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 50 +++++++++++++++++--------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 37800724e002..2bd92c0c3b0c 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -602,5 +602,6 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *r); void __init thread_throttle_mode_init(void); void __init mbm_config_rftype_init(const char *config); void rdt_staged_configs_clear(void); +int rdtgroup_setup_root(struct rdt_fs_context *ctx); #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 0805fac04401..a7453c93bad4 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2521,10 +2521,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(); @@ -2533,6 +2537,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; @@ -2589,6 +2599,8 @@ static int rdt_get_tree(struct fs_context *fc) schemata_list_destroy(); out_ctx: rdt_disable_ctx(ctx); +out_root: + kernfs_destroy_root(rdt_root); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2659,7 +2671,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; @@ -2830,6 +2841,7 @@ static void rdt_kill_sb(struct super_block *sb) rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; schemata_list_destroy(); + kernfs_destroy_root(rdt_root); static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); static_branch_disable_cpuslocked(&rdt_enable_key); @@ -3711,10 +3723,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { .show_options = rdtgroup_show_options, }; -static int __init rdtgroup_setup_root(void) +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, @@ -3722,6 +3732,15 @@ 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 __init rdtgroup_setup_default(void) +{ mutex_lock(&rdtgroup_mutex); rdtgroup_default.closid = 0; @@ -3731,19 +3750,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) @@ -3865,13 +3872,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) @@ -3904,8 +3909,6 @@ int __init rdtgroup_init(void) cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); return ret; } @@ -3915,5 +3918,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 Aug 11 20:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134704 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1361874vqi; Fri, 11 Aug 2023 14:20:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtayza21bRMa1IQAtllu8N51R2ZO1h9PO4I4P16k9r3CumDwSYS1fG9/A2lFbZuWL9xORX X-Received: by 2002:a05:6808:3a8d:b0:3a3:7a28:f841 with SMTP id fb13-20020a0568083a8d00b003a37a28f841mr3355332oib.41.1691788802495; Fri, 11 Aug 2023 14:20:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691788802; cv=pass; d=google.com; s=arc-20160816; b=pcLBdy7frHKmIO74GlEwDFgh+NmIYBk2A8DdMe7NVtZsYI4yaTSuaJCC2BKSGWl8+P 6go1yWgnrMx+AHKTLDBeLQ4tv9GLQIpQeMcix4z6W5So63Bus1QP8BOpoCxkPlXlBUfS afz/SP7CFY9qasluAGdziP4PfMsEO1tg0L2IBUMZ2TBcU0wruRQbsxkatNd8hQKeESwz B0izcJNxKd2YDwR36L10JQy3eHLiQlo2pvGBKhjqxjccwl/qFEoUqigneP6341mFoqJJ KULnEY5RjaDBQ2+keEbXlZqjKnJ+8zpX86D01gzvXUVxOYSunOphG2K1mu+4dhZFkBxL c9lQ== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=U4IhmNsexbxxmpffLsCR8dkV/Tuq3QoG6vGiVUEFgpg=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=MRm6KnyYR5ps7MkfyfTkf1gJDSo4O8AeuzD8wmtJZXfrst39TeyU2PZH5NZR9aQT8G UvdP0xIiXePBTHvmykwEURBAGmHxQBt408DcUOXozXARZjSSlkn70ifV38C2FYHf0sdB LRjDLNB5XFY9l8jefdaH+YBOx5K1YFUrAel4pEg0/xuPBRooMHe5sqttn/zbTwRMZYut hbq7mCMoM2NQf0TUDjha4N/W6BZ9SfWfRxVUbvdJFh23nyrqdbP0/4IdmdVt+fDq5k/q jGm08YBOZiSibsKjqN6qfhdDZhKSeo2tXwcy9y1vgeHDVM92YLGhulsaq8wgyLDpEpUn xwFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=jTLi3mRC; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a4-20020a637f04000000b0055b766191f4si3775957pgd.218.2023.08.11.14.19.49; Fri, 11 Aug 2023 14:20:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=jTLi3mRC; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236669AbjHKULB (ORCPT + 99 others); Fri, 11 Aug 2023 16:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235816AbjHKUK7 (ORCPT ); Fri, 11 Aug 2023 16:10:59 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2081.outbound.protection.outlook.com [40.107.244.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BBEC30FF; Fri, 11 Aug 2023 13:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NY21Ek9G4PuepjwBMYHgEVdC/9rSwgjcGuJdtECU6QQNFU30sElhadKQaazwuV5/nIUtVYXQC9YcO0kaCLzlUb31J8vFIheZTH+NeDm5uyHgfgZoqFtRmoEL33D5XM9ueYzSZNsqUXnXW1OADMpg4Vox4MyjnDgTKThq25/9q7Ez3x8MfYeRbGIVVCvJB4P2DNCcqboOTaLG9kVJurvsm3k/lxgNMcxTAQkWD/YvbYbQ3nGAovuPuH7Vm6hg2buseTXUAA7sO4kITk2sZ/1wQjcKsU2DnDXVlJb9S1RVq2+NNL1oKsHFOeUwc+8A3xd3JXzh1HDkMUqRPU3K5huT5Q== 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=U4IhmNsexbxxmpffLsCR8dkV/Tuq3QoG6vGiVUEFgpg=; b=TZCBHog1gUXYVI70oQ1hsYq2pPMljonPaVJe74AcQOhFpSu8maFSQJdaL7iAFl7+aZQiimMbZ9LKlCWMBZZ8dDSdPeAzuTNcOhgWAgmaftVbUtbuSvVz2vdqavxTkG/SwkTOBKV+jtocSqEXTP/mnYXGsMuEhdhfPpEM5BUtfiNkaAlYr4Xsp7qW7GIahiHIX7I/BRM/juwkJitB2NNGWCCe/zCstIQTgrzOuDuBQxZe23JcnkYYuMsLRVotjGQtJNPxYsk6uWNUzaTby63PU4H90N2yJmdwkwjnKl8udBsDbVE5zxsXoz+IC0p6RDr1ot8R2t0ebZfUz682lYR18Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=U4IhmNsexbxxmpffLsCR8dkV/Tuq3QoG6vGiVUEFgpg=; b=jTLi3mRCk4HPJrP1TnvLl0/U04rwk62j27lhqsfCMvAEZ8SSmHTiIupaxEkKfsy9lG/9sdmlUn/BbmRauinwbome0pOWaOryMqd3Z9DrQfBYRh0P5Umdn9fKSyJbri8OiarzLNEooWz8geIlBFrklkNNz7/uyYsgJOdfsmdeGGs= Received: from BYAPR05CA0047.namprd05.prod.outlook.com (2603:10b6:a03:74::24) by SN7PR12MB7835.namprd12.prod.outlook.com (2603:10b6:806:328::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 20:10:52 +0000 Received: from MWH0EPF000971E5.namprd02.prod.outlook.com (2603:10b6:a03:74:cafe::b8) by BYAPR05CA0047.outlook.office365.com (2603:10b6:a03:74::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.16 via Frontend Transport; Fri, 11 Aug 2023 20:10:52 +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 MWH0EPF000971E5.mail.protection.outlook.com (10.167.243.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 11 Aug 2023 20:10:52 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:10:50 -0500 Subject: [PATCH v7 7/8] x86/resctrl: Introduce "-o debug" mount option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:10:49 -0500 Message-ID: <169178464934.1147205.6915303244307989200.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E5:EE_|SN7PR12MB7835:EE_ X-MS-Office365-Filtering-Correlation-Id: ce2fc9e5-e71e-44c5-b156-08db9aa71024 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WFf5qI3QWM9N7faX3miY5cREpsG4x8hX/2AaHehbR47evfCb0Ug2LWH76FuAYy0qV1PEBAAtURfHby1EZF4PwSZYO1bYeIF9njR2qSxmh6/YajvJoQ6xUlyhvrl5RYgTdYjpDkRH+ALBUjcSlSAiSGmlspytiYYlOnAapL2TYam4zfgToG566sj/csDNgesTeYX3iz0fEvrLlj7Qn522LtfJd8mL9Njk2hm5OGvLBPEN95IbToqOzmvxijFSLaLEXvSI7KdJUjTtKBLvMVW5oSQfLFgbevBJjRBEFgxUNZoc0zMNYZ/ezNtmXHfJytWW6QmaP7flmi7TUfBnPVjeIORpjY/74P+u5ygrwD3s3FRaTgvXWx/cKicmcX3PJH6j8yaHMzROeKniz4F6UgqOAloKlNGKRqohn4BJYA3a1/+2AmJKxMGMt/Sd9AblIRFHiAveGmwOsemUBf2SBo1hEEzSRYPgSXT3Z9wx5zeGOkIzL2ZWX/aZBPUE5lwg2DWI9lXo2P87jTOS7MojVKX2tv2+S7956mA+0V5+kTHiW2oVPhg6nJzqh+bmP0+PiIhMnec9cEmMZRPXwf3dtBZ2ud/gJlfi+b5sk/qUx7OqjJBQAYZ0v6tnEJaJrKjWoisGq6hMh/k0ZHBg+ct635q8gKVdPxlm9a4YnWJ50XOBRqWM9bWKf3xaZw3JIWy6EYTz9YRn76DTCXBW1WxP/IDbNIKI5R2r1ArooxoxK5mK57UVF7z7qcClYnCcSuTEMw4l+x0CZ5kd/P8/aLTAec5KbJrTxO66WIv0fXFVRmMWW9I= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(136003)(396003)(346002)(376002)(39860400002)(1800799006)(82310400008)(186006)(451199021)(36840700001)(40470700004)(46966006)(4326008)(9686003)(478600001)(54906003)(110136005)(70586007)(316002)(70206006)(16576012)(5660300002)(40480700001)(41300700001)(40460700003)(8936002)(8676002)(26005)(86362001)(33716001)(82740400003)(336012)(7416002)(7406005)(44832011)(16526019)(103116003)(36860700001)(47076005)(81166007)(356005)(2906002)(426003)(83380400001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:10:52.2394 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce2fc9e5-e71e-44c5-b156-08db9aa71024 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: MWH0EPF000971E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7835 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773969135399128459 X-GMAIL-MSGID: 1773969135399128459 Add "-o debug" option to mount resctrl filesystem in debug mode. This option is used for adding extra files to help resctrl debugging. Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index af234681756e..5a2346d2c561 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -35,7 +35,7 @@ about the feature from resctrl's info directory. 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 2bd92c0c3b0c..4689e87ec638 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) @@ -297,6 +298,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 a7453c93bad4..6b7e914657fa 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -56,6 +56,8 @@ static char last_cmd_status_buf[512]; struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -1871,6 +1873,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) 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); @@ -2387,6 +2392,9 @@ static void rdt_disable_ctx(struct rdt_fs_context *ctx) if (ctx->enable_mba_mbps) set_mba_sc(false); + + if (ctx->enable_debug) + resctrl_debug = false; } static int rdt_enable_ctx(struct rdt_fs_context *ctx) @@ -2411,6 +2419,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_disable; } + if (ctx->enable_debug) + resctrl_debug = true; + return 0; out_disable: @@ -2612,6 +2623,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2619,6 +2631,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), {} }; @@ -2644,6 +2657,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; @@ -2833,6 +2849,8 @@ static void rdt_kill_sb(struct super_block *sb) set_mba_sc(false); + resctrl_debug = false; + /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); @@ -3713,6 +3731,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 Aug 11 20:10:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 134681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1345505vqi; Fri, 11 Aug 2023 13:45:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQLQD9gE3m0Vzh8YY9iMZ8qvFCVnKScV8vsc50MCte05jk2wQa8GMtzSLfjiYtFPPTx/iV X-Received: by 2002:ac2:44cb:0:b0:4f8:6d54:72f9 with SMTP id d11-20020ac244cb000000b004f86d5472f9mr2063319lfm.61.1691786712685; Fri, 11 Aug 2023 13:45:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691786712; cv=pass; d=google.com; s=arc-20160816; b=rBKUfy3NhOU2OIWhycfgyTj3i4KqDnJKYW0Y+mDLwmWi6zkJIDGubVQ2c/2FkuLbXs xQcm3B7497XMAKz0BdndjyAokpeOgctQFLRu6gYoeodX0nDGbVhyTGwQpAJSpkG76il7 pVsm/dg7twE/kt1wH/Ki73AfMBRJG/AdcF5Q9TaTNUCsjyBoX3LpyMWD/JoO7ky5G7Bp L7XNW+Et+6uarRBB2vGUhKahloPtI3XnmbUc0fAZFx71l0yG8RGZskbqO9mq9sf9wdRZ QGmtqN+5Z93O/LCNROqeUhV02fNLf1/LQscaC4tt6peKVvOV26MJVXEEz0cIPOqWvwb3 xT1w== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=W9WOWk3ZVA3KLqDN7eazTkBRKFW3gnVqyDdAPi+QCf4=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=Ia3YYEZbbDzVAIBKPKphAdMD32Utn/eXynN6LnwlyP0LB2cVo3lPNK/3QH7SKTaPln wifAp52Afq2Ch9vdds45Pyf75iF4d7lj0M6FVeV6SLcOG/OcTnZbz2zBb4+B0hVnAp83 e+WHOqjhNUijrcYfrobcfLolWX1wuPf7LtE8fO7yNV9aXE4X9QBvxBYtilkMc9gEJOKL 4Rx+8V5wOcInAPsl8zr+DdSlbWt8pEj4VLmsGUa161zp9dYLJxU0hr96iufRkC06M3bx KFcQUE3saPyQhyvGuO0YPc6htanpezFVooRdwz8FZREVnvwsBZrz3h9ipIByW1weUDNO SE/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yEPVgkdq; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be6-20020a0564021a2600b00522384df47fsi4178150edb.319.2023.08.11.13.44.48; Fri, 11 Aug 2023 13:45:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yEPVgkdq; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235628AbjHKULv (ORCPT + 99 others); Fri, 11 Aug 2023 16:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbjHKULt (ORCPT ); Fri, 11 Aug 2023 16:11:49 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2069.outbound.protection.outlook.com [40.107.94.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB0335AF; Fri, 11 Aug 2023 13:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YBo31yxoPSaMc/zKkzNVHq8Uc0E0qusfn1PQ+N9qiVsaaXhnfiHEiGwRbkwo2rdiNYZfkAx9B1Org0dUhHfYrImOQUlWbnvU7Bxk9gZk5rvtqf2eTeYTthjjdOGSGxL/gXDCfdTHfKFR5sjMRDn2Bp9nG+CccczPW/pz8kq9CczzL/ngiKozpPF66AIDafPzyv8XoZ6QrmDxHBFbtceEj+EumlBJyMcKfh9eKHUI3Ewk40NA+xSXAKe0yRorr4UaweBgO0wJBtyWy8kXoJBdfjaf3q/f9vfs03zKB/+vHmqII1OWyk6F+xGdri+rG/yCMk12m8kDNxyHhRad536Ecg== 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=W9WOWk3ZVA3KLqDN7eazTkBRKFW3gnVqyDdAPi+QCf4=; b=ls6QMqTiDUcCZ6M6QL+JSxSID+dF8oaMruE4KSbGcz2ByyUUELJQ4qX4Sdu9SztUkryGpK8Sct5gJDrGN6b/P5hiEaB1iq3FoTzA681IvM66kE9QTCmuz2w7MHdIqU5tPSs4JFGFpPmPcn+BmRHgAY8O/KjCWhW+AxgLTa+WSfiLKuPYTyXMHmizQCfpIc4dNjOm36BFcSyIvzcs6bxTmX0/53QxhWmX1CLwEdoc9G7J7WlmH9Zgf16znsvGLt0/PvObVKQ6jgatr2/GvKIgMwXPVBG6kWp+gwGo2WwtJKZFazDqfokDHUX5GY3A7ZuW2rnSkVEQTiSQxTFAO/BrfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=csgroup.eu 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=W9WOWk3ZVA3KLqDN7eazTkBRKFW3gnVqyDdAPi+QCf4=; b=yEPVgkdq5Lz5lRs94IdeHNZoTzdhPw7sPdrghntjVjIFJcjJHEEFNVdAqfFT+FLTS++B565fD9AKPDau2mY1jf6eAEi/ocUfCLCPS38oH4iXkvAKkIxe9XPpfRRNz7lrcr7ZqfqwuXClbLgmjZRrjMsG5KoDueYtWFtjhTBsVSk= Received: from DM6PR06CA0076.namprd06.prod.outlook.com (2603:10b6:5:336::9) by CH2PR12MB4311.namprd12.prod.outlook.com (2603:10b6:610:a8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.20; Fri, 11 Aug 2023 20:11:29 +0000 Received: from CY4PEPF0000E9DA.namprd05.prod.outlook.com (2603:10b6:5:336:cafe::13) by DM6PR06CA0076.outlook.office365.com (2603:10b6:5:336::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.31 via Frontend Transport; Fri, 11 Aug 2023 20:11:29 +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 CY4PEPF0000E9DA.mail.protection.outlook.com (10.167.241.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.20 via Frontend Transport; Fri, 11 Aug 2023 20:11:29 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 15:11:26 -0500 Subject: [PATCH v7 8/8] x86/resctrl: Display hardware ids of resource groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 11 Aug 2023 15:10:57 -0500 Message-ID: <169178465701.1147205.1483883019768336774.stgit@bmoger-ubuntu> In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> References: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DA:EE_|CH2PR12MB4311:EE_ X-MS-Office365-Filtering-Correlation-Id: cb5cf2a6-0a15-47cb-8d20-08db9aa72648 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F7qLwyJUzorPqWRvP0fiwyF9nIZeEE9t4kQ/m4PUCli2/Y5z5UXeLNylBwXikBGQyGkIRCHjcv2laljk1OsvZDziE0oe15mm8fhdUXwiJSVsKOyjeK77Trm67ruXFXPOVl3KSmq7p/dkCDRnotR3yP5Us8UZRZOM6mf9N7rxRIQdpo+iw9/jO2GTKyDfQ1QOkEica8mKwpTxkS3LI3E4DeZKPSuMpmeGxRLGU0RWDNJ6IovTM4x4ftMSQVnFIF1IqQRYqqe///guTqd+mAtRN5cNiYQnI0AbDeHpzgBIPZGIbrvEKwqpfNFtfbQdg2Gum4RFnL4oU56dUktaL2ymV++EEg+DvXeujCOcbBwfPhFicxpMh0cI5m3OJeyUctkmKUy5Y0vIVa4O1LH17svAkcEOmSWejye4lgjN86tVxjxX2qy7YjSfw/MB1JMy0YOOnO918zyjK0dYg+rHfPzMwfzKAylVsJyXACvkvVWzA5y8IZOQUbyJKeEo6Em72i5FPY1Y8LpXTCSY9WzLiABwa8YaLLUPCH+6fL3YS1vBYq5wFC9R2bgMI16ExRZQ29uxIxC3vPR8MDqM5v+/EqJGtbW8qyHW+l0e+ixQyu5JNCCSOnvLfGCrCtaBOTwRD3+SYWz/nj42y/czW+Ci5fxwdLy7PcoOXpqoy/Tg/rTbO6Lok0jG+pqw/hKM4EH7CJ9MnqwQKnSeacHS67Q+c+uz/yJOlU3t3BYOuk37q6cvJ3qdwQNgnb07x1r1F0z+84KAauIfh5Gvla475lXg/tA/E9caEznL/0JS/Sqv5qmDp3Q= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(396003)(39860400002)(376002)(136003)(346002)(186006)(1800799006)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(40460700003)(33716001)(6666004)(5660300002)(356005)(8676002)(4326008)(8936002)(82740400003)(81166007)(40480700001)(9686003)(110136005)(70586007)(86362001)(70206006)(47076005)(478600001)(103116003)(7406005)(7416002)(83380400001)(16526019)(26005)(16576012)(2906002)(54906003)(316002)(36860700001)(41300700001)(426003)(336012)(44832011)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 20:11:29.4624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb5cf2a6-0a15-47cb-8d20-08db9aa72648 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: CY4PEPF0000E9DA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4311 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773966944139724482 X-GMAIL-MSGID: 1773966944139724482 In x86, hardware uses CLOSID and an RMID to identify a control group and a monitoring group respectively. When a user creates a control or monitor group these details are not visible to the user. These details can help debugging. Add CLOSID(ctrl_hw_id) and RMID(mon_hw_id) to the control/monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Other architectures do not use "CLOSID" and "RMID". Use the names ctrl_hw_id and mon_hw_id to refer "CLOSID" and "RMID" respectively in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 8 ++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 5a2346d2c561..41ad9b1f0c6a 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -351,6 +351,10 @@ When control is enabled all CTRL_MON groups will also contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". +"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": @@ -364,6 +368,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. + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 6b7e914657fa..94471ad9d905 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -776,6 +776,38 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of, return ret; } +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; +} + +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 /* @@ -1837,6 +1869,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_BASE | RFTYPE_DEBUG, + }, { .name = "schemata", .mode = 0644, @@ -1860,6 +1899,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_size_show, .fflags = RFTYPE_CTRL_BASE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, };