From patchwork Tue Oct 17 00:23:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808600vqb; Mon, 16 Oct 2023 17:23:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAGE5KfLDOuU2QIAI8sNxDEKbHZxkFsYXwXu9pJpIkYyyVoRM0cysAj1s4w2mqTQqsRYzm X-Received: by 2002:a05:6359:3118:b0:166:d9b6:1db3 with SMTP id rh24-20020a056359311800b00166d9b61db3mr660070rwb.2.1697502229234; Mon, 16 Oct 2023 17:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502229; cv=pass; d=google.com; s=arc-20160816; b=hY7UyiqMuzl91S4q2WDd9hCTrjBGChIuOaMwKDNkX0QUqxP1zqYekt6chPC39kTBLf K5OJPbxzHnWwLmaE4i83k4QKmyfyyN3zw608xS5fpJ2DzqVQupq/RgvYDa6RLursDD5q 56h+8S4K1750WpAkzhyipliIxk+BMiBqzovNwfMNWiLA7t0OU9hEDzGL1grx+U2AwztD 0yopR8S7HQJexrLa2PQn7xtjiuGZxM5vBnBglor86mjOrLqgVtOeIu3LDnXeRP1HxKDW kzUR+Y8F1MnMf4/cndYBlRZWwhw8hgqTEsWQiyymXDHIqxHrcD8O2H6rF3xB1FNT4s09 pXWA== 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=rnFdzXUk12q75LojiHXfoMRT+bFDwETuo3qQ8MWElYM=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=PJNBENnFkIpXzPPVvuyifDftNWTRlG50+/Nxg4rcv02HsaSFMC3SJd+pwFx9LdGdDd MeMa2xm6uNm3biM+2PI1Gtm42jEiv5aS4YxXKOofBewCXSOX4nQdrORkCNxwLK/z9Y5/ qSbbL4WsRyqSN1FgauNitEAZngOUNtI/kAFS332vTm3n2bDqIFc+KmE9ugpNn4TGbaYE mtLjMS9WbOunKGopXbe2B47tAC0b9avzjpbpYCUo/CfCHuownP1whQmYLTHHOWr9HfhI WIPKk6ku3Wh43UbrDsqhTjDzy8V4ns2clQ+Ot3ykEr9+NhdxdF8zGtI8rO/ZMTgHEhfB eSHw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=cyAQt7Ek; 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:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g3-20020a636b03000000b005859e8c7c2dsi455938pgc.639.2023.10.16.17.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:23:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=cyAQt7Ek; 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:6 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 pete.vger.email (Postfix) with ESMTP id 0804E8034A5F; Mon, 16 Oct 2023 17:23:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233353AbjJQAXY (ORCPT + 18 others); Mon, 16 Oct 2023 20:23:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232096AbjJQAXW (ORCPT ); Mon, 16 Oct 2023 20:23:22 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D910092; Mon, 16 Oct 2023 17:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=In7HcEbeaDXpVR+dqxitQ+xEnwaE/lWckffF77xB53hj2v5pQm/DzZSqlBc/OqRk96gjJtbzgRwHQeSDTFzFsWbFb+ppGORWxTAs+X7WaTptDGG38NwLVB7/bRPE7i2abAXoZ82tq+7ajTsyNpC7/ZbaE9lWIBEFsMKBQEjbtq37MyCJtyBM7qjBL1JWlovYnqgph+Y7oS0oNLjNWpxIh/atP/Co0pCKWUuDQV4cELctznciZAbAlEfCeHnoB+vtqlWH0oLatLhVyxWD5Blo82wZIo3pdrus8LBwJ/wlUTspvYd3wVPHHKQh94tcDwTpGE4v3q3sBShB/8KX63sFlw== 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=rnFdzXUk12q75LojiHXfoMRT+bFDwETuo3qQ8MWElYM=; b=Uk/ZbU720frifoekgHi3GjXPCO2iRI8seG+wsUu1ce5VsYah1eEdC/zALsenlTJhb6VSDIEk+uXBTBaccgecOG5qKeMDLrQAghvTmibnkfKFJrK2LFOgTgXpoThcd4Hg4sZbXa2HVKHGaqo4N9PLfiOZEl6BQ6rBFB8gjAkYptQTnikKow7LKU7TULNIO57WvT3D3aJ1cCyVjFsiX4a6OFsD5zBPykNowkzIFUQGgAg7IrM+Amz3vQ1r+BC98F9uhh5xK9Q1Dwq2ddhgqeq2exsAlcmF0a6PU31a69eA9/cVYHpLn8sDk8b+b9DCmqFWniErrY8MBavuMq3Fg7k3CA== 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=rnFdzXUk12q75LojiHXfoMRT+bFDwETuo3qQ8MWElYM=; b=cyAQt7EkHSxY4EwOBHzICGsZFcKgCz/RCzv+ioERG08uO23pJDk1xgcuvEugpDqHg/GYpd0/YeIx1MLZXwR6GCymIIfEW/lLtviBGv+HODX2Kgce93S3ubjfl9B/bLUDbKLjHpv/N9NtaYMcwFqriMSElU3Pg9Ss+DpRHR2ohB0= Received: from BY3PR05CA0033.namprd05.prod.outlook.com (2603:10b6:a03:39b::8) by LV8PR12MB9271.namprd12.prod.outlook.com (2603:10b6:408:1ff::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Tue, 17 Oct 2023 00:23:18 +0000 Received: from MWH0EPF000989EB.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::c4) by BY3PR05CA0033.outlook.office365.com (2603:10b6:a03:39b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.17 via Frontend Transport; Tue, 17 Oct 2023 00:23:18 +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 MWH0EPF000989EB.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Tue, 17 Oct 2023 00:23:17 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 16 Oct 2023 19:23:15 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 1/9] x86/resctrl: Add multiple tasks to the resctrl group at once Date: Mon, 16 Oct 2023 19:23:00 -0500 Message-ID: <20231017002308.134480-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989EB:EE_|LV8PR12MB9271:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c0608b7-661c-469d-7e15-08dbcea742da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IJEh2NOUc/Mm7acKQKzGMQRBr8qI1BP9zkKCg31CrrLz7szVVN9U0KtAlPICWLAUqu8E1u5G8jy/luAUxBY8bSEPF3BFcf8LIHeCRs47SXxJnjVaubrkejML8MbdjWX1VRYHczk7E8vK2ltjTn6oIQWbb7XaNIU1AkZ6BxHOwzbJmy5hF9BA3oN9ytQhMAZbhir2rgQwpluopAfWxx9GAHtzC203xZsvNP0yB/zaxFh+nWPIkz9iY7AyYW8EfCFvQUar1a5+OEEBKGfq6rTfhlLf7rqHWwf2Zclbf5rD5kWa+R/3O5j0abmCXuu2loGz+w0vw0kp0LskZvIju/hVmrAbHVVMYA0mnhjyywa8jq7ECT/P0eXSo3yX9WzsKW2cv7Z16EDUmeOZ7gfwKfYqLBZSN3SuBPbb7Xm/wtAtaZ++8I4XNrPyMC3sCqUGIp9gx6/e732V8juO6v5ZhzJskRPWN0QKkyG9tljRx412+pImiKGahHEab4ykYbx3/s8gELzxcUb1vuL1fYdfqt9wr31xXZp1sgC+KPhgL/Pg3qzeqTcswuRZj+J5H5AI+a5O/zVOzGcDs0ItnxH5RAdCZLp0XOwck36Nd/Ced0LcMdvxFjFmw6px9CLKrvcMdxNFo59CJaCHHhy+saWomqcgzitjqVlkLjMe1/dy7wgDw4SyHq0z4eHu6piqNpbkhXs4pvi7dd/3uQbID+9+TGTFRkxbgi5scOQh/QgtKu4A//gTOsZ7F0tl7n3yL+Qx76frlEw71E6KdR6snGPQK1r8Ug== 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)(136003)(39860400002)(376002)(230922051799003)(82310400011)(451199024)(64100799003)(186009)(1800799009)(36840700001)(46966006)(40470700004)(7696005)(40480700001)(5660300002)(44832011)(66899024)(40460700003)(2906002)(1076003)(26005)(36756003)(36860700001)(2616005)(426003)(336012)(16526019)(6666004)(83380400001)(66574015)(81166007)(86362001)(356005)(47076005)(82740400003)(7406005)(7416002)(41300700001)(316002)(110136005)(54906003)(70586007)(70206006)(8676002)(4326008)(8936002)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:17.7970 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c0608b7-661c-469d-7e15-08dbcea742da 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: MWH0EPF000989EB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9271 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 17:23:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960097432161371 X-GMAIL-MSGID: 1779960097432161371 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 --- v14: No changes v13: No changes v12: No changes --- Documentation/arch/x86/resctrl.rst | 9 ++++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 25 ++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 4c6421e2aa31..178ab1d8f747 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -306,7 +306,14 @@ All groups contain the following files: "tasks": Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the - group. If the group is a CTRL_MON group the task is removed from + group. Multiple tasks can be added by separating the task ids + with commas. Tasks will be assigned sequentially. Multiple + failures are not supported. A single failure encountered while + attempting to assign a task will cause the operation to abort and + already added tasks before the failure will remain in the group. + Failures will be logged to /sys/fs/resctrl/info/last_cmd_status. + + If the group is a CTRL_MON group the task is removed from whichever previous CTRL_MON group owned the task and also from any MON group that owned the task. If the group is a MON group, then the task must already belong to the CTRL_MON parent of this diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 09848ff11f7b..fe239691628a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -696,11 +696,10 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { struct rdtgroup *rdtgrp; + char *pid_str; int ret = 0; pid_t pid; - if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) - return -EINVAL; rdtgrp = rdtgroup_kn_lock_live(of->kn); if (!rdtgrp) { rdtgroup_kn_unlock(of->kn); @@ -715,7 +714,27 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, goto unlock; } - ret = rdtgroup_move_task(pid, rdtgrp, of); + while (buf && buf[0] != '\0' && buf[0] != '\n') { + pid_str = strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_printf("Task list parsing error pid %s\n", pid_str); + ret = -EINVAL; + break; + } + + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d\n", pid); + ret = -EINVAL; + break; + } + + ret = rdtgroup_move_task(pid, rdtgrp, of); + if (ret) { + rdt_last_cmd_printf("Error while processing task %d\n", pid); + break; + } + } unlock: rdtgroup_kn_unlock(of->kn); From patchwork Tue Oct 17 00:23:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808645vqb; Mon, 16 Oct 2023 17:23:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeHDolhzgBr8Da5XNLcCGLwqYdyVAySjB1V8F0B813DoxBBBF/4dzmjgmUEFt0pDqzjn/+ X-Received: by 2002:a05:6e02:2145:b0:34f:7ba2:50e8 with SMTP id d5-20020a056e02214500b0034f7ba250e8mr1089692ilv.2.1697502234563; Mon, 16 Oct 2023 17:23:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502234; cv=pass; d=google.com; s=arc-20160816; b=Y6eUpsGBR030KQo9k0MD+aA8I+xrz3tpSUOgDK+KWbCiK0WWERvFkStjOPCaqJ+68x Z+67VIUj7fxaRWTx38lpnTLTFISX6ThoEUijREZgXLDP/9GXWxXBk9ki0/6eN+JJELKe prACCLefR8YgBZ2cVeDBur47+ieXESUuHJjJAd+KNUFkoH4+90abhlAcHXr2ZirulMY8 UOaxjm0+f8MTrTGRVXebQkswdisbxxYkW9RkCJatMHX6FR/FaZnGOWLvimSRXxr09I7K c0YwLqq7QTJ8PYeLSr6trJdhGCPAAfsoH10DAYBzPK+CyXBzQPjbN7e/h0paidbS1+AZ h9aQ== 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=XF+IxrRzTEaApog8qp4T7XQxXW+R06Y7lOOfLGdASjQ=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=A37ENgCEEEGKZj3nsLT54+FZCnYC6rEiNYhVRUK0dI7HkjIm8Z4Rykg9ZNgb8IJtY1 Nksby/7yEvt0XZ6RHenOsPPU0TXmSbVJZlJMLWf920FqN9eqJmvr65oBmiPlbYhdHnTt 7wu9hrsAwLeXG/EXR5df/vNnKfagrHIAyvQ05nF/KJW5o1vmVZxRop5Q9xDbukeXntt6 aqtxdo1VAQXABPqkzHDDlljwlehyw/02lEifjTgCEcnPdAJNYzALp7Q5wNCIofEJzDrz llvh/Ofr1ZF2mb9DPuHG/v47bKw87X4sq68l/k91JdumIqKwvn65lB/plfslCNgU7qoI GjGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ma7tJAXu; 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.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id x5-20020a654145000000b0057777451a91si477239pgp.581.2023.10.16.17.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:23:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ma7tJAXu; 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.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 451A08042D09; Mon, 16 Oct 2023 17:23:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234169AbjJQAXh (ORCPT + 18 others); Mon, 16 Oct 2023 20:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234112AbjJQAXf (ORCPT ); Mon, 16 Oct 2023 20:23:35 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2055.outbound.protection.outlook.com [40.107.92.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009E3EB; Mon, 16 Oct 2023 17:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EHM6pGnZNBW4E/lFWUUFn+g5gudDmh5MFBLbkn9fk4cB+rz7il3Or8SuJ44ZhvTdpnFIeu4/4a/n9eYeXk8v92Q+E9pHLBsmYuqbT8ERlHba7JBd/0OXJE41P4I+yd0U5HEGpRPWrtpl8RflW32fNrlKEa4IKVZmzvEj7SEU2nbXe4M7XDwHkDSWsLgqQ0vYSWTYVMubZuqTojhbZ82A3W7T9Oo4AuyB0Fv4SuDfbKmqFUL444viUEpm5Ohjxguea/m1+X5GbQ9eH/Q5A9UrNqD7eiy4Sm4mLoqTsY+G2tXsy1nckSi9eB9PBcHwQdZ86yaGTufqreGJ+ljXWggBrg== 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=XF+IxrRzTEaApog8qp4T7XQxXW+R06Y7lOOfLGdASjQ=; b=b7wc1M/ee/uQ50KQlwdlAN1GdWnUyZyR1/XrHQB8zn58aBkRc+S8f4XhzXbS+xRJ2q4+UucB+rFilStfPqT+W66ijh4VRCbJ/q0U/CC3dm/PvhkVUjgbNE7XLNTTxyTP+ldlrCZg/3jLLT1XfTQARpsZjnhbavTebgdR15JGILd2P32pmK4hobX5e4DU7uStFYzc9MezovPbHeblE/hxgjKhYEgUw3auGBJFuS8wZ8FfVT0k8NZUMsDtuhWPRJGs9lnsE2pF9ACM9auuhs1jlpturocZRULQ+iPBQP/2CVcDrW75rIMX5ypvrvF00tSbuVIGZTeUk8wzFoJoZG93Ug== 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=XF+IxrRzTEaApog8qp4T7XQxXW+R06Y7lOOfLGdASjQ=; b=Ma7tJAXunXtevuWMwho1cg4qqmn8OKLdKJCn6TWWZtb2S4n8GQ63UpP1x7BTsI/LAw+FjRdz5PnatXSp3odUuQybJbcmULRox+sD8Ta/xa9g6C8k3Bjt+zloPHK4HKCc7Mmffua1OISwfFLWzs8qUQ+tCkcGKEwIO5qr5w0XetA= Received: from SJ0PR03CA0151.namprd03.prod.outlook.com (2603:10b6:a03:338::6) by BY5PR12MB4210.namprd12.prod.outlook.com (2603:10b6:a03:203::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 17 Oct 2023 00:23:31 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:338:cafe::5a) by SJ0PR03CA0151.outlook.office365.com (2603:10b6:a03:338::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Tue, 17 Oct 2023 00:23:31 +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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) 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, 17 Oct 2023 00:23:30 +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; Mon, 16 Oct 2023 19:23:17 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 2/9] x86/resctrl: Simplify rftype flag definitions Date: Mon, 16 Oct 2023 19:23:01 -0500 Message-ID: <20231017002308.134480-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E7:EE_|BY5PR12MB4210:EE_ X-MS-Office365-Filtering-Correlation-Id: c3eb1a6c-9336-421d-4aa2-08dbcea74a9a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JOum1AUtbIB5MU/0/SSefGhWfqvTF1tfvA9uomoAC25gccnj9MfuLTZnQ9YHSYGPt+r4VnewfII91oKzhhdyDHCfpbKROxfIWrT/py5CTReZTSZoPdHrjLQOrZSwVL4FFwiotDEepI//ftd9OmEi3YZcaHzDj7PKqjcozZm9EeFu7Crrfyt9zNZvgEQdMZTWERi2yhpPKgtUBAJ3NTVhvYGNzBFC+Yf6+5LKtHt04QTsFkZDOLNb+NectkpiXE8Imv66A7k8Y7ozvbaslMvNw9a8C6h3u9qEpqu4IgSFERIvSPwHygFIt8qg4AxPjORbatVzF1JxErToP1eyqZE0Ls6ZuS30zxd301EafZjVaWMrLMofZDXfrHcvOqvHxAPhiWDOcZKpnt6Ov5bcgvbD/gKvefyDoilFG+kMwzjU0DRbAcBnaz24w5+zJJJv7gSFdjQL3MK+JHV6OGtl2VBd4bvSQ8UTQN7PwodQUb881JAwQ6spPtzqa2yFfXssLSSyRx2S8veRFY/Ep2rH7+PaL+XTCbpUEVeedyjwspuyHwjISxgWPtkiGB9yOIzFGwTHTSMVW3I9ZHEPqyUDHwnrSrj72K6U0oVB9PgB8MmLusldqqUI5abAgs6JVud8bU3UnuL1CJlTywebssE/s2ufQw/O9LEke7plm2tolsPykiBzgfNSOPjTyUqpp7KbHrCbG3MNBa5IjKjV+jq4JKzzG0a/5MM8jurpHAT+CCmxQZaONk9W1X/WctG+OiWAxZWooARFDheOFHyBC1HCgdzEGg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(136003)(376002)(396003)(346002)(230922051799003)(64100799003)(1800799009)(82310400011)(451199024)(186009)(46966006)(36840700001)(40470700004)(83380400001)(40460700003)(40480700001)(426003)(16526019)(336012)(1076003)(2616005)(26005)(7416002)(70206006)(5660300002)(316002)(110136005)(41300700001)(356005)(47076005)(82740400003)(81166007)(54906003)(2906002)(44832011)(4326008)(8936002)(8676002)(86362001)(6666004)(36756003)(7406005)(7696005)(478600001)(36860700001)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:30.7824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3eb1a6c-9336-421d-4aa2-08dbcea74a9a 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4210 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 17:23:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960102899045185 X-GMAIL-MSGID: 1779960102899045185 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 --- v14: No changes v13: No changes v12: No changes --- arch/x86/kernel/cpu/resctrl/internal.h | 9 +++------ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index c47ef2f13e8e..0ad970c5c867 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -243,12 +243,9 @@ struct rdtgroup { */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) -#define RF_CTRLSHIFT 4 -#define RF_MONSHIFT 5 -#define RF_TOPSHIFT 6 -#define RFTYPE_CTRL BIT(RF_CTRLSHIFT) -#define RFTYPE_MON BIT(RF_MONSHIFT) -#define RFTYPE_TOP BIT(RF_TOPSHIFT) +#define RFTYPE_CTRL BIT(4) +#define RFTYPE_MON BIT(5) +#define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) #define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index fe239691628a..09141f1f0b96 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3260,7 +3260,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); + if (rtype == RDTCTRL_GROUP) + files = RFTYPE_BASE | RFTYPE_CTRL; + else + files = RFTYPE_BASE | RFTYPE_MON; + ret = rdtgroup_add_files(kn, files); if (ret) { rdt_last_cmd_puts("kernfs fill error\n"); From patchwork Tue Oct 17 00:23:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808643vqb; Mon, 16 Oct 2023 17:23:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8xtm8rSjJdp6ayo4YmO65cI8zCfWk/9e+xrVnGO6705YJd8qiRpwVNH9t4Gy5eBelmenC X-Received: by 2002:a17:90b:3eca:b0:263:730b:f568 with SMTP id rm10-20020a17090b3eca00b00263730bf568mr763167pjb.3.1697502234472; Mon, 16 Oct 2023 17:23:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502234; cv=pass; d=google.com; s=arc-20160816; b=qmX9ljU2ECe6gDRB+oh6EWkkDcgvpkhB8YqHcQ86C+gOCuPK1Fb4IujMudmqFcg7E/ q/w3V9YFHIQyCljCxzE58GoJyIc7VCMbSpkFLzKEHl1CRPDBy7U4haxz31KEA1F6T1f3 V5GfhRe28GMEwvDZRz2pJ/gzDbe6eYir2ssfSpP9LWDrziQ6n+89BKFSBm/29Lcjm7JP /VZBwGRotRd2dsCcx2cdJAf4/oDf31xeC+Vg10KY7bixobSHQkGxf2EkYk3t5uC4uJ3b +Ifl6W722HxJ9T4JuheQcHqIzLcQ+gQDaewaRMgtlGLbkkNQJXMEhCp0nSGSezCpgZcX DoNA== 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=tjTqRul7g52Lit8D0tY2rSL3yj5DF7yKxYQd3xtic+0=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=1IJXGgPWXa0yx9Uay20m2HZvejgIIe21Q/vYEJdLFKheR58mxUEjRGWxchFLSk3RuO Q2fHyZ2mlTC0YMBZMsPcrIub7PA5it3nZl5jgJTJJqyp1TNz986TeWtrr5KGM4gUM8Xe pXUPCrkTvXH3UF0aWZFCfc4g91m/lD87k1/K4mYUl/sJJcy0VbY50EuKkEnRxg8RB9ZP Lk7iTO4Tl/dJfjV1QHW39tU57tNlBtiTklACmPDQbwHNWw9w0XfjOvWnEs+VS/P0Q3Tr MeNNkmOusfMo1vxk/Thp4DJsHPnXvkiJ+26KdUi60+IVslyRnNV5pqqsvIwQgUh53x/q QasA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4L2XoLxi; 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 pf17-20020a17090b1d9100b002790e9120ccsi7993469pjb.61.2023.10.16.17.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:23:54 -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=4L2XoLxi; 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 7AA8980236C5; Mon, 16 Oct 2023 17:23:52 -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 S234276AbjJQAXr (ORCPT + 18 others); Mon, 16 Oct 2023 20:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234233AbjJQAXm (ORCPT ); Mon, 16 Oct 2023 20:23:42 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2089.outbound.protection.outlook.com [40.107.100.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F2EAB; Mon, 16 Oct 2023 17:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OwjOtCTVqUtEsX5veLDRY/CX5litQu1V0eeHA+PKaWIupWRqi7ozbmIU58C/PT2vF+VsuUK1kWxrU5rcH69IX3UuqbPrBepbJK9Xn2ulqGJgqPa3EZCDey2SY4sCB/b+bNACHc9CpPNT5qHdLn3+prjSdM+Qpgp5VMCXsU0W3rOy2FCam/suVT+JQWW0pgNulI1EWovx029dCPpNJ14cKBiN8oAPyg31WhjH/pmRB8QiWqB4BMRkQRHv0MKH3Qdw6liUKNSELoHpJKKmpzrQ6D3NE2wGbxZ6QFFcNd18kP+zgV595BGCC6us03tOBqsycXiidpirq7ATqakZzLYYQA== 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=tjTqRul7g52Lit8D0tY2rSL3yj5DF7yKxYQd3xtic+0=; b=QbLQVEikIjCg39Ps5l5LX3vt5PFd6qMrrsALS2i7ExQ3g1Mvslh7aC5v0WCUAYdlM2a8oE0dpnF06olqwDgxcBX13CXipDpVJSM+Z81B30Ohb0/kErvRb3Z5Uk5D/YXuJS2Y8G+LL6TuVn4lf+XoQJXn7znVNC8Wu4/kjTlkEWl2iGdUcYAu2zU1YE0HXDhtaRceD9XF5CIADm6zm1/CiqbUf8WXNWqFD2JZH+Iq16EAlr2LssvchY+fBvRLJ4n5sI7oBqFrMeFyoLly5+zW3pq3y94jxCdgE6haIYoe2LtzsScsQlBlNvm0i6WvXpipKc1Gp5HVvlFg/a87svSDVQ== 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=tjTqRul7g52Lit8D0tY2rSL3yj5DF7yKxYQd3xtic+0=; b=4L2XoLxi9Nvv2WhC1c/Bnn0/F/i5WjI5N7K9B8n3faaKE9ItmtXUwuWW4dtEej75MuEcpoDkUCyBhiMKI/HpD/5egOYsSsInDppjhCApfWO3QfTuTley+L1T4SLTwu6aaNLRpXFMziu555BJtpp0gEzYTpXd6IqDhO3fOy2LwgA= Received: from SJ0PR03CA0162.namprd03.prod.outlook.com (2603:10b6:a03:338::17) by DS0PR12MB8785.namprd12.prod.outlook.com (2603:10b6:8:14c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Tue, 17 Oct 2023 00:23:35 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:338:cafe::c5) by SJ0PR03CA0162.outlook.office365.com (2603:10b6:a03:338::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Tue, 17 Oct 2023 00:23:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) 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, 17 Oct 2023 00:23:35 +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; Mon, 16 Oct 2023 19:23:19 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 3/9] x86/resctrl: Rename rftype flags for consistency Date: Mon, 16 Oct 2023 19:23:02 -0500 Message-ID: <20231017002308.134480-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E7:EE_|DS0PR12MB8785:EE_ X-MS-Office365-Filtering-Correlation-Id: b4351fe9-57ba-4575-f067-08dbcea74d29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VYmYHAfTfnvTR2qXgLAcbc3wALMbirXRCOblKGTN3Wm0owkrQWg3yoIaXY5Hu/fA9a/tNu4rNSDvLhGA7cilwNCQBsLzExVHzfAbPFxxp0Pki0si1nX8AnIXJU/0Ye/iV8XfQoi7CowdEi+4MKTTn3Ht1Hfug/zXci6jBOvkiyW2ssMoWUCDbi4LM+Z+ATcalG04Rm2mTwO//D9caqpybPIeHa7WzCprd2wPKWNwoeNm7CmdmoJqxmd13M34vfRzfa8vvOR3jzH8DDzfUQ5rlt8H87ICxLRk/O1od2/r7cetUSwg3hM0i269iDWlwbndIkbywpsMPFPgjdO6jvVo/7KH4+oIKze9etxptGppH2jlAFm2Z0IfT8os/HmVsMSaBoEdSNApBiq+fqVKuqUP7N5CCe5CS4D+tIxbeKtRP7UQ3uG7nAl5b/TdGfMSNhqwwMb3aMIbwufaYaonQ3NQ4q96+/LM79YduHSpJBjbTT8v+3uD7Urvicty8gbBP64GFr8/XVOvUWDFkCZfAg1pphLNKg5hnfEK8T0Y++MCvX6Y07+lEYne7ojlchwdLetwOIAIJkM6QG/0gVinvN7AOjHSC3Lam9RBYreEkcoa5rq9TXCMkx/hTN+DcWyO3d+GwXUyV6vrzNURQnz2XTdkKDW+M/5rEkQOWJBMHRKW8wkyHWc9bb2xBfYy/MydCz7UOwlzU0G9fAexiW2PPn8V0oFXDy2GoZAX4qxQrtnxCHiEYXW5qbgs6YAJx8omrQBzunH7UIQMFPoUQxM9oQmuZg== 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)(39860400002)(346002)(136003)(230922051799003)(1800799009)(64100799003)(82310400011)(186009)(451199024)(36840700001)(40470700004)(46966006)(47076005)(40480700001)(40460700003)(82740400003)(16526019)(26005)(1076003)(2616005)(356005)(81166007)(66574015)(36756003)(336012)(44832011)(7406005)(7416002)(54906003)(70206006)(70586007)(41300700001)(8936002)(8676002)(4326008)(110136005)(316002)(5660300002)(2906002)(426003)(86362001)(6666004)(7696005)(478600001)(83380400001)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:35.0792 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4351fe9-57ba-4575-f067-08dbcea74d29 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8785 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 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]); Mon, 16 Oct 2023 17:23:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960103095239555 X-GMAIL-MSGID: 1779960103095239555 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 --- V14: No changes v13: Changes related to rebase. New file "sparse_masks" flag has been updated. v12: Moved the RFTYPE_MON_BASE definition to patch 10. (Boris) --- arch/x86/kernel/cpu/resctrl/internal.h | 10 +++--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 44 +++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 0ad970c5c867..ba4611111212 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,10 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) -#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) /* List of all resource groups */ extern struct list_head rdt_all_groups; @@ -267,7 +267,7 @@ void __exit rdtgroup_exit(void); * @mode: Access mode * @kf_ops: File operations * @flags: File specific RFTYPE_FLAGS_* flags - * @fflags: File specific RF_* or RFTYPE_* flags + * @fflags: File specific RFTYPE_* flags * @seq_show: Show content of the file * @write: Write to the file */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 09141f1f0b96..125d12d8f4b9 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1716,77 +1716,77 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_last_cmd_status_show, - .fflags = RF_TOP_INFO, + .fflags = RFTYPE_TOP_INFO, }, { .name = "num_closids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_closids_show, - .fflags = RF_CTRL_INFO, + .fflags = RFTYPE_CTRL_INFO, }, { .name = "mon_features", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_mon_features_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "num_rmids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_rmids_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "cbm_mask", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_default_ctrl_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_cbm_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_cbm_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "shareable_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_shareable_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "bit_usage", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bit_usage_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_bandwidth", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_bw_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "bandwidth_gran", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bw_gran_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "delay_linear", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_delay_linear_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, /* * Platform specific which (if any) capabilities are provided by @@ -1805,7 +1805,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = max_threshold_occ_write, .seq_show = max_threshold_occ_show, - .fflags = RF_MON_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE, }, { .name = "mbm_total_bytes_config", @@ -1852,7 +1852,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_schemata_write, .seq_show = rdtgroup_schemata_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "mode", @@ -1860,21 +1860,21 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_mode_write, .seq_show = rdtgroup_mode_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "size", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_size_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "sparse_masks", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_has_sparse_bitmasks_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, }; @@ -1931,7 +1931,7 @@ void __init thread_throttle_mode_init(void) if (!rft) return; - rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; + rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB; } void __init mbm_config_rftype_init(const char *config) @@ -1940,7 +1940,7 @@ void __init mbm_config_rftype_init(const char *config) rft = rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE; } /** @@ -2075,21 +2075,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) if (IS_ERR(kn_info)) return PTR_ERR(kn_info); - ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); + ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO); if (ret) goto out_destroy; /* loop over enabled controls, these are all alloc_capable */ list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - fflags = r->fflags | RF_CTRL_INFO; + fflags = r->fflags | RFTYPE_CTRL_INFO; ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags); if (ret) goto out_destroy; } for_each_mon_capable_rdt_resource(r) { - fflags = r->fflags | RF_MON_INFO; + fflags = r->fflags | RFTYPE_MON_INFO; sprintf(name, "%s_MON", r->name); ret = rdtgroup_mkdir_info_resdir(r, name, fflags); if (ret) @@ -3727,7 +3727,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE); + ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); if (ret) { kernfs_destroy_root(rdt_root); goto out; From patchwork Tue Oct 17 00:23:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808599vqb; Mon, 16 Oct 2023 17:23:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEd2hXiiGJJbijnvo+IJruajId0oAL6/ayjhY60z/Bty8rjLzXZ0I6u0ZOCdqEGZLP9rNG3 X-Received: by 2002:a05:6a20:7d97:b0:171:947f:465b with SMTP id v23-20020a056a207d9700b00171947f465bmr656667pzj.4.1697502229201; Mon, 16 Oct 2023 17:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502229; cv=pass; d=google.com; s=arc-20160816; b=paBUxi1sfXq8qGW40GBvHD/lBMjqG4y1ET0s1z+D+IL4uT7rB7gCYf1odqrD2VR+eF k7Y380MLDpQb6B54ZCID/m+5Ohb9ivfYHKActEjWrxqmEaNk6gJ2bvcDsYCOICkNyS9w F/D+FjVvOqh+vcBkvw9vrvcR/FO3Cl7QBuu5rSPyM7YaISn1XehLb1KYe8fQeAafN/7l P8mDflmLkfggvueqqNXo7WCIoH++eQBfWVp75fsthVYR0p/9hJsxPjVqMGyGn8RqIXzn mWNS9YCNmw1ZdFNoXXNSImwCidpYzeCsHo0aEfuM7P7KyCgbunQxYsdIY7p8obB2hMzM 5iqA== 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+0ZjoMvPgCvWePnSut5vWYUpmpoW76ZIIFUVe/KzTc=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=no0VduFTzh8w3WDeyM96kMi7eavY/Cj1XE/507wDVzTd2qDSrrx0X0XdgNE6wiBHxI CmDcDWko3vlHE/gY5sFFRrxzkH74w6IBzcruO64IDYdHRfG1fDaFqCWJowpePJueRPvU ppXgwhJRlH4FV8LS91brggi/KXkjqJhtSMZy3Sk3+PglJ/mRwH6rdvF5i/WCkH5CxovT e+KCvR9XUaKW82Yo/HBdH3IsyE3T00NNVlfVUdEAD3OC1hx2YpsSYklCECxLbJZ2gVZE Onqv10rCZFXBU+AHHW4SkXTyLSmmTHnyIs+2Y9TRT4OdOPxt8m3eq40wByZ0Gh9rZZz9 hR1g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=hNyG28sk; 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 k4-20020a170902d58400b001ca119ef46csi485123plh.478.2023.10.16.17.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:23:49 -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=hNyG28sk; 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 684C98025B75; Mon, 16 Oct 2023 17:23:47 -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 S233835AbjJQAXo (ORCPT + 18 others); Mon, 16 Oct 2023 20:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234236AbjJQAXm (ORCPT ); Mon, 16 Oct 2023 20:23:42 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2056.outbound.protection.outlook.com [40.107.100.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC55EB; Mon, 16 Oct 2023 17:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=awxrZdRKvZ19kVTWaSshHtQc8EbyysepKqnCaKzYTZxiLvN5Fx/uXyX09IdZC9/4bA3L4EFSIszYjVOehM2lut2blbaXEPgJX/CAqTFz6Yhbrfhy+QpoBBsWCpbH5+yfGxfz5Hq1x5Jq1eZPHhZwrSq1ECEPgyXI8IXr0eNHIubU+UdmXIC7id6Oip0jrJMxztuj/iVfCZy6zCApF4v1SXKPPOZnIBHF+cbHIOV4vM4ncHcCN21qJ5WJXicyQKQyVchr3ewtafNEuZCbbBLcWZkdKc8UWI5TSincIx4aOQDIGILN9yza2YDZsdmrUKO34wHlrZ0QOPUW3HiekaoaVA== 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+0ZjoMvPgCvWePnSut5vWYUpmpoW76ZIIFUVe/KzTc=; b=ImA1jfeu34WrnAvuUgrQGDzQ2eFDXDuzTgeH+SdQv+T+Tfun0zg1MQM+yrGhotCnOeiQhw8cMh5x/lsbk6CIdY5FTeom4JZsWG6cZ0AJ5DepWKc1wRnZP4zw+ZjEwaAi8IJJipVFMYlx1msT7UXpRSgpXK6h0F13hhQ8fzh/DlnRLfuQloeJSoc2H9C6/XoduLBasBsbrF/N0Q7k13MNBSXaIRite+7FYUCIaGumcLDyN+k+PS+avNq/nvZfHgAtQEjwoIlj3l6S+lhzq368fRgvIuHY2WA3kRQulqkZevSesD1AnPVa4dhv+kPcYIPMGxtivUxj2NrpjFwf6FMJOQ== 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+0ZjoMvPgCvWePnSut5vWYUpmpoW76ZIIFUVe/KzTc=; b=hNyG28skuQOcQx4cOMKzlr16km99yIHHXW7YgQO/nvf3mqjSAKyaQB71E4jGfsAWn8viC5YkkbUFF8gTOXahavVPpTG+agzf6RJCrV5lgD9EkkZPyWveob0MPb+MTAqI8egXZQFlix80ruFoNN6BxUGrm4NklrgAqVnzQmc4k0w= Received: from SJ0PR03CA0157.namprd03.prod.outlook.com (2603:10b6:a03:338::12) by CYXPR12MB9338.namprd12.prod.outlook.com (2603:10b6:930:e5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Tue, 17 Oct 2023 00:23:36 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:338:cafe::83) by SJ0PR03CA0157.outlook.office365.com (2603:10b6:a03:338::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Tue, 17 Oct 2023 00:23:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) 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, 17 Oct 2023 00:23:35 +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; Mon, 16 Oct 2023 19:23:32 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 4/9] x86/resctrl: Unwind the errors inside rdt_enable_ctx() Date: Mon, 16 Oct 2023 19:23:03 -0500 Message-ID: <20231017002308.134480-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E7:EE_|CYXPR12MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e88a17f-bd04-4c93-60de-08dbcea74d9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QQTy8Tllm2g7be9+eCdm1vRl4wUlHq5yTaRmLLABx6Hr3HASEoFUqtfCpBwwNKAZVefbrbpKPW1brBlvO6ZYl5QK3eaPl+0+Go53JnUiA4IaoCrmh8bqel9jopR+rKREpvKymoZN4ZVbyC3IlQ9fNMWn8gBeET9DNvaDz9TnX/KxNb8dwwC2aSHkQvnH2wcNU1WUfgil0Y84460mbE94f0Lhzf6YptD2rrxYfcjBTOXbrEeNR6903E2UP3VqzjcQN0WKY7VFNysMLNYKZHas8zv2OA6TC4eD5nTKXkyEBwm5qrQYKy055+K4CgiGvcdZ4KkceUvDnLDOfsx6qt9hv7My7wH4J6e93YlYEVNPaEYuQZ5pTLXb0uaHiGv2DZaZBbXwMdmILEV6SUregjNiTspDz9r+8CP0YZCi/bXL5EzH/5Wl++zt6bMyJA35XW0yQixCe8lR3fpVQwaBHn/e/EY0tj88rd9nMQJOQR4K9pQ/OKebH3cQWUlxj7JbxW2LKuuK7XOJOmVX/y9rDpY3EDRfod7MU4r/R/jD6W43YlnK6cwGzQ/s4S/qIAzBTBui5aPMczwAOcJKSCZVnSvwOz2Ux+JZk3JnJAK439Nz6EvkH4elTaUuAoA4p7XOuaX7f/HsrXvGkZECVNJXtoszV41eI7WhvB0tm4Kfxy702donFvw31Idiv5m+d/1yHUJ0KNM7jUjs2oaXsg//+RZnYBxcz+IARHS+GxwGgfjnVAH3+2Q0DJyo6JR6FGCUXR3mbldFlaDpPsv9Ej7zFs7jTA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(39860400002)(346002)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(82310400011)(40470700004)(36840700001)(46966006)(40480700001)(40460700003)(478600001)(110136005)(70586007)(54906003)(70206006)(6666004)(83380400001)(36860700001)(47076005)(82740400003)(356005)(2616005)(86362001)(316002)(16526019)(26005)(1076003)(7696005)(66574015)(426003)(336012)(41300700001)(36756003)(81166007)(5660300002)(8936002)(4326008)(8676002)(44832011)(2906002)(7416002)(7406005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:35.8448 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e88a17f-bd04-4c93-60de-08dbcea74d9c 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9338 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 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]); Mon, 16 Oct 2023 17:23:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960097602550650 X-GMAIL-MSGID: 1779960097602550650 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 --- v14: No changes v13: No changes. v12: Removed the redundant comment about cdp_disable_all().(Boris) --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 125d12d8f4b9..d1b5fd70ccbb 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2308,14 +2308,6 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable) return 0; } -static void cdp_disable_all(void) -{ - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L3)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L2)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); -} - /* * We don't allow rdtgroup directories to be created anywhere * except the root directory. Thus when looking for the rdtgroup @@ -2395,19 +2387,42 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, struct kernfs_node **mon_data_kn); +static void rdt_disable_ctx(void) +{ + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); + set_mba_sc(false); +} + static int rdt_enable_ctx(struct rdt_fs_context *ctx) { int ret = 0; - if (ctx->enable_cdpl2) + if (ctx->enable_cdpl2) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, true); + if (ret) + goto out_done; + } - if (!ret && ctx->enable_cdpl3) + if (ctx->enable_cdpl3) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); + if (ret) + goto out_cdpl2; + } - if (!ret && ctx->enable_mba_mbps) + if (ctx->enable_mba_mbps) { ret = set_mba_sc(true); + if (ret) + goto out_cdpl3; + } + + return 0; +out_cdpl3: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); +out_cdpl2: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); +out_done: return ret; } @@ -2515,13 +2530,13 @@ static int rdt_get_tree(struct fs_context *fc) } ret = rdt_enable_ctx(ctx); - if (ret < 0) - goto out_cdp; + if (ret) + goto out; ret = schemata_list_create(); if (ret) { schemata_list_destroy(); - goto out_mba; + goto out_ctx; } closid_init(); @@ -2580,11 +2595,8 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_info); out_schemata_free: schemata_list_destroy(); -out_mba: - if (ctx->enable_mba_mbps) - set_mba_sc(false); -out_cdp: - cdp_disable_all(); +out_ctx: + rdt_disable_ctx(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2816,12 +2828,11 @@ static void rdt_kill_sb(struct super_block *sb) cpus_read_lock(); mutex_lock(&rdtgroup_mutex); - set_mba_sc(false); + rdt_disable_ctx(); /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); - cdp_disable_all(); rmdir_all_sub(); rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; From patchwork Tue Oct 17 00:23:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808714vqb; Mon, 16 Oct 2023 17:24:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJ0qeLmLp7oEDAGNbBiY3PJM5Dq3CDXYHYrj+thQDkmNnNCU+pqxn1aXmN8XxSvFqrscKr X-Received: by 2002:a05:6a20:d80d:b0:163:c167:964a with SMTP id iv13-20020a056a20d80d00b00163c167964amr570227pzb.1.1697502245754; Mon, 16 Oct 2023 17:24:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502245; cv=pass; d=google.com; s=arc-20160816; b=clwp8m8YyppVSrkUKRJaSAxf2+72Jw1OqRHnu90mBDVfiewPzDS+4scS/Rs/wqcPzM yCd/mMnlbXE4DKwRzdJDH+y/MlPUqwyDE5yRJw6qsKlFKh5ehJUFD10r27FBE1Mt30RA EPbtQ6kcyL42A/dfmZ2X74VbewQfILncTC2RBI/wXbOH4hLiNBtN3/aJ1AyL41LoWiyS tJgVhqlsMmRPJgMMjnVUpz1vPWXH6Ms1RilDyZNxPtlbIVw69Glr+oQN39PlSGvCkPme ie01GADTimHTeEU8O2i58KwuiWlHHxDjaJwFleHP6EKabroBVAY4PHlpykPoBMe2TF0L U44A== 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=27DSedx2hGE4Bg3gVP5x0PPZ7tUFt+K2UTQLHt1cg8w=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=sIXMXmxo70VtGhzzPqC8UQIyZLcpgSm6ZJiwLiQYhWo7o1pCObjx5q7ugGBEQuUUSZ GstlvN/o/Z15qFUTwmFAjRKeAgX4meVDx8msC73Cc3dFWNFbgi+GT8NPzrtMsOtSrIj7 GdNOukAtEnZJD6AfjvLs95BD0c1bAmlLDXDZ+kPwT019E7rPkOTxmEmerLJ7gN/8ls2A Wr7qYOkngmEZFezWx2+asLQjQ8SJE+l5TcADqj2muaUCb6s4xBcyoHMJ/fb14OI4eO+x 02wPXSXM/WeShVv6aFDRTnqU9qMEQRUCQAfxjqvAAg9igrneeP03qLR09MIWSzZYQhxF UqkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=gdBuLzrx; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l1-20020a170902f68100b001c754f13381si497830plg.455.2023.10.16.17.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=gdBuLzrx; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5629680203D3; Mon, 16 Oct 2023 17:24:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234286AbjJQAXv (ORCPT + 18 others); Mon, 16 Oct 2023 20:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234223AbjJQAXo (ORCPT ); Mon, 16 Oct 2023 20:23:44 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B93FE; Mon, 16 Oct 2023 17:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJ8O0IMY3SGxAWmcY6YxRJ4glckZq3hw3/q9MlFJce5TA7pbzw/fmaMrh6BwFuCp0vG8B9lpWiCoM1u9yTTMTMJavq5eDZ8NC5WUI5BnKH1lonxeAqBnkqNmI52IxysECMSGzBzhqB73mtMajS1chK+Sq/DyTJcPtXWRjUlHQRmrZHYGRmlp5BlOEwatrkpna0/9htrpJ2vpjk8h8ObsWd8eNoxtngF4Qmo9uxZBHBrDQMd5xYSqn55kmnNgwW29QHq7ZdS5bkSZRxxmgmB1iIklA07XMeX67PPuLxxZSKXzRjX8lgZtcRnLyQ/fn2x0Grddupfzvh2flGIiHfZMXQ== 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=27DSedx2hGE4Bg3gVP5x0PPZ7tUFt+K2UTQLHt1cg8w=; b=chRPlQ2Vi4LH99iO3GtRgVkANs2F92RFXoblviNARWhiHW05laBhFO5rcCWcw97jqcUJ7JXNHsxf3qc1xSPNiEvalLAI0qpW3zMXCxRkEcB72oRPIK4PP4hXSs+PQmG6zN+Ap62KCyrEsFx8ms+UyKQvuM7oJaWztT9lARJx2ii2vFCXlqpxxJCQxa3qbKV6uix9gye8FO7mYAgWsbZz5lFDd2M4EDJzV7VqASkOmy4krm7RW5FK0YFDcLOYUeks0tGBsfu4M2Nc4kwO1IglkESx5FzjEY+J8z8e5iO9cPbOgLR3mRNuhrm1vGn54yr/R6hHarpBc5haKkOr/+WPpg== 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=27DSedx2hGE4Bg3gVP5x0PPZ7tUFt+K2UTQLHt1cg8w=; b=gdBuLzrxMjTJUmr4orkoGwEgJvkpkMzYx09u9eMd9T5/NusKqyJf2iWwg2MvxdBGOgw63jE/Tku7mYbBgNcNSnqaTeBB+A0rxjA9wVXV8Vr11m8kCphq634QBDhS1Ac+Lrn4DvQ/UGCtQ4xHx6CW7gpvooFwFLMQXBkSQ7FCzPY= Received: from SJ0PR03CA0153.namprd03.prod.outlook.com (2603:10b6:a03:338::8) by SA1PR12MB6726.namprd12.prod.outlook.com (2603:10b6:806:255::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Tue, 17 Oct 2023 00:23:37 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:338:cafe::26) by SJ0PR03CA0153.outlook.office365.com (2603:10b6:a03:338::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Tue, 17 Oct 2023 00:23:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) 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, 17 Oct 2023 00:23:36 +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; Mon, 16 Oct 2023 19:23:34 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 5/9] x86/resctrl: Move default group file creation to mount Date: Mon, 16 Oct 2023 19:23:04 -0500 Message-ID: <20231017002308.134480-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E7:EE_|SA1PR12MB6726:EE_ X-MS-Office365-Filtering-Correlation-Id: 17378192-e38e-4f41-81f7-08dbcea74e1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zUE9CtBsrw2KJrlKCKPwnNxFwF6jTW4ebBQs+I7LM2JDkzOBPtX2ISU7f6w07PI44Gi6oLKzDqECF/ZCanjFtrEDD872AiYvxd+x2vdck7fPZ3rhMKcVl5efRYh1jFhtAQCQNZ4a3907/jhoemI0uPuVr8BBjOy+UkNY0qpvf88Xe6tA74oG14RdR82Af3LvDAgjhrxcucobpwR8hPkJe4b4LmC3FnzJgrIu8h0jKiAVTDsDm28uozqwLqgSjfcR0OSZLNKLt5/ER3DOI1R12cIMVoQ1RlXlZeS7DhIzc1hmCQ1TXAxZjkEhfFovROIb2YjDQZYQgOhACgbFnLCoinjH3lUa0z0CSAyepZzKJJ5Ir0Lt8L4kJNI8BnV7U0P1aZDGp5DnOny0kD6eyYL5SyXNYqEhcMAME3C5LAGtbGYmFhRBDxqZuR5rj6b/sqhrDFDGJaR2rscWpHUFWcnlvGw4puFctZLbrobCcvHzeGJy37J1lqVonEG6QZJbpGy63aiugP7bDCng6dU4vikbxZ7pWTcCNdF/wU2rc7S5t2TXJEN+ZWzvIKCWPOjIK5MZr/cegbM1PiG1cYweT185jknL8ze89254S0dOcgebLWSrjrGX9vsIZ44WoHLuv0CNmOSmPbLc6+r9KQvSMN2efX4CAvH5VBsV5WtQk1umDXcVKCSXAgO2MygDOxY1YHSyrnScV3ZshOZsKmI1LpwKEYrTsWcJoL3JRck4crbw6aH5/KFznnEn0wt0Y5ovlLNf3suzm+G4/TP8wjoTqsQ2Pw== 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)(376002)(396003)(346002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(82310400011)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(478600001)(110136005)(70206006)(70586007)(54906003)(2616005)(47076005)(83380400001)(356005)(36860700001)(86362001)(82740400003)(6666004)(316002)(41300700001)(26005)(1076003)(16526019)(7696005)(66574015)(426003)(336012)(36756003)(5660300002)(81166007)(44832011)(7406005)(7416002)(8676002)(2906002)(4326008)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:36.6886 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17378192-e38e-4f41-81f7-08dbcea74e1f 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6726 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 17:24:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960114952381445 X-GMAIL-MSGID: 1779960114952381445 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 --- v14: No changes v13: No changes v12: No changes --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 58 +++++++++++++++----------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index d1b5fd70ccbb..55da93b5ca53 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -54,6 +54,9 @@ static struct kernfs_node *kn_mondata; static struct seq_buf last_cmd_status; static char last_cmd_status_buf[512]; +static int rdtgroup_setup_root(struct rdt_fs_context *ctx); +static void rdtgroup_destroy_root(void); + struct dentry *debugfs_resctrl; void rdt_last_cmd_clear(void) @@ -2529,10 +2532,14 @@ static int rdt_get_tree(struct fs_context *fc) goto out; } - ret = rdt_enable_ctx(ctx); + ret = rdtgroup_setup_root(ctx); if (ret) goto out; + ret = rdt_enable_ctx(ctx); + if (ret) + goto out_root; + ret = schemata_list_create(); if (ret) { schemata_list_destroy(); @@ -2541,6 +2548,12 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); + ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (ret) + goto out_schemata_free; + + kernfs_activate(rdtgroup_default.kn); + ret = rdtgroup_create_info_dir(rdtgroup_default.kn); if (ret < 0) goto out_schemata_free; @@ -2597,6 +2610,8 @@ static int rdt_get_tree(struct fs_context *fc) schemata_list_destroy(); out_ctx: rdt_disable_ctx(); +out_root: + rdtgroup_destroy_root(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2667,7 +2682,6 @@ static int rdt_init_fs_context(struct fs_context *fc) if (!ctx) return -ENOMEM; - ctx->kfc.root = rdt_root; ctx->kfc.magic = RDTGROUP_SUPER_MAGIC; fc->fs_private = &ctx->kfc; fc->ops = &rdt_fs_context_ops; @@ -2837,6 +2851,7 @@ static void rdt_kill_sb(struct super_block *sb) rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; schemata_list_destroy(); + rdtgroup_destroy_root(); static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); static_branch_disable_cpuslocked(&rdt_enable_key); @@ -3718,10 +3733,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { .show_options = rdtgroup_show_options, }; -static int __init rdtgroup_setup_root(void) +static int rdtgroup_setup_root(struct rdt_fs_context *ctx) { - int ret; - rdt_root = kernfs_create_root(&rdtgroup_kf_syscall_ops, KERNFS_ROOT_CREATE_DEACTIVATED | KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, @@ -3729,6 +3742,20 @@ static int __init rdtgroup_setup_root(void) if (IS_ERR(rdt_root)) return PTR_ERR(rdt_root); + ctx->kfc.root = rdt_root; + rdtgroup_default.kn = kernfs_root_to_node(rdt_root); + + return 0; +} + +static void rdtgroup_destroy_root(void) +{ + kernfs_destroy_root(rdt_root); + rdtgroup_default.kn = NULL; +} + +static void __init rdtgroup_setup_default(void) +{ mutex_lock(&rdtgroup_mutex); rdtgroup_default.closid = 0; @@ -3738,19 +3765,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); - if (ret) { - kernfs_destroy_root(rdt_root); - goto out; - } - - rdtgroup_default.kn = kernfs_root_to_node(rdt_root); - kernfs_activate(rdtgroup_default.kn); - -out: mutex_unlock(&rdtgroup_mutex); - - return ret; } static void domain_destroy_mon_state(struct rdt_domain *d) @@ -3872,13 +3887,11 @@ int __init rdtgroup_init(void) seq_buf_init(&last_cmd_status, last_cmd_status_buf, sizeof(last_cmd_status_buf)); - ret = rdtgroup_setup_root(); - if (ret) - return ret; + rdtgroup_setup_default(); ret = sysfs_create_mount_point(fs_kobj, "resctrl"); if (ret) - goto cleanup_root; + return ret; ret = register_filesystem(&rdt_fs_type); if (ret) @@ -3911,8 +3924,6 @@ int __init rdtgroup_init(void) cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); return ret; } @@ -3922,5 +3933,4 @@ void __exit rdtgroup_exit(void) debugfs_remove_recursive(debugfs_resctrl); unregister_filesystem(&rdt_fs_type); sysfs_remove_mount_point(fs_kobj, "resctrl"); - kernfs_destroy_root(rdt_root); } From patchwork Tue Oct 17 00:23:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153827 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808763vqb; Mon, 16 Oct 2023 17:24:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhO2QI4NXR+znoVY1+Oa8HcGNisBB7UXC2tdrJulbSGRAdgy7BpDqAmlt/ANZipoEcZsFA X-Received: by 2002:a05:6870:15c2:b0:1e9:a8ff:67e3 with SMTP id k2-20020a05687015c200b001e9a8ff67e3mr803157oad.4.1697502250742; Mon, 16 Oct 2023 17:24:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502250; cv=pass; d=google.com; s=arc-20160816; b=uVZCnCjfsJG6TnNUQnxMvEFLkUBgnGblwWW7uHE0HBUWfVdbnLaU6Ht4C20zo8+LAt Cruub4irvQ941YfWhbh+EVErrIv/wN9xeRim3MKvK/QKCzMCBADI6ggQ7NCpS0omtGHQ dTi83+dpQXJi52ipiwy1+zHTKKNRir1mf/F+3jg+RJqTPLzhQg12pE3TpzG+XS0TVGzu +sR4QQdpVVzeIHa0sJ/kbrQfwhQPlJ5MEC9UIeojHDe0njMGRgsg//9Fpr8uANiA7vUL SNWrjVsg2PVJKc6WOzbMUU+eu6LcJp/CX5EuSUXHufsj4c/AuamQBYGRwOPNeqCd/EGv anjA== 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=72MrqNYcsnHSFp+uENMG+Qqh6S0Q0xiw1rzfBZDVBHU=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=fvMMekxsrxvhKCuz1Zsl6CEY/vcb6FeXATXik9XTyzLJQ0lnArIG2rcF9+SmLguucT yEI3fqiyvg1kH/c7bfJjCqYMxUnFLadMhXlc/mBxJyPg8J6vAOyohw4VlzAQcB9L7eLg lcb4BmECimkiotikLBUXaoIrl3JB9W7j/kxbIneVT4YdGqSVujqQSkOFaWUCh3PJ0cCB zAnCmAdm39knSUuyBlNa33Ftq8fTaRHms0GO1FOUR3BeuqerviiBm2EiEp3dceprYGfH DXKE0/i2Ysrnio7dl2daJOdH/MpkyYyAJvgZ5ZmZYd+ujUeqL+TpZyrRnWElvv/qBet1 WGZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0yROQB7w; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id n28-20020a638f1c000000b005af44ed3142si528583pgd.413.2023.10.16.17.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0yROQB7w; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id AAA738043AF4; Mon, 16 Oct 2023 17:24:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234264AbjJQAX5 (ORCPT + 18 others); Mon, 16 Oct 2023 20:23:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234255AbjJQAXp (ORCPT ); Mon, 16 Oct 2023 20:23:45 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1CC3AF; Mon, 16 Oct 2023 17:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WwOekzxqO7MMYVnVny2M0vPBUtrfMZkEJ9Up/tn7sYEVar+Q9R2R263kDN4gm5Xuj/pi5F9doxAkC1JmsNT6uveNcZqIYGgXWx0yjMzwNO8CBv4MxWFamyL6+Q4tfGRW8mD6nY02g+TjDI0/uoM7lrWHbu0aNxvnxGzn0KrepXw4gc+x7zmExrMG1jQ75clP5d7AL5ji+JuaFtrjmgHT2f0ot7ZEtsx+YRVfoO7nLx8mrDFjSIY5yPZ5UVQ3AAh6H4TBP63eBdBNJCCljSgRhQnYUDuk46OyDGGtaG5ceEar5SUXo860WK9i4dhSHQiQzKJiolAUceQFObSDv1T+aQ== 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=72MrqNYcsnHSFp+uENMG+Qqh6S0Q0xiw1rzfBZDVBHU=; b=itG9YjfK+Hob5yUkENWtCvXWdvfeue/NqE1+wSsZnzqviXIall9+mUBCHvlxauTewGSsBT3AvNV105vwshI6qLnLqyhcT1/+lgYXhXN0ahoofxpT+l+tiYNKXiG4QxL4r2nUdmbGhmjxIDOE+U08fw7Ca6Q+EknZg1nMUFCEy1w29MhZ4zv8SdJoF6dSe7XnaTwCgZoSfYyYhfuoyZjDqm3TCepEaOOFwJAAHTKkjO5LYluMIkiWEqk2yiRDeAsbiwoKMW6mtguGgdOnydURRL0H70cHIqv00Y/dEGJUD0zV6NJYWdS2gvAoNfDQZeKhlgVbGx6JwRk16v0R9wVo/A== 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=72MrqNYcsnHSFp+uENMG+Qqh6S0Q0xiw1rzfBZDVBHU=; b=0yROQB7wN4NPD4Tm0IC+oyOaXw928zYAfm7+GnKZYeq7Wmrq2fxks036v9R0JrZsjwjvgo1BAQqEufDHsgURRL40sAhaqWe5biDfgT+fbi6ZmgKA1+Jr2goQ0H10c67XYCokn+J9SngiYlbbO4YavsbTG4bfKlPTySz2O1OQU5Y= Received: from SJ0PR03CA0158.namprd03.prod.outlook.com (2603:10b6:a03:338::13) by SA1PR12MB8986.namprd12.prod.outlook.com (2603:10b6:806:375::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Tue, 17 Oct 2023 00:23:39 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:338:cafe::d1) by SJ0PR03CA0158.outlook.office365.com (2603:10b6:a03:338::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Tue, 17 Oct 2023 00:23:38 +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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) 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, 17 Oct 2023 00:23:38 +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; Mon, 16 Oct 2023 19:23:36 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 6/9] x86/resctrl: Introduce "-o debug" mount option Date: Mon, 16 Oct 2023 19:23:05 -0500 Message-ID: <20231017002308.134480-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E7:EE_|SA1PR12MB8986:EE_ X-MS-Office365-Filtering-Correlation-Id: 38eec518-9363-411e-8db5-08dbcea74f2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CxzTCSIJIA9l1op4QORC9CKVPfUFs/MBAoOFt79Tkm2V4sXd7dlcmPt0beVavgWSrYsibEOPcK+PBYEhOptOLxmfDLYzGqWpwo86ENcYdr5rWt4fA2FSSjHL7e8KtGyrSYHNW+ZvYQLnhZGSWg3DjJDdPvVDO+t+jaaciFW1lpC6n6Yko+/yKiTpki5z8naRFv5ctFwyYaMuKzPZ/Od6N9OO06gvTqwhD4LUFV+/G7m+yLISf/GaQF/9CQbspQdV2UYMm+gODn4myxoiQ97T6RXyk5rjPfmsUf9kPeHluma8ThSd2iR5gBZ2p+PVFbBOW6T656I6wjhfVGl3xx1kAlax3xxiV5UtrFxMkfQ/KMbd8MLiKr4hCn0Cu5d48MBc71Oux+nE1/9vwP9kfULGqv34pAHD3Pjth1bnF7cKM3QZIm5JcEOOCG7DZ3+tbT8n21Ez8Ahu2XyuUnMpLtGZdn3NPE7PTdtDBkLVRP3LOa6+ihqvxlpAb3bXmQx8BGxmzRbuE72wnnYADpMK7HdMHAhZHjrATsjJ9qqhVHfjK37gFPzALpxqdJ7VAlVaH5Q3I/RnRaMeY+j4DyOfSTA35u1S39XGaDJLjDh8UcpUU2JpgrT/KPNkjyfJXkXDD0ZwFGoZfjFytXJyF3of2YrROmWJOPPImL/jDn7Hi836ZsasWKPZgNvVP8rX4sJXcbhj8mTaOyITWRmHQXoNEX+ZesM17lE4AonF91Sefr57JF6mlsZPFHKv+eA8lm01aGxHAO9+C0FqB9tokrgNNvsj+A== 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)(376002)(136003)(230922051799003)(1800799009)(64100799003)(82310400011)(451199024)(186009)(36840700001)(46966006)(40470700004)(478600001)(70586007)(110136005)(70206006)(54906003)(6666004)(26005)(16526019)(1076003)(426003)(2616005)(336012)(66574015)(7696005)(316002)(4326008)(7406005)(2906002)(8676002)(5660300002)(41300700001)(44832011)(7416002)(36756003)(81166007)(8936002)(86362001)(356005)(47076005)(83380400001)(36860700001)(82740400003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:38.4542 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38eec518-9363-411e-8db5-08dbcea74f2a 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8986 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 17:24:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960119938532158 X-GMAIL-MSGID: 1779960119938532158 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 --- v14: No changes v13: No changes v12: No changes --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 178ab1d8f747..68f11611f341 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -35,7 +35,7 @@ about the feature from resctrl's info directory. To use the feature mount the file system:: - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl mount options are: @@ -46,6 +46,9 @@ mount options are: "mba_MBps": Enable the MBA Software Controller(mba_sc) to specify MBA bandwidth in MBps +"debug": + Make debug files accessible. Available debug files are annotated with + "Available only with debug option". L2 and L3 CDP are controlled separately. diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index ba4611111212..b816b902b5c0 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -59,6 +59,7 @@ struct rdt_fs_context { bool enable_cdpl2; bool enable_cdpl3; bool enable_mba_mbps; + bool enable_debug; }; static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) @@ -248,6 +249,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 55da93b5ca53..84e0f45578dd 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -59,6 +59,8 @@ static void rdtgroup_destroy_root(void); struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -1892,6 +1894,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) lockdep_assert_held(&rdtgroup_mutex); + if (resctrl_debug) + fflags |= RFTYPE_DEBUG; + for (rft = rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) == rft->fflags)) { ret = rdtgroup_add_file(kn, rft); @@ -2395,6 +2400,8 @@ static void rdt_disable_ctx(void) resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); set_mba_sc(false); + + resctrl_debug = false; } static int rdt_enable_ctx(struct rdt_fs_context *ctx) @@ -2419,6 +2426,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_cdpl3; } + if (ctx->enable_debug) + resctrl_debug = true; + return 0; out_cdpl3: @@ -2623,6 +2633,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2630,6 +2641,7 @@ static const struct fs_parameter_spec rdt_fs_parameters[] = { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; @@ -2655,6 +2667,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) return -EINVAL; ctx->enable_mba_mbps = true; return 0; + case Opt_debug: + ctx->enable_debug = true; + return 0; } return -EINVAL; @@ -3723,6 +3738,9 @@ static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl)) seq_puts(seq, ",mba_MBps"); + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; } From patchwork Tue Oct 17 00:23:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808836vqb; Mon, 16 Oct 2023 17:24:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgZkxULSIe0DAuk0uQNx//oyxuUXat5YDKH/GEn/MD88gMtz5mSBXqgJ2px0Nvcy24Wk4/ X-Received: by 2002:a05:6808:3c9:b0:3ae:24bb:381a with SMTP id o9-20020a05680803c900b003ae24bb381amr804275oie.3.1697502261661; Mon, 16 Oct 2023 17:24:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502261; cv=pass; d=google.com; s=arc-20160816; b=P/Bbh1adT2hbelJRTkPuBwZQyZLkvsEeUJys8CrsKW5zCsnoXKVrraeqK116Hc8YJb 59kpPv/Qa47LiUueN9t7qhamyLsC1X7S9rht72/IW/INtCyBAhRU/WlELX5a5q9CpLJd 1VOs9jYEzEuH77lJ8Voy+6cKS0RmHahUVGcdGXnYNF6x+eGoDT/z01Fz3c98/w2bo6vK rsw73Ylgm3NdPv5vvlkAFxub2mBkLx5kYDma+YGvLkYkUxCIT08oSo7EUDK+el5tufwR a8SivAPi5oWZE1V5iBla3n1yIm4tCx1sCdBPXKV/q1zTsF7ZGnvfsANMemPegCCQBj5C ch9w== 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=ZBTEOm/hDV81wZcytveC31QBynHeX0bfTtvjtU/RPiY=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=tQDktI7XWkvQs4M67N+3WbWKhqZsyheiexv7A9tD1RxpFPTk18FJFJVfBHTz6IR54E 7TlDRq1lzGuBrBMpCqro+TQIrEP4CLbnNdsGl/i0OUPD2ys7n54z9VJuEU3RvkE3lqFG OuAffM0dx4Rmg62iwLq97zc5dhT2lIZyK23FQqhmY6ofDvGvMWwmiF+L1xdRaO3qK1Zk db8Idm2Kng5NPY/VwB5QqG9+Z8f7BHziJ7yv1ddOfxRRxpOJTT1Mu8PYR5Nv5sCLb+vY +UEYbBcKRvtym2d4vcrefcYhJMAPz6EVBB/KvLJ6aWRDqUQqFo24gmpqlfRcEAsmdqaB wZ0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=gQI+ALKU; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bf7-20020a656d07000000b0057795cb4f16si532958pgb.684.2023.10.16.17.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:24:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=gQI+ALKU; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 2FA3D8042D09; Mon, 16 Oct 2023 17:24:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234345AbjJQAYJ (ORCPT + 18 others); Mon, 16 Oct 2023 20:24:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234308AbjJQAYB (ORCPT ); Mon, 16 Oct 2023 20:24:01 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2055.outbound.protection.outlook.com [40.107.93.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B8CB111; Mon, 16 Oct 2023 17:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AXX8eBeQdKMDeNTIjT8pkx2sF71wglgcgoKUNe8Q6CU8zDI7XEgal7nTzX272myr8ERB8Y3GkLGHNgZZ4De6e7moK+CpBxpsQtYPH354ctRmUh/yDOkWsopyFuIqwHXvvnQ4JaNJI+P0p89LHLPXsIcRw4lpwJVQVJ7P1VWEvR8ZuC6woVWXaTkuiDz4RuPzEFssvN9cLWBpdfh/ZOEQ2iCmhupJ7oF+L6aoymC7kHk9pf0WMeC4zP+jP5Qn15QDwAT7ZU+b+d9l6//EjHppUFXAMK05wOzgBKs9doB9AnFdaFVG/qkSdWAYP0emYHfFcCGI0LXD61KxgIFLP+jTUA== 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=ZBTEOm/hDV81wZcytveC31QBynHeX0bfTtvjtU/RPiY=; b=gIVNTTzV0GY1A76TlKUL8pwR0zjN+CQUEN7HDQ66uLCHyvH6inAuUKZdJwxgPkeyYZRQM+fimXSQU38BQIUnWHyVvhyRW3+zedLWKkU4QePNemSq6EZE3wbqEwTc0rQ6DITBMfNDBPKpOLBZOectT2QEbqai/P+QgJzk8DMexUUNDH2KxqQfFZVgjkfihiQMZp91A/taisrse26xX2SJFzDqDXjSAvSCPmPuRPI9tPTM1ENOPAg9xakOI9LdaUDYGShcqX2okefl3r4vMMc1bljocliHvbVKATTiTSFie5B0yJBXZmEOG5ndx582eWXvvNKetRvByE2f8kErFR73vg== 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=ZBTEOm/hDV81wZcytveC31QBynHeX0bfTtvjtU/RPiY=; b=gQI+ALKUEwYW3g4CD9KyAQK9Swf1dC9WGjmxu/4Gj/DQIVtamqnAJT1cYTBgVSEZsVb66B+l9/E3LS2xiBQHxcgiQZXEgknXYFw+r5VjpJ2vleP+IDWfLFAYdXb144noIhclZyiYbm49BWTonB+IqIKzjXQ0aHqmbfzjB2aeuBs= Received: from MW4PR04CA0124.namprd04.prod.outlook.com (2603:10b6:303:84::9) by LV8PR12MB9405.namprd12.prod.outlook.com (2603:10b6:408:1fa::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Tue, 17 Oct 2023 00:23:40 +0000 Received: from MWH0EPF000989E5.namprd02.prod.outlook.com (2603:10b6:303:84:cafe::7b) by MW4PR04CA0124.outlook.office365.com (2603:10b6:303:84::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Tue, 17 Oct 2023 00:23:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E5.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Tue, 17 Oct 2023 00:23:40 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 16 Oct 2023 19:23:38 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 7/9] x86/resctrl: Display CLOSID for resource group Date: Mon, 16 Oct 2023 19:23:06 -0500 Message-ID: <20231017002308.134480-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E5:EE_|LV8PR12MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: ed98e4fb-d8b1-4bf8-f7f5-08dbcea75043 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r6Q8cfpKOtiVOwjcFn6BHa/9SEGO/ZVI7vvxkImIN6vEu/NN+x3cEECoBZqiORnCObbhZ+UGVCjsy5JEcp3b/QTMmvNZAWPWghor4LoaDjpAzjOrOPFJ8ZAothrARdCb2mk4fANe+LhojwN336f4KLpmArtR83EtvhSBRaHrUi4eIU57pP22eab04gk5Xp6hdhklAD/wYT2LAxkj2OjuuaVJv68r0dOqrjFV98Gl/wmNJwj3Y3/thZTtE1Yv+kOD0Pz8uG5iZbHgnUHnEHijhngTMUzXtItJwiXvxGMidR+3eUaozyGabjpdCrLZsgFxtr9wj7QrDQVOmujXdDFfDplpmfZskNH5F1OPXyNg9AYZv3k6FBM6v2M/85QpwLKHBqRPXH6m9yyNoiJiQCprr4zd12p18/U6kveoMEJebl2c4x4Q5VGscyoyrrHYSClACrJu8Jf/+AG8n8hoChPCDIe1tyPE1GDAZ0TJpUXeBMCWelkIr3yd7fHAvVvWnF4kzBcTNl7PTOvbDXRKyY0Xhmz6f1WTs11Q5cq7ig2DTOvWJWJs+vJF+DWodUZcqXH2vPPWzAbMBuh2DhS/MbB1Cm+nH0InJtmL2FNefRH10p6m81U0iBgPjQ5Z1puzOVU4oCodKDBNP+mrSG1th48DlKNgq/Hnf7uIpd0vxqnJwFNNWZxjwVAuTBLh0sCxsJGiDqTwtVmipkOixriue6Gg1Bmxji0Li1ChVHmtVAf2P/+tY0VwgjJtuPwTJAMfK92RZIojvuOaaOKbvSmbTvy+VQ== 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)(39860400002)(376002)(396003)(230922051799003)(82310400011)(1800799009)(64100799003)(186009)(451199024)(40470700004)(36840700001)(46966006)(40480700001)(82740400003)(81166007)(40460700003)(26005)(16526019)(426003)(336012)(66574015)(2616005)(356005)(1076003)(7406005)(478600001)(70206006)(5660300002)(44832011)(4326008)(86362001)(7416002)(2906002)(54906003)(316002)(41300700001)(36756003)(70586007)(110136005)(8676002)(8936002)(6666004)(7696005)(47076005)(36860700001)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:40.2830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed98e4fb-d8b1-4bf8-f7f5-08dbcea75043 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: MWH0EPF000989E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9405 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 17:24:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960131248527864 X-GMAIL-MSGID: 1779960131248527864 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 --- v14: Removed the RFTYPE flag documentation in resctrl.rst file. (Boris) v13: No changes. v12: Moved the comments about RFTYPE_DEBUG to resctrl.rst. (Boris) --- Documentation/arch/x86/resctrl.rst | 4 ++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 68f11611f341..7412252f95a7 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -359,6 +359,10 @@ When control is enabled all CTRL_MON groups will also contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". +"ctrl_hw_id": + Available only with debug option. The identifier used by hardware + for the control group. On x86 this is the CLOSID. + When monitoring is enabled all MON groups will also contain: "mon_data": diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 84e0f45578dd..5814a0bf3cea 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -779,6 +779,22 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_closid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->closid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1881,6 +1897,13 @@ static struct rftype res_common_files[] = { .seq_show = rdt_has_sparse_bitmasks_show, .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, }; From patchwork Tue Oct 17 00:23:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808872vqb; Mon, 16 Oct 2023 17:24:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLSxmc4WBqJKV3EBFKN4z6BXXWorcwwyg2YjH1bjZRSRbLJd4x8raapwIQYHKNJGvu7ju/ X-Received: by 2002:a05:6a21:a5a0:b0:17a:e03f:38b7 with SMTP id gd32-20020a056a21a5a000b0017ae03f38b7mr718530pzc.6.1697502266186; Mon, 16 Oct 2023 17:24:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502266; cv=pass; d=google.com; s=arc-20160816; b=oNzkajBHhAB4QQ5SN9j2msBketS+aQ579Wh8AaftVXlS/iRlXy+hcZTT5mfM8/U45D 3hNwV3K4EZe3vDoxDbOpWgrxeEIrQdAyDxrIfp5uVXr5MfAWw6cLDGVlbr1PG4s5fFiG Qqs4cE4Exf5An71Tef+7um8QO4RMKm9FBIWgj+8XV5LdPlhzWVv1EHz98s34FPqIoOlf 2Yt0Ve13kZQePL+dZ8HZ9HnVjzIn6+r28TbDxQzyB3f8ZZI7KOxjKtmf0omv+taNnYgE APbrmqVF4G11zwpuHFPo0an5e0ajbsRINHvlsEI9AyFSLvT0F54FliE0ZIZSPuYeqFA/ Pcug== 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=WY9Q1XGjovX2NbFwxDDwTA7B7ZrS4TCO4WC9VQcHadI=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=hC0Uy4owpSvxabLBbKNcZsmKxUor2/x3jcQIsLCrwxoSS+N+fWZhH2pa60b1pNMyz9 qXItFXB32F6SppQ3zFAInOBjAQXk5/Wt7xQ6C6M5sisM4/DWwm3zGMB01rJg5doApqL9 idl819RgzePNT1RPnssXW+LyITt9tOHMJYBUiG7tMctoVia5BHYbNYwJ7AY79oCB0su7 RRClHxwUmHoLQ3zsW/9POBRZ4y+iMb2KWR0ih4GQrwNa+G2aTYQy2mnU9B2Yq6ekUcFV 9HqYQaBpnMliR8vLcIW7n0kPE4LsDRP2w+klGoBLRB0U9pqjA4aa0fKkdYTYGI9qAak9 Az2A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TwJNw4k1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bx25-20020a056a02051900b00565f182839asi611879pgb.28.2023.10.16.17.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:24:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TwJNw4k1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4EC468042D09; Mon, 16 Oct 2023 17:24:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234379AbjJQAYM (ORCPT + 18 others); Mon, 16 Oct 2023 20:24:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234311AbjJQAYB (ORCPT ); Mon, 16 Oct 2023 20:24:01 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DD5B116; Mon, 16 Oct 2023 17:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fwEAAh8vnAJ6d1FDSQvEMWdzL4zxKFXt/RxeejirlANnShvyW1NGQhO4IS+sdMlrEK0jYONUE4hEo/YJmOXbqc+VIUmYJSvg+JgqKFMRjMK6kqQPqRMnvJ2r2neygwjKL45PcYwo07zIMUXuD6wZVd3qAebqs8SU/ctM0vrohY8iNVAlQ/MWFXjMH7JS5oeDE4gLo5nCIyKohltCAPGytZMpyj9ZIKgHXyQeCYQN2KWGomCpN9vkhKMEgz4wC8sNWJlVRyvWmiBub0FF/RhcTZGHk63BePjU3aL6f0W5oFdbesF+IjdHOZjxB5Ft1LEqapZIo5fxXX32m1320EWc6Q== 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=WY9Q1XGjovX2NbFwxDDwTA7B7ZrS4TCO4WC9VQcHadI=; b=H07kH2OuSVYI7YGEfzVKkPTmP+yBR1DPANPn3ctMTdcah0gMXCQV5QMSwcCiooBUgIZTwoso/h0yAB2CJ7IQYKe6smgwnVRkhVHTiYVLX2JpxWbaFZkattROUPO/ToFdM+1BkDCK/dqsBkZjga6nogAtG/jUzVfkubig0dGFFo2jjRbQKJydzKN6vJF3GIJWmd6rCmkHJ50Tk1GHBx7rp5NSkqoGPzoPZ9ebMeAhT0BbY3bldrqWIDuBokp70Fz5UrbmEWjhwzTMqYJzH8ksvul+9kAQn8nySVGG3NrNfhGro7euq6EQgiChjQSsIArxZ7zRFYu9nP4ZM9Ur9TEoBQ== 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=WY9Q1XGjovX2NbFwxDDwTA7B7ZrS4TCO4WC9VQcHadI=; b=TwJNw4k1yE0SKywTIcNpzFF5WJygZ1l4uapTiTOhQ5arcFzGF+CEWSAwbI3CmGL0RvCBNpS2OO0a9kKUcZl8jSc0go9GBCmK+cT+narpQUcNPdAc0o8OCPTm8rx7aT+SQEXurC4+kM6UABlDG5qI8TKBIrIT27CUNndULOWi7jA= Received: from MW4PR04CA0132.namprd04.prod.outlook.com (2603:10b6:303:84::17) by IA0PR12MB8352.namprd12.prod.outlook.com (2603:10b6:208:3dd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Tue, 17 Oct 2023 00:23:42 +0000 Received: from MWH0EPF000989E5.namprd02.prod.outlook.com (2603:10b6:303:84:cafe::3d) by MW4PR04CA0132.outlook.office365.com (2603:10b6:303:84::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Tue, 17 Oct 2023 00:23:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E5.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Tue, 17 Oct 2023 00:23:42 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 16 Oct 2023 19:23:39 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 8/9] x86/resctrl: Add support for the files for MON groups only Date: Mon, 16 Oct 2023 19:23:07 -0500 Message-ID: <20231017002308.134480-9-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E5:EE_|IA0PR12MB8352:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c177fba-5e2c-4b18-e949-08dbcea75179 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nbg3F92Qd/XamYnFM7/4Ip0AyjjAoxhuFtQx6pZqo05+GSnleiEjCYWQg00MWpo0vBd7TtJOkLgcqboJrljMTVrzlmEB7ydbiXxvjgEPLtj95t6atHe0wx2nLa1ijzi51CF3N0rBPuc/YWG40e8pNbE4OcS9NRhDuUo3nNppjkmYQpaC8BacuR1A/CRU/vPwl7uHJAI3FDP5jOqf9nDaCi/oRBwiQ8jpLBUnuyVXcn5ECTHRptCgSvLmhuIqRSrYr//utw5scOFHKJ8XFAUvlKBdMy6yVQGgPNLSUD9/Kn8dxUtOBKwcMcdnxx89hpbih399GQXbyuEQyIT5fO6Hu+mcL4vs3OkFY6w6mO+IQN6bT1XePlgdz0AmwoY7WFTPvDQW2h5ChhQNFXO+nOORI8B+QBVsmibKDw1FLC2ASzque9regbpritHw5zYkD4konu2yMHZzx0RHsxDxUK4V7zohF5Ffp5LcdIG+K51NqfBF6ECaZxJR87GKmge8GS0kaKVDcAI+YRd2OzzasTz/ROAaMNDVmsZCbX/dxixhH1W1cVYkTqKZbBqi0VQa3SxarWXZ/tUry5KF8ux97GjKSftCfFm+DmWrXD8v7Ft6Iy70XmQLTvEQcpf/1vEuZbGhJyt29nTdyac8jaEitvI17DIWyyvQJXU+2gmLFkvyQJ9PyQd6e4cwKnRNEAoa9/h4ELki0GJ4phcxKDrVu5yRhm9ezoplTaW/ABQGCy7zIPT3XghNtjijUp/Srts4h6le8XOu0ctxxWDtLQU92+NKiA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(396003)(136003)(346002)(230922051799003)(1800799009)(451199024)(186009)(82310400011)(64100799003)(36840700001)(40470700004)(46966006)(478600001)(6666004)(356005)(81166007)(7696005)(2906002)(82740400003)(26005)(36860700001)(86362001)(110136005)(40460700003)(7406005)(7416002)(70206006)(70586007)(47076005)(54906003)(316002)(4326008)(66574015)(16526019)(1076003)(2616005)(8676002)(40480700001)(336012)(83380400001)(36756003)(426003)(8936002)(5660300002)(44832011)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:42.3455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c177fba-5e2c-4b18-e949-08dbcea75179 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: MWH0EPF000989E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8352 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 17:24:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960136266985579 X-GMAIL-MSGID: 1779960136266985579 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 --- v14: No changes v13: Commit message update(adds a blank line). (Reinette) v12: Removed the comments about the later patch. The text is moved to patch 10. (Boris) --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5814a0bf3cea..5f6d6ba63a2e 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2551,6 +2551,7 @@ static void schemata_list_destroy(void) static int rdt_get_tree(struct fs_context *fc) { struct rdt_fs_context *ctx = rdt_fc2context(fc); + unsigned long flags = RFTYPE_CTRL_BASE; struct rdt_domain *dom; struct rdt_resource *r; int ret; @@ -2581,7 +2582,10 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); - ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (rdt_mon_capable) + flags |= RFTYPE_MON; + + ret = rdtgroup_add_files(rdtgroup_default.kn, flags); if (ret) goto out_schemata_free; @@ -3271,8 +3275,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, enum rdt_group_type rtype, struct rdtgroup **r) { struct rdtgroup *prdtgrp, *rdtgrp; + unsigned long files = 0; struct kernfs_node *kn; - uint files = 0; int ret; prdtgrp = rdtgroup_kn_lock_live(parent_kn); @@ -3324,10 +3328,13 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - if (rtype == RDTCTRL_GROUP) + if (rtype == RDTCTRL_GROUP) { files = RFTYPE_BASE | RFTYPE_CTRL; - else + if (rdt_mon_capable) + files |= RFTYPE_MON; + } else { files = RFTYPE_BASE | RFTYPE_MON; + } ret = rdtgroup_add_files(kn, files); if (ret) { From patchwork Tue Oct 17 00:23:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 153830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3808886vqb; Mon, 16 Oct 2023 17:24:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGU4SECVUL+g9hqDel6eN7yKZi1uKPw7spSWw+2j2hcwf7ipfVEX3eHdhOVbXBFjqLOesQ6 X-Received: by 2002:a17:902:7893:b0:1c9:e121:ccc1 with SMTP id q19-20020a170902789300b001c9e121ccc1mr839075pll.5.1697502267742; Mon, 16 Oct 2023 17:24:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697502267; cv=pass; d=google.com; s=arc-20160816; b=LzN4F8v39LB1N2c7tNF0lQvQr6KeupUjlCyjpRQdGKq5C+tGs0hPWqKyPrvO1xeto1 B28uex7Xoq+XFjM8/PD2tR4TyxDHyKUPuDOsLZHABsN3oo0PIh2ipZsLhtzdO7tVDixt qH0NvE/oGABP6QHGFgNMoXe5/xT32csq6RccZfZgDXpjVoLb5PeLQlUebvEkHXF+BSI2 UCHAJ4NS9h13whEFynHuMQPTPAxHkJxYSgPDKskjiCfYSnH9iSImcLwYc4UERcuddN5T nE8t7Cyy+LRiHUzQQlIasseCQq3tvimJeGjn2JMl0J8DYk9ptuwIOEmKOvWMbau6y5tt UURg== 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=FA5mBzajElpiCfelQe7ylBRN/yhuuRgLzspIzo1mq0w=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=oCJwBUYwMWoB00ud/KfSDV5pWSbAbUEsZAINyTYlmfD7BqudHW7qATEIywOsoOV2Cv Yiszg1PSp6uET5qAdsizWUR9+ahTF0twiWRmHh2HJjbbjHQLMgLFJEC//O/p7QpDm/ZA JUXW/QvEvdP1rr+Up8HxfFeVQPPYfOHAKcs7pD0hTHg37lQK6ub42dtPNsp8ZMNV/jC+ yfdNEn0Z9aZihubk1JTDBEyjDiNMhcF16IgA+jOIwGI4Io8h3yq3j8wVgPxWG5m4MYyP phvJ1mGc4SvJwbbT0HPMWjDDjUSaiY6/444mPnvF1FkiEMfmlb9ANnbtmHswGdjFSzxG 5vzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CUxhxZj3; 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.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id l9-20020a170902d34900b001c8920e3021si481213plk.539.2023.10.16.17.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:24:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CUxhxZj3; 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.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4CF1A80203DB; Mon, 16 Oct 2023 17:24:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234311AbjJQAYP (ORCPT + 18 others); Mon, 16 Oct 2023 20:24:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234321AbjJQAYG (ORCPT ); Mon, 16 Oct 2023 20:24:06 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2076.outbound.protection.outlook.com [40.107.223.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AF06ED; Mon, 16 Oct 2023 17:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NtBx0KbXVtLemY90MZOby1vTJbdlTHOBjp65VqdXdzSJPhjakeAPol3Gaex6Y142xgwvNMab9QeFk59WkP2aYmL4sPIp/1XvZ10BhHAfDdm1l0JaIEJLo7GzXRenZAypfNOxrX+8MI30BHOdEwrc0zcyG7Dzj6Usrsxun93J4flomJtLC3Xv+2QpGYomZQBnWZw1rfYUrU5XEj2Sib2GkVyyaG1K/+6kq2zRIGARulWCrnaQ4W2lds7D6Ll6hRwl+nFpv2H6OGGpR68uccuetH03Hjpbt2Vzx1+UeKpLFrwEpiZjiJcK0gPNGbid494w5fLsG2HElIM9LMLZ49p5Sg== 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=FA5mBzajElpiCfelQe7ylBRN/yhuuRgLzspIzo1mq0w=; b=YCR50gP6yEollxDpyZhKpP/9KUG4Cjufrpvcm1HzFcyrkObC33vIFmLOsUg6gpd3i/AYUCqqIIPgNs9SRrN5N/5Q9nZbovbeKyjVEsOB9ZYtxCJnVvI4JnTiphKKGsMNc1hUpuyoHL8WiEM83oQY8AvSALrTZAp7LDeyCxVv6Ol4vp8mRczQhHzTmYzqYwX9CW/pQmlyv73+bycqpdAKDv+e+O9hw77D69uJyiAcRwghx/xTLBVwswyZXw+fnCrZbMiG0Hc9fxJPVsgEsxGDIvfLzNeVocZgvxMcKDEri1XGt6pWmO72PcDlFbU1ySL8SXH244G3Sd/zri5ykhfl/w== 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=FA5mBzajElpiCfelQe7ylBRN/yhuuRgLzspIzo1mq0w=; b=CUxhxZj3zEGK59A4MJFgI+hk5vshb+k4Oa0SYe0p2dewzhbz7u/Rm0gXM76kwtia6lSMOQleh5MPqkbZFBCa1I1f6Oq5mu4oFpOLhV+PSRw8PaJlPbXgnSOGd7eCAZDHXbY9irgKdJBs3iDDL5IDe/qMSkjuXhbHf3jzAxAFM+o= Received: from MW4PR04CA0146.namprd04.prod.outlook.com (2603:10b6:303:84::31) by MN0PR12MB6270.namprd12.prod.outlook.com (2603:10b6:208:3c2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Tue, 17 Oct 2023 00:23:44 +0000 Received: from MWH0EPF000989E5.namprd02.prod.outlook.com (2603:10b6:303:84:cafe::7d) by MW4PR04CA0146.outlook.office365.com (2603:10b6:303:84::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Tue, 17 Oct 2023 00:23:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E5.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Tue, 17 Oct 2023 00:23:43 +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; Mon, 16 Oct 2023 19:23:41 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 9/9] x86/resctrl: Display RMID of resource group Date: Mon, 16 Oct 2023 19:23:08 -0500 Message-ID: <20231017002308.134480-10-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017002308.134480-1-babu.moger@amd.com> References: <20231017002308.134480-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: MWH0EPF000989E5:EE_|MN0PR12MB6270:EE_ X-MS-Office365-Filtering-Correlation-Id: fa2a1920-ac5f-4d6b-8f82-08dbcea75263 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZR3fihi7EhTI4nYm47qTCM9gzTvyPEVc/Tf6rBMQtz95HZzOScWm3YeAo1Z7pXQUQ6jIgRRbKzhOWTSQACEtV4wrE3Zxh9SRJAl+TkqhiO0wwKHtVwmlQr0+X2hsYl2JAFQbuLv+Lq2dzSZCV8hMJT4gYu9Bro15I8Ssmd2gVIZxaxfWVQSCjX+kJiYZ9ec35ZEPXkbtKilWoUzYO29EBKGZQ7KrWjB6dcsoU8tLmX/e+tYgmx75D3zSyvJNDK/dIdGq6RM5rI0XRpf0epgSj1GTnAfwkuMVJnp7RnLIzQlIVj4CY++FUpDImp3eoIwifVSobsOWQfW0+0+gcer/EU8pl9NgSg1B61qJhZdn5Cll/+2HwOOmjlRhMy4Wz8F3osVF2iPksXvRbpeFbEfDILcLU4cdvnYk87SpspVoIiHwEpUql5zaFlthKFAy4tHk6Kfu3TFct3z6VlGZ5HQ1XlGcEWpyc2qMBoZrAZs/f34GNxnebZhRE4pS56LY5dWMHm8egw0TtByRvQmjt79iDvYDRWAd51wRjshWsqlxYablOdskNWQWqE14UN8A1xrnFADeL1TfdMLrcX30ycvxfi6CscjbDXkIwDxhbEhBPrvbaDoOWuM7wxQGRELS0svXGkfF2V1DIi338yjEpE45Q0TjpPqF4p6waXYt8VZnMFAJh9U6VpC/ErfzToP72FqeRMb4/r3ULyi1MpOpcY4uirqjOdHmTygokjeYEkvPp8hgFepxN4nDjXkLkLMKoNyQYA0baWplcJGQKLsEct3W7w== 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)(39860400002)(136003)(376002)(346002)(230922051799003)(1800799009)(451199024)(82310400011)(186009)(64100799003)(40470700004)(46966006)(36840700001)(7696005)(40480700001)(44832011)(5660300002)(40460700003)(6666004)(1076003)(336012)(2906002)(83380400001)(36756003)(426003)(26005)(16526019)(2616005)(66574015)(356005)(86362001)(36860700001)(82740400003)(81166007)(47076005)(7406005)(7416002)(478600001)(41300700001)(316002)(110136005)(54906003)(70586007)(70206006)(8936002)(4326008)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 00:23:43.8767 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa2a1920-ac5f-4d6b-8f82-08dbcea75263 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: MWH0EPF000989E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6270 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 17:24:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960137592207322 X-GMAIL-MSGID: 1779960137592207322 In x86, hardware uses RMID to identify a monitoring group. When a user creates a monitor group these details are not visible. These details can help resctrl debugging. Add RMID(mon_hw_id) to the monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Add RFTYPE_MON_BASE that complements existing RFTYPE_CTRL_BASE and represents files belonging to monitoring groups. Other architectures do not use "RMID". Use the name mon_hw_id to refer to "RMID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- v14: Removed the RFTYPE documentation in resctrl.rst file. (Boris) v13: Minor commit message update. (Reinette). v12: Moved the comments from arch/x86/kernel/cpu/resctrl/internal.h to Documentation/arch/x86/resctrl.rst. (Boris) Moved RFTYPE_MON_BASE definition here where it is being used. (Boris) --- Documentation/arch/x86/resctrl.rst | 4 ++++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 7412252f95a7..a6279df64a9d 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -376,6 +376,10 @@ When monitoring is enabled all MON groups will also contain: the sum for all tasks in the CTRL_MON group and all tasks in MON groups. Please see example section for more details on usage. +"mon_hw_id": + Available only with debug option. The identifier used by hardware + for the monitor group. On x86 this is the RMID. + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index b816b902b5c0..a4f1aa15f0a2 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -254,6 +254,7 @@ struct rdtgroup { #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) #define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) /* List of all resource groups */ extern struct list_head rdt_all_groups; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5f6d6ba63a2e..69a1de92384a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1867,6 +1883,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "mon_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + .fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG, + }, { .name = "schemata", .mode = 0644,