From patchwork Mon Apr 17 23:34:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 84503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2473901vqo; Mon, 17 Apr 2023 16:48:41 -0700 (PDT) X-Google-Smtp-Source: AKy350Y1i35H/HSuHT9QhLejCWu+h73BzKnOroCOKqXmEut3rjIDPQY4A/4WuDS8jmi7bgtp7xgA X-Received: by 2002:a17:90b:1d0f:b0:247:1f35:3314 with SMTP id on15-20020a17090b1d0f00b002471f353314mr114657pjb.48.1681775321346; Mon, 17 Apr 2023 16:48:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681775321; cv=pass; d=google.com; s=arc-20160816; b=Lxbe6/pFMLx/3PZYL0q7MywZEnAMab8HyEmkO2nTo4V1e9NbQLmun+ynmPgoAWgqD9 w8VyvC7uZP3Oeq/dN+l0by4A+NEvd9sn6Nvc11I3t/6LqPgJqkyJ1jtyOBA0J3yCuj3U +kyJUnnZbUABSzL0a0NJAQT1am509sUL1naQW/bc4XBphGV14iGUHhQ2g3wtbDLc9Xl6 p2kBvY2CvGjF8x4v8PWwaVuvZdlddXwWuCW95vwirptugTYqOoATXnwE97/mzLuX47iI M9f2p8ZO7ydz6hgeMg6FNMyBgj4yfBfcs3/Pzo6JlIs7eeK+DUgUb7ZRjHns63H6J67O OJlw== 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=QcErqOAyciZV5H4WhJpBgNzP/FAuWfbxjPa096tf19A=; b=YgQzDpHtJQ7or+D7T49LibtHroVrR3i6H0T09cCVz7J4KsaXf/17+h8wJO1jaA/tbZ Jod3hw1MPMiuXTPywEANcp8c5C9tcta2lJmDuQinUaD9FHMJHtqDQ82t3F0ocSyKUPOu fL1Lo3OosKsQOgbt/DXziXIhjUUT0MNE2DGRHJuqPh8C7k6Z8LcmuziPjzo0y4YNYVHm f7TM8rvA7Ira83c8o/mNsTVtJS+BHU61q8ndydOaBNEBO5KAU5k7A798/bZHb0wpnN54 6KHHJ8f8YabUNnRpOYxbZV38p7lV1SXfEIHuTVpPh3OIAP3bbBPjkh/Y7ifxGeGX9d3H 2pkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=OGi9xZ+e; 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 n5-20020a17090ac68500b002479e0c027fsi2938776pjt.102.2023.04.17.16.48.28; Mon, 17 Apr 2023 16:48:41 -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=OGi9xZ+e; 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 S230271AbjDQXeY (ORCPT + 99 others); Mon, 17 Apr 2023 19:34:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbjDQXeT (ORCPT ); Mon, 17 Apr 2023 19:34:19 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2077.outbound.protection.outlook.com [40.107.244.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 115A1E76; Mon, 17 Apr 2023 16:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G/gVAb2UKZF30AgDr7AeeBrzHCQAkCvZJHdeXidoEXkBG7zv4SkqXTVRFrHqwthwRG9Df0v+goj7PADmZ6RDZ50bFtIx9Ztc8B0u8ngWZNwObvK+ThrcWp/f/5/BwM4JKk9DGuPfw6elZfi23APhZEZjzQo49gJdD8NxRFM+TVMVk2mK2UURFl1ql1mNiLkJTJz/8b4yoRIqwRXxb8xM7pktgFe3t5ePWfKaOkFBr8XqVlTFUEDu8wnMlHm0DJTMZl9L6ewLNeY1kY1lFephqyJifc/iCTDzHhO1iLDXlHecubDh/vCBtXj9FiXMEMhbNd/Cd3BudX1Mw0sdTHgj4Q== 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=QcErqOAyciZV5H4WhJpBgNzP/FAuWfbxjPa096tf19A=; b=JXq0pjItgqc1TtpFJv/I4SVqf6P+gZwHm4UW78CzGEN+gKbVDUBBez1sTbDYiM2T65MXLNEC93TQ99EeOqX/7NZ0hKIKez9HsQNSbu6IKD5FWIUf/Gc8iqf9cXKQ0bxTQRQtuqjAxjtcg1OLwnrWEibDRjPV/+fgKQZyx6CiWAaMVi+PXPDy8l2j7hZgzw+MXNvdx59J5jHHVzPDGEGv2zdZQRyAVDIH48UBahfUQyrnwtr9WIi3Sni3bIh3gTMNgWJ/8OLxfCDh2IMraR6vUOSFEzSw5FfAIZsHRQvrKMlB8sJS+02OEGI898iGXvDiTM4uybIhd0/0vTbuWGA0eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QcErqOAyciZV5H4WhJpBgNzP/FAuWfbxjPa096tf19A=; b=OGi9xZ+esO/BaSCvo1xJXUj81OW1rspuLV50z9gU5MFyAS2RcKrTWCDYXm8O6AvUmq2fUFCx98EKQUurrewgbch/1EG4Pmu+JgRCRh6ut25RHrAVdy+OPExkLAtIT2SHIIA2pqX0D9dMnn3z9bG5gxgENSIQyYYlCUs7r/AAZGc= Received: from DM6PR07CA0090.namprd07.prod.outlook.com (2603:10b6:5:337::23) by CY5PR12MB6132.namprd12.prod.outlook.com (2603:10b6:930:24::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Mon, 17 Apr 2023 23:34:11 +0000 Received: from DM6NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:5:337:cafe::a9) by DM6PR07CA0090.outlook.office365.com (2603:10b6:5:337::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.46 via Frontend Transport; Mon, 17 Apr 2023 23:34:11 +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 DM6NAM11FT020.mail.protection.outlook.com (10.13.172.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.19 via Frontend Transport; Mon, 17 Apr 2023 23:34:11 +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.2375.34; Mon, 17 Apr 2023 18:34:08 -0500 Subject: [PATCH v4 1/7] x86/resctrl: Add multiple tasks to the resctrl group at once From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Apr 2023 18:34:06 -0500 Message-ID: <168177444676.1758847.11474266921067437724.stgit@bmoger-ubuntu> In-Reply-To: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> References: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT020:EE_|CY5PR12MB6132:EE_ X-MS-Office365-Filtering-Correlation-Id: 744f4389-94a2-4ed0-0bae-08db3f9c3f56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OCO4TfKFDlE9UGurbnK2abE9teeoWSExm/a3c+HGZEP3UwB3EsFXU5AjZQD7F/UHYiwPKcUe94b+kCg6fAhahuPMG6nekwCDGZ5esr0F9eepxsS54KtLXCWJSiDFP3brqAspiKufT3edAwKo0JCCNU+7cDB/xjfwuE9xP7ZAM2Le9ci42D/dYCcfT6UdrxtisRmPd05841bVDdD0+3bBrzvPJMhk6gMjKNUEwcM+ukujDl+JgyfDxnkSimIEu77BNFVVmvcE7h3pci+wvMC0szcLreKKJJuoBxz6GTnK3yrTawlDsSobKIdw763hDV4ueLzUh56I9XEj0r/FDJdmPU63PARUqfbDuzUUXqDFVF4sWWpqk8HQqm++PdKtN75M+l1eQp5dUSzitXQXVvUjLSB68NwgsQnq+LlHdMw9AHYAO2bwDAmSDD31bKlTRmJ7+KqiYxQnx6VPwSp9r9kNkcWr00q/V+qzniAcXmDKVIB9c3oy9HRpZ31WVByzzwkYzafB+olRhJ2Y8i5MMZebN1Ek/YlN/lSIYCg46+GBfRh79php0FE36LOlxDUXhlxLTKL5wWp7/+OreqYgCGa0NxiskRmrqxDqo7mhQp9cPWGpRj9l7h89uxD7Lq8Yec/y66bYYlmPILyhEEK/M1sDOo9OhwKNYs9cV+Yt7KPB/A8eK8yZRSUPYjaNPAr62uGxKMnfkojlCOSRPo0p4ZWn+SGBrYCYu8tPyRV4yGnOqdiNcl7qNKCdljIQNZADh3bN 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)(346002)(39860400002)(396003)(376002)(451199021)(40470700004)(46966006)(36840700001)(16526019)(82740400003)(316002)(4326008)(36860700001)(83380400001)(426003)(336012)(70206006)(47076005)(70586007)(478600001)(54906003)(8676002)(16576012)(41300700001)(8936002)(81166007)(356005)(110136005)(5660300002)(2906002)(86362001)(44832011)(7406005)(7416002)(26005)(186003)(9686003)(33716001)(66899021)(103116003)(82310400005)(40460700003)(40480700001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 23:34:11.2327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 744f4389-94a2-4ed0-0bae-08db3f9c3f56 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: DM6NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6132 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763469239449331114?= X-GMAIL-MSGID: =?utf-8?q?1763469239449331114?= 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/clos1 $echo 123 > /sys/fs/resctrl/clos1/tasks $echo 456 > /sys/fs/resctrl/clos1/tasks $echo 789 > /sys/fs/resctrl/clos1/tasks This is not user-friendly when dealing with hundreds of tasks. It can be improved by supporting the multiple task id assignment in one command with the tasks separated by commas. For example: $echo 123,456,789 > /sys/fs/resctrl/clos1/tasks Signed-off-by: Babu Moger --- Documentation/x86/resctrl.rst | 9 ++++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 387ccbcb558f..f28ed1443a6a 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -292,7 +292,14 @@ All groups contain the following files: "tasks": Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the - group. If the group is a CTRL_MON group the task is removed from + group. Multiple tasks can be added by separating the task ids + with commas. Tasks will be assigned sequentially in the order it + is entered. Failures while assigning the tasks will be aborted + immediately and tasks next in the sequence will not be assigned. + Users may need to retry them again. Failure details possibly with + pid will be logged in /sys/fs/resctrl/info/last_cmd_status file. + + 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 6ad33f355861..df5bd13440b0 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -696,18 +696,41 @@ 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) + if (nbytes == 0) return -EINVAL; + + buf[nbytes - 1] = '\0'; + rdtgrp = rdtgroup_kn_lock_live(of->kn); if (!rdtgrp) { rdtgroup_kn_unlock(of->kn); return -ENOENT; } + +next: + if (!buf || buf[0] == '\0') + goto unlock; + rdt_last_cmd_clear(); + pid_str = strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_printf("Task list parsing error\n"); + ret = -EINVAL; + goto unlock; + } + + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d value\n", pid); + ret = -EINVAL; + goto unlock; + } + if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED || rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { ret = -EINVAL; @@ -716,6 +739,12 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, } ret = rdtgroup_move_task(pid, rdtgrp, of); + if (ret) { + rdt_last_cmd_printf("Error while processing task %d\n", pid); + goto unlock; + } else { + goto next; + } unlock: rdtgroup_kn_unlock(of->kn); From patchwork Mon Apr 17 23:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 84508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2475247vqo; Mon, 17 Apr 2023 16:52:51 -0700 (PDT) X-Google-Smtp-Source: AKy350ZCNKBjbDf6qltd27hMutCJB0fvXcInnp8wqqXbUB3HLZ/Gx5wiOX1lonxI4jjtaQZQUZqK X-Received: by 2002:a05:6a20:4286:b0:f0:4664:ad53 with SMTP id o6-20020a056a20428600b000f04664ad53mr3789771pzj.48.1681775571112; Mon, 17 Apr 2023 16:52:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681775571; cv=pass; d=google.com; s=arc-20160816; b=GjHUWBo5vL47gY4pmdp9JQchHZo7HMgOYoiEg//Dn/zjhT3w+ZdiYu3Vw2KeF25uJ/ sR5VYfF+s0eXCDEVI6N7RedNI2Hw9t9299YIPAY3PMZ3+rIxKaOAV69P1AwzL93QPRaw wY6AhLPH4/073zbP2SjlUf9wyoM2Hxs5S7UxOBjMWW/BUYFfw/luIcs+aw36om0CKeG6 KUS22lajkv5ASD7vJWb3Kmpeo0oxOgow6sjoeJXU9baq9WtB1sME4PLXn/8rJ3LRF0ki mRHyWrUV/s6qXHxWo0tsGUZZrBgeaZaFj4LXYc0XNE2vBMFkhnckhZxC2UpV1d7bzOPW clEQ== 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=mp8J0/aAt/h2yh2n0l8J7cj4pphpRiCM2fjSASc+DUQ=; b=U97Wm03WgpSMvSn0yAjSG8z6x7GXyEQnIGg5I41QvBQbKk1AV43iHj/MUZFREZtd/m gbQDn0Yp7/wydk2GBN4MxMTEUBQe3tiR41t7JiEqT5PaOe3QjBlP74pwD6itQqdyCRQX i+F1nP8KuRtVAXM4Orv9nxk8S/xPByj00EvaFYCl+TmliX9L4Rtq6AYJGcCg97z1XZht PSL0LSIXUftLxVw03xhq5n6REyNVAdh8b+yBO34JkvxmHHVkT6IcYcIo3aWq1V5/wyYZ 6URUIFI9t2OkePrQ1zuDuqzzkRX5g03+NJVqjekn97/T7vspin3oD5YGCqwAR4dGjX1I EFLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=N3pct22t; 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 v191-20020a6389c8000000b00503059b8b2fsi12886875pgd.220.2023.04.17.16.52.38; Mon, 17 Apr 2023 16:52:51 -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=N3pct22t; 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 S230231AbjDQXek (ORCPT + 99 others); Mon, 17 Apr 2023 19:34:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbjDQXej (ORCPT ); Mon, 17 Apr 2023 19:34:39 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2059.outbound.protection.outlook.com [40.107.223.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 560C35FD6; Mon, 17 Apr 2023 16:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H4LXXXfZRE43d0Wypyk+VdHBaN59ZXChXfK2G4nRQCU6uJ2OAxYjuhMOXO8BUSaqt+1jK56Xhwgj12+xcjIFjBK99K8VKbbwVqY+bdBz6sdCY5LBArqs6SG7BH5bnYHSnmoAfKcY/gG8Jp4zkdyLooXR4eZQMQInqqeqNi7sGY0hKCgAukhiF97sZw4kQTa6f08vnWy0TAwb3ecz1eyFA5lreD79JjHI8xgSTKBGUsy4y6ycIZc+0m3CuuI37i5vMV1vhQtG0zrskZJRndYcRYMi07GCwrfL0aGr+mQj/x2whLy+Zzmz8PD5C2HpWinMy4RcXeKAGvkqPwlogPtZOg== 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=mp8J0/aAt/h2yh2n0l8J7cj4pphpRiCM2fjSASc+DUQ=; b=QcUCg52ZY65ToOg0RL6JRId08HYyEcScoW8sJUQe2yR3RyQMKuhm8mzecnltCw8lwvSwziINqhW0TtBh9oYqqrwems1fzHZyDgsB1XjWm/KjBiYz6HLu9l4zsN0pA6i94gzLQcmv56gc9uAxMpmafAeHVi02onPCmQW6ektJegrHdwPwjsk+2/fcTpK3pjGekfoS8ZFzRwKAfUaFdjIdL4R6ldCVhx1VsDduZ+1xSH4RTNQ55UjbvrIhAwNVBCgNtONgryR6egMrudkIblkYzJxOs3Ecm+SIOHjoTsnV5OT4Pk65NSpxD4eqbmKL/BFf32Kz8I37EhCMt7Is4GPNeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mp8J0/aAt/h2yh2n0l8J7cj4pphpRiCM2fjSASc+DUQ=; b=N3pct22tGwxJOfodN1CME48xTt5YQ9llD0tnR+pPP8vs9lWSq+CI8oQHz9+GKYPuUEcbkiTJAi6Xnyqayp6h2kMktnZuWp60Jmyvhgo1tvKtUYNZ2lFFIsZ4u1EB/s1O8cNrMC1L00ysjUDA7DVapbwwFI4MNVnzxynqCqRwsWU= Received: from DM6PR01CA0003.prod.exchangelabs.com (2603:10b6:5:296::8) by PH8PR12MB6914.namprd12.prod.outlook.com (2603:10b6:510:1cb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 23:34:25 +0000 Received: from DM6NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::f2) by DM6PR01CA0003.outlook.office365.com (2603:10b6:5:296::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.46 via Frontend Transport; Mon, 17 Apr 2023 23:34:25 +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 DM6NAM11FT010.mail.protection.outlook.com (10.13.172.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.20 via Frontend Transport; Mon, 17 Apr 2023 23:34:24 +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.2375.34; Mon, 17 Apr 2023 18:34:22 -0500 Subject: [PATCH v4 2/7] x86/resctrl: Remove unnecessary rftype flags From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Apr 2023 18:34:15 -0500 Message-ID: <168177445556.1758847.5029687867896978170.stgit@bmoger-ubuntu> In-Reply-To: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> References: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT010:EE_|PH8PR12MB6914:EE_ X-MS-Office365-Filtering-Correlation-Id: 74aad304-8c68-453a-919f-08db3f9c476d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cKFvhe7Xg9OWEH3Rc7DBF+JjLAPJHQ1w+ufXsZXYHJxjV5fHDrHr9tBMOzFNVEQIupVfp3DtFsz4q9z6ehPoK+LIIO1McbzhaWa3u3iY5/1Iy6yuMwlxgE8EgInsn9KkMOmdz527XRPHhQO8m0Pchdz4VpRh5z4B1WBYT+xT1vY4D52DZZz+t2/cXLeEtuO1zwmax9aa8bdbNkdqP7nLMuDQXzJ0eo//w/Ia1uxApJ4fbEIEHZExRDarJENDMEpNz2rD05wNN4exHkN5pJmopEuyFgoeZtMA7WO7EpwxCWpUn7rVyynBsSTD0TptsEm2SCIpd8E38oqp62XXokESMXnRpv0zeoytEj8Wi/KTGjR6hVNfPwF5VI2BnlKMuhtX/cf05PJ+e5O8zXhDsVoKwR3loHpUQFCJ6H//eTAK13yJvxJL4vj/RqUubiYrq8jCwHqdlOMHjck40fgvBH/30x3pVjtqFxocTQmjG14uJb3Rk/o/GiyRX047+as4uScIiD3jAY36Q6lMXp4yrAzS2p7R7QG4bl3JhpFSZbcu+PSRfBsb/jbOMFMSlxnQZYHftk6nXXhnFEFh56qv8DK0CpP3P6ElKNoEE6H/96O+zKTTbcHjJLv3op+EZWrLy6FR7tQIsJ8FNbTmYwG5OXc1y6M5U/8jm7b1lZsfyChgr4J66vicORAEX52HEny9uoXNLvlYeW7tk6o31HqwNKk+lreQvhCfFJBTy0DdpoVgN75HENiAqLxbjXH1sUundQBF 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)(136003)(346002)(376002)(396003)(451199021)(46966006)(36840700001)(40470700004)(316002)(16576012)(110136005)(54906003)(70586007)(70206006)(4326008)(103116003)(186003)(26005)(40460700003)(9686003)(47076005)(16526019)(36860700001)(81166007)(356005)(336012)(426003)(83380400001)(5660300002)(8936002)(82310400005)(8676002)(478600001)(6666004)(41300700001)(33716001)(86362001)(82740400003)(2906002)(7406005)(7416002)(40480700001)(44832011)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 23:34:24.8087 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74aad304-8c68-453a-919f-08db3f9c476d 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: DM6NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6914 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763469501549704237?= X-GMAIL-MSGID: =?utf-8?q?1763469501549704237?= Remove unnecessary rftype flags to avoid multiple indirection. 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 df5bd13440b0..6cd0a8396f30 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3239,7 +3239,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 Mon Apr 17 23:34:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 84505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2474469vqo; Mon, 17 Apr 2023 16:50:32 -0700 (PDT) X-Google-Smtp-Source: AKy350bw1h4FNQpnDVeD0fuHbIziq4jG/f2a1z5T0DLC6Ov8ZTT82uQppQa3kpncADaBt8wiJKst X-Received: by 2002:a17:90a:c381:b0:247:40f1:79d7 with SMTP id h1-20020a17090ac38100b0024740f179d7mr148317pjt.34.1681775432016; Mon, 17 Apr 2023 16:50:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681775432; cv=pass; d=google.com; s=arc-20160816; b=cQrU2Es8DNkVObFxw+wnBztq/3SNxkF0AO3bW/mAWZeQndgONYoW5xG2im3z0iASym hPE1FuGb6IsYmr0Yoy2P/Z6yUEazJM4WCNDW+83QpkEDPxiiPfHjiSy7kHZuSVRBGGWW aSJm+5U9fz9tkwqjPhFZqgX7fvFHc096k7X6iNj4/NWYcR9wnT2i30KoP/fjxK7hVwvN VkoMVaKpogA+aRpGBuC8dxRx0PZl/vm8HSfLfkP5zWOhx694jl20Dd6wf7svGUYuGWQ2 YQ8J7WgkNS+zPtK99WYpiu5ksR4zn4/9FugagVLJHla00868SqsTOIsdEzGR+d4Z3WTu KGzw== 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=amRrXNdXe01eIp0BrIPD37BmK+wPf1VLsqKbRdfu66k=; b=W5pO9Bm/FwvefvRS3/E8bdlNBT0zCbZr3q+hcdyiRRd8kiCCKzFNOFkZaME5UL1edT NCKvgZJgvfu/4ej5LitGJLmQ2DJ+O0mFOtYU5JAxbRrv3KsHodksIYk9yRRfNpiB/f9Y Bz1RJxy4QzQ3/8Thh/ksSgK2PP9St7+kBjgxowe7YRuINCHMSFIpTZ7ALqvRsWa4fsM0 L2SQbEes3HySxpx0UXleYoGO/z8YDxb144fTAadC9JLZsME+Q9Vvpqk9pNJjZROyiG2x ohkHjZ/yh7siKNsGVa+L3eWsrHr3UwcajFSVto/1bvIhMVTUUhxR4rbpKc/lge1lA7IE mg6g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lsffNqsJ; 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 q102-20020a17090a17ef00b002409e4ae257si11469287pja.92.2023.04.17.16.50.17; Mon, 17 Apr 2023 16:50:31 -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=lsffNqsJ; 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 S230264AbjDQXfC (ORCPT + 99 others); Mon, 17 Apr 2023 19:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbjDQXfA (ORCPT ); Mon, 17 Apr 2023 19:35:00 -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 8B6EB5BAB; Mon, 17 Apr 2023 16:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cQ5PMrMxsHyuL3hmcgWG0U8EhnKXjZ4CXz32ECRjN8BH0agthjLsWwseYxhC7xp2Dd5xEH+Z+QYcU5EuJosRchLwwKiRLhZZq//xkxCFNR7S+fluBUQQMEv7jEyrBqqQe07CVrVIaqjr3ge69U5Vq6Oqhl+4j7ySh1VrsKYA74D5AIdpG+b6vwrRnStSiZOeKPBXSEqLdSiSsU5Swx1Zi1K93QOaQp3QvOxd9lmD8GyCbpYYmYrsq1jikoQkFslQYxdO1sv5uecnEo8ZG1mLtrOanmv3ccXl4ZTeGVWEay+q6bZRcxkpQF+hs2Avnd8IZ/yUoaTUHasWvKknkumDbw== 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=amRrXNdXe01eIp0BrIPD37BmK+wPf1VLsqKbRdfu66k=; b=mdJ3BxgdtKwj6O44tIrKrYKVZf4WhR91pgQlNqiOOgi1oLOFs6VzFeidc5BEvp5j3UU1y/eXWw/ep+sAWWqe/07a68LzbVW0bIm8BiSmGFCTDaJ0TwQN6Onndp8KRgX6bHysGSrYptXlcLECRJhKBBdn+K3gJJpijSp7u9u/tlDqzV5HGdhD8FMGfQCHEON/eEqR+5l9rYDwlmbnIcKr8WfW8gxVtqG6TRLnZUqIG0wOiKTWDOLFLofA4kmlUNHnb8bXgdAVMYw/3nY4BY36G1rMicleYaTB/LTqDRT3O18BzbHESwjlC1Q8Zdy9ImSmZMuhwKglhRxLYRe0Tzv/6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=amRrXNdXe01eIp0BrIPD37BmK+wPf1VLsqKbRdfu66k=; b=lsffNqsJPezNuygZTArCzHE2jNSgTAEfHQfrUouZCPncZMWPfGrvZS3JEF5tEjKiIkotPo35EW9IxjY8Qqn7H1d5dxOdgZMEVuyoltaQwYmJsHTLKuVuWRYYGTWATJrC7DU5TVbGCYkNpzfmQu/CS2euYQTDg+FOqL5Jt+9FUsc= Received: from DM6PR13CA0054.namprd13.prod.outlook.com (2603:10b6:5:134::31) by CY5PR12MB6623.namprd12.prod.outlook.com (2603:10b6:930:41::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 23:34:34 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:5:134:cafe::d1) by DM6PR13CA0054.outlook.office365.com (2603:10b6:5:134::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.19 via Frontend Transport; Mon, 17 Apr 2023 23:34:33 +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 DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.20 via Frontend Transport; Mon, 17 Apr 2023 23:34:33 +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.2375.34; Mon, 17 Apr 2023 18:34:31 -0500 Subject: [PATCH v4 3/7] x86/resctrl: Rename rftype flags for consistency From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Apr 2023 18:34:29 -0500 Message-ID: <168177446947.1758847.11380042804869155387.stgit@bmoger-ubuntu> In-Reply-To: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> References: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT015:EE_|CY5PR12MB6623:EE_ X-MS-Office365-Filtering-Correlation-Id: f5126285-4197-49fc-49f0-08db3f9c4cc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9MOEVPLXsSFQ4lvkzFbE1+2o0nKBwomacbNWdnS8CTHYRSXB9cOMV5l5dzjWVQP2hxD7CW06zwcShKbPNkTxGYPPTfU5qqEtFbWQejIZHtCQkyv+rOVRxp1kPpsJJ2XtFPnae2VncmDHwhJGrXhJNlv4tS1Mt6QB4zCk7WUU+aAZQEg9liQaP86ehiomFpUsZ818YE2kKPqsHKD4OavRafvqH2AlUPuB1mFphR4+/oc/abHdCk1yb9V/3qQ6mXPExswlHTVyvHt330ffyqD7WUzi7pnDV6exBOgIHa2mkjrEFSA2YCS9Ps5o0UeHSScOnrelGfKD4U3vDbrYpaWbbL3kXw6eA1M+Eqs0Y/2YwCeJABlRlx0when73HAMLnen9dG6c9WjIdnPkIJ1fOK2bD08UWbOokF/msHcNMaviRmZjHwvyuelQo1EnlrtSDlIuvREnsedCo3qSC/1OF1b+4wFRBIQDFrYD93vWd6EeObvUOQOrhrA/KH5turHxInxKzroel4hvIFITWlp+/LHVk9mFmtSByr/n0lCKTQ1zPbvmFvZDUmNWkonGgJ+G/FD5XHiSVrmvj7hPeMa0zG3IXsoBFiTLFUM9HeUIWkp3EJtmBy2R3F5VJLebo2EmOWiP56f5qJDU58yqmks9FPYmTnWBqxERXjNGAXT8i+SrpFxWOtYU45YRCTrPjL7cv8slfMyb1LLYKVpNi4HCPRYUdDQR0gBpamyfYO8cu3VT1JVgLMbSvExHT4CUXanUcmdRl7ob0cdtPPTqmz0PjO+QQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(346002)(376002)(39860400002)(136003)(396003)(451199021)(36840700001)(46966006)(40470700004)(83380400001)(47076005)(9686003)(426003)(336012)(36860700001)(26005)(478600001)(82310400005)(54906003)(110136005)(70586007)(70206006)(16576012)(4326008)(7406005)(316002)(44832011)(86362001)(16526019)(186003)(7416002)(41300700001)(8936002)(8676002)(5660300002)(2906002)(356005)(81166007)(82740400003)(40460700003)(33716001)(103116003)(40480700001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 23:34:33.7787 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5126285-4197-49fc-49f0-08db3f9c4cc6 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: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6623 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763469355471580627?= X-GMAIL-MSGID: =?utf-8?q?1763469355471580627?= The rftype flags have two different prefixes even though they are used for the same purpose. Change the prefix to RFTYPE_ for all the flags. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 8 +++--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 ++++++++++++++++---------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 62767774810d..c4fc5a1c630c 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; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 6cd0a8396f30..719e29248892 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1711,77 +1711,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 @@ -1800,7 +1800,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", @@ -1847,7 +1847,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", @@ -1855,14 +1855,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, }, }; @@ -1919,7 +1919,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) @@ -1928,7 +1928,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; } /** @@ -2063,21 +2063,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) @@ -3578,7 +3578,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 Mon Apr 17 23:34: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: 84506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2474828vqo; Mon, 17 Apr 2023 16:51:36 -0700 (PDT) X-Google-Smtp-Source: AKy350bCFWgITebb4jVkAN+vcII/5dVwLHyMtvlDzU0ih1cGEFuZxd4Jka8mTH4FOXlNliZpJKhD X-Received: by 2002:a17:90a:f318:b0:246:fc58:d77b with SMTP id ca24-20020a17090af31800b00246fc58d77bmr109975pjb.44.1681775496231; Mon, 17 Apr 2023 16:51:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681775496; cv=pass; d=google.com; s=arc-20160816; b=e1S9GXaWyVD0u8wc8mfxemO0srfaZc9APayiRpRUYNlwWq/km7iYrtlFgyMMdS68+/ GXf1r+JXod0LbViECNcHNH5Er+DAo0AcydKpMcfuJclVpt6l8VHxBYaxnBKGOOoyEjtW inyZ3YsZ0nTEwywiwwXEjMIvKXbtsRSvqIcSrFX23H789ckQFLkMbkQOaNK3R0om48RM Qsq9iwgNZvjRz45PEA9sb2cEM9HJn0Qckb9KxOnOWt/Y2WUQS5dL/jOH8z9TqZmxtCAj F4EiJce/BaDpkf5bcFjQ4jnKqaCIFVUcVMO9Lu08DltHfCJYYMPu2hU6FdjzJKpQ17/6 WPFQ== 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=v739naT5KE3Eh5/kn8BKuSPeFkot4CMRU58/JZpHQl0=; b=CDj0Mlwal4+IJ1L9B6t1YEOP3yp5cYt/R3RbpbFx8sxQl8406WPVAdJu13MDObwuOO 2e45E2NzNoTgPZHz7F2tdTSCgYr8aweBf725w/fpSQ6xingzsoyNqXl6e0vu3+XJDKVN YSMt+zWFkMte4vpQlYTFmKqF4O+v1efw6XvGivTXrCOmr2plkWg6H+r2cLt9Sts9ySv5 WrWIlZ5F3naFUbco+jtr12B6ohN9FPw1ACrvM+M6+jx3rNf55EMHvkzCANj/1MxH7xWa J2jY5j/4LzQ5VphaXq7nqHjXLLqsKtryRLKoijAb0AyFqsAp96t7bdV7Kevyj0eT4BtM wQsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=cbtLIaZT; 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 o13-20020a17090ac70d00b002474fac337dsi8468196pjt.30.2023.04.17.16.51.23; Mon, 17 Apr 2023 16:51:36 -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=cbtLIaZT; 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 S230064AbjDQXfY (ORCPT + 99 others); Mon, 17 Apr 2023 19:35:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbjDQXfW (ORCPT ); Mon, 17 Apr 2023 19:35:22 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DF176588; Mon, 17 Apr 2023 16:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TeDzz1Zti2nbIuPgrEzzuqkKivalBP8in4pDEV5dK0jpE+ANdaIFsgtB7e8iqqKDVBa/9tvywiRmpssjtAbgZEFvhpDeIoLbgDu4+Zf3xk7UWKEnsO1qtmDHwaoqhlew8vESvAcUYD6c3cB/FTqEscx4QFiiK45ysOMdIb4FxO2Tm+fgh1bLa07aZXdlhX+BglBUJmqHQckH2WcUelXIzoml7r0WkL0vKlzrpR8km/g4ys0rY/deTGw5O2nEPOS/sgX/WkqbIMe01ZYR9n44dVmuB2mGZKBx2zzz6Nq36Ya8LMWVHT4gcubvDZUc3jtRrSSsuO4WM+5UxDC1APVdOw== 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=v739naT5KE3Eh5/kn8BKuSPeFkot4CMRU58/JZpHQl0=; b=kFOV0uQOSTmRb2rVsVctFI+NcsKQttbeidht0hfhO0Wo03/1r2jnZvx3j4fRlBEtqAJcy0NO51rYTChhZeF4zUX6oUz2BOtPlHIUq5vOxq9yNANbS1KgumonEbdz+OuWy7KynmvuV1cuFJsQ1YtmUQRRG1Tn0nuS9gzOGudit/cZBbXuvTemQJpvEd/5KP6F48cMIcg1LBKEQqIKAapRs1/e2+3uTaiQWYZxSiusR+GFF3/+aMRYpKClHLfzBFpTUwfIdSu2D3oXFVHZKZKkTXBKPaM58jrekS9PWJXKsbWrW1SSF5hBP6i0qmg4qgJO7Nkms81x1zU1toCjZHKOdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v739naT5KE3Eh5/kn8BKuSPeFkot4CMRU58/JZpHQl0=; b=cbtLIaZTbY/66Q1aEWXh9ilLP+p0vxxn6c0tk0AqajnCktWrEBP+Kn+254habajzp6VwYCNuZaI6pCuUQIR/FFyHxSHfLnMWfHvNpt/Xn/guohjjvnAMCaoZCDHHgp7EoG0OOIIrIkoq2s/OVGx3quGsPGQekmz/KxsqAFzB1t8= Received: from DM6PR03CA0068.namprd03.prod.outlook.com (2603:10b6:5:100::45) by SA0PR12MB4576.namprd12.prod.outlook.com (2603:10b6:806:93::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 23:34:43 +0000 Received: from DM6NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:5:100:cafe::a8) by DM6PR03CA0068.outlook.office365.com (2603:10b6:5:100::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.46 via Frontend Transport; Mon, 17 Apr 2023 23:34:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT086.mail.protection.outlook.com (10.13.173.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.20 via Frontend Transport; Mon, 17 Apr 2023 23:34: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.2375.34; Mon, 17 Apr 2023 18:34:39 -0500 Subject: [PATCH v4 4/7] x86/resctrl: Re-arrange RFTYPE flags and add more comments From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Apr 2023 18:34:38 -0500 Message-ID: <168177447844.1758847.17789021842152864417.stgit@bmoger-ubuntu> In-Reply-To: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> References: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT086:EE_|SA0PR12MB4576:EE_ X-MS-Office365-Filtering-Correlation-Id: 30ae592f-4360-496a-6383-08db3f9c521b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MaUXaOWqWPgdlqcblRBzar1CmK3E+5+D5TihpNlGjrngAgVPtyNJ06Ze+Z5uQiFhxkt7b9OMsIulCvWJYHWAdeMUQNTIOZ0pNo+wvjAYAkPP3ko7BQxmj+af7CJFdBYUyKExZ8Xbg736FAte5IOkdj639ICG8djlpNy51CC5rdyAoNXDy6LAOxt/aMDxYAwIp8CAR8xrD+AMVOl7usB6HykfzDFojoc9bKwaPdPF8ulBN/QzJx/lt/aRT19DV52OSqt2onTbm/OejALx3nYSf0QfL7uEk0+Ed6JMjsuGGjPyIEoohdQhccmC0GjqeV5XVYKpKl0ihrAAJ5kyG4n0Jyil4baVU149igTIPKiZ8P+f4bkWlvfp04vS4Jr6OGkpBWDvv4r2dYAGG2weYWxHuHU9CZ6ejGNIqMBlVSpsz+CMkEBJuFNoqIwgHab81cY+R848V3+HmGMj6/HO4DrYfrzeX4qy/HKl/XJedim576hN8lI2zKy5Z3nEzeqBLvactyVz6gWuIGuhnZEZnWWwsreLKiilmJfZ3uiP7wzMpia5scM2Wa73HFuSXZZS5VM0ba4uJyW340YshrrZEubKRHJjNEfxhMIjJu/pPnPQdB4tVungYWuLG2D5imlo4bVheeBWoUmPWOh1mcjDyttYROoEu3U5w2E5XyhJr9y/OwF9M/bJrp7EI1VIOS69a51NgD+UDD5/FqDnd1tOxXZStgu/Mm4G5R4/V8STa/ndkdoPgUDUS3a6iSDTG+cAKos7W9Soy0GXzEDyhrcaC0mWOA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(396003)(39860400002)(376002)(136003)(346002)(451199021)(40470700004)(46966006)(36840700001)(54906003)(16576012)(110136005)(40480700001)(478600001)(16526019)(81166007)(316002)(83380400001)(41300700001)(356005)(82740400003)(426003)(336012)(4326008)(47076005)(36860700001)(186003)(26005)(9686003)(70206006)(70586007)(5660300002)(7406005)(44832011)(7416002)(2906002)(8936002)(8676002)(40460700003)(33716001)(103116003)(86362001)(82310400005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 23:34:42.7250 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30ae592f-4360-496a-6383-08db3f9c521b 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: DM6NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4576 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763469422747408687?= X-GMAIL-MSGID: =?utf-8?q?1763469422747408687?= Remove gaps in bit definitions of RFTYPE flags and add more comments to make it easy for future additions. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 49 +++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index c4fc5a1c630c..75ddbd833fdf 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,14 +240,53 @@ 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 (Displays information about control and monitoring) + * | + * --> base (Displays the details on resctrl groups) + * + * ------------------------------------------------------------- + * info directory structure + * --> RFTYPE_INFO + * --> RFTYPE_TOP_INFO + * last_cmd_status + * + * --> RFTYPE_MON_INFO + * --> (L2_MON) + * --> (L3_MON) + * max_threshold_occupancy, mbm_local_bytes_config, + * mbm_total_bytes_config, mon_features, num_rmids + * + * --> RFTYPE_CTRL_INFO + * --> RFTYPE_RES_CACHE (L2, L3) + * bit_usage, cbm_mask, min_cbm_bits, num_closids, + * shareable_bits + * + * --> RFTYPE_RES_MB (MB, SMBA) + * bandwidth_gran, delay_linear, min_bandwidth, + * num_closids + * + * group structure + * ----------------------------------------------------------- + * --> RFTYPE_BASE (Files common for both MON and CTRL groups) + * cpus, cpus_list, tasks + * + * --> RFTYPE_CTRL_BASE (Files only for CTRL group) + * mode, schemata, size */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) -#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 RFTYPE_CTRL BIT(2) +#define RFTYPE_MON BIT(3) +#define RFTYPE_TOP BIT(4) +#define RFTYPE_RES_CACHE BIT(5) +#define RFTYPE_RES_MB BIT(6) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) From patchwork Mon Apr 17 23:34:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 84509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2475457vqo; Mon, 17 Apr 2023 16:53:29 -0700 (PDT) X-Google-Smtp-Source: AKy350YqPXG4hEJ/So/6FQVpTpzNdAKNCTr8rB3zCPJ0U4a6GwGN73bjjTgxrB6SO+9BXoTVsX04 X-Received: by 2002:a17:902:db10:b0:1a0:4046:23f2 with SMTP id m16-20020a170902db1000b001a0404623f2mr281390plx.56.1681775608781; Mon, 17 Apr 2023 16:53:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681775608; cv=pass; d=google.com; s=arc-20160816; b=fMyUJjmTL1A09jePHjEtp3VmNh9EdXCj15Zz+QP6tLlKwlnvuAz9JnwWgi+4MzZ9DE j1v8mAEwoSyauk0fJQDBfbC2O99vunp9zMcZhV+vRD8AQo4Pqfn7tJdzvESxYTcB8DxA SJMhRE2qqZSc3IQ7yKlOZ7xwLC+H9H9ax1cxjL6UdZ+4fEeuoe3wgEnT4gtd7GBoSmsd Jx4RkjYvtnPfRIdErLazbs75cl0mOANBLUp/t74EECw+BzQHOb94Wd557r0J504zTHLF 9wFwYsHOVZSbg85vc6qMvUuKn1MyYtjuws+dLGqqoL96YW8SisBgyu8RoKRuhzsoVGnK OqHw== 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=7Wxlde95AsHw+0VAeqLIM+TbHm0GFJbbkm7bzu+8CBA=; b=t1tCnF3nDL/FTgDyuH/80XRntFUOaxElha6KhSZhh7H4e4vWtVgTqwntDgU/s6OW3U d+lB8QzLgf1irSsLrZQnZu/Q9TBnC1o+q9ILsnD0hjIJ20W9+j7DAeoWwgzHJLOMZ+59 ct+cu47aNmNGUWyFXLp6W1qFk2dMY6GBjtIPG1YiJC7j0+5+zOfsAdTQOaD3glWNMm7a 9gs92z+hqWVObG0loVHxLp1LO6mK47YiHBS4cVPsEyC60WSf7ojfq2s2F7bOkuVN/KkV SGjrVedmN5mnpJ/Q4rLLFf1Hi57MfFdBRQM08T41qmHBNhNtVvcoxKIX05l2Hf9DV7r4 fJrg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="4DEO3u/b"; 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 t5-20020a170902e84500b001a63d07af3csi13390786plg.41.2023.04.17.16.53.16; Mon, 17 Apr 2023 16:53:28 -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="4DEO3u/b"; 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 S230342AbjDQXfk (ORCPT + 99 others); Mon, 17 Apr 2023 19:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230290AbjDQXfi (ORCPT ); Mon, 17 Apr 2023 19:35:38 -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 87CCB4EED; Mon, 17 Apr 2023 16:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XILsgfKN8YM9vEO6f8svo1gH7wbKuUFKNTudovDO3AMwhu1KcMP2ndVlo+ZJ9+3fo0N+dZzryeVBsfI2IZFFqXr0ZMoYJLdx06Dk4lAGBRs/lOcETmnD7noIi/C1B8wGr/ly7+xngXD9kdAF/epJuHR1G91Hpi+Sy+bazyDLsj1/LzdNdjkmU8OdSLEXjzkeIl90Xhx/nh/wvrlw3pUGP5bDXZOTFdDgVVUKCPsVpUrhx7mVyLK6Qtt5QKvzV2cn66t/9t+KohlTdb8dp5p50oI4dSn+6G7yR4XM8P3uP5J+4CHSsrpViCi9crn2vj6bjhVd3X9J6f9SwaV04+2lOg== 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=7Wxlde95AsHw+0VAeqLIM+TbHm0GFJbbkm7bzu+8CBA=; b=VVv7gmDuhoAGeMhaVb1kLitZ02ftpEOoCi0YZp0bROrA2DiU5wgbuqHFMW3FRb4+41mvfxgm1jnggYtgf243rcNAowL/rcymNqqMNSav/J7FfVy1+Zi/5kNUlD6Bzr9RHYn43TUSJsb9INWh0NUeP9CfWkWod7yeBusFIMM274IjqCUfUh238HTnqOYgbWRMqmrnfXBmsKrTY8zZUXFPgv6yekmTO73gUxOHtd5PoWdaqlfj2aGsp0VtBZddDsNQk+xE2nIp56mb4G9YLqEs89pLIY663W4reDQooKj/f6vteIZsWnEWs767Ak6ve18Z1i2ZpptefpJzgiyHCAykyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7Wxlde95AsHw+0VAeqLIM+TbHm0GFJbbkm7bzu+8CBA=; b=4DEO3u/bXtHmHDmwEQz8PTptQ7b+0xbCSVOOso8RmzLyFad95K+dcNgCGWUgta3/sWsZa5T7MkF76jVJh7e2MFnxzmXr3MzjXF4SHrYFAW/XRhPhTuFyQYNK28kb2+I42JMoZ6xTKjHIY0eHDWkKMxzaRJzUUT655raATfzO8Aw= Received: from DM6PR03CA0075.namprd03.prod.outlook.com (2603:10b6:5:333::8) by IA1PR12MB6283.namprd12.prod.outlook.com (2603:10b6:208:3e5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 23:34:52 +0000 Received: from DM6NAM11FT008.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::9f) by DM6PR03CA0075.outlook.office365.com (2603:10b6:5:333::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.47 via Frontend Transport; Mon, 17 Apr 2023 23:34: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 DM6NAM11FT008.mail.protection.outlook.com (10.13.172.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.20 via Frontend Transport; Mon, 17 Apr 2023 23:34: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.2375.34; Mon, 17 Apr 2023 18:34:48 -0500 Subject: [PATCH v4 5/7] x86/resctrl: Introduce "-o debug" mount option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Apr 2023 18:34:47 -0500 Message-ID: <168177448739.1758847.17451432454091802068.stgit@bmoger-ubuntu> In-Reply-To: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> References: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT008:EE_|IA1PR12MB6283:EE_ X-MS-Office365-Filtering-Correlation-Id: 1604e693-a5c0-4eab-1da4-08db3f9c576d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Of57r7sAAXyRvYdlwuJBrjlb+gxiIOhe4G2wqpF8cwH7+kCtc5dXoR0Qpx9PZcLilZWoJcZmiGDOVEIxn59UzyQW3jHh5JQmThdWiPr5tM9+NVAChhShqXRDMWl36x8yG2B6sJWE+6xQlC1zkSiXMygoZLDNG/fzkv1SUKAX70EVhQNWxCVEL6sCSELjQf19Shs8Cnt1L+MUrMZyo425gXCd4AV4cMR13qSmydn9tbPcJ4HQXOGswJx/MBAWk67l3KNv5lTRApz22Th8ULCszkcGQ20mMsJMZlsxAtYzBz6NT5aKB3bvNWWTKJdynT1tiNeIkCLM9QogEBTKDA68fa50R+HXAfgNV8kVW1B9PneMfG5oOaYKXnLYuglerjjEV8zPvayE3dkNgEZ+C9mwZX2Vtfl9qY16OhU/n5lRhcmtcFQu6Yzo1RGBRY3GZKZABZD88IsxT7a1wOZ+w0pD+8XSQvdKjF3EtTLGWlNy80LzMXNrIaGu2T7R6QVeMIZ6qoz0f+ffDNDMecm/+klKoU0GiH+Ih5tFiuh82IwuONk7tc+0MilJo3KLwnOMdWb9TUrlIa/ovVCJSuXjSnMTBiMpATBt8jiTBtC81dqAcNeWpqFtgcoKq+8xKlKRWs1Z4NBPp+KXgH2N3d0Z993e9FzbKWMTthuMizLUNAB9OzeuO0deQbqVwg+1IbdnnRtOox30pJGgUNKqJd0Z8LevozC3SwL7Rhcc82L2ttWrxfbvsnA2tKMnQyZFUoanjzOWHRqAwO80agMKa0BX538KFQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(396003)(39860400002)(136003)(376002)(346002)(451199021)(40470700004)(46966006)(36840700001)(86362001)(5660300002)(40460700003)(16576012)(110136005)(44832011)(316002)(33716001)(2906002)(7416002)(7406005)(356005)(81166007)(41300700001)(82310400005)(82740400003)(478600001)(36860700001)(54906003)(47076005)(83380400001)(8936002)(426003)(336012)(26005)(70206006)(9686003)(70586007)(40480700001)(103116003)(16526019)(8676002)(4326008)(186003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 23:34:51.6492 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1604e693-a5c0-4eab-1da4-08db3f9c576d 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: DM6NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6283 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763469540476517032?= X-GMAIL-MSGID: =?utf-8?q?1763469540476517032?= Add "-o debug" option to mount resctrl filesystem in debug mode. Debug option adds the files for debug purposes. Signed-off-by: Babu Moger --- Documentation/x86/resctrl.rst | 3 +++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 3 files changed, 17 insertions(+) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index f28ed1443a6a..be443251b484 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -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 75ddbd833fdf..1eac07ebc31b 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) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 719e29248892..0169821bc08c 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); @@ -2387,6 +2389,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) if (!ret && ctx->enable_mba_mbps) ret = set_mba_sc(true); + if (!ret && ctx->enable_debug) + resctrl_debug = true; + return ret; } @@ -2575,6 +2580,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2582,6 +2588,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), {} }; @@ -2607,6 +2614,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; @@ -3549,6 +3559,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 Mon Apr 17 23:34:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 84504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2474452vqo; Mon, 17 Apr 2023 16:50:29 -0700 (PDT) X-Google-Smtp-Source: AKy350aj4RzU4J6hhsTzzuFDNKJdJpybkReEKs9i3+i2pYh3A5Rfah7bvmJAqYbFvIK8yFz3Z8Ef X-Received: by 2002:a17:902:c613:b0:1a2:8c7e:f310 with SMTP id r19-20020a170902c61300b001a28c7ef310mr230854plr.35.1681775429733; Mon, 17 Apr 2023 16:50:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681775429; cv=pass; d=google.com; s=arc-20160816; b=qOzxSKe/SWwdqcZG8jMScS8/Nyj6G1ONbDo3jvZ2cs2VQmj8HiaxBdH2kFb/sTUK1F ypA88UG6pUndBjsL5CVl22AO4raJz0XQABhdjBAuw07zw16cWx3/+xlW12bd6J7hEkkZ OhD5FF/w7mDVkAtTql8EIe9kj3cWa3p2KbzamCGEkrFCZwkc/DKjv9Ziq8smbioBQO4X TS8/9BtUAppAF6Rh8tB2di9newoYUIgU92+B1eBAjrNeHhvOIt1Zm6HTbq/1fmnuPEUY ygD1yoUL4bKstgZJgZzGWBPfA2n55MBxYQzgmmq07yGt4GiaGipMCe740/sWaBkhgRSJ YcMw== 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=Ybihj2KdjI+Z/hC4V5qabsSvdzEjuHKYdxCu5RXeBuE=; b=j0AI3b1rmsuF0yKkQX4I6bJSxMd7lpyZQdGHanGM2m0p6Ybx10eWoIlUdeOs2FG8KN ox0NvnrPAx5FqVt0m+qS+F3pBnlBVKSWWzGzU/AjfgeBc0GtGCBwmke2u453/p+VD7Q8 S2uTu7sutT4fZzQrNFVHb2nlwbR8qX8yD+kZZtdS3uN2nHswNKW3hG2HqI95Hz7Ib/6P dDXxKNrBtzWkDMZHwVtjrtmdGRa3Z/6TJFZfE2y7l2cvlJ0+mA6teIWOlbBQ4KdZBcZI htgFNcVARrMq5BBRusYBkLCC/c4YfnV9g3QKNzSxNp5Q8xvVK5SRApPlmb+hLLQfgYcp Fi6w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=nvlQt+0K; 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 x6-20020a1709028ec600b0019a9834bb23si12540264plo.192.2023.04.17.16.50.15; Mon, 17 Apr 2023 16:50:29 -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=nvlQt+0K; 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 S230075AbjDQXf4 (ORCPT + 99 others); Mon, 17 Apr 2023 19:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjDQXfw (ORCPT ); Mon, 17 Apr 2023 19:35:52 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2085.outbound.protection.outlook.com [40.107.243.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6022A59C7; Mon, 17 Apr 2023 16:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLZIOyHLkgMCXL8jxQ2zQLBjiCra00FSTf1rPq+YZubaMDaDJuNxgODAxlLzS9TxEI1t2V1ByswTt+TvnxZK/6hSfreYTEMKjE3XRpgoYhsAdXLRoIkXzAaNiY6RzOtl7Q/qn3l4Xn7Nph8CfThoQJQXi16awGX3RWrgE2cNAbGgSljZBD88GKCvJe635p0PEOrdOC9u3H8XUlktB5bOipPC2cUp8/zcVpnX4NO7I7Z2E7MpigPG3ezEcedN7o7UmgBh1BFqF6pdlR1b7lO/oMqHuu2DfF+7OrhKg1z+hfzV0DQhiOcHxdMbqYeqzWHf9gfjj6C029uYCLxBVBjG8w== 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=Ybihj2KdjI+Z/hC4V5qabsSvdzEjuHKYdxCu5RXeBuE=; b=cERSTkq3Qqv1dLqgQVzb2ZHQU1do3vNv5/otabDpaAHuKFsjkvPBxtO3tWB7F3mNKMRNvEWOPWYnJ53VXmNgwY+VwNpm/5jG4LCjw7xqCm7sauU9sKdbuCgRgFJcPz3uf3JO+ngcxVnQvMl8qJzKqCt727AHSUGgoem2GCytny095moBGgIisB/uRW4dH0z0IJw8GdT63Nl9wk2h6CodLZtMFkzbNkT3lNRyrhh24gWcQNxvQV9LmBHyFyXnt3HvqeZBfUXvxFvXzRus7DucjtNOjCf7yIqKoVC5XuroucIdrCLpcgnlulp038yM6VayaSekDbmuC3V5xo/mmRlutA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ybihj2KdjI+Z/hC4V5qabsSvdzEjuHKYdxCu5RXeBuE=; b=nvlQt+0K4TQCMx4dN98BPpZ9iSCBUXMGYyTkdG/MhXFvSGjl3ogCCs0/7q9BohywSwCuyuAaRJoPnqVBsPrnq3tdMpS6CbCC3I2hqUGMqbFMQae2OLjRzSneVaS/Z3s9kYx/9/AeF4/BMnSUmL2PoTvo88623cbHWQS4FxWGPJ8= Received: from DM6PR13CA0066.namprd13.prod.outlook.com (2603:10b6:5:134::43) by DM4PR12MB5279.namprd12.prod.outlook.com (2603:10b6:5:39f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 23:35:05 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:5:134:cafe::c6) by DM6PR13CA0066.outlook.office365.com (2603:10b6:5:134::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.19 via Frontend Transport; Mon, 17 Apr 2023 23:35:05 +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 DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.20 via Frontend Transport; Mon, 17 Apr 2023 23:35:05 +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.2375.34; Mon, 17 Apr 2023 18:35:02 -0500 Subject: [PATCH v4 6/7] x86/resctrl: Display CLOSID and RMID for the resctrl groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Apr 2023 18:34:56 -0500 Message-ID: <168177449635.1758847.13040588638888054027.stgit@bmoger-ubuntu> In-Reply-To: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> References: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT037:EE_|DM4PR12MB5279:EE_ X-MS-Office365-Filtering-Correlation-Id: 5db6958f-de84-47e6-5db6-08db3f9c5fa2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +qHLlN3NhxpQeXu/Oq7b94EFUb+/bAUXFOD7olAcz8QNr4y7oBjTkAsIBA+Qh8GZixOOkgBI8HowcOjFqbKS+3a9Ov1xF4Qgs47bdHIzK/2C8wPeD49Ij0qK90ZgerBSFpLp9Eg40ZuZzB4zRMWAZpRpODaVKxdXhjMlurSbZ/SBy7dKvLarKQSGrg3Ym+e1XRLQI/YgrDOWYzIbdUhb1HoscKHHJ9mUhlSArSibX7iCDm8WrPSWVJHrn/UJI6c2w6WIMHbnEZCKACYP4lTTD8GexjLnCgyCe9hE59ZWzGbIf2YH4RGaJBHWQEvWvKYju4ZqGNFX1gZKWaTVccc0d6EKST0FIZURqrb+DmfG29lQCZ/QH4F4rIogUiXFIgjKxgScaoLjcWRGTm1XW2k037BFf7ZQLo0NLU7BL7ArcVW5QSmBivvQyCjj3UYfzxcrry+ySmCgJehTXhqnE6wzDVQTWArQVDvCBVlWeoegkFmQKCCedatxqkOQ3uTMJbuXlOZm/+Z9Hdj6EyOMRV8JY2HLHehDoetE7kZUehMWEs5PcMNkM6mRBWSR3Z6aaj1d/dxVZQ/4pINxxKMuO3IRWJdxiQu+U8y9tMzh43gfbEu7BmrLx1af/EWurw4BMxBGcvGm7ybn4qiejEyXGnSqImDnuqoFEbmJJxc7xmuTDcoPE2Igd5rM7sZdcj37niMxhGbs6gxBm4JoqkmQ7fqO9YPCCY/l8UsB8nUVC6pJ/50oZ+3NAgGT1GKVxE1ugD64FA93WHJtH+4aLl4PoI3N1A== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(396003)(376002)(136003)(39860400002)(346002)(451199021)(40470700004)(36840700001)(46966006)(36860700001)(16576012)(110136005)(9686003)(54906003)(26005)(33716001)(478600001)(82740400003)(70586007)(70206006)(47076005)(316002)(83380400001)(6666004)(186003)(16526019)(336012)(4326008)(426003)(41300700001)(356005)(8936002)(8676002)(2906002)(5660300002)(81166007)(7416002)(7406005)(44832011)(82310400005)(40460700003)(103116003)(40480700001)(86362001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 23:35:05.4200 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5db6958f-de84-47e6-5db6-08db3f9c5fa2 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: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5279 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763469352910343152?= X-GMAIL-MSGID: =?utf-8?q?1763469352910343152?= When a user creates a control or monitor group, the CLOSID or RMID are not visible to the user. It can help to debug the issues in some cases. There are only available with "-o debug" option. Add CLOSID(ctrl_hw_id) and RMID(mon_hw_id) to the control/monitor groups display in resctrl interface. $cat /sys/fs/resctrl/clos1/clos_hw_id 1 $cat /sys/fs/resctrl/mon_groups/mon1/mon_hw_id 3 Signed-off-by: Babu Moger --- Documentation/x86/resctrl.rst | 17 ++++++++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index be443251b484..5aff8c2beb08 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -345,6 +345,14 @@ 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. On x86, reading this file shows + the Class of Service (CLOS) id which acts as a resource control + tag on which the resources can be throttled. Kernel assigns a new + CLOSID a control group is created depending on the available + CLOSIDs. Multiple cores(or threads) or processes can share a + same CLOSID in a resctrl group. + When monitoring is enabled all MON groups will also contain: "mon_data": @@ -358,6 +366,15 @@ 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. On x86, reading this file shows + the Resource Monitoring ID (RMID) for monitoring the resource + utilization. Monitoring is performed by tagging each core (or + thread) or process via a RMID. Kernel assigns a new RMID when + a group is created depending on the available RMIDs. Multiple + cores (or threads) or processes can share a same RMID in a + resctrl group. + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 0169821bc08c..15ded0dd5b09 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -782,6 +782,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 /* @@ -1843,6 +1875,12 @@ 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, + }, { .name = "schemata", .mode = 0644, @@ -1866,6 +1904,12 @@ 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, + }, }; From patchwork Mon Apr 17 23:35:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 84507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2474983vqo; Mon, 17 Apr 2023 16:52:04 -0700 (PDT) X-Google-Smtp-Source: AKy350aiZRzUWp/h2jbgfQAXCZEf4SKQa+x+GsOZx5zyUJG5yRhKuAuTb9q2kOy6xzh1ZiyLB+Jb X-Received: by 2002:a17:902:f1d4:b0:1a2:9a94:2f00 with SMTP id e20-20020a170902f1d400b001a29a942f00mr221607plc.27.1681775524228; Mon, 17 Apr 2023 16:52:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681775524; cv=pass; d=google.com; s=arc-20160816; b=aiJRQXbwofh8+jO4R6IQmU5XE5fEHz9ElV4J+FTsKvNpLv0vqPZOtfDhcSNk+U+AAR /YBOnJa8nZxOSK0UISbtMUHOMlxaW/gQUKD6FchFCeSEOp4EL8P0RO/PBsxlq9qP0CtC g/GqW/XLJ+cKZc4tDKwFKuHmPHk7l0BmYJvpHAcqko6LdId5VFfnZOuIGTI/s+BS0YK8 0k+zxhDX/LdIiBcmyyHQdX/0WebTZgeCg9oUHj0h7mM9igg7zzrR7gMZ6arRCymk+NX1 DOH4lsmHmS3UuSjjoPDSrh2s4ocXcWjCS+Y6Q4PxhT9WldFexBR0CDXhonx3fmFRx5Xu hWMg== 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=2QEdeBYOcFQXPHhAU/bv6izaEr6SsDBieE7N+ywkJK0=; b=DcrYvriMN0Prp5SOrX1GNojYq+NuheAYsnt3obqF+P1tARAgEjZo0H4ykO8NonQto2 fQrXyY2500pdCD7Lmtr0TL793phZ1z50s/ND/nlOEIwAD/pL+Ps3maekpS3sXvVBgTtS sYDdQEZNIPULLY8guZJ31rVkyGZ6N6cDHDFLDV7QCVY+VY6bx3ZZBglo2Jyc0xW1qmoL KgwTtLHxp8cEsIUYFYA/Px8IQJaLB+UA6zPHIWVduDqMnqZD5fXRDLFXg40gtzxac3cB SS/mQr0fWtL75raIgbOYZa8DRFg3/5HpBwpXaK/bN6zk6ZufDlrjFyYG//mliU9aerKJ z2/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=MAAcyFCu; 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 p3-20020a170902bd0300b00192bac60af2si12228969pls.473.2023.04.17.16.51.52; Mon, 17 Apr 2023 16:52:04 -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=MAAcyFCu; 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 S230350AbjDQXgM (ORCPT + 99 others); Mon, 17 Apr 2023 19:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjDQXgK (ORCPT ); Mon, 17 Apr 2023 19:36:10 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2067.outbound.protection.outlook.com [40.107.100.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3ABB6196; Mon, 17 Apr 2023 16:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QXYpO5vz5rflvpurzmw7RTLsee2kLfPfVfRZFlWgHcNAfxRYWJrUV+08XB6cwSCYF8WpbzV7pe7fjpdPCQECulxGa86+NAGMIzzZu28f2XODLEFurw0xhMNMBGk7xrwleTHmiCOU1BprN9VDjM8V1nX53RJuZpuRD/J66Ajv/gfCkyvU6xbZZy/bL3Kwtc10ydEnemwPxTXkopNyUHUAJT63RnkA6/9ZlycC1qS45JKf+O2tAfX2ol87Lb3I/ycPamsFJB6f3q4equfusLqwbIufpdXVzwZoM7BDGDK1LsJUhlSRit38RGcMhzMDE2iCzTM6E+kqrSChK41Jt6eSNw== 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=2QEdeBYOcFQXPHhAU/bv6izaEr6SsDBieE7N+ywkJK0=; b=aGhldIrSx2wN/nZo2lLpG0elQGzHtyNNfjAqB2DpogPLEP3l3sEpZafw9b+HycMY6mfHG6gBIJqtu7uaIUmSd1zv4vY4mWF5Mo/D6Wrb63mNq0wmfXYizgiM/7yOiKibSdheFu0ScdvjUloTtMzCl/RbtX8pbf2SzfaEZdvIYleGuZUEJjdITHMBPHM+1e8aFoeu0RuUBpQCTU8aeohBAX8Q5VLfoYSVuiNyjnv90I5X5KPxQU48dKm27C+A7mb+xY2D/qS3CNl1XAV27Dd8vfQG5UF40/3ubU01z8LxAJvsHuXIUyBvNoQmxaTd87E7sT2iU6secKvY/hd6H1KEqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2QEdeBYOcFQXPHhAU/bv6izaEr6SsDBieE7N+ywkJK0=; b=MAAcyFCunrjOVvnH4nc4KpA9iUISPzDLGVKseYSe1WS0rwWxaU9ZPN6JCd0b3N3jYez/PUsoAGpfZvch21t7LysS5jjDwLS8DDfyRKYXaRjm0cYmZoKFBalVYGvBzjejpHHNTQUmcwxMXUESO4HFZyVjDbM1ldkNSablvO2NubA= Received: from DS7PR06CA0012.namprd06.prod.outlook.com (2603:10b6:8:2a::22) by IA1PR12MB8239.namprd12.prod.outlook.com (2603:10b6:208:3f7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Mon, 17 Apr 2023 23:35:14 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2a:cafe::37) by DS7PR06CA0012.outlook.office365.com (2603:10b6:8:2a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.46 via Frontend Transport; Mon, 17 Apr 2023 23:35:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.20 via Frontend Transport; Mon, 17 Apr 2023 23:35:14 +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.2375.34; Mon, 17 Apr 2023 18:35:11 -0500 Subject: [PATCH v4 7/7] x86/resctrl: Add debug files when mounted with debug option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Apr 2023 18:35:10 -0500 Message-ID: <168177451010.1758847.568218491528297451.stgit@bmoger-ubuntu> In-Reply-To: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> References: <168177435378.1758847.8317743523931859131.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT027:EE_|IA1PR12MB8239:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b602508-6733-48a4-b8d8-08db3f9c64ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ka3bysb9n3W17QxqgfImunfbwxrB4lFLonykVtms1qFBSScHLahfKLnK+AWT819jtsmqSTSiqQ3dc5ZmJSz7tp0DVkx7wdmUps8WvXIlXwbVJmfuJawKH7Tpsudo90iwrL4DSzU/TfUQ3+clgM2Y8SbXZ0eKay9fYEyiFdW0M0r6DPC61cylIX2+SF/jT3U1vMhd+MEZZw0xVblxs65RCplwMx2RPZymO+Rs8KyLRepk9L9fmdH7kxkjfaceK5SlAkJ2XLvVafuoXOrlHW0YeqEKIsHCVv6YrAoE4skNB0CncVmhydz17vcQcC80ETdt6DMsZES84pzbt3mS1NkdSxJr8pjnFS7HYPKRk8asprpLXJYYFNv5btPAFiyzXhFDpzbiBzAGZ/6wDwmvWlAHDW4KrS4Il4UylIqU1Cyx/y1IBAFRxqPEPPjEBYoORSN9D0SWHQxyS6+Z8dWo5SuUpQq60IhQbL7exEHkeCdyuKRAM9u4z9g5eh2kvg2QLvoI8nGKp8V+rdu6ccA7JjwqkTipK3VCl10btZNUyRM4yCOy1B8mTBpsgstNHPdS9l/2NLgpImtjUytY4ZCNs2oLVuM/Ofq5Iu1rny6Gvr/LSjqUz8WDL6WQOIGDZ0CvduHIedNS309Bnos9tN4XZcJqhwuoSaiYRyaZAdUAckumcFQkQwtK2GP+hN9G/xVzIVxqLW8xW85aN+KIMu+XhB5xw7pHB36tVumNULFMFiUpWTada6EwhDL/Q9LQZNGFnpGV X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199021)(36840700001)(40470700004)(46966006)(83380400001)(336012)(426003)(82310400005)(16576012)(110136005)(40480700001)(82740400003)(47076005)(356005)(2906002)(44832011)(5660300002)(103116003)(316002)(41300700001)(54906003)(8676002)(70206006)(70586007)(81166007)(8936002)(478600001)(7406005)(4326008)(7416002)(86362001)(36860700001)(40460700003)(186003)(16526019)(9686003)(33716001)(26005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 23:35:14.3024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b602508-6733-48a4-b8d8-08db3f9c64ed 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: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8239 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763469451762952956?= X-GMAIL-MSGID: =?utf-8?q?1763469451762952956?= Add the debug files to the resctrl hierarchy. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 54 +++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 1eac07ebc31b..855109abb480 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -288,6 +288,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(4) #define RFTYPE_RES_CACHE BIT(5) #define RFTYPE_RES_MB BIT(6) +#define RFTYPE_DEBUG BIT(7) #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 15ded0dd5b09..1ec4359348c2 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1880,6 +1880,7 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_rmid_show, + .fflags = RFTYPE_BASE | RFTYPE_DEBUG, }, { .name = "schemata", @@ -1909,6 +1910,7 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, }, }; @@ -2420,6 +2422,49 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, struct kernfs_node **mon_data_kn); +static void resctrl_add_debug_files(void) +{ + struct rftype *rfts, *rft; + int len; + + rfts = res_common_files; + len = ARRAY_SIZE(res_common_files); + + lockdep_assert_held(&rdtgroup_mutex); + + for (rft = rfts; rft < rfts + len; rft++) { + if (rft->fflags & RFTYPE_DEBUG) { + rft->fflags &= ~RFTYPE_DEBUG; + rdtgroup_add_file(rdtgroup_default.kn, rft); + } + } + + kernfs_activate(rdtgroup_default.kn); +} + +static void resctrl_remove_debug_files(void) +{ + struct rftype *rfts, *rft; + int len; + + rfts = res_common_files; + len = ARRAY_SIZE(res_common_files); + + lockdep_assert_held(&rdtgroup_mutex); + + for (rft = rfts; rft < rfts + len; rft++) { + if (!strcmp(rft->name, "mon_hw_id")) { + rft->fflags |= RFTYPE_DEBUG; + kernfs_remove_by_name(rdtgroup_default.kn, rft->name); + } else if (!strcmp(rft->name, "ctrl_hw_id")) { + rft->fflags |= RFTYPE_DEBUG; + kernfs_remove_by_name(rdtgroup_default.kn, rft->name); + } + } + + kernfs_activate(rdtgroup_default.kn); +} + static int rdt_enable_ctx(struct rdt_fs_context *ctx) { int ret = 0; @@ -2433,8 +2478,10 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) if (!ret && ctx->enable_mba_mbps) ret = set_mba_sc(true); - if (!ret && ctx->enable_debug) + if (!ret && ctx->enable_debug) { resctrl_debug = true; + resctrl_add_debug_files(); + } return ret; } @@ -2851,6 +2898,11 @@ static void rdt_kill_sb(struct super_block *sb) set_mba_sc(false); + if (resctrl_debug) { + resctrl_remove_debug_files(); + resctrl_debug = false; + } + /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r);