From patchwork Fri Sep 15 22:42:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 141011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1573289vqi; Sat, 16 Sep 2023 02:57:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2n+0Kv2GKP1EzCSEybHjAbhnf87EArpN7JWa0k7FmRZaHbWvKBAqBP12Dw7OJkzHCeBlQ X-Received: by 2002:a05:620a:284a:b0:76c:d007:b544 with SMTP id h10-20020a05620a284a00b0076cd007b544mr4411079qkp.26.1694858228536; Sat, 16 Sep 2023 02:57:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694858228; cv=pass; d=google.com; s=arc-20160816; b=d9qYkgpLNW4Bghct+Yd9HD1XX+9kdiUXc+0Bb3e0WZlmJ6A3Mnanx8UXgmZRbWiCsF xo0z6+ncrbjSit6M43do78TkYJiXukVK7NtZXH1iT9FhjLxt7K147k+McPnnuvsRtcCJ IgrFVyy7UtprmzIWfey0+gLxYGC6/ymS6mhcaL6o6Nj0cecQij+ZKAw7WG8dHMJ4Q3aR 4r8Yb1My9kbKqdkAPikBnw6308n0TixZZkhdnYiFxMt0XtCBznNGjwMktPbjAv7D7C8a 1v2qy3QVbk5Uk53uXNZOmhkm3x9cC1084hqZZasL3hOtT+qKX+GODPnkXfOGbTeO1A7E 5rTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IUhWzRrT6nvglIRlMoitP6PZLno159FzGba81EjYa+A=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=tdmPa+bKGcC+tI1uYlPxy8Hr/TNin8hjumnsV8lNLuZK8ND3ZEzgOc4Kr9+NplGlhi X+IB64Fe/dLKG+7s4VnKGaQH4wlV2/WkTzSQUKpRyrIzumBOSKyNvH0aIuDUkqjzqEsf EBXSruRaa0n8aZenm3ziMDUVKLBLxm3ZR9vsMpJF4U/f80+yo2lmfFVCI8ygmhjQxey8 dXIszS3LyxggD8NH39pftAqR/UuZoBAkeyaYjoCHXDZyUgKN48FzuQ5DXj3LYAQE4p8Z 45KsDW2n1NmCvpll4wmwWuA2ZUglBUCzdhj/E069uR27sA5JAtBhb+Tq4bIEIVb/lJ3S WVjA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=fmVF3MWo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 76-20020a63024f000000b00574037f35dfsi4765624pgc.360.2023.09.16.02.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 02:57:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=fmVF3MWo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3DF5583CFA9E; Fri, 15 Sep 2023 15:43:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237846AbjIOWnK (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237832AbjIOWmq (ORCPT ); Fri, 15 Sep 2023 18:42:46 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 424E526B8; Fri, 15 Sep 2023 15:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eVq4lgDDG4tTBA0VP5mqfWQ0UmnDNUEWBXPBuddDPbM7zDgdXtZm48LyYhqrWLCxY0DpQd+HMJlxjVWY29ypRtlnC28Xj/4WErIuHGTQZuhtLpXoiFamqnDCJTvTJOZvw0kii3lh84dU7Er0TnN3YZhE0gBvmwJwslVIwta7MoUULfdRirqc+liCZ20HkkrGnlsNggYx2U8zBnlXB5mPe69MMFF/7YpmA7fY6zWNrmQjcsxmPWkPk63JAMkn2414m15+QhVAUo4xBZ3KIA1jDdzgBrhaTq3AitcPQfVhbjbkEhzQW1MZ72+mPXDoUa7smMRudrOnCeikljP2T/S+tw== 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=IUhWzRrT6nvglIRlMoitP6PZLno159FzGba81EjYa+A=; b=JOEdybVWA35DTy71XvDZjI3b8TGs2i+cjId1O+nGn0DnCpJPMSkL5KFXDbVGUcLykNLGNRl6pcp+5LDZK00JXBp/SBFHUu5aLBWFGM0ncnNAkrVHbfID4ZDD5k6i0rK66UIQb8EJwixQOPh3Dtx3EGzQCK8K2D2qP2GyXOgoLamnq29trelRTTC14QgDNLH8BTphXJmyDsO9FyIwkCEsQRF8YQdc5cZaZ60nMKH5nJ140bphHhe6vJBuNew/5hwuTjQQpj4gS8ULrEAy5GuELWLBhAfNUWOHSfSp3S+byaoYmi5ZSgT5hQmmqnfjzxZED3yF9nZ2k5N6hSCEhZfIMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IUhWzRrT6nvglIRlMoitP6PZLno159FzGba81EjYa+A=; b=fmVF3MWoUDt18Hoh5lyF6QltwhvwTU1ZLfnxCeaMt8mAK3vRhCvCgaAGwXb7jjIIKt+sAhFal3ea62a9xTzC87HqYKaFXh5d5jBdB4gPOAi+Mi8ePI7AjGuHB1x4zPwf/I+64T2/eNLOoP4cxrgvEWNf59TazI8JziEps1DpklU= Received: from CY5P221CA0105.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::40) by DM6PR12MB4563.namprd12.prod.outlook.com (2603:10b6:5:28e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 22:42:38 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:9:cafe::cc) by CY5P221CA0105.outlook.office365.com (2603:10b6:930:9::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:37 +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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:37 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:35 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 01/10] x86/resctrl: Add multiple tasks to the resctrl group at once Date: Fri, 15 Sep 2023 17:42:18 -0500 Message-ID: <20230915224227.1336967-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CD:EE_|DM6PR12MB4563:EE_ X-MS-Office365-Filtering-Correlation-Id: 2348c6bf-3e18-41c4-9b2c-08dbb63d0fd9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 05ECD5FVt8Sj7gTD/f4ALIxUHnVczBs+lCbajodiImhRF8ITGED/6Tjkx7LgfGthhQiMrvtF3bzYl10SPrKDbIYviwFqQtP4upUx2pqYJddw1pFhjkwgo2jAq9YjJkcDEjbCRbygGgd2vjFcqlAm4MHN/RCZFxwcPjCo93XkKJE/djZQIsoJrx6nZ8aPkrKBnHeHEfPMW8Thy5VE0+1R8Ee6goJVCspHyxZ9j6VIChfQTCUGVK2Krxn6dqcSxK7vISitDEFNtmFJwIIUgI+YSN5oIPsdQpTLosHPdycm3fHiJ9WUJ6/NHeNgkhOwRiQ7Q+uh8A/1fDUy75ZkBHyhyUwTVu2Ys5DxLFYtMKuW05qwC0+JFwIjqddcPXjcQ0WzxEt9cvES9GyYkh16bfMaHbCYhjsy4gyk0WXa3Rw4LxY6CUDWPABRAYfRcPpqemrOTbts62Qo0uB4fUB/i2719K7q6SUhWWgj7rRkLDUtG/VshEXRyuuxoAZIiU+sUHAmjsTNUt/wOnQ4ULLRTmwaIsePURgC2KMOzqqJp+wtbAg8y3m3Uj11AzpJql7ReU3C29AUAFw0fTeksL9IMAeQVvagsZ2/17nZfTl1LHPw+Gdq9RyWhr7wt/aNd55OZVcEBPs7Qnwhi0izhIKJ5+issVFdqk4RqaO0uwdp7965p5dikfyaGqVRE5ipIY8hg2NbbLJ6N7Fu855ohK608o1/HPCZE27r6fPeRqX/FYmhgZ89XGMeBg95l3TGETzHwI8tBsYnoGytv98gj9Io6i5tQA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(346002)(136003)(39860400002)(376002)(82310400011)(186009)(451199024)(1800799009)(40470700004)(36840700001)(46966006)(26005)(5660300002)(16526019)(8936002)(1076003)(8676002)(4326008)(40460700003)(66899024)(36756003)(2906002)(83380400001)(7406005)(7416002)(86362001)(82740400003)(81166007)(356005)(36860700001)(47076005)(336012)(426003)(44832011)(40480700001)(7696005)(6666004)(2616005)(110136005)(54906003)(70586007)(70206006)(478600001)(41300700001)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:37.7299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2348c6bf-3e18-41c4-9b2c-08dbb63d0fd9 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4563 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:43:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777187661651937294 X-GMAIL-MSGID: 1777187661651937294 The resctrl task assignment for monitor or control group needs to be done one at a time. For example: $mount -t resctrl resctrl /sys/fs/resctrl/ $mkdir /sys/fs/resctrl/ctrl_grp1 $echo 123 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 456 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 789 > /sys/fs/resctrl/ctrl_grp1/tasks This is not user-friendly when dealing with hundreds of tasks. Support multiple task assignment in one command with tasks ids separated by commas. For example: $echo 123,456,789 > /sys/fs/resctrl/ctrl_grp1/tasks Reviewed-by: Tan Shaopeng Tested-by: Tan Shaopeng Reviewed-by: Reinette Chatre Reviewed-by: Fenghua Yu Signed-off-by: Babu Moger Signed-off-by: Babu Moger Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- Documentation/arch/x86/resctrl.rst | 9 ++++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 25 ++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index cb05d90111b4..8154e9975d1e 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -299,7 +299,14 @@ All groups contain the following files: "tasks": Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the - group. If the group is a CTRL_MON group the task is removed from + group. Multiple tasks can be added by separating the task ids + with commas. Tasks will be assigned sequentially. Multiple + failures are not supported. A single failure encountered while + attempting to assign a task will cause the operation to abort and + already added tasks before the failure will remain in the group. + Failures will be logged to /sys/fs/resctrl/info/last_cmd_status. + + If the group is a CTRL_MON group the task is removed from whichever previous CTRL_MON group owned the task and also from any MON group that owned the task. If the group is a MON group, then the task must already belong to the CTRL_MON parent of this diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 725344048f85..f0d163950969 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -696,11 +696,10 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { struct rdtgroup *rdtgrp; + char *pid_str; int ret = 0; pid_t pid; - if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) - return -EINVAL; rdtgrp = rdtgroup_kn_lock_live(of->kn); if (!rdtgrp) { rdtgroup_kn_unlock(of->kn); @@ -715,7 +714,27 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, goto unlock; } - ret = rdtgroup_move_task(pid, rdtgrp, of); + while (buf && buf[0] != '\0' && buf[0] != '\n') { + pid_str = strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_printf("Task list parsing error pid %s\n", pid_str); + ret = -EINVAL; + break; + } + + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d\n", pid); + ret = -EINVAL; + break; + } + + ret = rdtgroup_move_task(pid, rdtgrp, of); + if (ret) { + rdt_last_cmd_printf("Error while processing task %d\n", pid); + break; + } + } unlock: rdtgroup_kn_unlock(of->kn); From patchwork Fri Sep 15 22:42:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1507608vqi; Fri, 15 Sep 2023 23:26:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXu25HozilBiyZ8IYFhoDvYDcJSw1ig/5T1QJiGYBfU6w9LdjVvUD8TnLrY/WXokdD4vhM X-Received: by 2002:a17:902:d510:b0:1c0:d7a9:1c48 with SMTP id b16-20020a170902d51000b001c0d7a91c48mr3272445plg.49.1694845618298; Fri, 15 Sep 2023 23:26:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694845618; cv=pass; d=google.com; s=arc-20160816; b=cbTVyjGXUJwYrzh3/uqFhzAJJYCIwIXWT+0RHL9gtKMXuBeUme85KEEGFQegXvm5Ik IA2cusVc+oeeRxCJ+isHk+Q4khn5bURj9DVa9wMs70Fub8DLvtRy7sSPcIDeyExt+Ugb NcLC6PBmBBVaEpV989cqn5US7sdzlMHL6MR9XKEf1GEwprt/nWwk3eFRgVwCBsCaRt+6 q85Rv0SXeNp9nPlYFhO4VZCPBVuEYh3GKt/lgvpvOACwYYdxyChUH09yw3JMC8vQZ04F SruKEa+WI3YSARwFKm3NZI1Ox7C0SpW9imFkJWyiK/Jm0nspMAI/bIEBdzol+JeKm9OS LylQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tnwcG3l72kLybYiBjLxO5k4/kCMEuedhA0eBwbmELfE=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=GoWFvW392qdrtnqr/UvWbH9NwW24nvaiSQAkFyL7Ls6Ghy8weGRYE7bErZSCZ83cUR rtOwA4Y9odzNDyCb3SFW+DT2h06YNCkv5TBVtKMIeWt7qfUERpOVa2PlAaRmOC2toC6R I938U2bmuRnAYa2yAxgaXEjlOlkhwGX/knjeaoxzOQcJLN7SVeKa8QoiNaZZw7mzAeeU ZQSELI82nT9Jy0f4Xgpb2oOjEBsMtplAuuKDBY8iRmLqIMitTHbVzqGyySdhIIKk2fE8 /PwuO20EClrAkhKZt5eZRMBzvNmQ1kJOQxFDIhV3R7GVZZ/Y9+Jq3L1zsCqaTg/2lX5B jy/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FqRTAqVB; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id o5-20020a17090323c500b001b8b37f6b46si4380036plh.556.2023.09.15.23.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 23:26:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FqRTAqVB; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0681980732BA; Fri, 15 Sep 2023 15:44:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237950AbjIOWnN (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237874AbjIOWms (ORCPT ); Fri, 15 Sep 2023 18:42:48 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2086.outbound.protection.outlook.com [40.107.94.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A625115; Fri, 15 Sep 2023 15:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IiZXcCqN3cUrHynLVVdk4d2u146HB9yjgplOZ9nQN/uRZk1XE8OuDQmxVMUuNh0ZrWml0i9oCC+us9+/Gtjr8nTeeimALNUGbZudh+F6EFjFDTDeAtiwPVa105bEeZJlMh7GNH6WnRXikvXp2nf0ZHi9BvSL+DPakJO5db+ChGfEFKRychV1jsZUlzUZ3BpU1bhKYqa5qKTDRD4B8HiUhP8V3SpX5F2V8XKsJcaIHOiIBq2vlfRpnUGXwlw1UYWkAsVUF4t43BN35meAPao+Uk4WYq1b6UscH4e5SDRm1ZPgeQq4cg71GMszefPQySzcbRmqtyd9w37HKaQNoSW0BQ== 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=tnwcG3l72kLybYiBjLxO5k4/kCMEuedhA0eBwbmELfE=; b=IrXoit5U9GXJr5XRAnYxtFMygmx1e6eCYS85MNg0Bn+i6ERtfnMsSnagrxXVPJtDrruTpcx4FdXjGBlRYm19ZnmOCnxNqiaLgHnCSVCFrTJRScoFjASeehCWhI5iRpl1XW+yI5ZTV4D1/CUpyZH+aYGuKwIRYkwBNCAFv7qeYduFic9Y691TL+W8vFz7XFPh3YWbdWaRlZs/7zexObnL//9Pj+DPtqLbd2w/Gat99/AuYg9tkbJmaz23BspoeYouEHJkOn4Q9t7LNMiMNyzNcqhI3f8cHGf/7xnMMzK5rP3geC6WIzIOBctpGvSUqZXgsnrWOb27PAABEsXM67/JOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tnwcG3l72kLybYiBjLxO5k4/kCMEuedhA0eBwbmELfE=; b=FqRTAqVBCC053wgXz4OmZgZN0LAU+BP6hA5Gs/uEDMszYt2dbYu0maZsWsrzQCUOoC/u831MyqwM7QNTOVp8AqN1GqsdMV1D7C4/h4jjhiPWJQ2dSmYFJCKPaStndtjMd5EHXG1Ny0Q3d+1BPKTyRFusgDsI/aUcsSllG8uPtwU= Received: from CY5P221CA0097.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::37) by SJ2PR12MB9239.namprd12.prod.outlook.com (2603:10b6:a03:55e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Fri, 15 Sep 2023 22:42:39 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:9:cafe::25) by CY5P221CA0097.outlook.office365.com (2603:10b6:930:9::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:39 +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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:39 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:36 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 02/10] x86/resctrl: Simplify rftype flag definitions Date: Fri, 15 Sep 2023 17:42:19 -0500 Message-ID: <20230915224227.1336967-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CD:EE_|SJ2PR12MB9239:EE_ X-MS-Office365-Filtering-Correlation-Id: bf9636cb-6ede-4e6c-e0cc-08dbb63d10a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lD787liTZzf7ohBgjfgCI2Vx5kCI8YTGx3LfKSi+jJlbDNqu9tRaamSvFTq6R9mPEfA7Xt0cHcZlBb8Xo4XEM+j6f5AThqeZUYorRntEG8iVCmFV0ideoigW8s0cJm0gFu0Kn2gZtTFHOFYK6AOe2eeASBIuk5tgMyLPRTOLzM4fyJ2olVHnfG0rmlZpzySWZTy5eeQwvXP/j1j+VmuQCqwpm11hvORS6OMuSJqptqACKEK0eWsjvwFxE5mUsSug35Zfm2/csUh6bc9SVA9ZoZr5+K4ID7E3vTU04fpy/BMy2/kQdb6FlJw+IANwIu1eAXAdLxZMGJHMK/7hk1gkkngtVBWnCSIwgcve25h5QJMlq6LW8vxH/digqp3Dh1+wu3sLeqrVqJo+gEA3jDaymOxaI3WqG+dL5i3FL1LIpxJNjvxSKIJJFnSuFbtLuwZBvWnzAsxmE9cOKEL2Y9dHmfcy+dyGdMjRuoJvuz7K2qv8McyiswStHy9aPy79c2TuT+iCzfRkE4IpsuMApejwvZ8vLgMQUN+X3+aCZFwQKAsL9VGMhlXdeHwmj8A99VVDz1t9JG7lHG5XQh3e0gl+Ua+4oI3wm6HgRdL44hS5A+L4o8uXwGltpe7QZ2YrLxVDDDB0uqVmxEURUpISd0FiWLEDRA/NEZ0u6ezp7s0K0W0veKVq+Ou/VxmPbaExUDXMtazEJSXkKHyTSuzRsRpmuK3JA4XFfoy+GhnDDlM2YEQ+cZgmz2z6QwfqVh92JDzX2Ww5+sjLJA2AkdV6fq9lhw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(39860400002)(346002)(396003)(1800799009)(186009)(451199024)(82310400011)(40470700004)(46966006)(36840700001)(40460700003)(36860700001)(7416002)(7406005)(2906002)(47076005)(36756003)(86362001)(356005)(82740400003)(81166007)(40480700001)(8676002)(8936002)(1076003)(2616005)(70206006)(5660300002)(26005)(110136005)(7696005)(70586007)(54906003)(316002)(16526019)(4326008)(41300700001)(336012)(426003)(478600001)(83380400001)(6666004)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:39.0424 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf9636cb-6ede-4e6c-e0cc-08dbb63d10a1 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9239 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:44:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777174439103242955 X-GMAIL-MSGID: 1777174439103242955 The rftype flags are bitmaps used for adding files under resctrl filesystem. Some of these bitmaps have one extra level of indirection which is not necessary. Make them all direct definition to be consistent and easier to read. Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Reviewed-by: Reinette Chatre Reviewed-by: Fenghua Yu Signed-off-by: Babu Moger Reviewed-by: Ilpo Järvinen --- 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 f0d163950969..7ddfa4b470e6 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3242,7 +3242,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); + if (rtype == RDTCTRL_GROUP) + files = RFTYPE_BASE | RFTYPE_CTRL; + else + files = RFTYPE_BASE | RFTYPE_MON; + ret = rdtgroup_add_files(kn, files); if (ret) { rdt_last_cmd_puts("kernfs fill error\n"); From patchwork Fri Sep 15 22:42:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1386206vqi; Fri, 15 Sep 2023 16:48:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEi+Jl6853BXERaz/Hco77HiM6/bSnfm4pfi5hbAynIVLREtOkZAK4wODZF9Imi8F/+ZtG4 X-Received: by 2002:a05:6a00:1989:b0:68f:dd01:4da6 with SMTP id d9-20020a056a00198900b0068fdd014da6mr3437545pfl.7.1694821712389; Fri, 15 Sep 2023 16:48:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694821712; cv=pass; d=google.com; s=arc-20160816; b=rI8NloySIKdtiZLgsyj7f/0p7BbxVMusoLiJB8lyhuZYtlJx6KJRt7zJKaK6iFxbxr Fj/kNTmLk4hCJFEuZED9MDDEKK1i5YIXAxhP5F5cfKUIdhQPGvetHSiOhAwhyRcx8D7A 89s/C0LsCOgZw3FviC6R2yzss3eVprv+LN+Ltf2Q3PAqXbCU2mh+Dg7zl7tUMElNH4V/ EYsVyu/a2k7t+FOHgLpOl9P+gEI9ug/dJ0LSgvAFxZA7tL+gFeok91b2pzRZ7YRZyt+O 0jDcxIMEVKTuEyKkRmqCRZg550Goeuj6ZYAzDqVHGFsajM58lAs5krkNzhAuaYTHnH9X 4CjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vIbfI4sxiMNAJf/gypx5Aa/s9Utzz6vT3FparEXkxUM=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=GW7QriQO8dKLoZ1yFxy8HWfGxVPOVFhGmvSLOELpVWznBZqVui4wOwYcb85CLM5kC6 dZXcoKNXJrRVfjduPKewWho/RvmHVm1eCorGqLT/qGesnxu0EI6XEOQiFhyWlr/b/Pxy F8P9STaxSEz6BKu00iAX2Dpe/vJ4OryAwko2oI7+aAvbujnrig06MpThcF9d/e7LbhEa QDsKLSUp5XiihG4dghyRpXCYanjY4AHb7O43E/mXsINU2ujsHBrCxo80cMPYn3nl28on tWNo2tzeBpTzNJvR1WTAtI+kKTfouKzgUDuMP4AdsEBJDDR7SBy4+P9tuIeutaHICDMs 7BWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yPM5pyIn; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id z39-20020a056a001da700b0068be710ee8esi3995351pfw.36.2023.09.15.16.48.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 16:48:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yPM5pyIn; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 6C28F81EE2FA; Fri, 15 Sep 2023 15:45:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237998AbjIOWnP (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237890AbjIOWmu (ORCPT ); Fri, 15 Sep 2023 18:42:50 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2040.outbound.protection.outlook.com [40.107.93.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79A8115; Fri, 15 Sep 2023 15:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=POVLPl0upIRFB/aupXnTFGNzcp9T2LTO+8OzL+UNYct8Ikrf+5GO1OsDbchrmbbT/xHWZ86YcRv5WS3h17OFUXe4978AdVgzK+2wjob7+V7pfYAFTmv1KB10h9yNGbjxD0dkdjpVALzvxYc9hgmRegnOEq007LD0qtg+pkIyAHvyXIT+Kocc+TUvLxPXgz86eiPMWapBXU1UT3AJ7c/YVD1WDaVphuNqjHixtx9dAIRGhVbpLLRqNh4CY/Pm5S4Lh3+RePdBtKdt4J7KeYh0WwgaBuTdlCReKaxUtf/hm0OxLDmHll+cyd3+aWykdNjIuVYPkRWplg5dTK/YRnfJew== 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=vIbfI4sxiMNAJf/gypx5Aa/s9Utzz6vT3FparEXkxUM=; b=Dq5C8in+RRAIlydg9dcsfWpnwgYd2xe0Lwj1HWkTnbzCentxPMf4AOnuwFaJFWpOU28ohwZEA6LTT5E5COwxDmAl6zTsEewO4hmWrL96PH7wbrS33N9l5k8GjiPZW91jn3gYYXhWvGM3/pO+10fF+/Fgh1KOUV3FtOmGhlndMKCRE6RnKN37y94/eRQaKSow0cBTuOwuAGA5C8EEL2GK/dvEK//MepFQCV0pLoLEfuDlKtv8zt49QIV/S4mVXcKZBg9jx9qDRA9INQBMAGp1JByzcrvhhRZuzYMB8+gvpqjthe2H0Go1tg2tdgZ3gPJXCIKybUitdF899WmkDhPrbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vIbfI4sxiMNAJf/gypx5Aa/s9Utzz6vT3FparEXkxUM=; b=yPM5pyIngf0IJ/vh1iSveJRHIcZS/hWlhvvxbyIZWJ+Ng4sk4aBGPpkSU9GBzdfWVbOyJOlriiKCiB82P3zuS4+Zt4wSbklVmFu81+I7mJodxc/xiPQBZSqUIFNLnsL26Wqaoj+jhMv8gl7ZM6i3cccCmLvwz/AUX0/TEtim/UY= Received: from CY5P221CA0099.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::44) by PH8PR12MB7133.namprd12.prod.outlook.com (2603:10b6:510:22e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 22:42:40 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:9:cafe::55) by CY5P221CA0099.outlook.office365.com (2603:10b6:930:9::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:40 +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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:40 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:38 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 03/10] x86/resctrl: Rename rftype flags for consistency Date: Fri, 15 Sep 2023 17:42:20 -0500 Message-ID: <20230915224227.1336967-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CD:EE_|PH8PR12MB7133:EE_ X-MS-Office365-Filtering-Correlation-Id: 7eab1029-4812-43ad-fd91-08dbb63d1181 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k5mlkz4q0cM+oOPO1YeuBpFMrVvzcs70l9COWCB7l1SrUpOZapFxsUXTYSkV4rGKvcGYhAQegpWw11B7gZELdax/miGOehaTXQNp4M5cpq6PwYS7Ofck8Dn4GnZqPNOLxxx5asnxHsLApqVX0VBNWd6EKlrgBSXJ3jj6WAtXHGrTSHbp4qF5jN0TNklgVCY/8EYdvYrmlTQWtAnU7+wmq0KiS4WwcBhCiBv4pGAlAzsiMmssbToD8Hp1YUT77iaMiMYm6J1nXgFUiAdKmL3B3QA0cQ9t/jKkbe/Dyk/ZX/SihT/wfo+4YYRDnMHCUhHOMbPzTTDCg+xKg3cFXmHyNphbDLaebj3fONMs1wC/ij/camFOT2qoEEbi5qPFXz5+lvQZPzwoUeQVxQIXAL7934MxlmI9OdwxS4tIbCQdGQqA65aKKsyxg8rKb8R0aDYElHDmSN+Xo0/8/sAKXc1+28JNXrtfkDn/4uOiVZIU3/iU2rnK1morFhGlHvUoo9kyymICXTsc+KHXc9xqUOZh6KDpJSLj7oG4gJS6VZZyR6LjxUYYerEhNXvp6doxq3EZdnUdn4tBXlCBwn1MivmNAblMohcdZ73/IY24vLzbbViVjB0g8rrS/trMyjIvpjBG5Brg7SblPEYlwoJT7xJcGTUTT0r3mPfRBXaRhy//DPamoIh9zst1Oyy4xomwaG6tznN/wUoDMOVxNlYqUshGRReNhu12gpxNSXi9F9B7mqfakta0QUDAl0ZSX0ym6NjNOLJmqa2ihKWocG3HmyyygQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(396003)(136003)(346002)(451199024)(186009)(1800799009)(82310400011)(36840700001)(40470700004)(46966006)(82740400003)(7416002)(7406005)(2616005)(16526019)(2906002)(26005)(86362001)(1076003)(426003)(336012)(356005)(81166007)(8676002)(4326008)(44832011)(8936002)(5660300002)(70586007)(36756003)(41300700001)(54906003)(316002)(70206006)(110136005)(83380400001)(6666004)(7696005)(36860700001)(47076005)(40460700003)(478600001)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:40.5111 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7eab1029-4812-43ad-fd91-08dbb63d1181 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7133 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:45:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777149371412069914 X-GMAIL-MSGID: 1777149371412069914 resctrl associates rftype flags with its files so that files can be chosen based on the resource, whether it is info or base, and if it is control or monitor type file. These flags use the RF_ as well as RFTYPE_ prefixes. Change the prefix to RFTYPE_ for all these flags to be consistent. Also add the flag RFTYPE_MON_BASE, which contains the files required for MON group only. Signed-off-by: Babu Moger Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- arch/x86/kernel/cpu/resctrl/internal.h | 11 ++++--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 +++++++++++++------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 62767774810d..f71bc82c882f 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,11 @@ 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) +#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) /* List of all resource groups */ extern struct list_head rdt_all_groups; @@ -267,7 +268,7 @@ void __exit rdtgroup_exit(void); * @mode: Access mode * @kf_ops: File operations * @flags: File specific RFTYPE_FLAGS_* flags - * @fflags: File specific RF_* or RFTYPE_* flags + * @fflags: File specific RFTYPE_* flags * @seq_show: Show content of the file * @write: Write to the file */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 7ddfa4b470e6..35945b4bf196 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1705,77 +1705,77 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_last_cmd_status_show, - .fflags = RF_TOP_INFO, + .fflags = RFTYPE_TOP_INFO, }, { .name = "num_closids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_closids_show, - .fflags = RF_CTRL_INFO, + .fflags = RFTYPE_CTRL_INFO, }, { .name = "mon_features", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_mon_features_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "num_rmids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_rmids_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "cbm_mask", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_default_ctrl_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_cbm_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_cbm_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "shareable_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_shareable_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "bit_usage", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bit_usage_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_bandwidth", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_bw_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "bandwidth_gran", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bw_gran_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "delay_linear", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_delay_linear_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, /* * Platform specific which (if any) capabilities are provided by @@ -1794,7 +1794,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = max_threshold_occ_write, .seq_show = max_threshold_occ_show, - .fflags = RF_MON_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE, }, { .name = "mbm_total_bytes_config", @@ -1841,7 +1841,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_schemata_write, .seq_show = rdtgroup_schemata_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "mode", @@ -1849,14 +1849,14 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_mode_write, .seq_show = rdtgroup_mode_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "size", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_size_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, }; @@ -1913,7 +1913,7 @@ void __init thread_throttle_mode_init(void) if (!rft) return; - rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; + rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB; } void __init mbm_config_rftype_init(const char *config) @@ -1922,7 +1922,7 @@ void __init mbm_config_rftype_init(const char *config) rft = rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE; } /** @@ -2057,21 +2057,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) if (IS_ERR(kn_info)) return PTR_ERR(kn_info); - ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); + ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO); if (ret) goto out_destroy; /* loop over enabled controls, these are all alloc_capable */ list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - fflags = r->fflags | RF_CTRL_INFO; + fflags = r->fflags | RFTYPE_CTRL_INFO; ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags); if (ret) goto out_destroy; } for_each_mon_capable_rdt_resource(r) { - fflags = r->fflags | RF_MON_INFO; + fflags = r->fflags | RFTYPE_MON_INFO; sprintf(name, "%s_MON", r->name); ret = rdtgroup_mkdir_info_resdir(r, name, fflags); if (ret) @@ -3709,7 +3709,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE); + ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); if (ret) { kernfs_destroy_root(rdt_root); goto out; From patchwork Fri Sep 15 22:42:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1363485vqi; Fri, 15 Sep 2023 15:50:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFV3nLsnWFSYU3G7QHjg/p2B7rU2174zfmVwgFC5oy5sufjVXyb9z2PZlirn7csd6jbVwFG X-Received: by 2002:a05:6a00:1490:b0:690:454a:dc7b with SMTP id v16-20020a056a00149000b00690454adc7bmr3438708pfu.28.1694818218926; Fri, 15 Sep 2023 15:50:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694818218; cv=pass; d=google.com; s=arc-20160816; b=irbk9vH/CJrUn0F0eXSGhfHc39MqppZD0TX881Dq3tJ0/dbcUUQtrDepYL9tWv8EyK XlOQZbTEAnrgSJB28iTUorn1XGRBqAOjpwUwFG/KYkCqAVG3SQto26fAUvnY1kSuyBe4 RF2BUV8OtoJQotwU1PeK810P0JDcL/KAmz/LlB1inMR2ehpxqgzwJ10yVcNf1rYF8xaN NTrtbC4pxC6IZb+AzqpZirVRd8tpr1obSbNJuw8Y+k+xNb//S9WdHZFc7zAoE0iWEXrT sysQOLUtQSnPPu/6chWfhYWK1J/QY/a8CAw2E6MA3p2dMDYF2wl3Na1pYth1UOsF/2rK 05Dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aRNwt9E+1bJoLKKiUsRyKY7GIJyJUdLTEXyJaGny0OE=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=DhQyJQyrz9Izk4EBVkFQJxQH3CEhgPVXdgzzdw9EBO/CbP+IM3ZznFv7MIKBrY/GbY FWxgZwf8yRC7IKUfH6ah7Zyny/Mqm5min08AR5T1o0HTqQI9Yk+vy/KTzpNaEE00jfCM bOf7BeBwTsmw4exSK4SKT2b4HBb73mJmrMRqlxIzYQkrctG1Euz6zDOUvYXt99KmQRgu 1DWQ/tcKXa6qk84+UBL7zXPMCH5EYX4+oUwaFhWy90nMOED1y314nyZUxYZ/zep6ND1e pjEU9qsIu4OlkSqHqC+Gh4UU/2lLix4uYp0kb0WT2Vg9Hr1p3tYoOeqF930kMyARfMXi qeIg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ipNln5Ta; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id q7-20020a631f47000000b0057761dd9c56si3841960pgm.322.2023.09.15.15.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 15:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ipNln5Ta; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A3C7D82516C8; Fri, 15 Sep 2023 15:45:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237972AbjIOWnO (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237887AbjIOWmu (ORCPT ); Fri, 15 Sep 2023 18:42:50 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5F95101; Fri, 15 Sep 2023 15:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=caXDvIwhmCpLRbRco7F0KcIkM/6R9Y8g1C08u8NNuuBIAyNjCGr++zI1eQqotf7VMWNkYMIRq8TkGD+4Jv4+Dds8JO9VdnyErDkwOuI0GywC0FYPvYUCz9v+40MnJRinzU8tXJEQvsrufLx39Ry2BqhzwE8CU92NqMKEsZe6Z0fSmQXq+mm3mF0ulr9FDqbLBz8YHjE7HwHkXsFmMpd4P97K3eyZQOkfsQoMN935YlkNnEb7vGfrV116oO1nmo+tDpbta0mqMLdtHdBD1p9nbE4XiOs0A2wPw751lHVF6khd5xhEck1994mHLhIQ1a1MZOU9llYDRNZlemjxpzP3EA== 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=aRNwt9E+1bJoLKKiUsRyKY7GIJyJUdLTEXyJaGny0OE=; b=TqAixs56F0Yb9KfOGsGcTTCLVIwvpiZ1gUA24WN2MAi/8y8elyU1cY7lz1iWg4E2gTKXO1p7EHj3jR4rN2B7gE3/dik/8othXRfjn9ph7ISUSVgfRP4JrUp3nP6Or/Robpi/HAtWun3tO5lZwRtNbeS9NPLhCIycZVwHdm1jJsAeDrUs6/kjLsLs806K0YlETx3a8lzybZPEiyD7ZHVgCvSjd65S2EnrDLmwqFhrBOYy5xjgvI/dK11GndsmZocsCk4L1R23uxLhW14PDuU2O7hnWjhgKMZv6DCkJXN+4K+HmRT0dSYhMoDUaWNQ1QSicBjnATwIFCVPCE91VqhCPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aRNwt9E+1bJoLKKiUsRyKY7GIJyJUdLTEXyJaGny0OE=; b=ipNln5TauhxwJ0w0rnlzk2uM3jz9WALyJucJlNpRTizJcKUGJSEpmjwyuLLvzEOZqjLego4AsIo4uYUspGfdIYKpQFFuub49AKXF+yU9e9qLjlwnmMskaXu8K9uQAEFx5xDOOg522FkAmlvDY7XRL7ZQKu/ykMtuExowWq2hHI4= Received: from CY5P221CA0105.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::40) by DM4PR12MB5214.namprd12.prod.outlook.com (2603:10b6:5:395::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 22:42:42 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:9:cafe::83) by CY5P221CA0105.outlook.office365.com (2603:10b6:930:9::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42: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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:42 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:40 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 04/10] x86/resctrl: Add comments on RFTYPE flags hierarchy Date: Fri, 15 Sep 2023 17:42:21 -0500 Message-ID: <20230915224227.1336967-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CD:EE_|DM4PR12MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: 05f52e28-0cd6-42d3-b6bd-08dbb63d127e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5+1x+qJ4WjVRAC/vZB7i7d2D3DfLMa8zEiN6+HratIK2nbQkdHzLG1Jz+C7qT7RnanJaF11Lh8NVFgj8Jv7UC8G84VQ/mmS49mlM4bNNWRQ1HJK5efq0Os8CU4GeGox3SnJ2SEv1SnNL5piB29z8Be3ckUiXKCTNe1QeoT3ko1c1rSd2Q8yAaegKfbuWGPVvpUV3DKSOMXe85mgF0S5SD4CXp5zF7cOx6OxUnHJlK7kQu1lTwt4lBDVwbMgnBCJlxxQLuG6IS6umFL4j78KvtuyFSGBoOS2pDO/TXNGk2gDIR72cwm5kLa+WHnLWZCL+kCKBul93nsk3zIS8cj4qmXGAE9yQuqPUX59Oms+KnN/ot1F8xMGmoJnG7kb02g7kzY0vTiF2IAzCES9YTuCt6iwhkfoW+8e9FVMoKzqD2JnWr4LcmkyAC+6f7z+m+TmkhjYVaaslNsOfIDAvFVj3qCFOscjR5fg5VPW48Ji1n/O9hrLMRDWRbYAyycZGnsW+gHYOiMIvtisFxIW2q9HD7iuHB7L1efiNhCB8YMmJJzxdV9faG+YL8+22s0eSWWgeynLpxSJlDJ3ktSOLORHEchvgiXCRY1AEpJRmuS4nji6QpizM7d0X/qY/zO+slKphiGMUjsz8zPaQS8w4+2Txl5Ea9mhMBrdttF8v91UDiHle6b14J/Nuy7A1QREC3nLEAOhjf4BCuheHC3d3BKQqWpgLokDHX59YX14dvT3lnJI9TobgzKbM9/EyNntIq5gmexKqHE3hZTLpoEyRrf439w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(396003)(136003)(39860400002)(1800799009)(186009)(82310400011)(451199024)(46966006)(36840700001)(40470700004)(6666004)(478600001)(1076003)(2616005)(16526019)(26005)(356005)(40480700001)(81166007)(7696005)(40460700003)(82740400003)(86362001)(316002)(54906003)(110136005)(70206006)(70586007)(7416002)(7406005)(41300700001)(44832011)(2906002)(5660300002)(47076005)(8936002)(8676002)(4326008)(36756003)(36860700001)(426003)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:42.1674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05f52e28-0cd6-42d3-b6bd-08dbb63d127e 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5214 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:45:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777145708436862739 X-GMAIL-MSGID: 1777145708436862739 resctrl uses RFTYPE flags for creating resctrl directory structure. Definitions and directory structures are not documented. Add comments to improve the readability and help future additions. Reviewed-by: Reinette Chatre Reviewed-by: Fenghua Yu Signed-off-by: Babu Moger Reviewed-by: Ilpo Järvinen --- arch/x86/kernel/cpu/resctrl/internal.h | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index f71bc82c882f..14988c9f402c 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,6 +240,64 @@ struct rdtgroup { /* * Define the file type flags for base and info directories. + * + * RESCTRL filesystem has two main components + * a. info + * b. base + * + * /sys/fs/resctrl/ + * | + * --> info (Top level directory named "info". Contains files that + * | provide details on control and monitoring resources.) + * | + * --> base (Root directory associated with default resource group + * as well as directories created by user for MON and CTRL + * groups. Contains files to interact with MON and CTRL + * groups.) + * + * Note: resctrl uses flags for files, not for directories. + * Directories are created based on the resource type. Added + * directories below for better understanding. + * + * info directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_INFO + * Directory: info + * --> RFTYPE_TOP (Files in top level of info directory) + * File: last_cmd_status + * + * --> RFTYPE_MON (Files for all monitoring resources) + * Directory: L3_MON + * Files: mon_features, num_rmids + * + * --> RFTYPE_RES_CACHE (Files for cache monitoring resources) + * Directory: L3_MON + * Files: max_threshold_occupancy, + * mbm_total_bytes_config, + * mbm_local_bytes_config + * + * --> RFTYPE_CTRL (Files for all control resources) + * Directories: L2, L3, MB, SMBA, L2CODE, L2DATA, L3CODE, L3DATA + * File: num_closids + * + * --> RFTYPE_RES_CACHE (Files for cache control resources) + * Directories: L2, L3, L2CODE, L2DATA, L3CODE, L3DATA + * Files: bit_usage, cbm_mask, min_cbm_bits, + * shareable_bits + * + * --> RFTYPE_RES_MB (Files for memory control resources) + * Directories: MB, SMBA + * Files: bandwidth_gran, delay_linear, + * min_bandwidth, thread_throttle_mode + * + * base directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_BASE (Files common for both MON and CTRL groups) + * Files: cpus, cpus_list, tasks + * + * --> RFTYPE_CTRL (Files only for CTRL group) + * Files: mode, schemata, size + * */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) From patchwork Fri Sep 15 22:42:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1396532vqi; Fri, 15 Sep 2023 17:15:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBH8qqWdVTJ6H5eLkdT+EAJ+dgjsOnLxnZ+T9Zv34jzdIXkMmD82/urYCQMV7lFDbRgFpT X-Received: by 2002:a17:902:da81:b0:1c3:710c:51db with SMTP id j1-20020a170902da8100b001c3710c51dbmr3897008plx.33.1694823323456; Fri, 15 Sep 2023 17:15:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694823323; cv=pass; d=google.com; s=arc-20160816; b=Y2e9qn+mvr+R3oPLE7ibp7lbDTvbaQUQlkjyNXaFdsmuS0ninuDcSohXT3iUgvzpZ8 OYGs5ZOfe8MrfoYQahz4elDGV8w097BbsQa+GjtICr0BtRFQo3IUsyk4JCcguLnW5FSD lr3YTWTF9M8Jn6i0KQq0eyREjfxtL4PS64ifKrQr94tjNgaCvqHEDFh1BK3QXRGXt+82 O+zqns4zS48Wtw0SmjxSVjN/1yaUx+oyb46fe97+I2HBVtIbKWZ6vUh4PJSjk4kexHyL z4PuSuiAsTqCn4UMCK1FtiVlamNwfSpZiAmlQLOVbmXQ8SkgQptTpK2Zvu7sO/N+uPCk 1/Cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i/7hZ5SyYRhoLJbc5I0K2ThwZ1owcA5JNUGyhoUp7as=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=C1CUXMMzIT6F59ZFFOZkwGOkYzafXM3wuncw3FKwuhX7AhVYw4MR9Vsc5EwH+3utrw pgOjywDqm0Wu9F+HfaUyPNU0LW5EnmD/ZNR0y3M2f1np/C/YzCuGa0sN6v40AiunLVi0 PLeNh7Auy2nJz1iz6FTlukdCH0ehSW7fx6uOt0fCWEeG0s2FwW3J3CnYH7kKAQXD/NeG zXZx9kyr+0ik44ne1vKXCqRQ/Io65Hl4hnhYMYwLoWaOKL5l80xi5AY4HuT4uAyFB2vh /fVQOcSCwMS1vh0VPFoDqWMI5Vo/oE0/fmbJ0l+ERGSqn1syfQ+Hjgaesi5OfIUr/Dhf fZ+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Nv10mebA; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j3-20020a170903028300b001b887c89a8dsi4365484plr.521.2023.09.15.17.15.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 17:15:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Nv10mebA; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8BA1280A416E; Fri, 15 Sep 2023 15:46:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238017AbjIOWnT (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237929AbjIOWmy (ORCPT ); Fri, 15 Sep 2023 18:42:54 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2053.outbound.protection.outlook.com [40.107.237.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 105BA186; Fri, 15 Sep 2023 15:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nXeMB5iXk9O8OcztlBYsHRKAH5u0oQtnZetGHAz3e56VYDxSQZilu5lk2o5pcNwxgZZZICx8bD9nFUYgNuST5Odrl+/nbIdcOyV88Q6+GMo7KcV8ZIoQEkr/iMKEGBLxQEVkrOxMuQbBDzH5JMGG4cSTVd13dP/a9kx0CHwgrauzs0rUx3e6w4GxsULv6gue02yGfVVUDV38C5zN2cCoNI+ybFbqU9RUY0KT88yk/7baORZBX/t/p9lF85UrZmODqVHvZwwfcIDZsVC2SBehtraIn9Ufg5XxJjgxFJUxOZScQ3DFx8Qm9gqitTgjCGXEB9SrGdz3y7mXmeZQ8dHnPQ== 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=i/7hZ5SyYRhoLJbc5I0K2ThwZ1owcA5JNUGyhoUp7as=; b=PTeuSOeq47raz0YektEmTWsfMDF6z1ijd+cwQkr9YOwWagzGWNGU8J8HrMm7y4ijngLfKywQ706FtuvgDRHLNQjBEk2QCPTMQSgq/NvridmQD/nBE2Sdcj8tl14ZVvO7naw5Ntso2Kehvs7g+qZHzr569CWMLMkx5Itr/B5PiFKZVrMklI/jQ+gOEYx1Ie+8iMDOvDy8isrh46FaIJ0lR8ER/mO8F+G1nboQxlE62rtEyT4SkwcfZXh3t3zCsQSIzXyl2AEpBlKdrJK5AMOzBSIu5WNa/zyAGvV4/mquREtulikkMAXpEEkE42V+wRsiv7Er3++EIyO6DSivJMZaOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i/7hZ5SyYRhoLJbc5I0K2ThwZ1owcA5JNUGyhoUp7as=; b=Nv10mebAvj10AeV6nMojFQwbNLwhCzEzyDL3lrvc2/VQ9PuEcaPz6WXlya5rfwpTOQQkmAXX7zbwYiJJWqB20vl7wOULUBAzuDDPTOAGCwS5rQzyhztKis/403+jA9I7Tj9aZuTtR+S0dg7Z2LQAItr6GMPgMXpbuZJMN62I7uI= Received: from CY5P221CA0098.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::35) by DS7PR12MB5957.namprd12.prod.outlook.com (2603:10b6:8:7c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 15 Sep 2023 22:42:44 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:9:cafe::ef) by CY5P221CA0098.outlook.office365.com (2603:10b6:930:9::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:44 +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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:44 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:41 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 05/10] x86/resctrl: Unwind the errors inside rdt_enable_ctx() Date: Fri, 15 Sep 2023 17:42:22 -0500 Message-ID: <20230915224227.1336967-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CD:EE_|DS7PR12MB5957:EE_ X-MS-Office365-Filtering-Correlation-Id: c6fcb729-594b-4f11-d2fe-08dbb63d13bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EKm/pE1IK/uwPHWGFzlVb0GfE1Yp5ctay1rVebHOq0wwsTO2cXZ/TUeZUWSiiXRIkF3CerJoUtfj4IC5SR82fkhEv0kr/6GJaBJAsKGHeyilQW175dqWxmSAfwVN3A7CkIOexcfMG2VkgNF/PDIBw1OiTyAaO0CHxkzzjj7kHgkoaH39YcOBUJ41FUZ9K3ymAfFvkSxYj9Vs4Cn1QiS4AxaLYubhofn/Z7XqfhN+J1dKcYV3DriMl9kVOCRSaPXRMmdfg1miJlFBDHo3IeP/eck+wgx0/aY82ytAjyHSwuSSvFPYRr4oUFHQNl+mUF4JWUFuIhlKDr0VxzwzDjVFYP/WGI5195+NKJFex4HKS/8fz2lhshb9M9KGxu6UlEhpkwp/V4ZkB14rPoiRE/W6YFB/s+rjJB7VnnhloEzzCpMnQwXRbVSHrGyuXSiZDGnCGPKcEQOFljExmGvfn4f2JmyUEXLP2QbgY/E+Z9ILFLs0n5uVZSon99fXyXttNWB4ma+aonXyXLff08M1es2TV2bzPcJe98YcZRcUgRrbJDi46SZiwB3IBqIHFWGreNXoPWrfym5RxeQ18zI/M8HSiVfBxCSoMznIrVl5GFJsXmk1ItMDyb9Qw5ggQlO/qsCXLocMjh7c+WhpiHdLXaAGkECd8wBuu1vDjdXUoiOWXFWSaGrMUupt/UDFwPjEjWJMtIxTkq0ixeIAvtFzAj+l2pJ/bcIQjB6EtSkLQqzidacQXQkiIu5gYwbFgv7UlH8TGdr1Yegc0VxA5WXVTP60rA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(1800799009)(186009)(82310400011)(451199024)(46966006)(36840700001)(40470700004)(54906003)(70206006)(7696005)(316002)(110136005)(40480700001)(41300700001)(6666004)(70586007)(478600001)(8676002)(8936002)(4326008)(2616005)(86362001)(26005)(16526019)(5660300002)(1076003)(44832011)(356005)(81166007)(40460700003)(36860700001)(36756003)(426003)(82740400003)(2906002)(7416002)(47076005)(336012)(83380400001)(7406005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:44.2455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6fcb729-594b-4f11-d2fe-08dbb63d13bb 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5957 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:46:32 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777151061206262631 X-GMAIL-MSGID: 1777151061206262631 rdt_enable_ctx() enables the features provided during resctrl mount. Additions to rdt_enable_ctx() are required to also modify error paths of rdt_enable_ctx() callers to ensure correct unwinding if errors are encountered after calling rdt_enable_ctx(). This is error prone. Introduce rdt_disable_ctx() to refactor the error unwinding of rdt_enable_ctx() to simplify future additions. This also simplifies cleanup in rdt_kill_sb(). Remove cdp_disable_all() as it is not used anymore after the refactor. Suggested-by: Reinette Chatre Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger Reviewed-by: Ilpo Järvinen --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 35945b4bf196..3ea874c80c22 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2290,14 +2290,6 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable) return 0; } -static void cdp_disable_all(void) -{ - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L3)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L2)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); -} - /* * We don't allow rdtgroup directories to be created anywhere * except the root directory. Thus when looking for the rdtgroup @@ -2377,19 +2369,42 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, struct kernfs_node **mon_data_kn); +static void rdt_disable_ctx(void) +{ + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); + set_mba_sc(false); +} + static int rdt_enable_ctx(struct rdt_fs_context *ctx) { int ret = 0; - if (ctx->enable_cdpl2) + if (ctx->enable_cdpl2) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, true); + if (ret) + goto out_done; + } - if (!ret && ctx->enable_cdpl3) + if (ctx->enable_cdpl3) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); + if (ret) + goto out_cdpl2; + } - if (!ret && ctx->enable_mba_mbps) + if (ctx->enable_mba_mbps) { ret = set_mba_sc(true); + if (ret) + goto out_cdpl3; + } + + return 0; +out_cdpl3: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); +out_cdpl2: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); +out_done: return ret; } @@ -2497,13 +2512,13 @@ static int rdt_get_tree(struct fs_context *fc) } ret = rdt_enable_ctx(ctx); - if (ret < 0) - goto out_cdp; + if (ret) + goto out; ret = schemata_list_create(); if (ret) { schemata_list_destroy(); - goto out_mba; + goto out_ctx; } closid_init(); @@ -2562,11 +2577,8 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_info); out_schemata_free: schemata_list_destroy(); -out_mba: - if (ctx->enable_mba_mbps) - set_mba_sc(false); -out_cdp: - cdp_disable_all(); +out_ctx: + rdt_disable_ctx(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2798,12 +2810,11 @@ static void rdt_kill_sb(struct super_block *sb) cpus_read_lock(); mutex_lock(&rdtgroup_mutex); - set_mba_sc(false); + rdt_disable_ctx(); /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); - cdp_disable_all(); rmdir_all_sub(); rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; From patchwork Fri Sep 15 22:42:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1364618vqi; Fri, 15 Sep 2023 15:53:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNbNGOutx0URzmWpSbFNwYQVRkPo/DKr32wHe7uEY+7YTRJ5qLVIF688swQX9QPk+/pQg2 X-Received: by 2002:a05:6a00:189f:b0:68e:47b3:ec7 with SMTP id x31-20020a056a00189f00b0068e47b30ec7mr3267183pfh.14.1694818421774; Fri, 15 Sep 2023 15:53:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694818421; cv=pass; d=google.com; s=arc-20160816; b=bbFpGCs9DQigDHgoUi+E/IIYoWOGnrPVoFV2Kyfq0seEQl9dOEC+p6lnhblFyuCnti jXGdMQVoGgzT9IYtX3fmwGZG5+rY/pwOQCkFQ9/I5b/AI1bMWHF6D8KGulkQH19O6wYv MIlvY/W2FDKEklzKNKHGdsFH/NGEyUXQ4hq8mRDsoB6ziIB30BPdyUSJ9//PlcqxygvJ i4v9/4eZwb4+of/R8pZFTBRlhmujELgibuwf42v8D2SlSP7wo599MQzCtbG3tSe8ENSM Awju0MK4on+P19Mhv2W/frgxiAExr5lhoWU4Jt+gwmsiXjhZEHE7mbJ53a7T1Rnl5Xl3 IbKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dINoIK6N/Smd+D1h2Ne9MB3WxGCVRu8LqEjuIiQ6aPw=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=iUHyWLSSLULOgTJIxtAXOj0zQb6I9/E19h2/MlZpk4+UTQVs5Q5bXiheu+fyoiUcYQ NbUPqjHnpMNTc+ZbOAyLN8RM3jiubJO90/NboEwAZUo2rqRnxaks1p2dRPy8b/z3I7YH +i95yb/vC+qJavg1itqlhl9GHvqgPMcatSE1HOx4HvWGFDk8a9uoNvvloZ8jKADqM11r Wu9B296D0f9G3Asv3GK45tZ/7erU5z9nbg8VYbxHFXRGxWgDHfIh+Gb3+4ql+fmAPbHg Rdpla1UqWKbsmgcf1phlC07geOduSdeKNgLZfubPvY3m4U770j36OsNUkrhcdSHxQwlZ 8yGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=gBcizius; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id u20-20020a056a00125400b0068e41f07f33si4145643pfi.94.2023.09.15.15.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 15:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=gBcizius; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id BDCA583B824E; Fri, 15 Sep 2023 15:47:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238066AbjIOWnY (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237976AbjIOWnA (ORCPT ); Fri, 15 Sep 2023 18:43:00 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2077.outbound.protection.outlook.com [40.107.223.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAD73101; Fri, 15 Sep 2023 15:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HR3WMbtJULlvwOIB4bqVkcfyMI0WByJyd3BklDESXfQeaUgmwMsbB8Wv1O0NoWFP/w9yA8tdqFEwOq0lrNpGWH9X0CQEoy/YaOyHkf6/jkPUaaKSzqZ8+Pw5YZEFUzsLMYd2XquI5XE4y+U9qlt6weXO6QekzYMC9KrmpBh9iA/hpiv1A8IXV2t3mQVgnDdpT6/j6esB/PjEOrc/oHZI4O/SzRoH88QZXrFsx0oL7t7+cgrRTrbE7o7oGoQ7iqNapR2I3SXGFRDkB18cJx44Hi1MOJqZ2qYsUIPqIC5Z1Uh0PAnQTl7DjL7RDCOxXG4L5OL/MCCC7BlY73KJEGgPaQ== 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=dINoIK6N/Smd+D1h2Ne9MB3WxGCVRu8LqEjuIiQ6aPw=; b=KxNnmvjH5n9Hfus8832BCw8BlZyLpya3HMBFcyS92MHCoE2Wf1s8fYURslm7RYb1AK15s8NPV/R7ZJxKiCLhLWEBoUq4ujMfMjXUYXiVSdnu4CcmgSWeosfD88LZccUQcBGVNMKQa49doLhTDTQhXtihZpANsCSq5iPjUBVD0z9a+mFHvH1b7IuIbLQD9ZoMsnrTkSTOm2J0AbxuFRPaXq7OU/cyvQVFjPeVbr8cIGIntjkmSUkQ78qfnU98EaR48jA69ZcH5VhfOrIltzO8kSUHS0kQEX89oCLXj3fXyEEzG9eGmFxm7/ruDZiUovzl/Ahxw62yAu+M7SoWm4VC6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dINoIK6N/Smd+D1h2Ne9MB3WxGCVRu8LqEjuIiQ6aPw=; b=gBciziuspqUPTO9vjVQwm9WZxvzq9V3laT73aWJPTkfiLk0qstS7SMtvV9ZRPIvOYbPAx16zpuEQDNsnH7MDVMgSszGUd8wxG+b2fD9BFd1COAVViSbcrUJDa6JOmpF7eYR/iCPG7br8+l4C3yd10QlQ6kuNoVRX6xXEiVfltOk= Received: from CY5P221CA0088.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::25) by BY5PR12MB4210.namprd12.prod.outlook.com (2603:10b6:a03:203::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 22:42:45 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:9:cafe::22) by CY5P221CA0088.outlook.office365.com (2603:10b6:930:9::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:45 +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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:45 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:43 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 06/10] x86/resctrl: Move default group file creation to mount Date: Fri, 15 Sep 2023 17:42:23 -0500 Message-ID: <20230915224227.1336967-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CD:EE_|BY5PR12MB4210:EE_ X-MS-Office365-Filtering-Correlation-Id: b1141be9-9704-440a-501e-08dbb63d147f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4BH1s2f1kjjNBGIJmAL4CNDAfzJ/NeCtWlicRZATST2wlj2SzdRSlmSXuTTvnCIfOaUl0QyHLZe0RGHwUmUAjdhkvvAIF6c+r5OIHWBSTPjCcN+j7cfnGURFWISYY5E+opLzfKo4Fv8JVsvEFehjltRY0wy3kDFDJtFD5ZVw4xglih/NgF0UWTsfirpYs35DO3fOxxXpcyJq+vSuABlPxtmje5kl4bkbl5yyK5NFIdUEJOX/zYpAhuMKQLGtOPee0gwezTImUWiSZnXucLN88hI1Xj3xntCM8/Ws/lXTK+bfMle6rWyUqaNX0D0k/YBxYDE/FJDbXkRK+6kP8yoVunP3FTKGVBOvqT72+zT9j/WMqOjPkKFkTHEhC2UbaHStbwy8z+2AsM+fKR64K0Xly4TFbzYJ/Z7C4eVJAm4yn3RF+w4K3fZvggnIOr5KmbxSBitLum2fkVutyb2CBJiFPqTDQMr5A9LO1ozl3SKKV2KJfNBDiRhzzcugUtZugsirtQyIRU/YblfCXZKBjwsWelViFhPqhzdUUZx5PmrYpcVomJ4raj7rFczSDuK/03aauxhIK1+owUCsdX3R2wA1OV9Rsv2GIqP6ZFab/BVpCDVOR24vz42sa2dS9Skf/z/LU2KuOQIOnMTFYjYZvJAZQYTUU8QFd6f7TlOirspuJO4XL2YKAovMvK2ffTHkqSa72vgS3VyeceXwulwPjNOrr770Hj/ealSJdxrVRtbCfVJilpDJpDIkJUC+GPKbFHt0VG90WYD8l2HvmLzUkUVk+Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(39860400002)(376002)(346002)(396003)(186009)(1800799009)(82310400011)(451199024)(40470700004)(36840700001)(46966006)(2906002)(5660300002)(44832011)(26005)(40480700001)(16526019)(1076003)(70206006)(7416002)(7406005)(316002)(41300700001)(54906003)(70586007)(110136005)(478600001)(336012)(8676002)(4326008)(426003)(8936002)(7696005)(40460700003)(2616005)(36756003)(36860700001)(47076005)(6666004)(81166007)(86362001)(356005)(83380400001)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:45.5111 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1141be9-9704-440a-501e-08dbb63d147f 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4210 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:47:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777145921225905043 X-GMAIL-MSGID: 1777145921225905043 The default resource group and its files are created during kernel init time. Upcoming changes will make some resctrl files optional based on a mount parameter. If optional files are to be added to the default group based on the mount option, then each new file needs to be created separately and call kernfs_activate() again. Create all files of the default resource group during resctrl mount, destroyed during unmount, to avoid scattering resctrl file addition across two separate code flows. Suggested-by: Reinette Chatre Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger Reviewed-by: Ilpo Järvinen --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 58 +++++++++++++++----------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 3ea874c80c22..a34657f0bd0c 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -54,6 +54,9 @@ static struct kernfs_node *kn_mondata; static struct seq_buf last_cmd_status; static char last_cmd_status_buf[512]; +static int rdtgroup_setup_root(struct rdt_fs_context *ctx); +static void rdtgroup_destroy_root(void); + struct dentry *debugfs_resctrl; void rdt_last_cmd_clear(void) @@ -2511,10 +2514,14 @@ static int rdt_get_tree(struct fs_context *fc) goto out; } - ret = rdt_enable_ctx(ctx); + ret = rdtgroup_setup_root(ctx); if (ret) goto out; + ret = rdt_enable_ctx(ctx); + if (ret) + goto out_root; + ret = schemata_list_create(); if (ret) { schemata_list_destroy(); @@ -2523,6 +2530,12 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); + ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (ret) + goto out_schemata_free; + + kernfs_activate(rdtgroup_default.kn); + ret = rdtgroup_create_info_dir(rdtgroup_default.kn); if (ret < 0) goto out_schemata_free; @@ -2579,6 +2592,8 @@ static int rdt_get_tree(struct fs_context *fc) schemata_list_destroy(); out_ctx: rdt_disable_ctx(); +out_root: + rdtgroup_destroy_root(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2649,7 +2664,6 @@ static int rdt_init_fs_context(struct fs_context *fc) if (!ctx) return -ENOMEM; - ctx->kfc.root = rdt_root; ctx->kfc.magic = RDTGROUP_SUPER_MAGIC; fc->fs_private = &ctx->kfc; fc->ops = &rdt_fs_context_ops; @@ -2819,6 +2833,7 @@ static void rdt_kill_sb(struct super_block *sb) rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; schemata_list_destroy(); + rdtgroup_destroy_root(); static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); static_branch_disable_cpuslocked(&rdt_enable_key); @@ -3700,10 +3715,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { .show_options = rdtgroup_show_options, }; -static int __init rdtgroup_setup_root(void) +static int rdtgroup_setup_root(struct rdt_fs_context *ctx) { - int ret; - rdt_root = kernfs_create_root(&rdtgroup_kf_syscall_ops, KERNFS_ROOT_CREATE_DEACTIVATED | KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, @@ -3711,6 +3724,20 @@ static int __init rdtgroup_setup_root(void) if (IS_ERR(rdt_root)) return PTR_ERR(rdt_root); + ctx->kfc.root = rdt_root; + rdtgroup_default.kn = kernfs_root_to_node(rdt_root); + + return 0; +} + +static void rdtgroup_destroy_root(void) +{ + kernfs_destroy_root(rdt_root); + rdtgroup_default.kn = NULL; +} + +static void __init rdtgroup_setup_default(void) +{ mutex_lock(&rdtgroup_mutex); rdtgroup_default.closid = 0; @@ -3720,19 +3747,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); - if (ret) { - kernfs_destroy_root(rdt_root); - goto out; - } - - rdtgroup_default.kn = kernfs_root_to_node(rdt_root); - kernfs_activate(rdtgroup_default.kn); - -out: mutex_unlock(&rdtgroup_mutex); - - return ret; } static void domain_destroy_mon_state(struct rdt_domain *d) @@ -3854,13 +3869,11 @@ int __init rdtgroup_init(void) seq_buf_init(&last_cmd_status, last_cmd_status_buf, sizeof(last_cmd_status_buf)); - ret = rdtgroup_setup_root(); - if (ret) - return ret; + rdtgroup_setup_default(); ret = sysfs_create_mount_point(fs_kobj, "resctrl"); if (ret) - goto cleanup_root; + return ret; ret = register_filesystem(&rdt_fs_type); if (ret) @@ -3893,8 +3906,6 @@ int __init rdtgroup_init(void) cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); return ret; } @@ -3904,5 +3915,4 @@ void __exit rdtgroup_exit(void) debugfs_remove_recursive(debugfs_resctrl); unregister_filesystem(&rdt_fs_type); sysfs_remove_mount_point(fs_kobj, "resctrl"); - kernfs_destroy_root(rdt_root); } From patchwork Fri Sep 15 22:42:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1422448vqi; Fri, 15 Sep 2023 18:32:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHEGT3ZwEw9W3pnHSeZAo2NkA8TWCcUBoYhlmMMNqtFAvX6HFkCe75nY6jfQ040via4Zlp X-Received: by 2002:a05:6358:5289:b0:139:d5f0:c027 with SMTP id g9-20020a056358528900b00139d5f0c027mr4112508rwa.30.1694827931417; Fri, 15 Sep 2023 18:32:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694827931; cv=pass; d=google.com; s=arc-20160816; b=EkyZ2CcP8jnrdS4IuUwtDNYrkSGKpN/IQaF6HTlq2gIcJgdy+i6djLcPXFwLmTFAnP 1tknq1IbkLqWwl/i9GPwIbcsJNpb+TVbmXzscuvhSt3tfhTGMHmVHLWwq5FElb4oLzeV /jkPuNLFtXV8Y2pZebwQBl6RCJP+uWI6bz87cxXBBhCQx3M30kuZp6MlcGRVBN1/3f3u 0AJ8X/Xn2rZ9G9230AxqL4cLQ2J2j9EeyPkZfh6G5ZrWyBpJbSX02F8395S6sKFzHsSA uFRu9hqKLvM7xE9Lls4elBLRA/S8W2e8Ngh/+jVzZPdFvt+N9UkdA2jWxnwtqEWAU7rP o5wQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HvaKj6jCDUqPY4p5TSEJOa6+/CN/X84gmnBh324gLsk=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=IdLT9g9f9tHF/kpjPndyJfgP/Z8HHMbamHiawR1MAmge5kkp02hQovPW4fii62df/H qYXOF5lqmyIPTm2eN8a+3v/IvdlO/3nIoCB8+t8QWingCqKKvdbCX5sN8ynbbQ2caq2u 4hNKpJ4EwhkrDmLrzYmGJqa/zU1pzrcKQMb0pcylsaPvkWMFv7zc6YkM/2EJHcoHJv78 yL3ESig6rAugBVRH9TkgsvveQnGXXkAPees3miKsS3FimiWeLVzHz6+o6CRYWjku3DaV nJztFQorVxrhapIojCZKOdJMJfAVlMQgcRR/jE2ilPjvrRUqLmKEif/he9I+OuzV5FKd obkw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=t4YBQnc7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id g13-20020a65594d000000b0057759a5b7c6si4104343pgu.62.2023.09.15.18.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:32:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=t4YBQnc7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 514FE8120459; Fri, 15 Sep 2023 15:46:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238005AbjIOWnR (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237945AbjIOWmz (ORCPT ); Fri, 15 Sep 2023 18:42:55 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0655C115; Fri, 15 Sep 2023 15:42:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ie0j3RaN92UO+w09K92j1RtEbMUDLqMgFN67qW1lLFbM3lPXmZKwuap5pNnyxJxVbb8RVFYrwbqNJKYxQOfawTn0vgHmYn0Ymq3kx2l7yU+Kfsq12qHuG1az1v2s7ch1RjMT7M3M5d5qJWG1AOjHPL5SkEpZ2MZP6Vrk/EjO0LaGqJezV2eZzfFk06WEHYtPdBKKRia/z4k7S8XDgdsnQlad7nsNAq1oooVPYRFlImXA+wZ8TQzDp4oND0XvciJgOPHhRdCSLS8TVtnrlYrIRKMfP3zMU4T+b7opdMA575HfCUjewLRiLgEI6kdwYlCF0K9idcv3J6/weyC6pC1iCQ== 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=HvaKj6jCDUqPY4p5TSEJOa6+/CN/X84gmnBh324gLsk=; b=mvEhqVceVHWciRIkFQOzCtM39aw0SNE4nzIHwxXG95nt7eer6so8+l4eMxmtjrAI6g32VtYy7lcYzjlP/hNGXAfYSMzf6kD4+wsMiIQpnzueB3dlH+wgPjBIQXZ6zxWFaAtV+JcdOSCN3p2GiQcFEgXpIX7QiE8oeiJlE8+XQLCAMbKgtoA25cKT8/3SPM/A2TwE+2Fo8JOba6xhBxNInjrE6XhqvPk9+CKt30Ok/Ka8xA4BCFSL4HF36Y3Y6GH37MqteFfeFHWp6nYV+QLJw6zqgy0DSk5EK/CFcf3lsi2bWTiWmFGhYw3qrWkzFPFrN+6rn/x6966MkiztbDosVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HvaKj6jCDUqPY4p5TSEJOa6+/CN/X84gmnBh324gLsk=; b=t4YBQnc7ZVpnHRk2utbfpKlNyVmV7AEX9S5tm4A6NCxIJKbkpB0OGhbQHknu5MWfpFbgqZA4eqfpa9WLtI0WUUIseZC/WRBZFBnr+FPlMFg/y24NPXYhORj0+EvypbfI/M5A7NeSdjdLqGb88mJ0cK7nvm+fBPxthauhDD7XIBo= Received: from CY8PR12CA0030.namprd12.prod.outlook.com (2603:10b6:930:49::8) by MW6PR12MB8998.namprd12.prod.outlook.com (2603:10b6:303:249::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 22:42:47 +0000 Received: from CY4PEPF0000E9D3.namprd03.prod.outlook.com (2603:10b6:930:49:cafe::3) by CY8PR12CA0030.outlook.office365.com (2603:10b6:930:49::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:47 +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 CY4PEPF0000E9D3.mail.protection.outlook.com (10.167.241.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:47 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:44 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 07/10] x86/resctrl: Introduce "-o debug" mount option Date: Fri, 15 Sep 2023 17:42:24 -0500 Message-ID: <20230915224227.1336967-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D3:EE_|MW6PR12MB8998:EE_ X-MS-Office365-Filtering-Correlation-Id: 381d759c-3f2e-4a05-d6f4-08dbb63d1563 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f15aanQmQKrphSPGL5T4VQ+5AYG6QgU3zKi/rnNVAmoBA2QIeFM1b3np14J91APk/K2IGUffJInMIYPOjn1sitkWnZMD+qqN1ei2PbP0qmMri5x7EY7ez0lawDuvEw3RsTfqNmkmekSVcWuF1yjyY+Vlc58rYEBTbgvUuTNUBBvWbtNwZ1LXeKeycZ6xY2HFuIQjqMvPZRi5v+2VeM8P4opOMyY2CO/kg5s6AU6Vn8ZGXeDr097ciT6NspIPgo3xwmsbvfJWDVF4u03FeWKov7lYW1HloeHjLsvhHUuLBE8f+HqeKBVNHeegRgNbm4Yh0KImiERSdVD6NcEWqp/rV3R3Uxm0V68I1i3S+1k2L+cgqVrAl2cpn2awRqIYPq8UQC8M2/A1PszJlqZci3giqovc0bSQYIe/U4iZEa2verg8wy5TDsJg+X8reyS/itwSRx8dezKCagSisp7EdpzGPY2F0wYu/AWpA58V0sKZrr8twl33qa63G1t/ctg8jsdN1tEnms9dfeUFqAFIVcUG11bKQiY54Tuz77gm5buQ9H3QcBis7XHSkELIAerhuD2vaZ2TXnRzZbtvKXUTm/Qn1yIt24nLYlo0RFbXCE2yDIznIwJY+XHjfBZzwsGwkgL2k+DOnq8a9Bgf9xZSuG35jUgdXEBuA+9A0iE58CMt5zKtwlglCuPgTkY8jkVE3rO96pnGv8x156T9IqXaGDGwEEpW83xK7ZZGqb+JNEULHdkIbtwbwGWswiXtNz0TRz0OXYQEUPdGZx+XLIznAIMMgA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(376002)(346002)(136003)(82310400011)(451199024)(186009)(1800799009)(40470700004)(46966006)(36840700001)(7696005)(6666004)(478600001)(83380400001)(5660300002)(4326008)(1076003)(26005)(2616005)(336012)(426003)(2906002)(316002)(70586007)(7406005)(70206006)(7416002)(44832011)(16526019)(54906003)(41300700001)(110136005)(8676002)(8936002)(47076005)(40460700003)(356005)(82740400003)(36860700001)(36756003)(40480700001)(86362001)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:47.0088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 381d759c-3f2e-4a05-d6f4-08dbb63d1563 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: CY4PEPF0000E9D3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8998 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:46:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777155893180472589 X-GMAIL-MSGID: 1777155893180472589 Add "-o debug" option to mount resctrl filesystem in debug mode. When in debug mode resctrl displays files that have the new RFTYPE_DEBUG flag to help resctrl debugging. Reviewed-by: Reinette Chatre Reviewed-by: Fenghua Yu Signed-off-by: Babu Moger Reviewed-by: Ilpo Järvinen --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 8154e9975d1e..28d35aaa74b4 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -35,7 +35,7 @@ about the feature from resctrl's info directory. To use the feature mount the file system:: - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl mount options are: @@ -46,6 +46,9 @@ mount options are: "mba_MBps": Enable the MBA Software Controller(mba_sc) to specify MBA bandwidth in MBps +"debug": + Make debug files accessible. Available debug files are annotated with + "Available only with debug option". L2 and L3 CDP are controlled separately. diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 14988c9f402c..68d1b7147291 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) @@ -306,6 +307,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index a34657f0bd0c..150105c21fee 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -59,6 +59,8 @@ static void rdtgroup_destroy_root(void); struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -1874,6 +1876,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) lockdep_assert_held(&rdtgroup_mutex); + if (resctrl_debug) + fflags |= RFTYPE_DEBUG; + for (rft = rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) == rft->fflags)) { ret = rdtgroup_add_file(kn, rft); @@ -2377,6 +2382,8 @@ static void rdt_disable_ctx(void) resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); set_mba_sc(false); + + resctrl_debug = false; } static int rdt_enable_ctx(struct rdt_fs_context *ctx) @@ -2401,6 +2408,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_cdpl3; } + if (ctx->enable_debug) + resctrl_debug = true; + return 0; out_cdpl3: @@ -2605,6 +2615,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2612,6 +2623,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), {} }; @@ -2637,6 +2649,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; @@ -3705,6 +3720,9 @@ static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl)) seq_puts(seq, ",mba_MBps"); + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; } From patchwork Fri Sep 15 22:42:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1426969vqi; Fri, 15 Sep 2023 18:47:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzuMEDxG8a9HG0KesK8hGWPycMKX8gKwSsHSzGS6CDz2r+wTOHqPxjQWrbeJrTXn1p6Rq+ X-Received: by 2002:a17:902:d486:b0:1c3:e130:18f1 with SMTP id c6-20020a170902d48600b001c3e13018f1mr3547694plg.20.1694828862268; Fri, 15 Sep 2023 18:47:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694828862; cv=pass; d=google.com; s=arc-20160816; b=eDCm3iOADXatvUYNBzA/LUUgrDZHaqk7RHLUXlZW7l5vIx7fgKB4L+lL1BNzcQ8T3G MFMiV4cqxx+kNDg5D6FwvaY5zrkOR2iylUOYCccZ662qcsgy5QL5F90fRguCbNrgyJba M5P/xDAK5PUcqm1hJrlHMbbiwCy16TBlK2UXuOeQS2QsvvxtnTs7ad//j3G0fgKQipKv pENGuxzUuBFKw0U4IzU1HIqZvZfPp/LVWlYC3br+bX3qBa9Pjzfu+hVkKyOW+x9KAMzh fWSzwf/iws5KEn8bfBuS5Zc0Ga74n6Xw/fOODWOqQmLV8DbHvtAI3LI2qetwoZMsPPyT Q5tQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1hW1sH+uy2BK99NH17UbT1ILqKzFbGOj2VAhNTqgB5I=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=bosqgi2O74ftExXhaJSF1uED5e1NtmOkXkqnpmnX7B3YvbhVRKmyUe4veNOh99zrvp REYtruq1aX8p0b4WtTJPsZbEUxpeO1ALeiI5jUIIJrbJ5UEz55X+ep1zC8bj05A0dMJD RFtSbOITeQyiixdW5ljUehQjdSVpHO9ztlP2dgJH8j8NXdN6wxgvnnVKOXV9d/4iAFOy FyTgekTmVROmVM0orfDE7Fj463F3PA12aJbxStdwPfv1VTR1wIOyBwAwFgUPdYvdOH3Y WGPeUdtJqVLfXtmZDIpfSlEyoIasvHYVaJYuFVrWP0xRB7R0VZz2LAaU9V2sunIEo4kO HT/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xVGlb9Gg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id j7-20020a170903024700b001bb86cdf12bsi4348574plh.147.2023.09.15.18.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:47:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xVGlb9Gg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3A543803560E; Fri, 15 Sep 2023 15:47:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238043AbjIOWnW (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237974AbjIOWnA (ORCPT ); Fri, 15 Sep 2023 18:43:00 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0629F268A; Fri, 15 Sep 2023 15:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HbXS3iqFWuPMBlB7Q0++4zWi5fkHa9f+Jl2bwUdOzSUU6HP5HK5ekzhbmHWsqaZxTjxtLy+WVXIwjqhZFiVNttRqc7Ylcam+v21Bjup/I1DrA0xJd0hnDT8YtLFN5trBJgUxtkjYvBEoQA4GCSLFf2nTOEFdYQqUkPGVZ6KLPybr4TMeg5VZMmqxeLqcZSc7Iu4IOeJbKXuPC9F1UxOhqsfXKiodliZCAQw86zOjuHVU8fFnL9WV9ujfhqSgzW+P580UUCByGeAv2Z3bF3ABRYjSWctYFdypwJMALamHd14EtGgqaqpppdttoRiT5kIwjfuLt9E24J7FFls1MpzVLA== 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=1hW1sH+uy2BK99NH17UbT1ILqKzFbGOj2VAhNTqgB5I=; b=JOy+Ek7uNxFV92ryRt1BiPb+yFdccYcNpDtGhYFL4G9E2ngUwRCyJGsTWxkkWT85Wd4xpHzEKUwVFsO1ZtXK0Cq6h3iOCwTGf9ywIe/1qa0v9+AMJD65CC2BPh/8btVPSgqySDcS2eazQER9Y+Woz9RBTTurud6vTxb9WN+PKQzQ3glw9d4Q5DRRc66BWP+Pn93lP4/fGmWe6XRGsJG4vIGDc2bsLssnNyBucBmULhzjE5+bXfVsp0aNGDMeFUc5nfhpFTm0gqC4g0kBfT0P+o/IgY1XU7G++CveP99F0zzsUD8PKRHwsWMj5Yx6KcF0mUOxFB/yWzQGRYjrYYun8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1hW1sH+uy2BK99NH17UbT1ILqKzFbGOj2VAhNTqgB5I=; b=xVGlb9GgCzZC9tFWyCtre/AvygzRPtW6z+esUWC/Ch2D0GVTv2fqowVPUhLI9X4/QdyvwNyC2jDeikm0kHT26mvhH00twz04bBgRt8emsADZ4EVan6SgaA8n19KFNk/Kc7GpCC4JJrJiax8WkHb+KdqmtI0MRGfWOYWOE9GnfJo= Received: from CY5PR22CA0097.namprd22.prod.outlook.com (2603:10b6:930:65::22) by PH0PR12MB7813.namprd12.prod.outlook.com (2603:10b6:510:286::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19; Fri, 15 Sep 2023 22:42:49 +0000 Received: from CY4PEPF0000E9D1.namprd03.prod.outlook.com (2603:10b6:930:65:cafe::77) by CY5PR22CA0097.outlook.office365.com (2603:10b6:930:65::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:48 +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 CY4PEPF0000E9D1.mail.protection.outlook.com (10.167.241.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:48 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:46 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 08/10] x86/resctrl: Display CLOSID for resource group Date: Fri, 15 Sep 2023 17:42:25 -0500 Message-ID: <20230915224227.1336967-9-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D1:EE_|PH0PR12MB7813:EE_ X-MS-Office365-Filtering-Correlation-Id: 31367151-4061-43b0-8f72-08dbb63d1653 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SWL1pRb1dpImBO/0YWeXXA+kkjJM6FJdo18QTmG5DMPPbv45ft7KIk36tgicdEqSY0TXhuLP6cdvg6kjaasqDL5ZaJMc/cwNMixE5mu/zHelWoE3IjjtObak6SpD7IZgRK0Ma/oLhCgLn/A44idtMR9qfVvUYTzQ+JULhhSzloLyQTmgOcwY42V6KVldrg38O86DoG9Pufkt5E6WHuUZayryC5++svez52dpb2wDswZKZseeQ3avCtPnKraxbmbYJSXW6jlKwJVjXF93EV9+gld7iFwZouWn+X3H3WSIrnCe3jLC65YTPvjyLpvxQOABT5eVJ8PrysL1qS00UjRz4y600YLDKQcVwLDgj7hD9NI54KOhaiUiugnYaSFinCcW5MXgIPEHoTtLmZRAK69NiApjnPHxr0wvSK94XJvFFcWDv3uv3OR0+PIqSEb9u10sARP3zRWABk4WU1X6HYG//JMyjkRJrRT54/6sU+MkPkP8ZbS6SWQ+KhvH1s9HSXfKPEORf4+pw0uS6CFJlnoOYhfHaxl1lUYsWGSZ553Rrws+rnE87G48NH4aUB5vKYXUsQCZY7J/ojeLC6S9NBu2FA339YMLuAY9na3Hp8qYveRjgJpIxM+ysAd/QCEVLpJYpK265qQLTq7QpBDZcRZD0kh4qXKqeO76hshuLM9Vd/PO8SCDOtpR0NwhIgrTs4+q6DcHwk2IBxhbfM6ilYqRtyi2VjoH+4iAKR73dQxFSaj9rFDo4IwgbIyZElZ7c5NigwXrbsLMM4YVQvOyumzruA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(396003)(346002)(136003)(1800799009)(82310400011)(186009)(451199024)(46966006)(40470700004)(36840700001)(40460700003)(40480700001)(336012)(1076003)(7696005)(70206006)(36860700001)(478600001)(83380400001)(16526019)(110136005)(47076005)(86362001)(356005)(426003)(26005)(81166007)(82740400003)(2906002)(54906003)(70586007)(6666004)(7416002)(5660300002)(36756003)(4326008)(8676002)(316002)(8936002)(44832011)(7406005)(41300700001)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:48.5954 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31367151-4061-43b0-8f72-08dbb63d1653 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: CY4PEPF0000E9D1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7813 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:47:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777156868805768875 X-GMAIL-MSGID: 1777156868805768875 In x86, hardware uses CLOSID to identify a control group. When a user creates a control group this information is not visible to the user. It can help resctrl debugging. Add CLOSID(ctrl_hw_id) to the control groups display in resctrl interface. Users can see this detail when resctrl is mounted with "-o debug" option. Other architectures do not use "CLOSID". Use the names ctrl_hw_id to refer to "CLOSID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 Signed-off-by: Babu Moger Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- Documentation/arch/x86/resctrl.rst | 4 ++++ arch/x86/kernel/cpu/resctrl/internal.h | 3 +++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 28d35aaa74b4..54691c8b832d 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -352,6 +352,10 @@ When control is enabled all CTRL_MON groups will also contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". +"ctrl_hw_id": + Available only with debug option. The identifier used by hardware + for the control group. On x86 this is the CLOSID. + When monitoring is enabled all MON groups will also contain: "mon_data": diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 68d1b7147291..a07fa4329b65 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -299,6 +299,9 @@ struct rdtgroup { * --> RFTYPE_CTRL (Files only for CTRL group) * Files: mode, schemata, size * + * --> RFTYPE_DEBUG (Files to help resctrl debugging) + * File: ctrl_hw_id + * */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 150105c21fee..953b082cec8a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -779,6 +779,22 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_closid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->closid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1863,6 +1879,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_size_show, .fflags = RFTYPE_CTRL_BASE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, }; From patchwork Fri Sep 15 22:42:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 141150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2159157vqi; Sun, 17 Sep 2023 07:30:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxHIkVM2yeX+EgKczb2m/GbRMcwJbYItKpXIjpu64ZTf8GLWPT5uQemtTXOQrNNFhNtcN0 X-Received: by 2002:a17:90a:fb92:b0:26b:66f7:c9be with SMTP id cp18-20020a17090afb9200b0026b66f7c9bemr6218730pjb.10.1694961037846; Sun, 17 Sep 2023 07:30:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694961037; cv=pass; d=google.com; s=arc-20160816; b=EskB1/+zTp/n9L5Bq7rqD3uT4HeHGar/imFXf61EFXD5p55hPLLydA/fU8kinumsLq h66C8dxcj4cTuL9+cAs3VYcitv89mGLhq8mZHIFP3l4LEleKq33llI2EEkZt2TYOXdJn W7phsFljNc+ieoZVWqa95Vkyqe+3ewyk4jFtAzBL0tuZ821+UZP4m7pqLZ4aqFqCY+I+ SQPjgnhu/X1sTvV3D3qGm0LnJr3tNtV1aWr/jDjhK9QrUow+Ghr1Hbl1+b+YEWOXMAzg JVx4Ss2AmccznGALcIviL7j40YCSMXjyv+nrb/n+4wPAqLS367dM1J/+rvieDliU5jBw JqmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hoFHthP8jJEaLGBvg2GU+s6+SJMGwMzDX40DDYN1UUM=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=G9g2UVdwJgkkOJjYLgN4pX+JHvqsJKdZ7JPiunBMpw5Ri9IhJoyJ/s7TT1CKiFXa73 gbWGNb60jl5cToq5roExIc9FVtXoXLcZK71geD+PGYAa8t62gXU9vDB5LdWqAqYoyycE s4z3kn7ciYwuWUXiJkZi7RipzMWPrSvYFImYs0HBmmxS2DmzeWUNrocKJCteAJCFY/Bh OXQ8UjXH7ntHhILanz5rD5D8Eae21KI/zfjk9z7ThkvpYEvMFIjkc1KWRjWlKTtryCQd siJhfLxNkolyBbv5WcYQZ4wM1JFgqkFBUaF1VQtfIBoudTGuR2Hr3fopP+YvhzQ58Hh3 sulQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=p+4ALhY8; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id u9-20020a17090adb4900b00273fa934cc1si6152954pjx.167.2023.09.17.07.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 07:30:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=p+4ALhY8; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A134782372F3; Fri, 15 Sep 2023 15:46:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238032AbjIOWnU (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237971AbjIOWm6 (ORCPT ); Fri, 15 Sep 2023 18:42:58 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2071.outbound.protection.outlook.com [40.107.212.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FAD72701; Fri, 15 Sep 2023 15:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XBsfVad4M8iY9bNIsC3ubNwiFd5tqV9Y0xkt+8ZPnAghJEvRYjbW0NPFhE56s9ucDmBdpc3h3aXm0kJWYlC5ZU5Ql0P9fqd8WTI0jkwzdnG5Dv/LZvli2TWMELCsiI/2KP+GeRgEduBePRjpiKtu00/JOhOa54peDV96oq4H6M2Z81ZIKlPidoSRcd6bMm7cjgiDK0k3pJ0W0nrNVLfYc5ukwlqDqUX/6iHb8Bown/ZDq/OWpDof8J4ztohSMme6xbytFhhAXdUQZ79X3i6KnSAF7394E+pcTc7caYDr4ZAjFoMcAmCb1Qy1ibGN/UYY50vsar5z0ujU2MWevkUR8g== 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=hoFHthP8jJEaLGBvg2GU+s6+SJMGwMzDX40DDYN1UUM=; b=n/m9zWbRS4mzhJ0Lh6kfzRa8LsfLAGEXHxYhI72yp1lQNYDdITS536ZiHy1NT3TWc7hv+ld9CW6gdvFvNSVOdUJPf5XpUvtSOpjz4ToP8mgpT0aoost7owXgIkAViWGJvnMmvkOXR2o2PR7PUTj2j9oyNn6YNqjwdx+aQ4xp8sCVufxpmo5ocUJvhl/F2AYwUbej6Y2RFSPMahUDKTIefdUUIkGwSRU9rNg0rsogdb69pWxWvGKiucSnMmnzeXDYk18im/70TQFvID7N+CMqwR2HWQ2L/CT1F50UaGM5u59Ntt7w42XLW6cl0GOg0JfPBMtDPnGNVFp4dJ4D9wJ1lA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hoFHthP8jJEaLGBvg2GU+s6+SJMGwMzDX40DDYN1UUM=; b=p+4ALhY8EiJWL1GdX1B14fAWakvKxbocOU5kQvsVHv0b+HQgGmqtnlc6EzFXIZx5u0GQrTWT3frv8rTakIKltMkmWR/aV8iXn7UvBm6PTCHsrmpv1V5owx+CG24AvGxnZnBWllOcKEing26XUQLja7ERsdkdWlDYzeUoSYP+2ys= Received: from CYXPR03CA0053.namprd03.prod.outlook.com (2603:10b6:930:d1::21) by PH7PR12MB5617.namprd12.prod.outlook.com (2603:10b6:510:133::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.36; Fri, 15 Sep 2023 22:42:50 +0000 Received: from CY4PEPF0000E9CF.namprd03.prod.outlook.com (2603:10b6:930:d1:cafe::35) by CYXPR03CA0053.outlook.office365.com (2603:10b6:930:d1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9CF.mail.protection.outlook.com (10.167.241.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:50 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:48 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 09/10] x86/resctrl: Add support for the files for MON groups only Date: Fri, 15 Sep 2023 17:42:26 -0500 Message-ID: <20230915224227.1336967-10-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CF:EE_|PH7PR12MB5617:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c676ae5-18bd-4606-50b5-08dbb63d174b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PmsOQvDuX2y1HMNX80kZUQ1fw/TP7wgPQxPhW+vcpCzRpT4hFOfdVLtK0wLgQPVHVRQ6GiR79pVZzOI8Uvpcxb/pevpOBdOO/AFCC2W0MD9y8Or2lVNLXnP3xP4ycrYyaEQxpLRrjFb7AGPDMNXeewS2ehQ9prRdxJeFY0r2XpCQGOeTuSbWL38t/8YC/V2ed4hTy66dTwXfhcTtxpgSFYncLqmRzFQLgGu8d/cYdQf/He8039LhXC1OFIyvmFDoEWMFLcFoduc4UABlOI+xU2DtKuqj18sGdFLmlwPm+olQpuuH6rxWq2IdIv3jl3SP+Rz9PzObC6teVuseAKDLNpyZuOLNLQJM/G593MzesLJ7ANeCGH3oviUBhpT0Pr2yX7saOmDIoEH2qyiu0k1SQ5pEcFDG46IFyv3MAZ8YdEjkXwSIJjXcZQ4X4gZ5AKbobzJWzl2rXjxoZc3xiORGMCsoH/MtEl8RL7YKs6azdjSHXlDvUwcoGFzkpYC+zxp6BX4UY8f9vA2iPRbde3FVYdBp6hklnmuGjaU3MJD7OP3EGIS+ZxQiBCgJtG5qo/0d5v9FNWt4l5igiyAKPghCg1ujUlMIqGkTwSgnWpWhZ+ui3yD6L7U71xyU9b7BLy+PCPGvWVPdCOynqLZz7C37Z/U5QvdPbnbQArcMn9qM7Obel2lblfanvA+q7qJ35bcT876QCUYdbdN+cIKf4TeCVqaNX+Yk6nh5E6QHEY524aIKzoy5Ju6MLQVXtKZSK168Nb08IU5fTq5C1Aix4wLkuA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199024)(82310400011)(186009)(1800799009)(46966006)(40470700004)(36840700001)(81166007)(36756003)(86362001)(6666004)(54906003)(70206006)(40480700001)(110136005)(5660300002)(8936002)(44832011)(316002)(426003)(41300700001)(7696005)(70586007)(26005)(1076003)(8676002)(4326008)(336012)(83380400001)(2616005)(47076005)(82740400003)(356005)(16526019)(7406005)(478600001)(40460700003)(7416002)(36860700001)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:50.2035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c676ae5-18bd-4606-50b5-08dbb63d174b 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: CY4PEPF0000E9CF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5617 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:46:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777295465543963099 X-GMAIL-MSGID: 1777295465543963099 There are 3 types resctrl root files. 1. RFTYPE_BASE : Files common for both MON and CTRL groups 2. RFTYPE_BASE | RFTYPE_CTRL : Files only for CTRL groups 3. RFTYPE_BASE | RFTYPE_MON : Files only for MON groups Files only for the MON groups are not supported now. Add the support to create these files. Signed-off-by: Babu Moger Reviewed-by: Fenghua Yu Reviewed-by: Ilpo Järvinen --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 953b082cec8a..55d1b90f460e 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2533,6 +2533,7 @@ static void schemata_list_destroy(void) static int rdt_get_tree(struct fs_context *fc) { struct rdt_fs_context *ctx = rdt_fc2context(fc); + unsigned long flags = RFTYPE_CTRL_BASE; struct rdt_domain *dom; struct rdt_resource *r; int ret; @@ -2563,7 +2564,10 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); - ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (rdt_mon_capable) + flags |= RFTYPE_MON; + + ret = rdtgroup_add_files(rdtgroup_default.kn, flags); if (ret) goto out_schemata_free; @@ -3253,8 +3257,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, enum rdt_group_type rtype, struct rdtgroup **r) { struct rdtgroup *prdtgrp, *rdtgrp; + unsigned long files = 0; struct kernfs_node *kn; - uint files = 0; int ret; prdtgrp = rdtgroup_kn_lock_live(parent_kn); @@ -3306,10 +3310,13 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - if (rtype == RDTCTRL_GROUP) + if (rtype == RDTCTRL_GROUP) { files = RFTYPE_BASE | RFTYPE_CTRL; - else + if (rdt_mon_capable) + files |= RFTYPE_MON; + } else { files = RFTYPE_BASE | RFTYPE_MON; + } ret = rdtgroup_add_files(kn, files); if (ret) { From patchwork Fri Sep 15 22:42:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1462373vqi; Fri, 15 Sep 2023 20:53:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkpkTXCsL/ZnqU3LP+7F5Q/kVwl0bIMsa3CErYwJS5bH3K+b9OWG/MhB2t5CIYcReUrLqD X-Received: by 2002:a05:6870:80cf:b0:1d5:e15c:5dba with SMTP id r15-20020a05687080cf00b001d5e15c5dbamr4479086oab.45.1694836392348; Fri, 15 Sep 2023 20:53:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694836392; cv=pass; d=google.com; s=arc-20160816; b=odX9jwKZU4xSVl/fwGALlU4WzdZpjlnUfiGafOlSbApwxKTVLBbiHkbRP69PKPUwcH byvh7KDxkSUJqp0ZoO9ixXqjWUnUOY69VoO17tTNt8Y9UPPSa6j+2o1lblGFmxog4pj6 IzsDeQMeOHijY9hhgZqmdOLFfE/V/wGpEjOeIlLRdsqICxSBCiZmX1j/ofGRn5u9NlEa UJ7mgBa57MxC69Uccg9p0IbabQzNP7iIdeeJviKFo7NvIKsGkRlhLW2JtDuCMJSwM3lq yWA8mWCNL0U/vT0x24YNyaGJcxQ8U+AtAcmPK6SL/TTaXf7XN0JeUxxS1TMhBKSlZlLO 5E9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I/p/sKy9VU5qZCE4fZmT/UyLRX35DEIdmsn4W41jxy0=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=Fp78lGATgV/0dj648+swuZDs88CGpBOokFns4LE/fC2Vpw0cP7TjAPJeYqCuQuorMf CE/LUWzSOe8J91Qz14LeaCtty4FHrFxaUBWHBQy1MzCRJsxmEeM91C0gIm9Q326+70GO 7/MbRMNp9ikSLhE5tPrA8Mae6RcicxhxADlQdqXSgXIFWXy89STc+2yNVhO4aSWHZzMh n2xcUGbjR83fA3qdcyM2O8laZr4VoaXCnkBDaY2t3niMYBuhidiWkZqUzD2/Pak2P0mF I0hveDBesjUFLczQColBR4q45NmtbUcDqxTDodXdXnqN1VJsAnzhSjFkjxKPqnmJoZhT KdCA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HAJ5308u; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id z11-20020a65610b000000b0054ff717395dsi4157296pgu.691.2023.09.15.20.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 20:53:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HAJ5308u; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E1973836D262; Fri, 15 Sep 2023 15:47:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238055AbjIOWnX (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237975AbjIOWnA (ORCPT ); Fri, 15 Sep 2023 18:43:00 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2087.outbound.protection.outlook.com [40.107.93.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5945A269D; Fri, 15 Sep 2023 15:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Coum9UpOAVkEgHjAoo4L9FvimIldMWNubG08+/Th18ifzg42vSt/rxgCRgFQK9RaSDa+9cSRLh1OV8/LuRekfRWTx3wME0/4Ehr7eLrgiH4CTT8/S7uZBdpTbIjj+3wWYQddm03Um1JbF4YCRwKGSfyOZZ1B+jZdNcP34jsLIUduzVaYOu6zJd3RIWRk3EgIU2KKOrP0YH6HLRxXafZmLm0mpDQqfcORKr5PciMqDQ4OPI8iffliO8CAoN6R56zxBkAAvfnjtcgr+li8i9mAZwdieI9SClEsyZRdvPHrv2HDZgWbMgfi1ct90eLtDgdI5m0Znx6OdnBM6B/BNK9DbQ== 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=I/p/sKy9VU5qZCE4fZmT/UyLRX35DEIdmsn4W41jxy0=; b=P5SfQJMueaTh/It3HqkC/Yl3ZpNWJZxwK8XdZw6KxWAZ4RjuTyHdMHMHl9su9B05pGVi28B/ThdKBabkN37AwcThrZ2gz/6CcKvIU40H0Hwj2vXxV0lUOsCul3hVlsX7icA3T0b2dUbl+iDduBWojHMF6c7fx5RMaBO9znQ/wqgXDpmpLG8SWmnlR38YO6DbiQJC/u3ubDyBT9r5m/QTS8HLMaEyggOuiVQUZqXdIBe034mKk6LdvbEUnxshUjL1ZlqbWEQzRc/azmXMxY6v9YeT32pTpZqphar/ANAVWBCnVdM8unTFUqVfO8ZNkYyYYZd1mXobd7pao8YnPqqslg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I/p/sKy9VU5qZCE4fZmT/UyLRX35DEIdmsn4W41jxy0=; b=HAJ5308uyc+3hSx7MSmwvf4vPE5vWB0emKPLBb6+mdK2B0V0E69VUVY06PGeQeNoVZugUEOl//rWEafC4Tjls4B50LB8cxtYt2rywX/+nzpxpC/xHrLBrYIcDYSeVgx+E53vYh8/ZqmeJmMKXq3Y8CpbZuN/LhYBOW1Og+9HbB0= Received: from CYXPR02CA0038.namprd02.prod.outlook.com (2603:10b6:930:cc::11) by MN2PR12MB4158.namprd12.prod.outlook.com (2603:10b6:208:15f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 22:42:52 +0000 Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:930:cc:cafe::38) by CYXPR02CA0038.outlook.office365.com (2603:10b6:930:cc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42: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 CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.19 via Frontend Transport; Fri, 15 Sep 2023 22:42:51 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Sep 2023 17:42:49 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group Date: Fri, 15 Sep 2023 17:42:27 -0500 Message-ID: <20230915224227.1336967-11-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|MN2PR12MB4158:EE_ X-MS-Office365-Filtering-Correlation-Id: 642c61b9-e66d-44e6-ce44-08dbb63d1834 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p29ulDix2ut3MqbKemMjmntNx0teSWUcymMG1A46ZVsOE8EIB2RVT4K1FMSHjleo1KaD/6Jd6ifU4gSqSJ18jxm3+bvvxWRlAUeTFpc6RUOSw9sowsyQCnCRDzwuCPd1AzAaACcYXPXifVoiSvg5F9Fw0Tj8zze0nvgf7JwoW8aHDg2GzZ81UOKW60yGxpxCrZI7PyBl/kBr5TaRMCP0UTeB118Le66GaMXi9AdrAOuZJ4rvjx/D2eYHNPq/wj6MjP5TprThrYq0he8+txEC9JVk/2s/BUkEigrZyB3Y6X/B5u1w9t0gJorU/wy9h1DYufkklkMNVNUa+J/ouoCKJaML3MzdBDr1uxFKzu3Emz9t1bcgbbGmOATz2fVBL7/5vLQQ/gZnpWJEvo5j5HHif4/bLGTjpvVVcn7SXFC/OkJ1oAcJwqG3aGYUct2D6rSvnCzr2XDZpUdgtTeUH8qInWPeWpO8u32011Td5bVzUePMBHgEMjtHGNTiZgKoLh9Ri3vYqjQTh0hryr2On33ryU0xQlKBYNZVt1iCRnsupWkEasJ/tM2cTW+2/myqDodlJkZ8w7tPptAoPymYPrnHdDtsGCzq3MTc/+uWyITvSqiuaqskGiGuI7zcjmD/R6hgWkdCKCvw3ij8CEWDZ49c5USkFckyw8dL4X87cZ6suT7CytP6s005/ELJBqGwbH4zl7iDK+FvWUkz8lELCxtwxlyMrebFl3T7l3DDJ8wS4Ipnd8/vYKYWssc9K2v2KFAstspOCgmXU7s1aaYJw0AHww== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(376002)(39860400002)(136003)(346002)(1800799009)(82310400011)(451199024)(186009)(46966006)(40470700004)(36840700001)(6666004)(7696005)(478600001)(5660300002)(26005)(16526019)(426003)(2906002)(336012)(110136005)(316002)(70586007)(7406005)(44832011)(70206006)(54906003)(41300700001)(4326008)(40460700003)(8676002)(47076005)(7416002)(8936002)(86362001)(40480700001)(36860700001)(1076003)(2616005)(36756003)(82740400003)(356005)(81166007)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:51.7337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 642c61b9-e66d-44e6-ce44-08dbb63d1834 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: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4158 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:47:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777164764717904920 X-GMAIL-MSGID: 1777164764717904920 In x86, hardware uses RMID to identify a monitoring group. When a user creates a monitor group these details are not visible. These details can help resctrl debugging. Add RMID(mon_hw_id) to the monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Other architectures do not use "RMID". Use the name mon_hw_id to refer to "RMID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger Tested-By: Peter Newman Reviewed-By: Peter Newman Tested-by: Peter Newman Reviewed-by: Peter Newman Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- Documentation/arch/x86/resctrl.rst | 4 ++++ arch/x86/kernel/cpu/resctrl/internal.h | 5 +++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 54691c8b832d..98b0eb509ed4 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -369,6 +369,10 @@ When monitoring is enabled all MON groups will also contain: the sum for all tasks in the CTRL_MON group and all tasks in MON groups. Please see example section for more details on usage. +"mon_hw_id": + Available only with debug option. The identifier used by hardware + for the monitor group. On x86 this is the RMID. + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index a07fa4329b65..b4910892b0a6 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -296,6 +296,11 @@ struct rdtgroup { * --> RFTYPE_BASE (Files common for both MON and CTRL groups) * Files: cpus, cpus_list, tasks * + * --> RFTYPE_MON (Files only for MON group) + * + * --> RFTYPE_DEBUG (Files to help resctrl debugging) + * File: mon_hw_id + * * --> RFTYPE_CTRL (Files only for CTRL group) * Files: mode, schemata, size * diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 55d1b90f460e..ef4b18091e5d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1856,6 +1872,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "mon_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + .fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG, + }, { .name = "schemata", .mode = 0644,