From patchwork Tue Oct 10 23:33: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: 151042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp199971vqb; Tue, 10 Oct 2023 16:34:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHC6tJpci3aWZlBrBlG2WpGjbdsF/0j9j1we8qFIsfOCMFnlqBEQMKkTLBo9UA9ZA6SFpp+ X-Received: by 2002:a05:6358:c10a:b0:14a:cca4:55d7 with SMTP id fh10-20020a056358c10a00b0014acca455d7mr16012380rwb.3.1696980842916; Tue, 10 Oct 2023 16:34:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980842; cv=pass; d=google.com; s=arc-20160816; b=B3VIGEiIgNJUoRlJUDSyVvfF9sE0V0ocXxwdR7vd3xGDZgf6sOzv8/f1S4ZhS7yiSI t5rOoGTSR66e9dAO3pofCVwdRRcALnvel5WHk72Uf3XwUi/zbLrGZU+sC5JmG0BujnTJ 6i/DZPIT/6bP1oaP4jGP8a0LhXGO/AxKMg9mmRtR8Kms6YtH66slnNEuctgRyT6PwnV9 9za/GMsV58rUX29P13EYo8GAoBJumArDL6ulo8iz+z73AgsUr9Y0OWT9tz9S7Dt3Oz6d e3Q2hSI/aIy4y61+G9qXRmBEmDFZLi5lmvHp4j26TzhWITObAzycnDb3dNpKJ1vV2T5w gQbw== 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=IgNwhczAPO//dMRRHaucn0zT8vO7DFd9uRDVyZw4oNg=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=C91Yw/iGITBlZI3Crp+wHRJDF3GcileldIGL0jM1Yb9qUOCI7jEML8gPmc20ecS638 DTBnetYbbzc+Rl+Kus1C/uxeWOUta7Ejn0WDJRfnQOb7pPEn6fbXYE714qO++CbpEtxB /27wSChiIFfS5uLmI52hXfdPeFiQg9su/4a8Nztu0Bb0TeePPgvxtwIw9FVpP/+TlbJH aRdXusbEatvay933pgEqXpfT0DGxp0a+egIVP2Lpq4fv76Wl60NavDJHAhKYV9XIpqZi 5XYgKEVSRyx5glDeImQlNh4D6EVnDmHIn1H+MHHXZ4YZ9MrJcOjdLF+VeD6ck4jtSCvh gjog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="lxXl/nzr"; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id md5-20020a17090b23c500b0027752ac4aefsi9736190pjb.24.2023.10.10.16.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="lxXl/nzr"; 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.37 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 snail.vger.email (Postfix) with ESMTP id A170480E7110; Tue, 10 Oct 2023 16:34:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344152AbjJJXd5 (ORCPT + 19 others); Tue, 10 Oct 2023 19:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjJJXdv (ORCPT ); Tue, 10 Oct 2023 19:33:51 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2670A93; Tue, 10 Oct 2023 16:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VsQU5f7LPyTZh/3R9O72z+RJpta1rFvuX9os+BNmDDvamAjLGryAiGfJuM2j5rR3ifnDmu1SBQkGPVWsjvFwX5auFXjrzT5LcsSD3S2TBvJwf3wEtJxoyeBAU9rWgymFtcVj9hWeUaTeZjJvfvjVdlMiLnQiAVl5qF2VP45fLDVwDtdbjL6bvAMNkGCf05N7rM8fm/1xnihGBzZbQUOGkZU2eIO5t/ZuRR467JtSrMmV8aFVVmdAOsyH5Pb/TreKyACX0SnTfSSeI+vR256MJJlp0yi2onDj2EAnqrWVicPftRzXGtaBiG/piLoF9Xtf57cvDfsXUGgOMoEXAy5VLw== 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=IgNwhczAPO//dMRRHaucn0zT8vO7DFd9uRDVyZw4oNg=; b=czpIiiW+tPglH1FSw/r+QMLmcQoaCIAbFHsKMe8B3xmdNlUTEWbaFpZ8Qq8RF2xMOy6spfTYtkUc/M28OiDLZf4G0dhTBsQALbRUl6fiXfChCW9LYrJ/rJkCYOXOfIP6zcZ5Qnn0GgAosR2Q8pgwfeKAnQh9Z2zjU9L9rF3tU05kgyDe6aiPVzUTs9z39+4RI3AhINLnfrk8Hw//cJtHSF/uT9ge8BOELXyATQTnasfLmLW0L3rhApLntP7D0qH2at6hPCttSPgCZJHxMoI2oWsPJDPuw6Hjb0YNy2BpZ9guh+u63pn37f629EJrfbx8nm8KD5dGaOOH7TDtkd+1QQ== 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=IgNwhczAPO//dMRRHaucn0zT8vO7DFd9uRDVyZw4oNg=; b=lxXl/nzrAM4BwdKaVnUq1P79+mheca4s0tjcdU/VJ/zew4Nt1vbONXv53L2unyCGbsYRxl6W4nMVLh1dNMsYBaSQYgMKv0jnyAgskXU41kt69Ztb8rAOFkSE+aovWrRZDMPUUysI8IS1cmVcIXy6Bn6kL5k3zthosxU2LEMQU7Q= Received: from MN2PR17CA0017.namprd17.prod.outlook.com (2603:10b6:208:15e::30) by CH3PR12MB8260.namprd12.prod.outlook.com (2603:10b6:610:12a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 23:33:45 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:15e:cafe::c1) by MN2PR17CA0017.outlook.office365.com (2603:10b6:208:15e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Tue, 10 Oct 2023 23:33: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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33: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; Tue, 10 Oct 2023 18:33:43 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 01/10] x86/resctrl: Add multiple tasks to the resctrl group at once Date: Tue, 10 Oct 2023 18:33:26 -0500 Message-ID: <20231010233335.998475-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB4D:EE_|CH3PR12MB8260:EE_ X-MS-Office365-Filtering-Correlation-Id: 6dd48623-20e4-47fe-b8ab-08dbc9e95878 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WT2gFKiry4P7NHmA+hEFmcNotb2NpGULyDA2Uq8bn6oiLacDcvVhI1vcxiaJkmZExrqOO7n+/oYxXfXaRhCltH6gsAnvOJ/R9RY6K+jKkwkPj3e1jkjG9W2WQNQhJgdEPWlK3kyn9zEjaz/IqSr/fICpRZ8Q/3/xwUnHFxp5qWaqZhYqRoR3Qp6tT/hmcoD/Avl8/heLAwt1tsP76Jcb2HdyoK8zY/Rj30HcLpO/j7ZNx0gQ4fsAhVjkVmMYzOvgbDkI5CPSRC2HAn8PAOt01zKoDhKwb5kTH3K7HXCi2gQjiQH7SPNRoZ3iRaJNQ8BAP5OO5fpTQx9f8bX53LwQvIZBAfXD3Tmy35hcUIPsQ+vyncdBwGqtvtlD1rnbx6MjCIg+SVlViJyipOzmsIyaiJgYKObF5uTcN+Hv9GRa5Yz/4+I3iKbLy1jICMG69gXP6aGCn/zMjnsc7CRM6LqWuRt2CNEvF4Qlti7wwh2WOPDAMk9uFEDlzrqAGTB9hIg1LGNdq7antbJEH1SZ531CUov+OGEYCGP+uLLzBNSPrahU72sPVBpPtcbNkj70CejqRY0vyPHUCCrt3PtCuxb/Ar7PTcqtVD9HXv2kX5RRQBVJIreiDRxsSBkpLCZ62HvZxeg1RCuKkC1Wud3o9j7JxJ6n/pgq9/1DlEj2bYzuVPiNan5yONOr4acwUqIQrmnjLw2rb2Stlfmxo42kufFik/JkJ0oKs9SRzWF1gu553MIYT137lyydFJjJA8HN0WR+l4ujxCZ1en7y60Venm8VjA== 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)(39860400002)(376002)(346002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(82310400011)(36840700001)(46966006)(40470700004)(36756003)(86362001)(66899024)(40480700001)(478600001)(7416002)(1076003)(70586007)(54906003)(44832011)(7696005)(2906002)(2616005)(70206006)(110136005)(7406005)(5660300002)(41300700001)(316002)(6666004)(336012)(66574015)(426003)(47076005)(26005)(16526019)(36860700001)(4326008)(82740400003)(83380400001)(8676002)(40460700003)(8936002)(81166007)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:45.1301 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6dd48623-20e4-47fe-b8ab-08dbc9e95878 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8260 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413384098507189 X-GMAIL-MSGID: 1779413384098507189 The resctrl task assignment for monitor or control group needs to be done one at a time. For example: $mount -t resctrl resctrl /sys/fs/resctrl/ $mkdir /sys/fs/resctrl/ctrl_grp1 $echo 123 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 456 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 789 > /sys/fs/resctrl/ctrl_grp1/tasks This is not user-friendly when dealing with hundreds of tasks. Support multiple task assignment in one command with tasks ids separated by commas. For example: $echo 123,456,789 > /sys/fs/resctrl/ctrl_grp1/tasks Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: No changes --- Documentation/arch/x86/resctrl.rst | 9 ++++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 25 ++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 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 Tue Oct 10 23:33: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: 151044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200043vqb; Tue, 10 Oct 2023 16:34:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOz9FwJAgLzoYHbDvGzHBQTa2dhtLpNxHjHo6mSiJ/M7v66ohqZlI9CDUKtsgp+qEOO05l X-Received: by 2002:a05:6a20:3d85:b0:163:f945:42c4 with SMTP id s5-20020a056a203d8500b00163f94542c4mr23077843pzi.1.1696980851915; Tue, 10 Oct 2023 16:34:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980851; cv=pass; d=google.com; s=arc-20160816; b=N2y+Qz8TYkz62dxukoj6iXsuxN4EnjN61cKeqnWLyHu1uUVLlCZg4hp02niTSQ88gW Xz9Lm+UnK6IT9FZKfOxpZPt2zG0eJ49ZRxuXYOQs2aa2d9NQiNSor3W2WLiwhMJwPKgt c7qcHB3n8NDuETVBb5vN8d/uqGBloYFixC5c+1XEtsmT/aX0AOyM4T3QOPQUjdPe63zu OGGfDf1aS+nxhU+oVGvoa1eBkExKqtkVsZ4R3WzbfiMHIzXXCa+Aj6g/tsq3z5J1fWUy /xk/WluwATZJCmP3/h7l6Dw5eoaOgPATJJyO97+c+1DkvtQYsCUqX9cOQcZaivbutFkH on7w== 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=T3lo19Z3taUJl5Gy59RynpNh18VIJAYAW9337PE04pQ=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=B2aV6aR7RHEYOzpUGrMztnHVYJ/zgKGaWh2Q76Q2NXfpJ36s4X/FWbfU5ps1qXk7OQ LFw6/eVtyOTpZTCx0tKAFjcYG0lJW76PKKaHysXxfR624FKP7pLtpMk/FwNzvyUeKJCJ YwW6MgIFma8Bi4wucTV1Rs8RuBELIBSIk/naBjH7KiADsDlx9at09UlnlF1ZEMCCvJ9z dfJRN8x6YHNZ41mFLaCR1OYsUmCnwzkfKla7qrkglWgPlM4d2GSJ+waGUIO9oSY7/ezv jRzyhZDmJIS4lZPT3oxfosYud3mAQ1d5/7Br9i4VGSf0LYnCJbYprB7B6L9fwMBeMnRH IAEg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lbjPAasy; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cg20-20020a056a00291400b0068fcb779a3esi10278835pfb.278.2023.10.10.16.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lbjPAasy; 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.37 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 snail.vger.email (Postfix) with ESMTP id AAAE680E73E0; Tue, 10 Oct 2023 16:34:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344191AbjJJXeB (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344141AbjJJXdx (ORCPT ); Tue, 10 Oct 2023 19:33:53 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2051.outbound.protection.outlook.com [40.107.220.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87799D; Tue, 10 Oct 2023 16:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=evi3JWRlxCZdbnEolIhCsWgElZAPIQZ3y+rWgn4TXvrgNnlb1aiNjy5wEpMUCMMyD9MKT8A/MtVBCjkckFkFb0cTD6/uKj5UufRsbUVkXw5cycFcrOoHBFG9q9PVAa6Y8gCLCNPXwQySQ5TT2ko7APWU224tFHj+5rBCWSk6i9pVKolkfPJ3T8D3pMmCsHZ5ObjUdB4kndRcLCfctaX1F6sFfxeKY2FMKSHCZzNqxVHy5vfPKAlL+iMRyUOcstzsIwr80t1mSnmWXEBqwagewzg51xW8Er+jzhyEaVZfuif68CfKmctEwnuMSMd+B1sHgmbijnOOQsBGCNjLXMuaGw== 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=T3lo19Z3taUJl5Gy59RynpNh18VIJAYAW9337PE04pQ=; b=QAMU6n8q7cnDrqm1mi+y/kk0fyQIB4tugLx3E8l/4SScitCy0j+mKbwy81SiP3Hhu8BQEJ+WgOQL0XLdHioNl7baqIXMrwub3wUrsMDtBpya98N2ROCv4Q2Gr7KnvGfPu3iZYXOQNfRkwYW1lT0GPyneM2p2kLxIx1Jp6/AaWlzzXwO/mSga+d5JERe+gTkZRy2KUpCPiMdXeAvRCPFil9Gbpj0p/cq4Yg7VKBlnbdW2aW30/ZVCvGzUEBFFYTq8CgLHiFv5TWOp+oilO8h0uy83eecw4SGoTLsJ8eEVmZzcmeJFJXcL3vqKLligEpx6Tqbez0JL74MMjgRdpQS8wg== 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=T3lo19Z3taUJl5Gy59RynpNh18VIJAYAW9337PE04pQ=; b=lbjPAasyuZA2rQm8eG8S0f7bFuFReHJuptsKD3l+2I98GBqoMwGGDiXjF37mzRe+hcNPlcusPxKKuaeBGDbhXt5u6PoiPlVQ/zzCwKDt/WPpWP5csmeumK0gIWO0TeKy1ruWnLBTyMTH5sH91g4gFvp7vL6xkpy3asRVWXDi8ws= Received: from MN2PR01CA0031.prod.exchangelabs.com (2603:10b6:208:10c::44) by DM4PR12MB5748.namprd12.prod.outlook.com (2603:10b6:8:5f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Tue, 10 Oct 2023 23:33:47 +0000 Received: from BL6PEPF0001AB4C.namprd04.prod.outlook.com (2603:10b6:208:10c:cafe::cd) by MN2PR01CA0031.outlook.office365.com (2603:10b6:208:10c::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 23:33: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 BL6PEPF0001AB4C.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33:46 +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; Tue, 10 Oct 2023 18:33:44 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 02/10] x86/resctrl: Simplify rftype flag definitions Date: Tue, 10 Oct 2023 18:33:27 -0500 Message-ID: <20231010233335.998475-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB4C:EE_|DM4PR12MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: 64623571-b48b-4acb-8833-08dbc9e9596d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vRojnqrX2J15LaqQeH8O/al8a+wQutDAl24N6aP4Hdp/gvOVFjwCSXMDVC3f+Z7IIQi8ovr3E8fcjG3UBJg0GvgYcp9/JaKw5k+CjXeSeHcmbYWAhO7n2WqGdxtgJBgt/XOBNLykKAVEOTraS6bmiZ+7eVZRBEQO7SlnK62LGrb3OX7Af3jLX1UIpM1s6s6kyPm3P/6DGEnY1Fb7dGztQJlJcQMGcEUuzAZDAML61ijih8osiPOsX65tX6PNca74mHSWa1GNWvXr0oOtBmZDVNN7Rh0aSWuu+cVYrMToTQHwJlBiNnN+CdNKubXurDpIV3XtCZ06BgdmOfnLblRxmPJgNZUVQF9DRVogbCAkWY641kvN1NOaesEjRSv0M/yNCbujbsVQul5lPi43rNJg7MzAgrm6pqqMwNwQryh41z4XOthXrdd/K5jNbm7gxQ2Wdt9Dpe86iPlf1fPJehLsWeHhzOv5583U0dYNkMB84FWfrOHHPjbRpyfxnr9dD9orYhHXC7S5e+shaof42SzRk2/LFftcfUnzxZRrw9kt76DUCxgbYnKWNKNVtjyoyEiylsLHkgb1M0hXRrDyThKoe8sY5Q2MQx/ybaabY0kYYK/LqQ3gRFC31iRFvqYewkGQoUPiqXdqgbS5+dMj2MM4zfTR1nPprxj40Rmm+BYdOztrrY6vhnhjy2yOZhjyJMG50ExHWBq9K+4ul0es0KFyt+RbeROb0x5gNDoSDkRkngWRpV59hGNlzC53CltwpHHCuclbIS7MzKYm6luYnhCqKQ== 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)(39860400002)(396003)(136003)(376002)(230922051799003)(186009)(82310400011)(64100799003)(451199024)(1800799009)(46966006)(40470700004)(36840700001)(40460700003)(16526019)(2616005)(1076003)(26005)(426003)(81166007)(336012)(7696005)(316002)(47076005)(8676002)(6666004)(8936002)(2906002)(7416002)(478600001)(4326008)(36860700001)(7406005)(44832011)(54906003)(70586007)(70206006)(110136005)(41300700001)(86362001)(356005)(82740400003)(36756003)(40480700001)(5660300002)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:46.7345 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64623571-b48b-4acb-8833-08dbc9e9596d 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: BL6PEPF0001AB4C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5748 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413393603978259 X-GMAIL-MSGID: 1779413393603978259 The rftype flags are bitmaps used for adding files under resctrl filesystem. Some of these bitmaps have one extra level of indirection which is not necessary. Make them all direct definition to be consistent and easier to read. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: No changes --- arch/x86/kernel/cpu/resctrl/internal.h | 9 +++------ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 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 Tue Oct 10 23:33:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200010vqb; Tue, 10 Oct 2023 16:34:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBi2n/Oc3wK4JNi3/KtK0AUqhRnvuxDp6CWocr2Ru7AnCCCGOr6jJMy0Rb0YmNzdoQsbjz X-Received: by 2002:a17:902:e80a:b0:1c4:1e65:1e5e with SMTP id u10-20020a170902e80a00b001c41e651e5emr22174837plg.0.1696980847679; Tue, 10 Oct 2023 16:34:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980847; cv=pass; d=google.com; s=arc-20160816; b=ooSfRIAfnOyeh68YQr15S6G3I09XlpL6IQNJuAem/Hf5f7yurruKuP5HaQt/FzQFXC g7+63UtRrPCzZPLu1TSDCfUSSnzx66L5jurZdlujloPk9XmBWw2co2+u53i1TzvlUxHw UVp1mbvQbktV37+rzOO2Y/nDH11aAph3JCqUuXQRXY7KnG2qggjJAy67cCeoRSJwfZam ZY+y8lJYIZJemG478HIkU/dSiwu9uFvgYk6vI+5u0HhJf4YIaV3bydofC0uqIIoM/w0+ v/Ob8qLBzKcLCNOGp10JhV7OuXagptHR8TLIjmIkKXPWUFzKXszdq8b83vPm9w7Pb+39 8zOg== 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=Wks3xuViPedDO2nYSh7/q+hbubJfaQT34DHMV+GxKOA=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=TG5DxEpyq0nSsGK1WdAKBimsW31fuYq4/+YR5jbRYg1YjmXYz8UHP/UD2f5j5tkaHQ vzWokq3m0FVLv7ysd7eO2xsRMxRmZbZb7Lzk1XqJyWsx9wwEWjTWpkHVKfklzy1AICiW EAlHedEO5rVsbYuDqgvHb4H5Kc5sSs8GMZ6MUS+KesWal9LXLnfRQl7PlcIKSog1f5b5 grnShq05Vp15C5Hex539+Ck+OVD7QCQ/mqmA2Xy8EU7ot2QkNBv2Z9myne9rrtM2k66b 1m64WkBBU55kSfnwiDIR42J7cWs5ajQGtnQOuPVJYgbNt2P1X/v741s0lDbm8CgAziq4 v2kQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=vn8uLrzQ; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o8-20020a170902d4c800b001b81a112f9bsi13591019plg.586.2023.10.10.16.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=vn8uLrzQ; 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.37 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 snail.vger.email (Postfix) with ESMTP id CE3D780E7110; Tue, 10 Oct 2023 16:34:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344154AbjJJXd6 (ORCPT + 19 others); Tue, 10 Oct 2023 19:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343994AbjJJXdw (ORCPT ); Tue, 10 Oct 2023 19:33:52 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2046.outbound.protection.outlook.com [40.107.94.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DAC294; Tue, 10 Oct 2023 16:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eTSB9LyCSCP0gs8IQNg0FloihfB0TLZNAk2FWKnjoG9OFECtditNZl+sEP1GNrHhx/CVE7Gv3QCGlF3S3ALAc2hi9x6+slefRK3JiPh4S4wBMW7AxS/0zKGEPPPHNaxE0oRW355WH36hDukZOtzZ1bkRp0m9DEyclcjxRo229BJMMNL+/iKqUWQGIVXcZvHlwsBG+DGgJDi7mzFyD0S2Gbenr+1Os7ETYnmZBDz65uPnPW+ZUZvmdup+fIqaQ5nQKrtGDBkGl3+UfXrd37H+k9C7mXUyygqsAy2TopgC5CqntIA7djPbz2bBDiZhjWUCYHfn86uFhESH8psa+OHasg== 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=Wks3xuViPedDO2nYSh7/q+hbubJfaQT34DHMV+GxKOA=; b=YKosFuUyR++W3WLw2gGYozduI93mHXIIA9YAZu1oKNZ5SlJlybppzNOUylRZE7YfuXbfx2HzKVHVYS2RnoODDSuu+/7raRkNHVMXS0623JkTUwaU0eYcqbxJcXgnXDgqMsoMsPFeE/fdz2154NOYRq59UQlGLcceAqjEaC78UegSap+VB3MSKfUFNZfdcMiWk4jIKrWapLlEx2bbwfEcIiAg4Tan9HFWgip2aNGlySdxq6d36lJNZHEJE4oxeK6N5uMSGuV1qhFdcrvZD1n9/NAwQWXX6DAPrORSsqIXiOlSDx3OVrpA9Q2SsyMhryZ7ijk3EHnBMgmRAS/hhlgHMA== 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=Wks3xuViPedDO2nYSh7/q+hbubJfaQT34DHMV+GxKOA=; b=vn8uLrzQ2FytwPiWXD8qD6eIDU6avgAkQAI0YAZFryEMoCzIlXF4vvoGZ5PEDb0uKXnVOZtsLIR2nK2AYZoU4dLIEoeGK70o0dMrwy2UwTnnPfkLbR9cvz/AFwOS0jEl4EIq0OSZj6EYLj8W3Yg2SAeqKfXuLh3htyLwSWnfnk8= Received: from MN2PR01CA0022.prod.exchangelabs.com (2603:10b6:208:10c::35) by MW6PR12MB8661.namprd12.prod.outlook.com (2603:10b6:303:23f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36; Tue, 10 Oct 2023 23:33:49 +0000 Received: from BL6PEPF0001AB4C.namprd04.prod.outlook.com (2603:10b6:208:10c:cafe::b6) by MN2PR01CA0022.outlook.office365.com (2603:10b6:208:10c::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Tue, 10 Oct 2023 23:33: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 BL6PEPF0001AB4C.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33: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; Tue, 10 Oct 2023 18:33:46 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 03/10] x86/resctrl: Rename rftype flags for consistency Date: Tue, 10 Oct 2023 18:33:28 -0500 Message-ID: <20231010233335.998475-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB4C:EE_|MW6PR12MB8661:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d5ff5f7-3e4c-4791-4202-08dbc9e95a6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6hgUHljTAa3Ely3ZP1Hm81/ev6y8DrD/V6q2x3ki/S0cn3CJjthN4M4fUuEUKgrPdoXY26a1zEuodYZzxDt+WyaE9uDLRYtPaJamF+CvyEI9nVR8mezhKfnikOMnuQeGV8U/Sz6eE1GbZjUmcFD6a3jrD7AGX+78Du0/t/gPCyckFXlhHfliSES9GmR70yHakpNNxSRCJ/mZoYwX7mcwGK1DfyZlOkpF2+7c2DcWJbxP9uHWkRG2JAGD/pDab+4X133dmuxCEPUpAYyV/cmxLEkbBZklBS0BDpruygMZItmllTNM4SGqoYy9H9P19O5Oco9Pgfy0Bz3pHCCI9yMiXX8aPRJ7IoL8QuqosCRwA8gZPXZuL4TCTOl6hUoRjeNrCJIJ8j8gE4q6d/h/Do/OuFJW+eAb1AklO9BEVBYzLV7w8rwmqBNS9PFzH0w4QMmZAFrNGDgZUK4P+Fhfn+GpfrOzu7NufBmVetDdKOl9MVAkwnrF/gAJCQ7ANniD1I4typmzoIuawmfrLPM1NfAP4XL5Y40bUeHI4thRMrzM8gBuXI6RpSq0vSCdy8uGOzHrysoQMnqqIAn3m1h7DIujkbYvbxbo3IpuYIHquHnczLX5glDwrw6YDqr8oKZTQL+h9mjqFVBalIJH6k9f2YpopvO74yDN3Rir+4dsvMav0TS/RXRaTKGoc24cxOPszJ+cadZk5an1eTF9gTOU+b2lqILg4+bWvlLRQOvKzjsxRsNUIGpUVbbp9ia5cYJGcVCoFzW4D2U8tJnH58Y6fwAHSQ== 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)(396003)(346002)(39860400002)(136003)(230922051799003)(82310400011)(64100799003)(186009)(1800799009)(451199024)(46966006)(40470700004)(36840700001)(16526019)(1076003)(26005)(426003)(81166007)(336012)(2616005)(66574015)(7696005)(8676002)(47076005)(8936002)(2906002)(7416002)(478600001)(4326008)(6666004)(7406005)(44832011)(54906003)(70586007)(70206006)(110136005)(5660300002)(316002)(41300700001)(40460700003)(82740400003)(356005)(86362001)(36756003)(40480700001)(36860700001)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:48.3908 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d5ff5f7-3e4c-4791-4202-08dbc9e95a6a 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: BL6PEPF0001AB4C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8661 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413389396264480 X-GMAIL-MSGID: 1779413389396264480 resctrl associates rftype flags with its files so that files can be chosen based on the resource, whether it is info or base, and if it is control or monitor type file. These flags use the RF_ as well as RFTYPE_ prefixes. Change the prefix to RFTYPE_ for all these flags to be consistent. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: Moved the RFTYPE_MON_BASE definition to patch 10. (Boris) --- arch/x86/kernel/cpu/resctrl/internal.h | 10 +++--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 +++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 62767774810d..2051179a3b91 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,10 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) -#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) /* List of all resource groups */ extern struct list_head rdt_all_groups; @@ -267,7 +267,7 @@ void __exit rdtgroup_exit(void); * @mode: Access mode * @kf_ops: File operations * @flags: File specific RFTYPE_FLAGS_* flags - * @fflags: File specific RF_* or RFTYPE_* flags + * @fflags: File specific RFTYPE_* flags * @seq_show: Show content of the file * @write: Write to the file */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 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 Tue Oct 10 23:33:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200048vqb; Tue, 10 Oct 2023 16:34:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhJ/LFUdy66CNLoxDcA4HOpo49PTrDOuexyaTPONCSYhSYw0r/k6WzpVIKN/Qxes6z5l1W X-Received: by 2002:a05:6808:1495:b0:3a8:458d:e1cc with SMTP id e21-20020a056808149500b003a8458de1ccmr24537559oiw.1.1696980852325; Tue, 10 Oct 2023 16:34:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980852; cv=pass; d=google.com; s=arc-20160816; b=WsjQma5YTcLtGBf3AFRfUvLytUegGsVp1fI13P2z3osjezi6LLXRo81KbpzwnS8DWU bOlM6Xi4kaSS1mmqqBHDtYcuWx1ALlqlwP++Pam8OEq+jqNzwybzK10m5Kzp5a5XF1BS m4iaytnVFlkRYeBXYnDwmmE53Bl91MJ4o0z9bTYVC7xUXDWDgUEL13yjs6Hv4eTj0tQj cpFtH9x+sTaBLNSqr/C6ZhgN9jClFfirb+r/Fij3eC+UzAWXf6rUaz8fF6e60Q9LFus9 efwWsAep8UKqYs8rfJeQh+yQX6wUHYf2u2/u0a8sqw3nJBBo426UlA65n6Em5vZ4WfTE wENQ== 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=VjCrpoDVtV6H0wD3sT5CdSWgeYIuhdHxg4IlNeY2I5s=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=V8FXwg6nGhtFgFxZwXVYzX1qQUmlg7R9mEw9Zei0H8KaEUJLMwR8lqlDUDdSnH/Ybd Mc/53M/VZv6uUd/Fb8H5Clcvnknh1KnKRyB97vbyjQX4A92t2Z7iIN0OT2TJSSEvJ9X4 YR6OPWZJqK7M3/pP6AOGUvLsnEWugHnL92+6jnam4FkXkR1KmI+oP3HuZD0Hyqu0I0tZ IESOWp+uvHq9DtW6TmQqxu1y0w9Um3XAHsqhw9M1ypDpHC6JrHC+E4+tw0wKFijA2H68 gskinyVw23rk1+AX4y6WvZZ1Xw1XCq6zpBhcBvQ8k82vKqLUlALP/eBZa5KqCgTJZ7j8 +VVg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="iKh/s7Rh"; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t184-20020a6381c1000000b00578b1a60710si12495693pgd.552.2023.10.10.16.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="iKh/s7Rh"; 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.37 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 snail.vger.email (Postfix) with ESMTP id A96B080EA8C0; Tue, 10 Oct 2023 16:34:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344206AbjJJXeG (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344150AbjJJXdy (ORCPT ); Tue, 10 Oct 2023 19:33:54 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2053.outbound.protection.outlook.com [40.107.100.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00C8A9E; Tue, 10 Oct 2023 16:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Is4jBXStRBUdy5Ils8clxwHi0SVoWbqNn4+hsaANrRs1nXGbmbHMKiuQFzJkPFUQyqUqtDXmqAVnhba8ZlP2oBzriDpTmDg0rDmhqC6x+8IQB/kEB2UTF+Yy2hDlsJ4aMKHbnozGdK8c+Bnht9HHcHwEOOVi7xpFUQPmrwTYFbDb1iLPRwM0jbXX5h/msmh9pO4V9SbAquZCGwmoReeqoW6JphGSOlClh7MszxO3yEwEHyuW+Qu0sYG3q+CliovqhsC6BsN2292kBc5yOQdu1a1RxMs5nBcj7DBtz2+9cm53UqjpFy0H0ZUiO6QObnIVw2adBH4lFGlZLzbmDktUyw== 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=VjCrpoDVtV6H0wD3sT5CdSWgeYIuhdHxg4IlNeY2I5s=; b=nmAuaVn6LdKz7wUV5n0QlyEQ8XxMk682Cavuo0K129OdvFopaM2ZZFst3ohu8/5VF+ZfEiSCKNR4AoOGr5QxXlKq1IjYW83rbVoJS8WoKRu0HC2/7O9ndRXGJyGRaG4y04DfcywA4wuJSgxE/R+5OKuEDXM7PWrSdo7pOsH9wKYKqHjbI5lLSUeHIf/CxrxkofvCD+D2nftjPnsbi1pFfkqV/vEtrkK9i1wesmR4ulpWpTMEbFhXoOd9IKjLmYQgrg7jna1+IjI8ANsnhYSLjXtfUlNztNyxiGYARgMMDhqPAju526hmXucFQM24TP0r6Qxzah6e1sqDzp+YH4yoxg== 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=VjCrpoDVtV6H0wD3sT5CdSWgeYIuhdHxg4IlNeY2I5s=; b=iKh/s7RhVN1xkTIRil2KVGxrS7FTt0QSlVbc1CDrrmM647JPzSeVUpLx9Y+UTEghHltwnm02LSSxswxL4ee8jf9qgazWNkzw6mtm5kOBs1lraAIv/J4N+rEwZBKEdTlnsJxlkvYzcvZI95y9W42aMLsureF53y663zE2sMzEiAs= Received: from BL1PR13CA0437.namprd13.prod.outlook.com (2603:10b6:208:2c3::22) by CY5PR12MB6081.namprd12.prod.outlook.com (2603:10b6:930:2b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 23:33:50 +0000 Received: from BL6PEPF0001AB50.namprd04.prod.outlook.com (2603:10b6:208:2c3:cafe::7) by BL1PR13CA0437.outlook.office365.com (2603:10b6:208:2c3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.23 via Frontend Transport; Tue, 10 Oct 2023 23:33: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 BL6PEPF0001AB50.mail.protection.outlook.com (10.167.242.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33: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; Tue, 10 Oct 2023 18:33:48 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 04/10] x86/resctrl: Add comments on RFTYPE flags hierarchy Date: Tue, 10 Oct 2023 18:33:29 -0500 Message-ID: <20231010233335.998475-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB50:EE_|CY5PR12MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 02edfb17-1eeb-4314-0642-08dbc9e95b6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jTuYAQdCN3Lrn/W2B9xpHvFvsrMitLK7Y2QPnCUH1UlvzB+BmhqSD7xiNwse+nGLRt20BVSWp3AZZ8WzU9qIMvdZCJe9KiMrAT7/7wsIItcE+6p3907FyuyM1ytKuPdiFRQvBweJ/at5+nmpi6gvaeOqzovDFIlgh+2iFQhdlAlb1H/DwisA3ML9nds4R5Bg1tceII3U+VtmW5rOIDIIRn9KZpNEUHoEBwftX5DkreYuLwu2Y5UTWiQsh/+dz88p5Pxi1RVhAPRcUmZw2iEJ7thDxhqWiVjE0UX0GBFPmOX8qpiS2p6Q5t4ZH/HMZI+SUCIEm3z7ITuBtYHPqLEnz3+Me8JarNtG0V+m8Y73DwBGFqy0FR3LKLuHcJ8djo/c7v7rs33IiM3D0F3pzM2bevwilBgBdEKLBsLWa0DS5MeXbivkSvKbXHaRIpbIV/JLxlWHrEYn/WGUIBtmuBZkdwyEU9dCYKOE14Kn5MiLXRc5ry9QWAP/aotrkaB+ebtidlZCAaqVyAaAhPfH4sGrOmPypvdCuGU7Eq/xmFin+qUq1Mssdrp2/t4PtepmY3dfWXTKnwqaS1eST+fmpPJXz17TwlRfkc1+pE666ucslxO5u1lwmBqRTFKI8aKxvjta8hudihq8teYM3w4VPv+kKrhsF5Uy5qiI9QRhG32J4QH0M56rZWBoq1S6BEVecVZlyLOTwMq3QwMkFvIKoFQ1lvYkgVs2XwoKG6BxhRWHU/rtqJ9DbxGNuMrlZfIJ9T72g9IFEP0GB0RrSvLWsStSsQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(451199024)(1800799009)(82310400011)(64100799003)(46966006)(36840700001)(40470700004)(86362001)(36756003)(40480700001)(478600001)(7696005)(7416002)(2906002)(2616005)(44832011)(70206006)(70586007)(7406005)(41300700001)(1076003)(110136005)(5660300002)(6666004)(316002)(54906003)(426003)(336012)(47076005)(26005)(16526019)(36860700001)(82740400003)(4326008)(8676002)(40460700003)(356005)(8936002)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:50.0670 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02edfb17-1eeb-4314-0642-08dbc9e95b6a 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: BL6PEPF0001AB50.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6081 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413394578269305 X-GMAIL-MSGID: 1779413394578269305 resctrl uses RFTYPE flags for creating resctrl directory structure. Definitions and directory structures are not documented. Add comments to improve the readability and help future additions. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: Moved the comments from arch/x86/kernel/cpu/resctrl/internal.h to Documentation/arch/x86/resctrl.rst. (Boris) --- Documentation/arch/x86/resctrl.rst | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 8154e9975d1e..520a7753d829 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -362,6 +362,66 @@ When monitoring is enabled all MON groups will also contain: the sum for all tasks in the CTRL_MON group and all tasks in MON groups. Please see example section for more details on usage. +RESCTRL filesystem implementation notes +======================================= +RESCTRL filesystem has two main components + a. info + b. base + +/sys/fs/resctrl/ + | + --> info (Top level directory named "info". Contains files that + | provide details on control and monitoring resources) + | + --> base (Root directory associated with default resource group + as well as directories created by user for MON and CTRL + groups. Contains files to interact with MON and CTRL + groups) + + Note: resctrl uses flags for files, not for directories. + Directories are created based on the resource type. Added + directories below for better understanding. The RFTYPE flags + are defined in arch/x86/kernel/cpu/resctrl/internal.h. + + info directory structure + --------------------------------------------------------------- + --> RFTYPE_INFO + Directory: info + --> RFTYPE_TOP (Files in top level of info directory) + File: last_cmd_status + + --> RFTYPE_MON (Files for all monitoring resources) + Directory: L3_MON + Files: mon_features, num_rmids + + --> RFTYPE_RES_CACHE (Files for cache monitoring resources) + Directory: L3_MON + Files: max_threshold_occupancy, + mbm_total_bytes_config, + mbm_local_bytes_config + + --> RFTYPE_CTRL (Files for all control resources) + Directories: L2, L3, MB, SMBA, L2CODE, L2DATA, L3CODE, L3DATA + File: num_closids + + --> RFTYPE_RES_CACHE (Files for cache control resources) + Directories: L2, L3, L2CODE, L2DATA, L3CODE, L3DATA + Files: bit_usage, cbm_mask, min_cbm_bits, + shareable_bits + + --> RFTYPE_RES_MB (Files for memory control resources) + Directories: MB, SMBA + Files: bandwidth_gran, delay_linear, + min_bandwidth, thread_throttle_mode + + base directory structure + --------------------------------------------------------------- + --> RFTYPE_BASE (Files common for both MON and CTRL groups) + Files: cpus, cpus_list, tasks + + --> RFTYPE_CTRL (Files for CTRL group) + Files: mode, schemata, size + Resource allocation rules ------------------------- From patchwork Tue Oct 10 23:33:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200092vqb; Tue, 10 Oct 2023 16:34:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfqd0sR1n9l4ufDeSvyJDoAJLb2n3jvky2xi5o4+vGWxiAMLEnEMqZiUYGF3hSRBVmP9Of X-Received: by 2002:a05:6808:1a27:b0:3ae:5e6a:5693 with SMTP id bk39-20020a0568081a2700b003ae5e6a5693mr23514753oib.0.1696980859014; Tue, 10 Oct 2023 16:34:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980858; cv=pass; d=google.com; s=arc-20160816; b=phDJOStdUV4hq7HdsqOshXK45stEegXisFk00CpjimZwWC3bYuSmHMqphK9Pm1FD43 y37z6o8McFKYKjobiuJQ6bLF1sogyYbuY+juRPbSoDJ4bpbDe9w8ApIbv3Kep3UfEaXa 6ruK5wq+AlhwxWjVIY2+Vf/rPGHFM/7BW6GZLb5dgwdqi5q3jS7Fn7XffFJFmorrSNy5 zk7+A4zp+6HndDPuWyqWe2DkCGGNnmzwBZ6BTyiRwTNfRS64H3EOnxX7HPeu6sjodoGz nFrijdQwBfg0Ds7PtdJrE6RpNfDHgqEXH6s4jOKRNAlwBV1LaCEsftwkYbcNCflW5gwz D/lg== 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=Bc1oUxiw0dA5e9jsoVcsacmbFKbM3gi7SYCxARNC66U=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=U4tttxP80/OOqzKPNl8tELBPsU3kfKg4PTf5WQE+5xp0neuMy11ouwxbYGWD2/m2yy goEV/HN8pjVFiFE8SEhs2MozdLBHEIDTqQornR9smAwRaqs3oDvEOF+moPv18HyXjbWh bcbkbpgWaCdas2AQR3xGfyLnz4UokPBZi3CbZ7c45M/Yup9teaq2R/D4IPCx/DOEeM6I 2qGfKyW1o7hMTUZhOfMsnXSPE0OEmaM4+ds7b84Btj+1UclQIY6gmdVWyij3gSnPzwle 4A9QnSqd+ENpfjiKcXoN8jW3RXJUQILpykssw+pML8ObLTwlCUo+djwvTFPT9BSHF1fX ncvg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=r4Y0SNsq; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id c23-20020a631c17000000b0057755c96163si13144547pgc.14.2023.10.10.16.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=r4Y0SNsq; 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.37 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 snail.vger.email (Postfix) with ESMTP id D35F280FA9E2; Tue, 10 Oct 2023 16:34:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344185AbjJJXeJ (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344163AbjJJXdz (ORCPT ); Tue, 10 Oct 2023 19:33:55 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2054.outbound.protection.outlook.com [40.107.223.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47D8A93; Tue, 10 Oct 2023 16:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IdNcTOdk+/6UZhryh7S34E8trsqIpCWenN0GN+HIDIc2W9sOBmAmRZ5dAAsa7FMcXxqStVgwmTMKcrwuwVcRvuyreHYaVmVCBL6qAAjDQSQNM2c9mE+nzUBROb9CKfktIS0sXQc8juU6MRwviWc+/AFAxsaPbr58VtE35lA/tp7JJdEdYjJqnYUB+hQskI7qEJgaLNkQchG1aYhoAFX1Idk95Y98b+n8Hyyia4/OlszTbKywDKgei2CuPuxOsEXR+Dq5SCezpfeXZ2mOqPJmp89jPoImmQWCdzBnEZSC/AOEYy1Z2Bgh6BJ4+daGKj8txd8p9qzsN7SUm9wZEORHcA== 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=Bc1oUxiw0dA5e9jsoVcsacmbFKbM3gi7SYCxARNC66U=; b=Y2/UjzJcTrHhVdc8sz3N0GlpaFJvpxLk9Wx/JGPmKvRZ/iOb55Dxlq+X1WIGt6xphmwCMz51r2hKGd+P0Wx++wMhFDtg196YSrL97pMg0YG4dNkxDtRrXsNzoxrkEfD+ATN0cutU7aN2rcA8F2ITNYNOmbjGFFIv+li3/MsWys4LwYPqHXC9KDfYjw/D+ayRwI08AhsGYUpS0vBjsfvLxgzq4mXABFFbxWNVnirWPoCvREIv5tE/KA5+v1jCiptAGnCIYSOOfvE7GawbpA0yODJIe2/z2IdBZLhZFf7+PzZecrBStyC1hXxnA2drKRRhdgMYVpaydsGsmlDgiov59w== 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=Bc1oUxiw0dA5e9jsoVcsacmbFKbM3gi7SYCxARNC66U=; b=r4Y0SNsq3ffcikIxuL82YlUoEsugX6IHcBsHydYWmnbtcvsm0Li1oiWZ7lKm1W57Oo2a7bqzzrzparX1zHkOEQPYNyHZkwD9Zau7R67kGwBnA/K/lPXdtiqj9Q9PbKqOpunUIPTjTgVbVd7sdkA7lqvBFCIwSqC7km9XjXf7ns0= Received: from MN2PR17CA0033.namprd17.prod.outlook.com (2603:10b6:208:15e::46) by DS7PR12MB6168.namprd12.prod.outlook.com (2603:10b6:8:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Tue, 10 Oct 2023 23:33:51 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:15e:cafe::80) by MN2PR17CA0033.outlook.office365.com (2603:10b6:208:15e::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 23:33: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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33: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; Tue, 10 Oct 2023 18:33:49 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 05/10] x86/resctrl: Unwind the errors inside rdt_enable_ctx() Date: Tue, 10 Oct 2023 18:33:30 -0500 Message-ID: <20231010233335.998475-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB4D:EE_|DS7PR12MB6168:EE_ X-MS-Office365-Filtering-Correlation-Id: 901245dd-c94a-48e5-8dea-08dbc9e95c58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j5ox6Xs77fbhhELMUdCCrpk9kNYMbTzzK91CCCPANo+Y+8Kne/8K2dhR801aQLiy7OECvwjlMc83L7WzJbfws55CqSTklHdK97aWa2PCukIDtFup+jlBSgL755V6omvvzMfASMbu8ngg2/g1TIXbUzeSnO+fLdCZvq1aF4cQ/Q9g3kDJ12lxeFUvGG1G+h7YkrziW5SFRM09M0naYzmtaT3q/7rd9W+Nqfai9vIy0Mmk22rRLnM/UkKn2IFkpr/YdWbv+xrqBTJVwdT1IZI1sT45IgybSuycxrn0Z9wjVqrtWWjNNEFnewxIsS0GM6ZUS/s725Dt+D1bKwx+GVEPEDTyk4N7W44E9wY8Dtx09eRqWOSutFih1xQEER4OTPB8ErdDHkHqnJmGoGu7O4aWQ0CBo1Wutf50ERsvJ/TZvIduEGRgv7Tb8PQKc7Nbz2BUnIJlEO8cDKA/Cq+DnGtUgQlFT4Vq1eLDwei2ufIYCTHrm7+OfMi7y62xia15LeRaaL8TrPV8vBbMJENRNjLXQAMgPa/5aXk8kgD8lfGxnFLI2gcYCLAz1ZOu09Itfq10SIK3jDecLZgfofi+RgINaFlJOYktgtAsfSHYqUgHqKYXxG2pVfiECXtpDM5Yq+rUfQ+Au6PaeEhmgcFbnPSA6N+p3ps+soCfVvhRWNt1nV+OFxqgCdQ5G/6qsgLFSDNESd8znT4qrlXAb3dGoGOboZkZFxwsPYUsGyztwfvsuX55a9cqyQJOUm5xGygv649Hh4FNL+0qbJ+C5fGqKKZ4eg== 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)(230922051799003)(451199024)(82310400011)(1800799009)(64100799003)(186009)(40470700004)(36840700001)(46966006)(82740400003)(7696005)(2616005)(1076003)(478600001)(426003)(316002)(41300700001)(336012)(40480700001)(66574015)(7406005)(7416002)(44832011)(47076005)(2906002)(8676002)(110136005)(5660300002)(70586007)(54906003)(70206006)(4326008)(16526019)(8936002)(26005)(83380400001)(36756003)(40460700003)(36860700001)(356005)(86362001)(81166007)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:51.6458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 901245dd-c94a-48e5-8dea-08dbc9e95c58 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6168 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413401585284646 X-GMAIL-MSGID: 1779413401585284646 rdt_enable_ctx() enables the features provided during resctrl mount. Additions to rdt_enable_ctx() are required to also modify error paths of rdt_enable_ctx() callers to ensure correct unwinding if errors are encountered after calling rdt_enable_ctx(). This is error prone. Introduce rdt_disable_ctx() to refactor the error unwinding of rdt_enable_ctx() to simplify future additions. This also simplifies cleanup in rdt_kill_sb(). Suggested-by: Reinette Chatre Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: Removed the redundant comment about cdp_disable_all().(Boris) --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 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 Tue Oct 10 23:33:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200140vqb; Tue, 10 Oct 2023 16:34:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjzkDaJqOG1ntTTX6Mm9YYs32oDSG/J9zKxTvv6mcEHplXKTQnufM7+o2LosFQXCe+IuwH X-Received: by 2002:a17:90b:17c3:b0:27c:f653:37b2 with SMTP id me3-20020a17090b17c300b0027cf65337b2mr2182589pjb.1.1696980866934; Tue, 10 Oct 2023 16:34:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980866; cv=pass; d=google.com; s=arc-20160816; b=Ktk2QUFtzehLv6iKtmQp/WrM4oHLUHG2p7Ymx7rS3I9BcZjqZUTk4eMLqxq90Op+3p qU1aNK/vgxPHHxLrJFOAkYM/3IXhD6mBsF3cXgz9ALEU1Nb2VIjvjq3XqzaTXd/dO/5W 7xAOU3Mj06vz0Fnx7Tus47g+lQYSImqCevlZrrVkBK5+oz4pRv1LYLtL/jCOozN5eeSg u43jn00uASwf7MQsjS59QqyAIKX7iIL/MtOmoRJ2EJPx8Un4n8GnaPHJKSdCRJ/mMqH6 wCB6XWDHWZEfvgc63q0AQoem8sxgaa3qLseUPSTmDneGRXoR5ruMkODG8NEhZFtToI7B TS7A== 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=17+APesLAgJrzKT0p23QwGARelWvZo7zmLb7Gnj/sjE=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=zJoiIpYVgEoOiuofnemx1gQ+5j2gDg/pR6C7VLWYH0QpoUtt0+G8vV6zWVqAGyZctf 7H4Mz7dExlfoBxVeu5wBHD1ZFNLndLqbV2yDDuPvv5YMDeT9rvDf0rfgkr1e8YirWNBX ZIla0ZQ8dwkSDgEi0IyR0kaB/wh2/a3uSJUuFtVOeHUwiSgBoSuhm3JL1PefBalrOXy6 wgpia/6XE/oKxoH+aTheDfcvV+DnpVVTKlzgXzzBSTHVd20FvCO/8xGyG9rS1OZxuFhO FBvU38J37nDyf9lstSGDPDP84p+i0JrhjvNPFJwk9zIuhwwr60xu1zUGytPu/9NHkUWJ YjYA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wGiDeWkS; 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:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id gj2-20020a17090b108200b002775281b839si7499871pjb.39.2023.10.10.16.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wGiDeWkS; 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:7 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 snail.vger.email (Postfix) with ESMTP id EEB898104388; Tue, 10 Oct 2023 16:34:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229713AbjJJXeQ (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344181AbjJJXd7 (ORCPT ); Tue, 10 Oct 2023 19:33:59 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2049.outbound.protection.outlook.com [40.107.237.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB31BAF; Tue, 10 Oct 2023 16:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YIS4MfX1CnlXO5LT2lFSzf8ReC9KYD+JSnPZ1Eyu0Wu3HUIGTsN/A4eiApwg1M5fROFrxjpsE0LgvldWhjCUQVHUoazuAOubCtLz0inaXUZM3+AKpg5am5x/MJSA4ArCZWXd6/7jDrgcQbWWFFjpHgbbjdLbidAk3Tls4RDt5+QxImlIuVT0ZJZ6itMBlI/KJKGusI8ZlVDXou9TWWJAx3fcZcby8EK6D3svd0cH2IyI9k3iM6KojbWBde4xIW/EHS8j9O0y5aoLn6tyrR68UAwTt+A0rlRKHuu3eoFJJOaMh2NHi9LDHYlNKVJuA90woJQaO8jfuhBj0ijzFupCpg== 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=17+APesLAgJrzKT0p23QwGARelWvZo7zmLb7Gnj/sjE=; b=Yohr93ej1JnBuHFxtKVTmYKMeZD8ppNVJjfl05SG6/6LxQu5efFqBQZVxYv21bLMe/A42a1Z6SQYNnkKmlwkVf+KRMMGctXbR8GbfBRT6nRcyEjUZF4RaLXD1pM662TTen/fNoZfD9pYV7oWJ9cQa7dNY7jXeBTN2Ccy2p9mQCOiXKg6oWjl8QxgIrVqR8sg/NmbvNOjdA6NNX3FrZOHEpWxBnSovBmgTItYdS3sGl9xq4VkkvfJ8Jo89RUR3LWnWoEyXBrq54KSOs+k3KkXvhXf3IHDE0YO31PASCpMnkpPgDxwXyr0tWFrKXewkSDvt7qYZaTSWjzrgZZx8H0wvQ== 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=17+APesLAgJrzKT0p23QwGARelWvZo7zmLb7Gnj/sjE=; b=wGiDeWkS4GvAantDHFYnTtioaylF8W1zxRqKbI3q11uUJbpZcVMoS6gc7yB/XYGLqPmqTxnYRZgEf/RzALWCVctIU3AXhSoDKCVXeLF+eyvEpKyIl+0egQcshGA/mVrtQ+EAEOflYyBXT/rvZHWZid1d+2OpP6dFtSwG8BcBHmk= Received: from BL1P222CA0007.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::12) by LV2PR12MB5965.namprd12.prod.outlook.com (2603:10b6:408:172::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 23:33:53 +0000 Received: from BL6PEPF0001AB51.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::24) by BL1P222CA0007.outlook.office365.com (2603:10b6:208:2c7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 23:33:53 +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 BL6PEPF0001AB51.mail.protection.outlook.com (10.167.242.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33:53 +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; Tue, 10 Oct 2023 18:33:51 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 06/10] x86/resctrl: Move default group file creation to mount Date: Tue, 10 Oct 2023 18:33:31 -0500 Message-ID: <20231010233335.998475-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB51:EE_|LV2PR12MB5965:EE_ X-MS-Office365-Filtering-Correlation-Id: 90a03560-7414-497c-4f45-08dbc9e95d43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kw7XCzTcDJAaw1oSDkY9pNXXp7KGDDegIvusmdZiyUKaMimqQ6hLsJe6MQsDpremopk6MCJvRynNNVB6Zrvj28FemkcJmcmhU9/QAtAvlnD2m3PCuLUd8ZdUKL4RdTN2OYOrhC2/g926/VXq5ja77TbhQHjHHgCHgpr1LUPTZrsa9r2npr6bX9dHIos6euOw8+d94aEQf02hHk68+fNKmUNCYLa+nJ70xmxygrhUAyJbGpEaD94aAl7JWK0gLQzznApwPF1TJ2U7tWEIOBTkoVq4Set2XxdHy55G4RsZQLo6Jo8TQlUKw3Wz5R6vCgsOkw/nLXBZCO4EVS+nY/KJTe0Y7gmMy0JCX5I8O97m4OxiPN5XBL3z+XRqwWyc8Zpam8PBUWbTPfIu7sVj7ae6DNHDeHCP4LKwmFxy371lmCdKYo6ylJt36dMa/MgrhzIilLp1z2q5ld7JA+6ez0lDQIhZNwVnqQ7qPJPyyak7xIq38SD6FqtGRyqLE2C/Gb48ffuMuMRCyvwA2Chqzlo6l1qNZcqdeGZegKGcjOppcDem66Ey+EBX4ru2g4m/jaYhA4shHuobrCSBEN3MeoJfBZU2wWlyDc4ZymknBq+/uId9SZOEnYEBvaoWQEg+0jRNOFGbiuPhv+MWcISDHIXN+4HyVFQ+ZYN6ulAzIQ0rTSeIzZ8cqqwbbPe9ZehbSINTyoEOb+xD/xZ6cXphavzjs6ES2AqV0ySb8lUVZoSu6pydK2qnERwIXGWRNOzooG1YBSTsR3y66rlqN59V7qzXaw== 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)(230922051799003)(64100799003)(82310400011)(451199024)(1800799009)(186009)(46966006)(36840700001)(40470700004)(40480700001)(7696005)(40460700003)(2616005)(41300700001)(1076003)(356005)(81166007)(82740400003)(16526019)(26005)(36756003)(70586007)(70206006)(110136005)(54906003)(86362001)(316002)(47076005)(83380400001)(5660300002)(44832011)(7416002)(7406005)(426003)(336012)(66574015)(36860700001)(2906002)(8936002)(4326008)(8676002)(478600001)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:53.1687 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90a03560-7414-497c-4f45-08dbc9e95d43 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: BL6PEPF0001AB51.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5965 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413409296164315 X-GMAIL-MSGID: 1779413409296164315 The default resource group and its files are created during kernel init time. Upcoming changes will make some resctrl files optional based on a mount parameter. If optional files are to be added to the default group based on the mount option, then each new file needs to be created separately and call kernfs_activate() again. Create all files of the default resource group during resctrl mount, destroyed during unmount, to avoid scattering resctrl file addition across two separate code flows. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: No changes --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 58 +++++++++++++++----------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 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 Tue Oct 10 23:33:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200153vqb; Tue, 10 Oct 2023 16:34:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkZKrRz3XMOQpEkiIxLaKk1IrRxcw/IwNwvxzCBE8L5f2lWxmAmXGIVHMfmRV5S9wyCVzd X-Received: by 2002:a05:6a20:9417:b0:16c:4959:c372 with SMTP id hl23-20020a056a20941700b0016c4959c372mr9493862pzb.6.1696980868978; Tue, 10 Oct 2023 16:34:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980868; cv=pass; d=google.com; s=arc-20160816; b=f7U33LPauGpAMRhtZE9bzZdl05f/9s6KT/sh/psBmH9sutTkwKx8+s4b5ip3371m6c +FszItyUtexXWfo7anYB9NwUKtIdLc31n39sdWJLBnW9ZhCs3CF+QTTWVZXg2WpU+54x eVZL/E976FtLnWv9HuM9ozlVLy8ifIANnB9lVN6wuQzt+a7wy6vuQvDhltb/YXh00FfV 7DODr3LjoFddzW4sLj1BbLEuuEaLBdxYxIg26YlMg08ixYQZKRNaSGLQv75BKUh2sxZp R0X0I6+89PTLv9aN8mkljhBDADEp069F7ufmaduhFe/X6Dzg4/bo5aB5IqDSW1RslErw uiSg== 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=H+WfvfgXRMRbjdYp1Vi5GEwXugoe5e8TZLnv0VoakJk=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=xFLZcs+5TTUagIFjObb47ZZIRAStnC6H7ZDZitrivfMAQYxQwuwUPUqG7i3VsoiI7/ cIWDpygHk8e7PvAdFxllSOyb8LkmvGWDsyqVVyMptYle9T81tsOX578ClVX7IeNbx83Q Fo1u1DyuZ/4xE+7q4BM6kUj3fuUDMSQFxDMe963nKFqavTE30qNoP6Dfq9ZarZi1vetE toip9/jUPwSyckI2xn+Mrafy1ix/+541HoGIX/VcgM5dO60Ou3/6YSBi/pvi2Q35Zq+z 2GKqbzKTEf0btFX+ZmiM7NE/PZrb6GI4xtpf8bm5TItzP3YYHELzH7apu/TVBj+Zmngq AzhQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lOwIOFVd; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l186-20020a6388c3000000b0056fad9586d2si12739333pgd.429.2023.10.10.16.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lOwIOFVd; 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.37 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 snail.vger.email (Postfix) with ESMTP id D4F1D8104390; Tue, 10 Oct 2023 16:34:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344181AbjJJXeT (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344209AbjJJXeE (ORCPT ); Tue, 10 Oct 2023 19:34:04 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2043.outbound.protection.outlook.com [40.107.223.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B32ADB8; Tue, 10 Oct 2023 16:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k5AxDnu0weRenwVyq3Ud+PHD7l3ldar/OvYcY82bbDrRb9qs2r8CS7Yy4MZ4PHbXTw1ZMICUs+ZW9/NpeRrLgw1R/c1iih6cGEWtro+LhHn5mXaQjSugmsRBvTb6F9GXwn5Y74jn8l02cfa/pstysl1ZLEORansN57e7aZJyfsGpKS5urlfmYKtKIYBMOWisHaMHF2t7kemS2p+d2usQmvgmAr9GTnpvsJvGVy9fkXMZVJIYOwXQTQGFTTnzZ0wOjvMEqGEoTeJen7cU5LPn8a16bw5+EiD71/rZ+3zgnf7+m6bVthGr/Ndmzfrm+8U1WTomNp8bvgsr+En9+TxsWg== 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=H+WfvfgXRMRbjdYp1Vi5GEwXugoe5e8TZLnv0VoakJk=; b=K10bAKJcdIU6yLZbQA4GC8gYEhobbS8PRiWV//JMitkaCBmNbzK22NDhhYlUiOVJK3kBKd52qConVGAHsjDGTzm50rV7MiyzQUangZzHJoXiu7DaZNrUiepyXEbGksW6QmU35d6f+/zTw9CtbYer93Mv9HKb8e2QkxXTsDq+a205LLo3I2BnFhmkbZgx6ExuRgch7Cj8H1Yvsklp8G4/RfluoF4JSrTYcq6owrYw3OayNsy+9zy2j68rnMrQ+nwTEXMIryaARj5UvAFi2AkfkCUJNJE/u3pRjAfAY7l1tlgSv2ij1AsFa3KSh2J7H27wN9tAj1DmVTh8ypxHJNiqGw== 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=H+WfvfgXRMRbjdYp1Vi5GEwXugoe5e8TZLnv0VoakJk=; b=lOwIOFVdPKTKgFN5G7QoqZsp4pHG9fSUTf5G/tMBcccHBNWSC/LM2pxTwbarCsmpO3iM1rRN5h5rsL17NSeTIHUIremKm5lRjoolpQOLOCLHMIwP1ky88H7PQAfVAycmhP89bAWTDL84xfhHeS51Pt2Eb/oJu6FfsaqgacpLd20= Received: from MN2PR17CA0015.namprd17.prod.outlook.com (2603:10b6:208:15e::28) by CH2PR12MB4152.namprd12.prod.outlook.com (2603:10b6:610:a7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 23:33:54 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:15e:cafe::ad) by MN2PR17CA0015.outlook.office365.com (2603:10b6:208:15e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Tue, 10 Oct 2023 23:33:54 +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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33:54 +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; Tue, 10 Oct 2023 18:33:53 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 07/10] x86/resctrl: Introduce "-o debug" mount option Date: Tue, 10 Oct 2023 18:33:32 -0500 Message-ID: <20231010233335.998475-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB4D:EE_|CH2PR12MB4152:EE_ X-MS-Office365-Filtering-Correlation-Id: 310d600b-cbdc-4f34-8ca6-08dbc9e95e3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nc4QAnEZYrWB8VcVqkXG04wtYezeD1yZ6B+jpE2LzyCCNJIR9X6EDG6GGHb1mo8l7dxQZnrFEtiOojQcYKk9HirB0HjVQSXQIMXOKw65PwrL8zflYD9se/TEHTJDv0L7fJtsqec7NsF0APNjMU6bEqpf47Lh+2JGvR8Zb2COqvM/OgCyNBPSazXn3a9CN2beOGJTiomoKZpw0mbRYCks8WjWsOdLub5A1WtGJgncBLNbqxgkBjgB+lAooKQnIXF13wheZr2buEJRlyiYEJ1rQ7gu+chi6vTHvIt/9Bm++w62h3zEHAfqrlx791Px/+xFlwvseqY/BjWGJUmzfzyG8Ewl0fWB4enH47yES9NTBULKKDB0u9O1lcBXJNZKkDAVuNekCzyDqVpMAXRJBp+6onQlvLiYfn3VvPzOPL/uN5oHwSP2O//7bEoHD9cRlH+Lzd3l+LqpIbieDTGfSI3rVumNeDYHEgcs7MqAmA46WTwFV1Q83Tm+sR75qXSj9mRk37GfQ7WzYq4ZCgpk0y82WGxXExBnwSSHqmKDvNs4CZp4HblVOfzIUlW5MegMaOKoyQ8Ub/hRJRfUFKSy+2Y2luof0KkA/AeA6wET1FFHgZsePEgMclIRH8xwtB1Nsv3gO6lKPaAez6zjAdVhqWXWgtlvKkTtZrzNdzamuJKb1wqe29+Csa7Fl6T0/pI0BgzvTfIV6MnCCqm/oxwWMFawUXutTD0shGkD0hQg4pi6mFQz8LO48xXjrHQDPNTSII/cdoqOSUIzlIO8/imFysGRuw== 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)(136003)(396003)(39860400002)(376002)(230922051799003)(186009)(451199024)(1800799009)(82310400011)(64100799003)(36840700001)(40470700004)(46966006)(2616005)(1076003)(2906002)(7696005)(40460700003)(16526019)(81166007)(356005)(82740400003)(86362001)(47076005)(36860700001)(426003)(36756003)(26005)(66574015)(40480700001)(336012)(83380400001)(8676002)(5660300002)(8936002)(44832011)(4326008)(478600001)(41300700001)(316002)(7416002)(54906003)(110136005)(6666004)(70206006)(70586007)(7406005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:54.8021 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 310d600b-cbdc-4f34-8ca6-08dbc9e95e3c 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4152 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413411520848298 X-GMAIL-MSGID: 1779413411520848298 Add "-o debug" option to mount resctrl filesystem in debug mode. When in debug mode resctrl displays files that have the new RFTYPE_DEBUG flag to help resctrl debugging. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: No changes --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 520a7753d829..1774f7b8450f 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 2051179a3b91..f0d135e004e2 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -59,6 +59,7 @@ struct rdt_fs_context { bool enable_cdpl2; bool enable_cdpl3; bool enable_mba_mbps; + bool enable_debug; }; static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) @@ -248,6 +249,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 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 Tue Oct 10 23:33:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200123vqb; Tue, 10 Oct 2023 16:34:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFatOn5aM9rT6IuDrXHlBaP/QVehHP5FnloakVsWkBBr4tg+MoOunEPILsY9sBKSZIRqjLo X-Received: by 2002:a05:6602:140c:b0:79f:a8c2:290d with SMTP id t12-20020a056602140c00b0079fa8c2290dmr25773250iov.0.1696980863621; Tue, 10 Oct 2023 16:34:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980863; cv=pass; d=google.com; s=arc-20160816; b=F0XvJUT/o4yv7bFNfrCqf3pPhqcnHlrDOZI1mESL+LG/h6RSEe0chWHT1U2Hh4E3oz 6tsEm6AYISqG9LWcHEZsRAAUSrh6TGfefD07d7ReeF1zu8rg0cPPygozRJZIzThRDA9o H10z4ipEvLYtMg5NAvH/6zlHsQrGI2/7zDnU79BXYSWQ2b7D/nhaH/4KkXVRlv6zqWVq YF7Q8hTa3zW+TFikq85Ox0EjQ/pQzogYd7RHaylhWR/JB2AKRyeBjPoitsjPKkoBzJnl 5j3emERZxIGQe45mfkJ0BLwJUX+YssVT2Q0P0rpduij2AGdeublRvnN/E7myab/RmmP2 T1oA== 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=akFdCl0umwGazU7ouu48BHdA5i+GpQXriOV1oTjjoDQ=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=N0jObDVtM3YhtwY7GIUaPudCVZDBoubWb7og9gEV+U1dnTpKpVDNQ2lgMzwjaeWoXl xwt/npZxbekEnRrpgI5Amok0I+e1rkxlYHpOfLqg8324TuipWu1JFwDtY4vriijjg9bT gWZtaWr30PQXX3OH+t2L2XR+u2i6/bziQ/HArFuKkmxWGpTE+xPb4gr5NaRj+6KrHy4r CwwsqK1niR6QaM+MMjTwtwcX/zHZAEHVT7fN7ir9fhkb00sUx3G4EM9dUVJZaIUt+srT 9xa2y2vmq4LwfmkwekvIrnfJOa1S7uGrefznsrreisROgqMS/x0M79M5xxZTY21q0MvG nlsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Gx2MSrAn; 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:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bs5-20020a632805000000b005859c874eb7si12751697pgb.701.2023.10.10.16.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Gx2MSrAn; 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:7 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 snail.vger.email (Postfix) with ESMTP id 8CCDC80FDDF4; Tue, 10 Oct 2023 16:34:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344233AbjJJXeN (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344199AbjJJXeD (ORCPT ); Tue, 10 Oct 2023 19:34:03 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 676F99E; Tue, 10 Oct 2023 16:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZTjmgpO6qWK1q26X5GmrcBGn3ybnlFvNDaFj8edyn/YDysue2wCRXWkmMwXMYWNq/4HYnngGqs7nlVmS+kwsmcw8iQmR2aRinoHvB+q4qzQo0iaGTA7rLlSPZPeRrjSsMJMJXvldLb+Z1UKCO3mRAB/M+Kat5THY8Kpd7if1C4kxZj98o3H8g1zgHGoNIkDQGn7H5+hfbvHNLBhupnsaRNwif8QfF5MGac5MHoUjTI6HJ9cTTA8gkvvqjGh3GM+qDqF3bAin17NNfQLpyerRGGitMRgowiikfJ+dSElUn9gS47qAKhtpFUKk4p6hqUY61QRPurO0HDxf4bn+GpojsQ== 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=akFdCl0umwGazU7ouu48BHdA5i+GpQXriOV1oTjjoDQ=; b=nxcgiDGXcVI/6HL1YR7c34zw/iw60sKNotZ9/6PdxSvP1fbwy41C9IaBJhyRR2DIgTiE/p45wbiYboYeKrS0iD2QQypPMo4CadlxoYncff2uMUHl3nFDEK2ushEjdjY9lB8YCnwOr/iO3hN+UFM/UY5tNqbAqBl7KMaqTtCDolyjFnJEw5cUPBQB1IK110HitkDl3dnNZdgBpaAFzf4ph4GzpSVnIJdOCyI2AFXe4nR4jEWA65lxGXAjLebFxvJjAiI0SnJlb5DJMY1EwsbHdZFiF93Nh8W5NOa/pVJGyqmYAgfOge06vxFfv0M+2oEWrL0G9ACHkbnAs0JOgHgyJw== 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=akFdCl0umwGazU7ouu48BHdA5i+GpQXriOV1oTjjoDQ=; b=Gx2MSrAnYQ7DXYQ8vz1n7ZoalDrUDnOI4xx9qjyFQnT0CTeEnKsEW7iSFchf13Kr4cZK9iUxjenYqKQtiX49hXTRwA3NYIdb1KUB+Tj7utyeGmmxRBef/juJf/WOX8mKbNXzljrIha8ld93AyV7JtaS76OCsXDdag4cvH9JHA/Y= Received: from MN2PR17CA0019.namprd17.prod.outlook.com (2603:10b6:208:15e::32) by CH0PR12MB8507.namprd12.prod.outlook.com (2603:10b6:610:189::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.43; Tue, 10 Oct 2023 23:33:56 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:15e:cafe::9b) by MN2PR17CA0019.outlook.office365.com (2603:10b6:208:15e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 23:33:56 +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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33:56 +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; Tue, 10 Oct 2023 18:33:54 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 08/10] x86/resctrl: Display CLOSID for resource group Date: Tue, 10 Oct 2023 18:33:33 -0500 Message-ID: <20231010233335.998475-9-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB4D:EE_|CH0PR12MB8507:EE_ X-MS-Office365-Filtering-Correlation-Id: 7580660a-f97d-4ad9-e44a-08dbc9e95f36 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QhtuF+6GzUdv6Rlb0SScBAGFJVjqtsSkQlLX9f6t0v8hWhMOe4WhiOfhDPoC6LYtcT4wwqEh6kyP/4P7BZDXQ7DgCREp//B0BeNtQ4vIvYE1iXaj3FdxC04HL2DqlM/p1dyyOKotIR81kcc+aePKDU1e54jYppQsbmK4YrQRjcapDSrkiwFVrgRoFFd8I2TUoUGPPagtIjuIuiHJt/JpX9umTYTJRFUPXn8iZd4HNiTZ+fpwF6TBFAhnWD3LvstirnJQi5ZG2DJA1IIUAPqE4ZqMO4ZRWC5kmOBn8YYUk7d1KcKQDVxnzOsBtdN0AKTPrAjcKjqOePh0ZxRAYeMbj8T2n9eJqNGuX/zQFfKe+K30CqWjjTuPuqiyVw30x/4LojrQ/blalETDK09h1sTsjv2cOKL4FjH1FVbxW4KVabgAtJKPz305UOkjbNPok3fyfqUIoSp8OEvzjlyKam7xrrqbS4fPn432e7/RDKpUVVYsSinqsLBahcxYmkwFZPHuYa84V3aZ3nSRj2SZbDnfil5wT6So2tfzZBHbi8muSGnNAmPM3SnhU4Pxiaj1D+2aXVqVF4l+WPPxIVso6v15sPf7m3B+b0vdVk+K4joeyRoG7sVrzOp+pE1EdMjwrotnsDg4NJ1cg7a6q4bwJu0hGiusk929eF+2TmA/7A8VQUhYk3KsFm/abPs5N9pzVyvHEFHHK7tM6eei4R3h3aR5PGaN17035nya5WhbR4gg1ts3CY+3a195KtXZ8hgcg9jioOTWakcYOxg7ETvKJjeECw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(396003)(376002)(136003)(39860400002)(230922051799003)(82310400011)(64100799003)(1800799009)(186009)(451199024)(46966006)(36840700001)(40470700004)(70586007)(41300700001)(316002)(110136005)(66574015)(70206006)(54906003)(6666004)(26005)(2616005)(1076003)(7416002)(426003)(7696005)(16526019)(2906002)(47076005)(83380400001)(8936002)(7406005)(336012)(8676002)(5660300002)(4326008)(44832011)(356005)(478600001)(36860700001)(81166007)(36756003)(86362001)(40460700003)(82740400003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:56.4428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7580660a-f97d-4ad9-e44a-08dbc9e95f36 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8507 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413406174169511 X-GMAIL-MSGID: 1779413406174169511 In x86, hardware uses CLOSID to identify a control group. When a user creates a control group this information is not visible to the user. It can help resctrl debugging. Add CLOSID(ctrl_hw_id) to the control groups display in resctrl interface. Users can see this detail when resctrl is mounted with "-o debug" option. Other architectures do not use "CLOSID". Use the names ctrl_hw_id to refer to "CLOSID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: Moved the comments about RFTYPE_DEBUG to resctrl.rst. (Boris) --- Documentation/arch/x86/resctrl.rst | 7 +++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 1774f7b8450f..5dcd7d250ca8 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": @@ -425,6 +429,9 @@ RESCTRL filesystem has two main components --> RFTYPE_CTRL (Files for CTRL group) Files: mode, schemata, size + --> RFTYPE_DEBUG (Files to help resctrl debugging) + File: ctrl_hw_id + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 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 Tue Oct 10 23:33:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200165vqb; Tue, 10 Oct 2023 16:34:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGbGqf+Q5jjFrAGDekZAE4Fspy5IKmMCiIuaE6q92gfjMo3drtyn4KM1STpKHkf3a0bRgq X-Received: by 2002:a17:902:f54e:b0:1bb:d7d4:e2b with SMTP id h14-20020a170902f54e00b001bbd7d40e2bmr22186838plf.0.1696980870068; Tue, 10 Oct 2023 16:34:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980870; cv=pass; d=google.com; s=arc-20160816; b=k+HKEpVwARe6cZVBbtyjAeminkqTQ6RXqMbzCQe5rb1BpttV2gd01lwKMHdqh0/w44 W7A4CZX1MQsd11oY30XdNYV5xEY5gERQlGc8SetHszM9HkWWDoXJmKHCs14zFVoJixX6 s88balUjhkMY2WQzfO+m5NYvZAumSbhw5lQvIjS1Q8diqIMPAKWYZjVlCAzQ3m+wmtEw bOp/9F1DCvR4VGtufAnmfHb4e28C9MTznkzzo+FtJLtWKsZxibeciPsNfZeCz1o6MC98 YTAWf4q7dO6iSgVyKqw49c/f39+FpCA4T9jBMcN/PQ2jTYWRaB52IqzD4AQkSLBiX5Vi as6Q== 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=6dc+oJiQA2vAp3G2TZl+W32BuVWJbjfvwNJiGkrhQPQ=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=wJn97vU+XT96QV8L5GFd6Ib4LZZgKltfu3lsPF7HLsdYtvyhkwfUFNKxd/j5TRoJur kmrW2xa/7JtYdwjh4bqupDTtVAQaEyeOyDcIHrc0TUU9ddYItRlsvEOMux1I2SNCMXe7 0JkLs9sTXhUnqLU+WsVjqLhZXGn+7UnfAGhYyWTOVucXr+eC4HL39QxEwAE6oKnaJKWF 3COQo2DVOn9E4p7T98uMnCj6VmBGRPveAfWsBArjBhfFylmsVzZpwWpBg/Q0QvRaCwN8 mzJW1TKYoEXBQH+5jjo5g8t2zWKyOZY9DAd929FjmLPBjBTxJvuyj2cLTmr0XKePTDK3 KBUw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=d676wSvb; 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:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z11-20020a6552cb000000b005849fe1d3afsi12858485pgp.847.2023.10.10.16.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=d676wSvb; 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:7 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 snail.vger.email (Postfix) with ESMTP id 2A34880FDDF4; Tue, 10 Oct 2023 16:34:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344203AbjJJXeX (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344141AbjJJXeF (ORCPT ); Tue, 10 Oct 2023 19:34:05 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2086.outbound.protection.outlook.com [40.107.237.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8611BE0; Tue, 10 Oct 2023 16:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A09/HRyQnSlBWJCexeRgVIFOXTfGQ/KTHrYWNv++ceq+zOAnEuGwDUEMk2WLlru71GJpa1CTVg3LWhk45sUpHFeCgkP7y59a49GSIHS5ab3ASp268le+2lgHs/3DhE6UMm1NNohu1PHagSd3UFdpVJytG3hYvgdSkjBYwbW75yZ3kE9AlG9PVdEuyWQcJvMCaZx7tEoYUHhDKMthlx1ATjh6oEiFKXAewrqNs806OmoeeEcygFfERaoWRDmTAYhhvGJrGmgyHFmNpJ7lyTwB0NRl8VK+zc9tKSXXzwjEXj1T8CmP4ojgA8rWO406+RFiOF1g2d3lYm5MhTyrcCWUHA== 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=6dc+oJiQA2vAp3G2TZl+W32BuVWJbjfvwNJiGkrhQPQ=; b=fWqbSBQAkMdzxLMxWZOUseJCjtd8bLgNeTBsjMIbkm8P1BO8wV4IlNREgpbdy3cvNbfNOuV83JWguzdGKiU6cRI0Ci7Fk3aLsraQ5OUu9l9xGEoeewQkXzkUuUfiZwwDdPyrWI96RTxNd5IETSO+bkgVFKcgdB60mpgXie0iHl6MkhaK8RoJUSbJUdnm3qR1noIA+soZNz3PW154UlQ7qDbQpjTE0V478HjH2Im0083QqMrCjEX0xIQYOguQPHY4KJnfTc2fyTUUnHSTmzrj5JLQ7zeAu6f+1FPqQdru3ATIKTr9bZrHfHOVkgGub7C4kqezRC3sJf9lF90GeycWGw== 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=6dc+oJiQA2vAp3G2TZl+W32BuVWJbjfvwNJiGkrhQPQ=; b=d676wSvbq+pazsBsnGz4Javt/eWUMpqC3C9Bu5cNT6W5NV4MKf/FaPSVb6dkqDEQuR4+GnlSx8FmgcocO91FUaH07yXZ6gWzUloO9xiAJ3b2vEKkOFOz5dqh05FKgblpcgAiz49nSWItf70fQzdyOfKIMeU1kjVhlgb0Ev+NToQ= Received: from BL1PR13CA0449.namprd13.prod.outlook.com (2603:10b6:208:2c3::34) by CY8PR12MB7291.namprd12.prod.outlook.com (2603:10b6:930:54::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Tue, 10 Oct 2023 23:33:58 +0000 Received: from BL6PEPF0001AB50.namprd04.prod.outlook.com (2603:10b6:208:2c3:cafe::21) by BL1PR13CA0449.outlook.office365.com (2603:10b6:208:2c3::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.23 via Frontend Transport; Tue, 10 Oct 2023 23:33:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB50.mail.protection.outlook.com (10.167.242.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33:58 +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; Tue, 10 Oct 2023 18:33:56 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 09/10] x86/resctrl: Add support for the files for MON groups only Date: Tue, 10 Oct 2023 18:33:34 -0500 Message-ID: <20231010233335.998475-10-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB50:EE_|CY8PR12MB7291:EE_ X-MS-Office365-Filtering-Correlation-Id: e26d3233-126e-4de7-42a9-08dbc9e96038 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nJ3Lfg2BUiYtiOL5R24wsXiCEamJBlLCMue7S1a0NXcy9/Oar0KZb22bCPC0aA+dnuIOdbe7TGFFOB48Avu2rw3udMza4lKgDpRVGzGsJdGQIGFrYyXQzrLPVu+p8+uYv9560IRSiP3jefQhFCZ/byL3WTFpWZqpNkYOaLat4gdZNSGgk6H362uSLHlmrgqf3CHTkx5J8k9wMlXzk+EVOwv1l5ABrrPHBIHzXBFWn6Uj6J/YDPSpw8p8OBW83VA6Azv4E+5KT0eUGEkiBCkYP35ETq1gVCir239xu5mm6NuIkf3khc7zJ+LcEMAKFN+nS2Q2yTfbQ0q8ON/vO/NryhMAuIi9lZvzTM8vt52soBfOZhsKT3krhgn2Ae73e1nLfHdfblUhd0HyBwdbh2N9LKKfkjmYd8D3rC/S/2Vc+Njy61nEzSXVbuSh2GR9XK859/B/SFTu8pHGMHb+IuOvdFUxYYVm8zyAnXGX9GmwkMoGqkxl4lmL3K/R9Aur5vrMmT3UOT5LRpG74p5TEq6zVUb7Njkd34cG0UsgiZSM/wa3HcAx2fsNwBoauIW89vA3j1dKHvOpzKTDIZ7NeDW2cCAFBnxgvwgDxEfNGkisYGwRvvJIYLYGVOn/NJY03ZTYtLLFo4c37R5IcgL9aauoM7U//i0CWtLFot5tAzqUfVBYbesYs0zmlq4tkoOt+7dB1cyhG6t2dye7wqjy4JRfikKoIUM7854Vp+8LVX7o2+08IU9pRihbondoLRx7rD2gOqRsaE2cNZ6NzjTf7xS12w== 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)(346002)(39860400002)(136003)(230922051799003)(82310400011)(64100799003)(186009)(451199024)(1800799009)(40470700004)(46966006)(36840700001)(426003)(1076003)(36860700001)(16526019)(66574015)(82740400003)(478600001)(70586007)(36756003)(81166007)(7696005)(54906003)(336012)(2616005)(83380400001)(6666004)(356005)(26005)(47076005)(70206006)(41300700001)(8936002)(40460700003)(7416002)(110136005)(44832011)(8676002)(4326008)(316002)(40480700001)(5660300002)(2906002)(86362001)(7406005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:58.1294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e26d3233-126e-4de7-42a9-08dbc9e96038 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: BL6PEPF0001AB50.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7291 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413412889487726 X-GMAIL-MSGID: 1779413412889487726 Files unique to monitoring groups have the RFTYPE_MON flag. When a new monitoring group is created the resctrl files with flags RFTYPE_BASE (files common to all resource groups) and RFTYPE_MON (files unique to monitoring groups) are created to support interacting with the new monitoring group. A resource group can support both monitoring and control, also termed a CTRL_MON resource group. CTRL_MON groups should get both monitoring and control resctrl files but that is not the case. Only the RFTYPE_BASE and RFTYPE_CTRL files are created for CTRL_MON groups. Ensure that files with the RFTYPE_MON flag are created for CTRL_MON groups. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Ilpo Järvinen Reviewed-by: Reinette Chatre --- v12: Removed the comments about the later patch. The text is moved to patch 10. (Boris) --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 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 Tue Oct 10 23:33:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 151051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp200195vqb; Tue, 10 Oct 2023 16:34:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFk3g53b0NOu2CPeJvvkwBHZO2RBrpoSOEPkg381NWmOR/WHTQk0gR/sdJhMyQM1X3WLCac X-Received: by 2002:a05:6808:1590:b0:3a9:f25d:d917 with SMTP id t16-20020a056808159000b003a9f25dd917mr25374234oiw.4.1696980875900; Tue, 10 Oct 2023 16:34:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696980875; cv=pass; d=google.com; s=arc-20160816; b=mv4u1OphQWM4lwKKA/WYZd1NFKAmq2hNM1tyIpd1/bVKV5IwV3D4caLqppKKcx/Ew/ yS47KGPeKaZihcxyhaV8Pk/uSCDwncht12VY8h2csouVxYCTdoiJCIUzkSEnNg49wJ2O 29Hta08T2c06umC+EPNDY2gNLdCh7iJToQWR/EVcZraepjlaBcBg1hToiJZt++rRglgW lb2PpTrMU9+LRX2FMwqCUohNEMRiYAvjDTbTb7hTFjVDFuThkod9zK5G+tlTluCm/5/U O7hGL65zy93+a3ymvuUf46uO0VR7uYslARY+KmzQmHIw0L6PNaPcPXRJ9qHxKLCQS73i w/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=wmaph0uUsn266K3VN15HgWwURdzFPwcIi3WSSi8E0hg=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=AM5ncWYyme1Gf7PP+4Y2o6aFMSB/kAxbfbW6XSIBS6k/E39Sd4I1c79QZPECpVnPpb fFjn0L9xnCcAPUtpIeEWMvmRu5rAcELOkDldxEcS8Efo4pTbnp994J5z7sj5BDSLuTms u8Jrozgdo91aKk/DhzLqxYJ+J/HADguJ3cO2cToQ64HfUUflLSKMSvRyoMJbp4r1FfB7 bnbjlybpfYQxAKnMYz1q5SveK4+7GVoyI7B9XXxpLy13GmW3gbgpbftTHCP67IMSu7iS Z0kAe94HlHWA6XX8luCvqPMevSLTyO0TOaeMuLWPXrLE9+tY8Dao70W5rPY6RcIG8uIi wJBw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zEkP4sO2; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y7-20020a636407000000b00580e32f7793si13126015pgb.151.2023.10.10.16.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:34:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zEkP4sO2; 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.37 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 snail.vger.email (Postfix) with ESMTP id 3778A810451E; Tue, 10 Oct 2023 16:34:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344255AbjJJXe1 (ORCPT + 19 others); Tue, 10 Oct 2023 19:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344147AbjJJXeJ (ORCPT ); Tue, 10 Oct 2023 19:34:09 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88AF810E; Tue, 10 Oct 2023 16:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bm+xJk6NwfS/Y7W1kVpDI7MFnWuEe6dZ1fEAn+FLMCoQmEpzPijZk3f0e2zLqXxJYv3Xmq51W4MeUTxVVUq/Uurv6psZjNxNODweuM1xA/V7456PyUiFmMHf7w8HwhtLPhNKpj+bxOjUnsvRzzmwJc/I22mwSH7iJDbco13wJgrVQGwX3FVziKlRq5uALyBLHusKml2PqZH7HNFjsuBX9OHmoVUO8wE/2IpBBMTJ/feMCmGeB9YO/sJyHNSUsA9fTt0Xix2zj93VJpo0p7pbsB1z+sS+5X7U2vbIyzKbtabWEgI2Y0W3aIB3Sg4lmi0h5Fc5rw3murr1nmq/omXZog== 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=wmaph0uUsn266K3VN15HgWwURdzFPwcIi3WSSi8E0hg=; b=MP9jZVeDF7MIWgl6kZPpTDb85dVJuyj0/Dh25D2QcTw5X6csxngcLiW1eKHbYsn2p4saFjFiNg6v+ik7y/EX8cHDt6O1WisA3m6yjQzHJnwmUQgyeZxevhVljgIVzx6AZVuoX8lL+G7Xpls7J7cjZS5MlYlHxZ+FvZfpJ8E+r30pwFEKCaS9de1Bne7ZYsvxpyUAph/TbEo0sjdsAMpR2u18EM1KRR7WE4HVeuAyDOkvRaTDuBS8L7aUNlmmUb1HwAJjPJWnisK+Mea9lsKoTd2B9adHetm5lLvMUztrEZTQiiott/AXiSFJsL7O0BrlrWQj0G3uc7Cy30cvUoMrGw== 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=wmaph0uUsn266K3VN15HgWwURdzFPwcIi3WSSi8E0hg=; b=zEkP4sO2tRXZuawc8lywSGWSFQp/EuJpqKLqwz0Nr7i2NGDbsjVs9YzmjRrS2dAyKn7RAWHaRt03YMEaqgyVactGjPGtx4/Btby4ZwN7nnJG9mcXYSThrkZXfhfwBKgkV8NaC1SbaxClOxA2oCiHbVPvf3j+u7GhbxwfAKcHofQ= Received: from BL1P222CA0017.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::22) by DS0PR12MB7946.namprd12.prod.outlook.com (2603:10b6:8:151::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 23:33:59 +0000 Received: from BL6PEPF0001AB51.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::d6) by BL1P222CA0017.outlook.office365.com (2603:10b6:208:2c7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 23:33:59 +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 BL6PEPF0001AB51.mail.protection.outlook.com (10.167.242.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 23:33:59 +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; Tue, 10 Oct 2023 18:33:57 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 10/10] x86/resctrl: Display RMID of resource group Date: Tue, 10 Oct 2023 18:33:35 -0500 Message-ID: <20231010233335.998475-11-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010233335.998475-1-babu.moger@amd.com> References: <20231010233335.998475-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: BL6PEPF0001AB51:EE_|DS0PR12MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: b587c890-9256-4c89-ab08-08dbc9e9612c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sm9w+nekjc9rNYc7jdqzRp5EAXGzw0t68uAIUOhO6ksx0mUGtRjGhSYYGoEmGIZPF1M/+opBVyZcvpNbZQR8T8ry+XbdJ+L++zxaNy83pSoRmy4Dp8LTBNh/BEbx1sFmXyjALmNT6f7ZSi3cDa4VdUsmVK9wEnykYRpItcjJGxBECKcAd3dhfSOxBFIuMSnX7TjBEZ4JG/VbN9C2dEQQi/+z9k60xQMXpPqELyRpziI7CxmDML04MP27DjwbvGzZbune8IAGB9wsM1BucoZk7gGVxjDwQvY8Xkvfu9IhT2Qs3l2xUBNLlur57sf2B4dfZqy2+9PtI0EFJDvAf8Yh4K+5epgxTNvd9hZrzwngEH5gXC/x/Uqt1oI1dIkEzO6Xv7i3qsIbIDGfGYOe+sfklIXBBlV5/tg6hg55OKYnlrtfuK2JTi7PxXDMscq5HE1zr0gu6+ZHklj3fuUzbfLT4e9Cr0bp6DhOuXtytWXAhHtybt/hhHeAPr1qHtfgfVxY6IiI/ls2yGaAIiPl0cjjSKCk9QrNWRT/GjwLI7gxNG749BdD5+7lsE79mynGUac6XtRnXAZs1QKIRJHYxaMeCgP+FeciQCBu+/nyP61WiJU6bsnfKeWw/T2He4ouCBQT87rxzLZD89THh6KCPRwnWU7hNT5QkIsRmDf/TzIkD/Rx9JFSD4kmq1EmZixnjjMfi1EBUPqRtm63PjK++SrMqxnUlSJ6ZzLOIbALrZIdctt7cJmfaWS7lGs8fVaLXBnzbt9IFO8g+SjU9NdWJHh6+g== 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)(396003)(346002)(136003)(39860400002)(230922051799003)(186009)(1800799009)(82310400011)(64100799003)(451199024)(46966006)(36840700001)(40470700004)(40460700003)(1076003)(478600001)(7696005)(2616005)(6666004)(47076005)(66574015)(426003)(16526019)(336012)(83380400001)(7406005)(7416002)(2906002)(44832011)(5660300002)(70586007)(54906003)(110136005)(70206006)(26005)(4326008)(8676002)(8936002)(41300700001)(316002)(82740400003)(36860700001)(81166007)(86362001)(36756003)(356005)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 23:33:59.7312 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b587c890-9256-4c89-ab08-08dbc9e9612c 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: BL6PEPF0001AB51.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7946 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:34:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779413418829879092 X-GMAIL-MSGID: 1779413418829879092 In x86, hardware uses RMID to identify a monitoring group. When a user creates a monitor group these details are not visible. These details can help resctrl debugging. Add RMID(mon_hw_id) to the monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Add RFTYPE_MON_BASE complements existing RFTYPE_CTRL_BASE and represents files belonging to monitoring groups. Other architectures do not use "RMID". Use the name mon_hw_id to refer to "RMID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v12: Moved the comments from arch/x86/kernel/cpu/resctrl/internal.h to Documentation/arch/x86/resctrl.rst. (Boris) Moved RFTYPE_MON_BASE definition here where it is being used. (Boris) --- Documentation/arch/x86/resctrl.rst | 9 +++++++++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 5dcd7d250ca8..e89b889980ae 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. + RESCTRL filesystem implementation notes ======================================= RESCTRL filesystem has two main components @@ -426,6 +430,11 @@ RESCTRL filesystem has two main components --> RFTYPE_BASE (Files common for both MON and CTRL groups) Files: cpus, cpus_list, tasks + --> RFTYPE_MON (Files for MON group) + + --> RFTYPE_DEBUG (Files to help resctrl debugging) + File: mon_hw_id + --> RFTYPE_CTRL (Files for CTRL group) Files: mode, schemata, size diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index f0d135e004e2..714606275b98 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -254,6 +254,7 @@ struct rdtgroup { #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) #define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) /* List of all resource groups */ extern struct list_head rdt_all_groups; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 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,