From patchwork Tue Oct 3 23:54:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422716vqb; Tue, 3 Oct 2023 16:56:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF15uDyiID0M1yLrlXC5tYnCR7XPJ6MfYiEZncyNSMNjqLnK4h1tCejrk7lYRP3yJzAY1Nt X-Received: by 2002:a17:902:ea07:b0:1c3:749f:6a5c with SMTP id s7-20020a170902ea0700b001c3749f6a5cmr1128564plg.12.1696377392843; Tue, 03 Oct 2023 16:56:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377392; cv=pass; d=google.com; s=arc-20160816; b=fuuUEH3s3NGBDqiT/QUCpHV3Skk/uVg4Pd+UTZLYTXvQdCrw2bN9HoNSWRWnvt9hhL /Qk6ux/inya79BA/BvtmmI7YWaTcC6lSw8grIm1qekp7UD41GEOzVS0tqZ8vguIlfkDu TZorRyu0F0t/dQ2wcrM/hflOQBoQrrP/f3jE5B6cGn0lmSs64qRNmzNY4srzm/3CyqQM 6yXoJ3AVInsztxbZMHp+nCLjkPrMya8NBe89jXvPPBvHFrK2f+RutW+UEvv2qB1nf13/ 47mq47kX+DtLEup8CALjv5B8Ieav3Px+fCqdpft+VaAryKUWwDtkPfsNvZvZbp31hbaR W7+A== 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=zaCH8MTSkc0UzW+UL86tyRkNZrgjqp9oEk2+/H79ms4=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=CtmF47P3gWbJmLlSgGxUh9hsVE0kh7SWfESNMIvXsEEQwzLQGJVW374f4+IzM2Mg0T cNLMu6C4vmKSABPU+zsGJy/9oqe5K6f3JlSpskp25h+T5JJapucj/nEg5qxz+Hw/VAIg ukSm8u0JMSUkCVJYo4jJvGOcnDPzhzhnfmj+rKsy7nLCoTmLAyFoICrHDhvrh+Ue5x9B 2HOG1V9EYQuObYMLg43wHzCxmsoqx3UJ1vtFizVJg1xviSOhHrn0g/yXTxfPVFgd3lwn kkTCKKs9R9a8Y1KHrsp8MTefl3ke1Oj4YSYSdPPlTnDfLOUvEr23egvVrd/4/0buI1bL 5ATA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1Bp8dORq; 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.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id l13-20020a170903244d00b001c61a231d33si2779231pls.292.2023.10.03.16.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1Bp8dORq; 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.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 25217819D1C8; Tue, 3 Oct 2023 16:55:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbjJCXyz (ORCPT + 17 others); Tue, 3 Oct 2023 19:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbjJCXyx (ORCPT ); Tue, 3 Oct 2023 19:54:53 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 500FBA9; Tue, 3 Oct 2023 16:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PdgZvuh0AOahsCW3buPSUAoQH5tnS3Yka4dfC8yPhjTOYCq2bM7fjmSO6MNEePFO8yVkiciDyqO8HDZihS2Xg2jPk3EDkrsn/AUl3yYan4fG0Jt1DE9nMAgfZx1DG70f73d1FvrT5FznPZLyQCV6XHlH1k5S2qTaU3znBZWTi0cJoUy3O/7WNtfLUu8Py++Zfj41FAQ0yryEmXuJx793BypoX0XeL3YlNBfKBciNx4X1KmiyRRDqFWbWJF23VOt/pCDYI8l25LSN3pN9y/hO10Q8GD/UPSS68JpWTi+q1geaJnPQJPUdU9NqkytZGJN+UeEvt2IYZyruQY5InfAEvg== 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=zaCH8MTSkc0UzW+UL86tyRkNZrgjqp9oEk2+/H79ms4=; b=dP1TDGiXYSYz9nKlB6r187a0Mhyk6XIi20pkvK+CoNz60xJnrLkzIq5HPxErtsYLmK5H6+cpkOoEWf9ulFNi7pHcA21qh1cd3W1mhA9yyppfSMX64feiEuBpRr/RkQhghCM5+K2oPzcii6It5ye7stAEZ7dFIjvUbpu7cELbxdH5Ii75fT4R+F0/w6Eq13rYrfzgKyMhPtCiRq8lRUqJTwdqjmf0CWMtFIz4lSvLc65esypXSD0Dy+EP/P8XGbqd+ESq+w9ldfjjhe97Rio+LFDvjJt0raaaZjzBBcEPAev18F2FJ4in3MaFU7ePvshqynlw4tpGFfsogQqJRVY1ww== 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=zaCH8MTSkc0UzW+UL86tyRkNZrgjqp9oEk2+/H79ms4=; b=1Bp8dORq5/U9O44IBJ1OGbMpjwdZ0eeHwrYg4uPTyAe5ditcDRVdChZ91YtI0/2pIO8SPtPeEzmJ2kACmYyT252bSusle6oidUUGgK4twzSdWsGeVqlx0RNAXKGo+vmCBSPEsrsIU03Y3kRaDmA4qzP2v46IBN99aGq4T3/ep/s= Received: from MW4P221CA0019.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::24) by CY5PR12MB6576.namprd12.prod.outlook.com (2603:10b6:930:40::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Tue, 3 Oct 2023 23:54:48 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:303:8b:cafe::c4) by MW4P221CA0019.outlook.office365.com (2603:10b6:303:8b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.26 via Frontend Transport; Tue, 3 Oct 2023 23:54:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.9 via Frontend Transport; Tue, 3 Oct 2023 23:54:47 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:45 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 01/10] x86/resctrl: Add multiple tasks to the resctrl group at once Date: Tue, 3 Oct 2023 18:54:21 -0500 Message-ID: <20231003235430.1231238-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044FC:EE_|CY5PR12MB6576:EE_ X-MS-Office365-Filtering-Correlation-Id: cf9cbbf1-a000-4710-5823-08dbc46c2024 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MHEvOhmEw+wAcQw9B3/vJ5UA2zxfdaLwFE9zNjTeXMFMFCBTgfMc7Nx3BR211ADsQFoCzcHg6u+w1086JtWegV+hljkAIeASN63K0SH4X9BoPFPJ/E0FBA/bWczYicNe0RBaaf/fodE/ff7ZgqXs2Y9blkc7f12AoN8KfWpzS8hqN8V9ydH/VQv7M2i+caq0lCDWHKgmr9tou94n+R9SOSLy8GRX+U87NGBa0iZ1CePJBfkmtyipgtXIW6cQGVASgu9ursUifrCRNgwuux9QSEJI58vY2DpUV1siTFgt3oJlllBubuC1BJCrOi376C+83MRdC++veXTAKm+px1sq0vRxI4zNaC9xDU2RreyYKh4Noxj2W13Gq1f+9KNb4FZ50IDIHuBhGob/71xv2pcDgNhru3bmJ29oXxyYQJluCjxofbITM1X8Jv0p/08WmSdR6CE3cCZqTH1iLxNAKlUjicieuxmwPK5ID2hL8GxDEIOXaCdWIYPaoqj/+tajlWeux12+OL4cKNHZiVlI5wr/x8FGyPQje2wn0pSIRFI5mhbKyamMih/HMUBQptzwLmDfMA/YFXYxQWzyzRp3v2RzBXTVYqb8yRW64Z/cHpaJKNa2hN3Y4Jzb9SZmGZrjrxoESCdmt70CP4JhwN7Wa3AiGqTd+NqjIU07XYGnMRjlrN7fLuZ1AqcRoTv/K6Ndgf3Tct1ONufoGJJdv+k5m0RI0xCYhItiyhge/75ntJoYO3nMstiaa2Eg6mkePih313aybXujhP2vSPccHKPZVhwxTA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(39860400002)(346002)(376002)(230922051799003)(64100799003)(186009)(82310400011)(1800799009)(451199024)(46966006)(40470700004)(36840700001)(110136005)(66899024)(40480700001)(70206006)(70586007)(54906003)(316002)(36860700001)(1076003)(41300700001)(44832011)(2906002)(426003)(336012)(66574015)(40460700003)(7416002)(7406005)(36756003)(83380400001)(7696005)(26005)(5660300002)(6666004)(8936002)(16526019)(8676002)(4326008)(2616005)(81166007)(82740400003)(356005)(478600001)(47076005)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:47.6415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf9cbbf1-a000-4710-5823-08dbc46c2024 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: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6576 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 16:55:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780621366254738 X-GMAIL-MSGID: 1778780621366254738 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 --- Documentation/arch/x86/resctrl.rst | 9 ++++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 25 ++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index cb05d90111b4..8154e9975d1e 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -299,7 +299,14 @@ All groups contain the following files: "tasks": Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the - group. If the group is a CTRL_MON group the task is removed from + group. Multiple tasks can be added by separating the task ids + with commas. Tasks will be assigned sequentially. Multiple + failures are not supported. A single failure encountered while + attempting to assign a task will cause the operation to abort and + already added tasks before the failure will remain in the group. + Failures will be logged to /sys/fs/resctrl/info/last_cmd_status. + + If the group is a CTRL_MON group the task is removed from whichever previous CTRL_MON group owned the task and also from any MON group that owned the task. If the group is a MON group, then the task must already belong to the CTRL_MON parent of this diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 725344048f85..f0d163950969 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -696,11 +696,10 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { struct rdtgroup *rdtgrp; + char *pid_str; int ret = 0; pid_t pid; - if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) - return -EINVAL; rdtgrp = rdtgroup_kn_lock_live(of->kn); if (!rdtgrp) { rdtgroup_kn_unlock(of->kn); @@ -715,7 +714,27 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, goto unlock; } - ret = rdtgroup_move_task(pid, rdtgrp, of); + while (buf && buf[0] != '\0' && buf[0] != '\n') { + pid_str = strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_printf("Task list parsing error pid %s\n", pid_str); + ret = -EINVAL; + break; + } + + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d\n", pid); + ret = -EINVAL; + break; + } + + ret = rdtgroup_move_task(pid, rdtgrp, of); + if (ret) { + rdt_last_cmd_printf("Error while processing task %d\n", pid); + break; + } + } unlock: rdtgroup_kn_unlock(of->kn); From patchwork Tue Oct 3 23:54:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422234vqb; Tue, 3 Oct 2023 16:55:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHcaDWjozHEO6i0as43KE/YyZ8kaW1YOzB3tpNCW+EI3jVGRek65doJW4irsii2j8XVNQK X-Received: by 2002:a05:6358:430c:b0:134:ea45:53d7 with SMTP id r12-20020a056358430c00b00134ea4553d7mr777922rwc.26.1696377303077; Tue, 03 Oct 2023 16:55:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377303; cv=pass; d=google.com; s=arc-20160816; b=v0YCSriaq35rVS7bkpG/P+7KTenS04709A8WkckMBZLHsmvGzCUmJ4SSRaWeXjYDZU yFgJnJarsyb7XsH1nuFIXgx+nZmHWlmlRQ1PlfC6KvgLh5wcTbQeKAcA5kXkG91htLVG 5d8w390+5eVIV/HOPuVSeecll5wc3uC82blDvpCV3p2lmPgKDxEFmjpIGEHggPbDCVQP EuyNITtVeFEyzOPy30XaqvmdWwTSngTnezv31cRXqroBGmAr9v+EzAXPYCSyDK5yh8YC s0DXNuAkUnWHyrD62esKlMqQRy2IaBjCVSGmHOdnuMHAH1NB51O4/e2mlWyQ87MyVHuO qUuQ== 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=rvx6wpstpXyvbg9fQ0PRt/s04VUxwIAdPEUkvwSPzCY=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=AUlM2iPl0PjWcnvpcpTFvDWqeN+E6LreeW/a3O3qNcgT+AFvrqbNaxiyX7YJvDRrrT Yw1t1lRy0tP9eBn9LF9vfIdTltD4vct7+qZvLcaU4lymQtr5z2CY+hI/iDzk5PDVo6EW HibZ4gf2VejZL9Hm9dBq7wlWNaFEw3vDtxzxFLJVDAk9xEE0CUewAxz9WiPdSzR0MnQc 5tPjklc0uMgdLigtKNhO+D4PeSOwUw18AMkMdx7H1co0vgkUNSu7j7YO/fgo4pjkK8g0 Px1wuZcLDvM54yNfooBf+BnRiMUZN5D9aQ8khX+RfUXvrG1m+Cke59R/1m9IWTQRjdyM ILNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=YIw0ovYC; 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 w8-20020a63f508000000b00584a4a74243si2516293pgh.771.2023.10.03.16.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:55:03 -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=YIw0ovYC; 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 BCEAD81B94E2; Tue, 3 Oct 2023 16:55:01 -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 S237826AbjJCXy7 (ORCPT + 17 others); Tue, 3 Oct 2023 19:54:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbjJCXy4 (ORCPT ); Tue, 3 Oct 2023 19:54:56 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED9FAAC; Tue, 3 Oct 2023 16:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ae4/IAvRIdCfq9fFdxfWcFHvTPI/bNVBgYqbuR/1j7auiq4C1t8/LFdvAUYZP52ofx/0AzT/iJXyRyJAVyRYhSL6EVxzmJC/WRlg0oIEw8dEbsiTi3N4tk0U9ia9F5rc4B+g9ki8TNDPT7EJrGqW5P5vAHztvfsQiYreNzbPNkOm0mRTwwY8NwqGnNBLHSKF8osbuiPgtrnd9EM3bolYylhIu5ewjrtYwVv9xGk/pRmet7ZKoM+EtxDM+9rkvnWRaBjT5eWadfZqIv8FZnqRx/2EEyfV0H5ahqLJRjpYVpRgsHLBKsndTFyttp9gvY9rVesvqGDfTffrI67r64xnAA== 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=rvx6wpstpXyvbg9fQ0PRt/s04VUxwIAdPEUkvwSPzCY=; b=FKlgeESG+Nq4M5e8hyAasrZ55J8coEOhRi/1Q0njG6SmUZiGh+ZtGohgSqk4BQRhx7lVFgrrjhb3FyYlxKGNg+ALA+c69DX6ZXZX4ukhwuUcP48cRzp3b2dZcQj1BPurdDuelHmXjPsyHh7myS6lnIs+mZAfa1Q9yBGxfp88V99SiN4kYsj6uHYMWBZxi1O/p1Ph36NcdebukPGaVbedxJ6Sgax6wirEOEdC2qPDvPYSupcHS0Kv7yakW38tyxm0rdzQ0XCh3YqkZzsdw3ECZ8AC6FBxBMFi5Vj5E1TMV0Ps1WDLjrfEItHQ8xPwdaR8xnpJ4xiPEmE3OOhRFgDmQw== 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=rvx6wpstpXyvbg9fQ0PRt/s04VUxwIAdPEUkvwSPzCY=; b=YIw0ovYC3+4WLhfnd0u9MWPlqJroFQ2WczQZnOnC/GyzUTzN+x4Gb/aYzd8xxzcPAdIyg7U5oY+PWzoxVr6woXtct1DgWzHrDXmwfi0Y6lb6v7uJg4+KwuyvIAgA7ulqVI0q1VqoUoyzIqoW8HeUzc2RYA1hDbyHLF7RMXDGqRg= Received: from MW4PR03CA0218.namprd03.prod.outlook.com (2603:10b6:303:b9::13) by CY8PR12MB7243.namprd12.prod.outlook.com (2603:10b6:930:58::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.30; Tue, 3 Oct 2023 23:54:49 +0000 Received: from CO1PEPF000044F6.namprd21.prod.outlook.com (2603:10b6:303:b9:cafe::39) by MW4PR03CA0218.outlook.office365.com (2603:10b6:303:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.25 via Frontend Transport; Tue, 3 Oct 2023 23:54:49 +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 CO1PEPF000044F6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.14 via Frontend Transport; Tue, 3 Oct 2023 23:54:49 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:46 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 02/10] x86/resctrl: Simplify rftype flag definitions Date: Tue, 3 Oct 2023 18:54:22 -0500 Message-ID: <20231003235430.1231238-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044F6:EE_|CY8PR12MB7243:EE_ X-MS-Office365-Filtering-Correlation-Id: c1c30a18-f901-4ad9-0095-08dbc46c211a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sX5fzwbZvRWRFsCDMW78QISe9yuhV6AgJYmoLbLQrvZ/O0NetNxJfsJyqL20XVQbCdAo/QWZGNS0ujACInnX0Vr9VGJfkuI1CCWwS1pYkmb1ZTVrpWlSKhOLnor1A5fCvWeRtI5xzBCumBzhBziATghiFT89dgnhWTZBJ/5ijlz0JxjC234Du6n7zNSoOf5q3AzxL+jXB8TEVGji1VGyemF5phx7fIgF6abWTus+BXUqN8uHdlIiAd/X49aL1ATyUDj8xzM6v/qrC+KBO1vyRDN5F0LTexQN4gd1rY7f6oGSETE60zTdfJa6y7HYUW07yTWZEcXqMNKYnmDlAa+7p2PDj6G8/6ynI3uXynrYvWQcDY46gR/VLU8v5uk8CPDYn3O3MrT0N4DzQ5SV2ktYNZDM6ChOrAZ8w+9O9WSBIkmONaGD+6N3Ix3yihLz/T75an2NLJa/cgvz9p7Zw0OnZZnq6eIErqAGuowbBR8Y0CpNPqARhwy/ckdyrRi2ed2RqaSHbt77SUptFr/9hAPkk7u+jcP17gXsqD73X1f77vdXTv+1mb/j7oAfYR6F74XskrIrYGRAy10nU3aRv2mLzBqtAYxLglNT/38KqFEhTWmPJC/ETYoKX5dXqJnP9uwmfjarA8JTpDAXcIIjLkHX8xT6TC22zbzX7O+CW1z52UQ/X/q79mb6poehw1wPhFy81/A0U4zBp4burAvl2/iE/ScseILAbS9kz5i2c/Tx8cjeo2gaCJj/FxxIesAYo9/8cZbXEbC622GI5etq86xaTA== 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)(346002)(376002)(396003)(39860400002)(230922051799003)(1800799009)(186009)(82310400011)(451199024)(64100799003)(40470700004)(36840700001)(46966006)(110136005)(6666004)(7696005)(83380400001)(36860700001)(478600001)(1076003)(2616005)(336012)(426003)(16526019)(8676002)(40480700001)(316002)(41300700001)(2906002)(7416002)(70586007)(44832011)(54906003)(70206006)(5660300002)(8936002)(36756003)(4326008)(47076005)(86362001)(81166007)(356005)(7406005)(82740400003)(26005)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:49.2357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1c30a18-f901-4ad9-0095-08dbc46c211a 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: CO1PEPF000044F6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7243 X-Spam-Status: No, score=-1.7 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]); Tue, 03 Oct 2023 16:55:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780526675429191 X-GMAIL-MSGID: 1778780526675429191 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 --- arch/x86/kernel/cpu/resctrl/internal.h | 9 +++------ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 85ceaf9a31ac..62767774810d 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -243,12 +243,9 @@ struct rdtgroup { */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) -#define RF_CTRLSHIFT 4 -#define RF_MONSHIFT 5 -#define RF_TOPSHIFT 6 -#define RFTYPE_CTRL BIT(RF_CTRLSHIFT) -#define RFTYPE_MON BIT(RF_MONSHIFT) -#define RFTYPE_TOP BIT(RF_TOPSHIFT) +#define RFTYPE_CTRL BIT(4) +#define RFTYPE_MON BIT(5) +#define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) #define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index f0d163950969..7ddfa4b470e6 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3242,7 +3242,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); + if (rtype == RDTCTRL_GROUP) + files = RFTYPE_BASE | RFTYPE_CTRL; + else + files = RFTYPE_BASE | RFTYPE_MON; + ret = rdtgroup_add_files(kn, files); if (ret) { rdt_last_cmd_puts("kernfs fill error\n"); From patchwork Tue Oct 3 23:54:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422290vqb; Tue, 3 Oct 2023 16:55:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9yEp3/Gx/6c+dYk7PhO4TN6aKh6L/O7Qgwn9+LLgCyvHodunlryyZ4vo2vlt/xeFK/rMC X-Received: by 2002:a05:6a20:4425:b0:138:68b9:138e with SMTP id ce37-20020a056a20442500b0013868b9138emr6380684pzb.8.1696377310934; Tue, 03 Oct 2023 16:55:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377310; cv=pass; d=google.com; s=arc-20160816; b=Qg5ieZeDJcYoPPunfMvGeUihb0+vWBWc93rDzlrzHfQYLWuJ/a8Xu3MmZ4JkFJNwlB I6YHYCMNlWSW10fYbs1oizZ0ySUbkH/DWeXM4j+8DYKsj/1k4wUPjGOEv9Fiwzw0VOnN KhGn3q1Gqh8s80pZPp/4JS7aCY6WbtLISMjUZ3FA2SwwtU3ozEeEV5+F85LQnEgLn5TS an7JV47IEFtUf0UBS7Aam6QNgyVETIRBes0DdwW5BgtkuTCJiWvEhCmIOmQ7KfI1RdqE 3SWZOVS5cAhPtXMivs77yrAaKPKzVki30zY5rwrLHjDheDe3DG2jzGylmeSVer4eSTfz P/qg== 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=qzwTJlM63WgSK5uC9/0n1aSS/15CcclKP5QzmZxLJOc=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=bAv190+m+8nb2226ngasV1llMesZfsUcghDiA7Ri5A2TGSZdtXi1eBb1Or0Ak8PJ/a vhPH2wgY2pFwXoz3uxTkEBrXPdFljOz3OebqEtoWsTgK3SXS4UemLCE9dTCTbM24I9fQ DpOkiBIpoX/8bx1YhHMxPtyFr4R9Ida/HumeWCL1ZO3y9RlQFIXwjSjPvtrnkRozlhng aTM+6QTMKAWMoaF7OyMbs/hrwyObLI5mm4NjZAFkpI4D7q4W/h03/F17Gpp50Z7RHBHN 31Ewtm/oqBm0RbL32akR95CNPlgZUy+k5RmIt2/eEkMRnPRMtO7b2nIM+4d5mMRjQFr6 UT8g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GPE20Tno; 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:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o15-20020a656a4f000000b00565eedb1cf8si2885595pgu.825.2023.10.03.16.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GPE20Tno; 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:4 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 howler.vger.email (Postfix) with ESMTP id 3166C8317E96; Tue, 3 Oct 2023 16:55:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237999AbjJCXzH (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237402AbjJCXy6 (ORCPT ); Tue, 3 Oct 2023 19:54:58 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2053.outbound.protection.outlook.com [40.107.220.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC0CA7; Tue, 3 Oct 2023 16:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WUROmPbui4/LTRpmsJ1gCbG/AC8VftAqTKpwJpXcs4iaBOCDIMLE47yJgrY9hBHz7KXa5/xG0AnkgvokGbBcLKbOdlqQ2f4+E5uGSSzLWxWX3LLIcYMzYH6dqvNwxaxikzIWyOO8JRlsx6sQP/QoqEIquuOXqOopdpEpNSVwqIV5/HYR4/hDMhOcutKVXTLBciegQpfH6J5BN6EFtQPOECdYOfO9y+ODR38GNLBb3A8tP8SUe/JmLfJvo+gMYimjd/nYqlA2t8QEf3MQ0cS82/KG55Jd1KDhlIlM1hB3nuyHgTWUHrOwHw4LCb65hsfFgVhR+CD+nMY6TA7evZu7IA== 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=qzwTJlM63WgSK5uC9/0n1aSS/15CcclKP5QzmZxLJOc=; b=Ncg5lBc5V3DkzrYUIibfk/OwfyGemLWsdQtm4s8SmV0Szejwt7R9Meo73xRzgJ7LxYJxUjxBZnJO6Ufuh87rDPutAd57h1vVuC0R9U73c7i4it3w2Ay9IwtDpdVEjgFejgHef6pLafbXKnCU9W1/8zk6CWCjbqyFaicYXXyyPCZJHktYh1yOQVnzEum3/2k/941YlawNTWk8Y+R/DjHaLl/Jn3qDZPr4EhKlWC6kfOFtGMVd2LmzKCodB2ils/qwvKAdWDpJduntYWZvoBJ9ii0nBKlHLwhbXeoSgVckRRCMexwZGA2u3C4AVSJAOCH+YMsNzvsXueucyacfMkjRbw== 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=qzwTJlM63WgSK5uC9/0n1aSS/15CcclKP5QzmZxLJOc=; b=GPE20TnorMgj//TwkRqUAb16FYkbN95uRME/VSZZkgyvrSOY6uWkSl4mK7gQwCX3vN/a3GjVIvjL0g2UlKmw2SschCS9STzrWcuzQM6QJhoZiI3gVu5EiK7bGj6b8eTUu0FNBbIrYSuQLajypIlT/IyxI3RrvGqaFvK1WKSaIKE= Received: from MW4PR03CA0264.namprd03.prod.outlook.com (2603:10b6:303:b4::29) by IA1PR12MB6065.namprd12.prod.outlook.com (2603:10b6:208:3ef::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Tue, 3 Oct 2023 23:54:51 +0000 Received: from CO1PEPF000044F9.namprd21.prod.outlook.com (2603:10b6:303:b4:cafe::65) by MW4PR03CA0264.outlook.office365.com (2603:10b6:303:b4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.34 via Frontend Transport; Tue, 3 Oct 2023 23:54:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F9.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.9 via Frontend Transport; Tue, 3 Oct 2023 23:54:50 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:48 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 03/10] x86/resctrl: Rename rftype flags for consistency Date: Tue, 3 Oct 2023 18:54:23 -0500 Message-ID: <20231003235430.1231238-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044F9:EE_|IA1PR12MB6065:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d3e0390-c4d8-425e-3a08-08dbc46c220b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DmcaMkO/cGMWhREwWIa8PlhJPhLumuCbYh0WGvo9b2nwv+35R/nMqY4MgsRU8OxoEDtLZ5PcQSY3M+plUeqya+jRxsbsTG4LBiGCp4CBy0FBCxlsuaIcFiCLUho4Oz6ccxfyAowCEwddZkSPFrAztjfSz7Zb7Bxp/gt+AlhYRkdQhjGkVa3vfeLKBbKROgPcOTs6G7jkqAiAM5jc2iOmBj/BoTHCWQCqPmH7NSTsUEy7YPmxJKir5DcxjX3Ow7pNL0qperfRDC2L37E47yuoUCSZHLF5zGbCVXgqcwWgE+JYRCRZLEI0DVm+3phtJ98EyDet01gfYSDVfrcW7IM43u0FeNdKcW4+D8dsUuiMxCAyKrSqdy4BQE1/kbco5lXHN4e5bNUEEDKTgwF/OB0rwHp1Dzd/djkjKefGC66mY5XuaIVX1/kuXaECW96tQzrVKUBeYm9bV1UzI8mfPxYY3wYfigH73lqCwy1/wFtUkbZY+rpnCvxhd+/ML+W8Odf6D1jOobjbSkwwBhj5aIJr9D08klK/T8nT/rS6BYzfQcBo3+uO1bIPQRJsZkOLV+TqZj8DUwqn8Z/8TAYSwqey7JAWwdRiqyuI6QOS4H8waH6ZP23mQQ25AO2svPui6hjqUdrwteSdEr/uQ3Qe6vHG12kVEUXBir0NHbF8i6wRMTZikDbiDMpe1kwUp7kQ7FcKJ6CqvnLTx6xG5CsvstV8MqL6amnrB8MjT7hsCPicissCy95HgCkjlfQdgtj7c8mBYfW7lgZNqNyMkMuXjI2jtw== 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)(136003)(396003)(376002)(230922051799003)(186009)(82310400011)(1800799009)(64100799003)(451199024)(46966006)(40470700004)(36840700001)(7696005)(478600001)(6666004)(66574015)(336012)(426003)(2616005)(16526019)(26005)(1076003)(83380400001)(7406005)(7416002)(2906002)(316002)(110136005)(41300700001)(44832011)(70586007)(4326008)(8676002)(70206006)(5660300002)(54906003)(8936002)(36756003)(36860700001)(47076005)(86362001)(81166007)(82740400003)(356005)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:50.8167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d3e0390-c4d8-425e-3a08-08dbc46c220b 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: CO1PEPF000044F9.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6065 X-Spam-Status: No, score=-1.7 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 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 16:55:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780535185669428 X-GMAIL-MSGID: 1778780535185669428 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. Add RFTYPE_MON_BASE that will be used in a later patch. RFTYPE_MON_BASE complements existing RFTYPE_CTRL_BASE and represents files belonging to monitoring 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: Reinette Chatre Reviewed-by: Ilpo Järvinen --- arch/x86/kernel/cpu/resctrl/internal.h | 11 ++++--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 +++++++++++++------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 62767774810d..f71bc82c882f 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,11 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) -#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) /* List of all resource groups */ extern struct list_head rdt_all_groups; @@ -267,7 +268,7 @@ void __exit rdtgroup_exit(void); * @mode: Access mode * @kf_ops: File operations * @flags: File specific RFTYPE_FLAGS_* flags - * @fflags: File specific RF_* or RFTYPE_* flags + * @fflags: File specific RFTYPE_* flags * @seq_show: Show content of the file * @write: Write to the file */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 7ddfa4b470e6..35945b4bf196 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1705,77 +1705,77 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_last_cmd_status_show, - .fflags = RF_TOP_INFO, + .fflags = RFTYPE_TOP_INFO, }, { .name = "num_closids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_closids_show, - .fflags = RF_CTRL_INFO, + .fflags = RFTYPE_CTRL_INFO, }, { .name = "mon_features", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_mon_features_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "num_rmids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_rmids_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "cbm_mask", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_default_ctrl_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_cbm_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_cbm_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "shareable_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_shareable_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "bit_usage", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bit_usage_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_bandwidth", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_bw_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "bandwidth_gran", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bw_gran_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "delay_linear", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_delay_linear_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, /* * Platform specific which (if any) capabilities are provided by @@ -1794,7 +1794,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = max_threshold_occ_write, .seq_show = max_threshold_occ_show, - .fflags = RF_MON_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE, }, { .name = "mbm_total_bytes_config", @@ -1841,7 +1841,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_schemata_write, .seq_show = rdtgroup_schemata_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "mode", @@ -1849,14 +1849,14 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_mode_write, .seq_show = rdtgroup_mode_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "size", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_size_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, }; @@ -1913,7 +1913,7 @@ void __init thread_throttle_mode_init(void) if (!rft) return; - rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; + rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB; } void __init mbm_config_rftype_init(const char *config) @@ -1922,7 +1922,7 @@ void __init mbm_config_rftype_init(const char *config) rft = rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE; } /** @@ -2057,21 +2057,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) if (IS_ERR(kn_info)) return PTR_ERR(kn_info); - ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); + ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO); if (ret) goto out_destroy; /* loop over enabled controls, these are all alloc_capable */ list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - fflags = r->fflags | RF_CTRL_INFO; + fflags = r->fflags | RFTYPE_CTRL_INFO; ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags); if (ret) goto out_destroy; } for_each_mon_capable_rdt_resource(r) { - fflags = r->fflags | RF_MON_INFO; + fflags = r->fflags | RFTYPE_MON_INFO; sprintf(name, "%s_MON", r->name); ret = rdtgroup_mkdir_info_resdir(r, name, fflags); if (ret) @@ -3709,7 +3709,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE); + ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); if (ret) { kernfs_destroy_root(rdt_root); goto out; From patchwork Tue Oct 3 23:54:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422301vqb; Tue, 3 Oct 2023 16:55:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLlXTyQeUEFqHxH+Eh6qpnIvcsL/0oeJp/tGQW0AdbY/FkmqexLChhTUBOCQgSLaWkNSIv X-Received: by 2002:a17:902:c404:b0:1c3:e130:18f1 with SMTP id k4-20020a170902c40400b001c3e13018f1mr1285016plk.20.1696377316132; Tue, 03 Oct 2023 16:55:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377316; cv=pass; d=google.com; s=arc-20160816; b=jT0QRZGjhzHfdMz+NzyYbVSbW6s+yAwYuJToTO9WTSJrbF0v5vrQhI86I/WIbsJuXB GtRXuR3D8v+CFwb/NfvGBdJ0dbDu0W3jWXcIzyRRINsCBeaWxSVnuXmUe6GNs6otf64h 2zyl2v7P9rtn/d4nOymKn7xd3kwV/rYZhN4QrtdGRXARUxj8eoG/f4/W3WnQSwpmdpbZ oU9YkJC0etpjM46aZbVcZoKsrFUqXdQXx8JuPj/Dt0INrmgvgPxF1+LeUiPyOJBlkHDh ipLbnc1Nk5C9QhKm4HqfOm5eNd4f5NU4hxkdwACqTKTIr2q+loJV+roybJs4ssaUU5QX TyLQ== 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=U5bAhVhL44d5lXnrKca3CBF2AA2u3p0vGMxt60L5ecI=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=H3FNrRkvrpAW6B2xjOrVHVHSPTMRyk5TsJWrm0l701EaOBV11DAx3KjTG9Db5ymamy Hxb6oAnkaob4CkT8seBbrRhMazCMzCQe5hRMNa6/DAYKCaX3lrHHmI8LsjAL+1P6cE5K 6q7Nt2dxpgAuMmhsDAvWnCcK8iMXWELmYJbDowBPfugEPTOrQcjjLWVSUWuA+BJnPHDM 58GAbFwWYpWDitHo2yeg6vJ+n/XQesuBxirnc4xawn5k9Owj4b3XpR6xZYXBiguZwROU qKwkqYtQ7QjFhCbrLgaUxqIRB0GG1kX5gO+X3LJ6rzPJnddzkcy6Fsi05JBj8cbSF7mx /YGQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="PL7/ol3t"; 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 o10-20020a170903210a00b001bf20c806b0si2407239ple.175.2023.10.03.16.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:55:16 -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="PL7/ol3t"; 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 7BDAD81B94E9; Tue, 3 Oct 2023 16:55:15 -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 S238320AbjJCXzJ (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237474AbjJCXy6 (ORCPT ); Tue, 3 Oct 2023 19:54:58 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2064.outbound.protection.outlook.com [40.107.223.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE783AC; Tue, 3 Oct 2023 16:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RxEk0Ch1mpg1lwsDgrMSuXXLt9eRmZ1vDW6LJqx4UT8QlzNuIJqRR6+XSbNwTCEuaurIZn2kVy6WwNDLgqtwlv1RWTS5X6Mw0BAvuNpws6o4JNMU8AOq28OFVzYC1eX9bn4r7k5QedBbAA3A6s/bip6GG/g1/sFcN65giOFkqRcFr2TmItDJaij2p7/YZlOc/nfCgdXbL7uVxIa4BaIVu/Ke2d3VCO2VxJPMBZ1AAx5M1D/zYmORJ/+IYAXBqygO5aKXLAcGrGZdAM6hmgtc6HbDK+CYuYDBUSoGGdYzC52mZ+ii4gdZOwY47VxPTsa1esB3r0EWbLvWLg4vpsC5Xg== 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=U5bAhVhL44d5lXnrKca3CBF2AA2u3p0vGMxt60L5ecI=; b=HBffq5Ge2zyPb76j5aEzLGz/uoZg2yKA6UUi1xYc+v8eFx3ZQBY1qIu1STDRj0u/ln2pWB0TU6FCJfqN97Q0DV8cGsqOEBYSR0RwijTC6DPZm6mPRqKrvkBKeIBLUY2/rGSGY1tCu2Tvr4qBQTjZL8zX4+gDMw8l4RHS4aiR94XUfExEOzm68if7TFn/aOMaRwgAAt9TfUqG1pUB4cUfRDz8vUsSGob8TfwzWFdml5atuPV2QUnOZVhDGtUq/g79d20WjG6AJIwEECjq59+qm/ycboEiNFKl682i3qgSE57C1lhoTkcsohG+rDHl7bx0KLy43YdXZqM6GsjIzBespg== 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=U5bAhVhL44d5lXnrKca3CBF2AA2u3p0vGMxt60L5ecI=; b=PL7/ol3t5F3j7z0qdm0XHR2bLCYi7QrkYCgOYXOS7m7KP+48ycVqy9U2nPykif1ZravbI0HCfijK449Q1OsX+LSrBevzNzfbvP7Cr7X7fNNhxrp8ma7PZNeG/8Ri1O36PiWf21KZrDYzW4/dkrVUMyOWipdmYPIKJE4VLVd09BQ= Received: from MW4P221CA0011.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::16) by MN2PR12MB4334.namprd12.prod.outlook.com (2603:10b6:208:1d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.34; Tue, 3 Oct 2023 23:54:52 +0000 Received: from CO1PEPF000044F8.namprd21.prod.outlook.com (2603:10b6:303:8b:cafe::fb) by MW4P221CA0011.outlook.office365.com (2603:10b6:303:8b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.25 via Frontend Transport; Tue, 3 Oct 2023 23:54:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.9 via Frontend Transport; Tue, 3 Oct 2023 23:54:52 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:50 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 04/10] x86/resctrl: Add comments on RFTYPE flags hierarchy Date: Tue, 3 Oct 2023 18:54:24 -0500 Message-ID: <20231003235430.1231238-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044F8:EE_|MN2PR12MB4334:EE_ X-MS-Office365-Filtering-Correlation-Id: cc51d60c-bd02-4e65-1f46-08dbc46c230d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oq3Y/RTSaO17afieRdO0ru3VNkrsXKp3SrhouRy0CKmNXhJuFxNTbmXuzNqMUPV+a+SURkFermbCi2NkC0vIY5TIOhCfropJimrbW83c9dVdE1MXCkObESpBknCEIDtUJ1Ni5kr+/5CVA8bZgvgyG2ZNz6swVgfvujTYxL29IhDTJHm28woveUKjC0z0IgOmRSjfy7ULt6QHMJAGuGJk6hXZriUGR8Hd9+rNlfdwP1Bv7x/qW+fIi2HyjjjnrAINVfrGj2uE6aQ3YkvnqXN8T0oAKM5fA2WlK+A7W/xH/yJOCfLgIbQFdfbWqeyzltDoSrb/LjryEdZy6+hnZRkteDa6OLunz+JcZOA+v54lDDLpUsx/6+rRZfqM4w2S5FKvvJ2m9Fc+govLrgSURfiACwmvDgGKSodopDaI6TG9M84q82NEoEa2awPObLlZQcy1LAdlMP1+11V9IoRDOtekXzmQM0fJZ44p1CjOy9eBzekJP2c+s9+2npMhSUnkp+ERDqvwnTS9tdRPAbkRpkBXzwPM0vXruDA4KHD8+EWF1eV6irRpbPBoXRX4a3pr6o00zvHlycEgczOQKA0/jh0bHIr6AW/r768z354dOQgUuuncdq771xfRVg1FYx78/Ntnkf+9Iwp7HXE7OGEUFmMvCkDhDlHB/LqK7bcTSj2spkvyAvg2vFtHmG7hxsGeulq5qvO3fnAD3NgQ867ZO6pXdbGVFnQHPRn2U+n6diMvyh/dF0lwlI/q+TUGd/wp67ETzdHw9DzNFbDeh6e3t5Szsw== 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)(39860400002)(136003)(376002)(230922051799003)(64100799003)(82310400011)(451199024)(1800799009)(186009)(46966006)(40470700004)(36840700001)(36756003)(6666004)(82740400003)(7696005)(86362001)(478600001)(81166007)(356005)(110136005)(70206006)(54906003)(316002)(70586007)(41300700001)(2616005)(1076003)(26005)(16526019)(8936002)(4326008)(8676002)(426003)(336012)(5660300002)(44832011)(40460700003)(47076005)(36860700001)(2906002)(7416002)(40480700001)(7406005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:52.4913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc51d60c-bd02-4e65-1f46-08dbc46c230d 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: CO1PEPF000044F8.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4334 X-Spam-Status: No, score=-1.7 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]); Tue, 03 Oct 2023 16:55:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780540642857041 X-GMAIL-MSGID: 1778780540642857041 resctrl uses RFTYPE flags for creating resctrl directory structure. Definitions and directory structures are not documented. Add comments to improve the readability and help future additions. Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- arch/x86/kernel/cpu/resctrl/internal.h | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index f71bc82c882f..b47a5906f952 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,6 +240,64 @@ struct rdtgroup { /* * Define the file type flags for base and info directories. + * + * RESCTRL filesystem has two main components + * a. info + * b. base + * + * /sys/fs/resctrl/ + * | + * --> info (Top level directory named "info". Contains files that + * | provide details on control and monitoring resources.) + * | + * --> base (Root directory associated with default resource group + * as well as directories created by user for MON and CTRL + * groups. Contains files to interact with MON and CTRL + * groups.) + * + * Note: resctrl uses flags for files, not for directories. + * Directories are created based on the resource type. Added + * directories below for better understanding. + * + * info directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_INFO + * Directory: info + * --> RFTYPE_TOP (Files in top level of info directory) + * File: last_cmd_status + * + * --> RFTYPE_MON (Files for all monitoring resources) + * Directory: L3_MON + * Files: mon_features, num_rmids + * + * --> RFTYPE_RES_CACHE (Files for cache monitoring resources) + * Directory: L3_MON + * Files: max_threshold_occupancy, + * mbm_total_bytes_config, + * mbm_local_bytes_config + * + * --> RFTYPE_CTRL (Files for all control resources) + * Directories: L2, L3, MB, SMBA, L2CODE, L2DATA, L3CODE, L3DATA + * File: num_closids + * + * --> RFTYPE_RES_CACHE (Files for cache control resources) + * Directories: L2, L3, L2CODE, L2DATA, L3CODE, L3DATA + * Files: bit_usage, cbm_mask, min_cbm_bits, + * shareable_bits + * + * --> RFTYPE_RES_MB (Files for memory control resources) + * Directories: MB, SMBA + * Files: bandwidth_gran, delay_linear, + * min_bandwidth, thread_throttle_mode + * + * base directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_BASE (Files common for both MON and CTRL groups) + * Files: cpus, cpus_list, tasks + * + * --> RFTYPE_CTRL (Files for CTRL group) + * Files: mode, schemata, size + * */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) From patchwork Tue Oct 3 23:54:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148113 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422336vqb; Tue, 3 Oct 2023 16:55:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuTyWiSLYiI42+napQ7FFq1dfNHZaTFqwQj2yjNvd2X0rW1i3a6SHvQoXZsPml4AxD3nGL X-Received: by 2002:a05:6358:3994:b0:145:794e:ac30 with SMTP id b20-20020a056358399400b00145794eac30mr802682rwe.17.1696377323234; Tue, 03 Oct 2023 16:55:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377323; cv=pass; d=google.com; s=arc-20160816; b=LCFTaif3CnFp6jxInUbCdDBoPK/Q2sxdATq2E2pKEfgPmMmupbbozVJp/M4jy6bJaU KnKdiMsU3jomnFoIzZrIsA9w4U7p7Pgl+qKqvapgAuoAS7nAk+KSacGTkQXOOvqI+ank ZMA5xHBFq2/ZFLgGv/mE9AeC1ptNEzCg1O7jU2Scj0lTS+BG16i9gNuqiQ/8tBWRfLs2 g62ZTSmknFz/LjRDE/+GKA8LyB2MEPJ/YcU5LFEJbevFHHKtHgB3QuQtM74R2DgChWUq pmqT03GiIHUVUQHjMGznE5VP+CeWnJjN6BEa+rvV8xsQ1SpOyUIJLoUeeR3MXGfgiTqk L9ww== 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=9J+w0jVFnvyWGsoedzrlMz9PpUJA018ZIyHAgQ0g1v8=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=chP6WjbIpoCclIu8OQbL1TFmhtzkvjSy80MizmhpZL4uPNRbuKZaCWlZpa6jSM255u aap2fdbb7JeXV0EnD4WbqwfCWU+9QwkHJbfT0DCN6APompa7i1kEgL7LRyvHpaTghTdA K217uZyxiHaeK2GNNmYSefF7I3JpJs+ovNrOCdIX7mvv6HGxkK7dCrhhGkar7glxhDxJ xoOYHG7S/1qaSTmHfoD3MAL0LB9Rnq6ecx1zR4bFtBv/vs+42VQQ6ctZ5tLcfxkuJ3wY Qqyr8Iziq9KoYT7QBp/lnD0NbwrR/OjWfdigIbBuT8gG+pgrYJ1/csZ2q5n2KTTVZ4Nn e3rg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="zAYsLan/"; 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 gj22-20020a17090b109600b0027728f01512si300191pjb.167.2023.10.03.16.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:55:23 -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="zAYsLan/"; 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 6C61181BA641; Tue, 3 Oct 2023 16:55:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237953AbjJCXzQ (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237649AbjJCXzG (ORCPT ); Tue, 3 Oct 2023 19:55:06 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B10BBF; Tue, 3 Oct 2023 16:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DLNJQBKRJPzhi16l1P8zDDyEjYocuiuwINootZr4hOnQGaTi3LVQkVmxl9+zr1u1o+tAVxCw9TGz5brPBnn+AmRzz7GGxCUkq/AGmFeA1tBMVdzE2bMuG26s+2dTS8aumKoAlnmYUKeOdER/tkKKuNCqZbJ0Plr/YavY0Umu2xWTJIolqt2pB0ilzvZycEWEbtq5zSaRcskZXZPu26nfmodoR98pXb63gLSOEN4jLCwXgm2aenQVWG8LalWK3rQNNA8OMhZRIiXvlZEcnDJ/GWe/cPay9vFU734eYRQVk5xX6rqyT8wM9yy+o8HRIA6OegXq+YmAb8058Wafc98BRg== 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=9J+w0jVFnvyWGsoedzrlMz9PpUJA018ZIyHAgQ0g1v8=; b=Tispr3p8LkouUV++pZ/S8RIyvzzvBWBNtTvwfv6gkPL/SAvxZk818FjymFU3jq0z4md97Yasgau+H4paQjYMM91d6O1DyjuThov1ansRYeFqgffAsekzirjHgnCGQ8VF+67rlEeHRVeiHyTKUnMv6rdtahl4st0aI9oO9PBbUOxRNoSPtrXZNVmSVIqC0Wp+6aAZ0zepGiU5ngceDqu1A6MF7Xg9W36O1VfFfpMNoQD+V1nTzd65b1Ei7R2Lw77QQ/3kUIazFvmAa4Vc25wVmzrHAaojPWTW4EPoK/z2tL1Udt2XB1RVgASeIC4Z9dZtckSfhz1uGJv6wUcdVKZpmw== 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=9J+w0jVFnvyWGsoedzrlMz9PpUJA018ZIyHAgQ0g1v8=; b=zAYsLan/qie3OCUChWBa6EODdlhaHIYS2U1LYEevzcmsNYtZqzQPEy0mmlc0WNjrZTVV2VrIFeG2l9tksWNHkRkqr9QZQgZuPeX/3IV7tAtcHUqoEFuYA3rYAF7o9na/QYR7TEsdjUQPCSUmWTLCY25m/NdBmyg+I2p/KTomk2M= Received: from MW4P221CA0026.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::31) by CH2PR12MB4037.namprd12.prod.outlook.com (2603:10b6:610:7a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Tue, 3 Oct 2023 23:54:54 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:303:8b:cafe::59) by MW4P221CA0026.outlook.office365.com (2603:10b6:303:8b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.31 via Frontend Transport; Tue, 3 Oct 2023 23:54:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.9 via Frontend Transport; Tue, 3 Oct 2023 23:54:54 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:51 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 05/10] x86/resctrl: Unwind the errors inside rdt_enable_ctx() Date: Tue, 3 Oct 2023 18:54:25 -0500 Message-ID: <20231003235430.1231238-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044FC:EE_|CH2PR12MB4037:EE_ X-MS-Office365-Filtering-Correlation-Id: a4e76f15-63ad-4d22-3c84-08dbc46c23f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rO6UjeExdgLCtKR7Pzx1j/gbRvlCTzWr5FxhBFffBUOeOdpeD2zxjn5KDz6GNDymEg9g5taIAlksDA2WZSnRJt+JdX6csDOI3vVIpUpFMxyVxd5pmuV1cwTY1/q9vu3euF+B2T3n9g5wlPFADbwwdKXyp1yRQoikmQfM3N0ut3DmS3JUQRNozLmeAePUbWJcqoV81mR+FEAWa6uh6wNV1daIYuwXD3wI5YbllpTSNagOx/3j8Uo53w50Q8bUJE35EyNeYkr47Rik3nCPkCEcTFxJESVUHZF4N6Boq/qra0WOKRerq2O0WCrXmVOxzlwB/zwL3G9WbHixtpC/E/cAa+OQufQcn1tPe+KUGzRJha1LL1qkl/vTxYEECzX7EmNhhBPllyKoYUxtdlyMkg/RP7KOhqF2h5Z+Y/1zwC8+H8TbdkBXYw33HA0qbLGTwI5cAhhng8b2JfMGBndn8HdRzAgFGg/ZtniziKh/lIoTrZkXobfR8soheo6bsUhNwd0pyqtrojKtRPgN5lKcnICRowwN0E+1uI2Q8cw9uuXFp0S0fw1oXdfum+qhzJli2s7GbgGkoVbr8o5NWU+McnTrgYOnzn+EkZh+OU2nl6r4apq6JAI5dsDCMie7/U/1y66vqXH6VbGFyMzDp+/J7Wd1GHFXc7xQ4FwIsrWrApm+r6z6H/cDdBq/iTs2MBS8FdQivPGua4sigXhzz7ZX2jyJTewDY+dS6mKxQuDStYrx6roL4Kewx9975Rl5LYZWl8t489K0eeYXmSwdBfAQBaMAIw== 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)(346002)(396003)(136003)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(426003)(7696005)(6666004)(478600001)(66574015)(336012)(2616005)(16526019)(1076003)(26005)(83380400001)(7406005)(7416002)(2906002)(110136005)(41300700001)(70586007)(4326008)(8676002)(70206006)(5660300002)(54906003)(44832011)(8936002)(316002)(36756003)(86362001)(36860700001)(47076005)(356005)(81166007)(82740400003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:54.0633 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4e76f15-63ad-4d22-3c84-08dbc46c23f8 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: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4037 X-Spam-Status: No, score=-1.7 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]); Tue, 03 Oct 2023 16:55:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780548063492759 X-GMAIL-MSGID: 1778780548063492759 rdt_enable_ctx() enables the features provided during resctrl mount. Additions to rdt_enable_ctx() are required to also modify error paths of rdt_enable_ctx() callers to ensure correct unwinding if errors are encountered after calling rdt_enable_ctx(). This is error prone. Introduce rdt_disable_ctx() to refactor the error unwinding of rdt_enable_ctx() to simplify future additions. This also simplifies cleanup in rdt_kill_sb(). Remove cdp_disable_all() as it is not used anymore after the refactor. Suggested-by: Reinette Chatre 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 --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 35945b4bf196..3ea874c80c22 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2290,14 +2290,6 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable) return 0; } -static void cdp_disable_all(void) -{ - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L3)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L2)) - resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); -} - /* * We don't allow rdtgroup directories to be created anywhere * except the root directory. Thus when looking for the rdtgroup @@ -2377,19 +2369,42 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, struct kernfs_node **mon_data_kn); +static void rdt_disable_ctx(void) +{ + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); + set_mba_sc(false); +} + static int rdt_enable_ctx(struct rdt_fs_context *ctx) { int ret = 0; - if (ctx->enable_cdpl2) + if (ctx->enable_cdpl2) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, true); + if (ret) + goto out_done; + } - if (!ret && ctx->enable_cdpl3) + if (ctx->enable_cdpl3) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); + if (ret) + goto out_cdpl2; + } - if (!ret && ctx->enable_mba_mbps) + if (ctx->enable_mba_mbps) { ret = set_mba_sc(true); + if (ret) + goto out_cdpl3; + } + + return 0; +out_cdpl3: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); +out_cdpl2: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); +out_done: return ret; } @@ -2497,13 +2512,13 @@ static int rdt_get_tree(struct fs_context *fc) } ret = rdt_enable_ctx(ctx); - if (ret < 0) - goto out_cdp; + if (ret) + goto out; ret = schemata_list_create(); if (ret) { schemata_list_destroy(); - goto out_mba; + goto out_ctx; } closid_init(); @@ -2562,11 +2577,8 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_info); out_schemata_free: schemata_list_destroy(); -out_mba: - if (ctx->enable_mba_mbps) - set_mba_sc(false); -out_cdp: - cdp_disable_all(); +out_ctx: + rdt_disable_ctx(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2798,12 +2810,11 @@ static void rdt_kill_sb(struct super_block *sb) cpus_read_lock(); mutex_lock(&rdtgroup_mutex); - set_mba_sc(false); + rdt_disable_ctx(); /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); - cdp_disable_all(); rmdir_all_sub(); rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; From patchwork Tue Oct 3 23:54:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422341vqb; Tue, 3 Oct 2023 16:55:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpahPZO0dHPMJOo3f2w2u+qTYomcDtcmR/lMT1f2rVbvR8DNqMTLb5DvDL6h2X36JBaZqR X-Received: by 2002:a17:902:c94f:b0:1c5:c546:fece with SMTP id i15-20020a170902c94f00b001c5c546fecemr6863815pla.34.1696377324264; Tue, 03 Oct 2023 16:55:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377324; cv=pass; d=google.com; s=arc-20160816; b=eWJS+zSd9NWAPxJlNE2rIsSAApI62Wg38wZrT8lqr+jNI8jW24930nUDgrAIRFf3Q8 SrpQJApYL8Hso6S2916judQ+8kAm67arMdOrhXzIVpYL+HN54kIo5fNSrSpMYdtFP/wz IY00QCE3KzHxVxMHs1bSGrqRtfy6VeU3aXw/emyGj/6E434TPPD3elw7D8ibVw6odTzI nFuKwF+wATF1Eoj9ogAPVZpdv4a2ckVAu4xguvubitrd1DxdMaB5zr1CC4989cYZo0vy q+3UWXjm7WjcEjQG7kcnnwu+umSr+aHJbwEhl+zAmlVOQS40xjHYyszTA5qOdtWnpOCO a7qA== 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=XvLp3ruEV92yv6FV48PWw6is1UZBCFZ+uHy28wWq6p4=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=FIN9IV+SSKfY6HEy4BEtuD78pJ318SbWok+QFKyltCkdvilyWJWjpU6iegJQPmR2OT wCqgBLTVL0a4kfksCvpHFgxX/J6ayHpJussVIT+bqFDQYucieibuSuP6CiFcm1f8C4+7 s5kJ8QrGvCY7pYHQBQ3TsErBZUvMAo/jug9XE+EALUb1Iwh1rAn7yY9iWOUS911z+gE2 i2a8zOn/QpjmWZ0pnc/3ngAAdaa6Zs5C0PmTV9cdQLoh7K0OVp3D9MI/8MDo+dKtYYls u0KW2l3tvQC5fTTD/vT/+ZICuCVPPGHZnQ7DSbMcoDArDFTGU/JhIE9DTU6xKW+1sXeF IFVQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FtK+J2QB; 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 m12-20020a170902e40c00b001c39b8b1d77si2346259ple.149.2023.10.03.16.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:55:24 -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=FtK+J2QB; 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 D505781BA649; Tue, 3 Oct 2023 16:55:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238601AbjJCXzV (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238149AbjJCXzG (ORCPT ); Tue, 3 Oct 2023 19:55:06 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2086.outbound.protection.outlook.com [40.107.95.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E2BBD; Tue, 3 Oct 2023 16:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fNaFXaH7gBNi5eE/ftRKG6yZaqHrchgXx7uP4341DJ7T+8YaVzZhxDhCAn4D/Eg2sMTTuTTs1qivUN1omyLDPfdSA2PyP3Zk6ZmJ93DUqeH8p5CL/6hiH137GuEbrbFJkl4LXlcInXVES/wiJ0UI1reDKiTaxCaaVSJ4hXBvCojkbKO8Z7nbjpn/EWdnAnX2hlt89ahnrXv/vPGpC6UbdaDH2H6LTY61nD2yCdUDXAVIMYVLFsShIetb/5Llw9qjaEJ8IL3X96YPF7I/9AlB7F18o5rwwr1b6QwbsAV4+XirCsLm5Uu4tP5D4U2aL+LP/ihAxgfIXGYeqI0ouAZxGQ== 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=XvLp3ruEV92yv6FV48PWw6is1UZBCFZ+uHy28wWq6p4=; b=FmoeFCiv6O9TXoGEbLCUGwP5J8bPyCLrtt4Hq6E5jUSxz5oZBmwVO+mbEt1T5yPbRgrsrWXDSw6Eh4nyFhn/sGrhgaBVHHsmwjmAFtTysDMn1680OI8q6JmPhW7xzSuGeEqHuMtT3fQMVFONc27+5Hnnv8JWci7dWQHiKcHtYHDrbH0UcRiqIkKoByJixXDT25g+5GJufQkVXUEuXmGQbSO8wmhGseqzljyp8ZJZRtZc36WwLmzawVT5U+G0ebo4tYyR4era74LIhsLPRx/Lk9dydT8ARVeeHDignWzCczpdT8c4Bat04r2ZupVEu8ZH7lKilkoeM+wNHc0oI+DHCw== 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=XvLp3ruEV92yv6FV48PWw6is1UZBCFZ+uHy28wWq6p4=; b=FtK+J2QBR+g5Y+Q5wpMKRhr9gn+8YWN/5gX5iBOgsGx8h5HDQRNZ+iC/4hc4IZkPC1zGjlb+Mkm2jzlrLMs3bcUWti4OchyrWKZKHbRrSOWYL+Yvp2GQlFddk6twUqQA87xa3EHPJ7zY+quOzQFch3kSsQ1ktk+BmIyvMBEKGZU= Received: from MW4P221CA0018.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::23) by MN2PR12MB4471.namprd12.prod.outlook.com (2603:10b6:208:26f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Tue, 3 Oct 2023 23:54:56 +0000 Received: from CO1PEPF000044F8.namprd21.prod.outlook.com (2603:10b6:303:8b:cafe::b4) by MW4P221CA0018.outlook.office365.com (2603:10b6:303:8b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.25 via Frontend Transport; Tue, 3 Oct 2023 23:54:55 +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 CO1PEPF000044F8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.9 via Frontend Transport; Tue, 3 Oct 2023 23:54:55 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:53 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 06/10] x86/resctrl: Move default group file creation to mount Date: Tue, 3 Oct 2023 18:54:26 -0500 Message-ID: <20231003235430.1231238-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044F8:EE_|MN2PR12MB4471:EE_ X-MS-Office365-Filtering-Correlation-Id: 30d92659-50c7-4724-930c-08dbc46c24e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cu3Ku6Fjvw5J8dZDRE+m2Axa+jZF91fQ/f4u44gUcS1fu1Uy20rRWAl3LNY/teT1DK50z1Cp/6f6sZxovoCXaztyRPRqgXqyOvJLx6A+sjC5L2IuY0CvVlexfOYULd6FmgXxhN5J1Fpj/QzDkmtL60aLYx9uI4AOSWr4g4tS5bi5QpRxPvzyvz4sD1YSfQI0mwxzVf3hj/rMYeS1Jih0Vn4kWoJdkuwh7W1RUMVNswC2BwwborOt4Wykkve9ZBhvwkcRPVjYPIcX0FsnjcKnUthVGzo1mHOk/9jMR9JQwfkzmrknUvdxmndzpOWbr6b1k9jo9jSYEhvLbHrnasRqebRoKxVAkyE/TVb6qyTNc7fUNipim5SiElWn17Mnlla50DfSA+1Hw8+zmUBc87OakxYOwMcmq4fA2+NfiQAq9ULr0oDi6roSFk2XnI1pW9z6O2TRQoJWiwhnVyDGeocbBVEuQdQK5NvzqwXmqDq/wJhmau1I+S5g0CFXhjsj5gPkJVLy1q6EmmMJydaS1pkIBVtKaOeRPrXCde0h/XWfUvOwjIvAs/s87ZAzMWWlA9QVUnAPbVwMLOvvln+xPawOeITUDEaj7VzCL5zzBe9CSdnI3DaJ86fhYwt0RNWosLSBqO0IZKKOkmVmOAxr+byxOSma5PI4FLobkI1qAzeRTPsJv0E6DrZRThGolux8ACgeOC8/9aEwERX5N+hODmB9c9DBK42bGakH6qKZIFAvWX+cWAs6u+vRNnOWEv61e1QiIPJPF2QfZMNDbdKVtG/HCA== 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)(346002)(136003)(396003)(376002)(230922051799003)(1800799009)(186009)(82310400011)(64100799003)(451199024)(46966006)(36840700001)(40470700004)(426003)(4326008)(66574015)(336012)(83380400001)(8936002)(8676002)(70586007)(47076005)(41300700001)(316002)(54906003)(70206006)(16526019)(478600001)(36860700001)(6666004)(2616005)(110136005)(26005)(2906002)(7696005)(1076003)(81166007)(82740400003)(5660300002)(44832011)(86362001)(7416002)(36756003)(7406005)(356005)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:55.6006 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30d92659-50c7-4724-930c-08dbc46c24e7 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: CO1PEPF000044F8.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4471 X-Spam-Status: No, score=-1.7 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]); Tue, 03 Oct 2023 16:55:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780549251419466 X-GMAIL-MSGID: 1778780549251419466 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 --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 58 +++++++++++++++----------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 3ea874c80c22..a34657f0bd0c 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -54,6 +54,9 @@ static struct kernfs_node *kn_mondata; static struct seq_buf last_cmd_status; static char last_cmd_status_buf[512]; +static int rdtgroup_setup_root(struct rdt_fs_context *ctx); +static void rdtgroup_destroy_root(void); + struct dentry *debugfs_resctrl; void rdt_last_cmd_clear(void) @@ -2511,10 +2514,14 @@ static int rdt_get_tree(struct fs_context *fc) goto out; } - ret = rdt_enable_ctx(ctx); + ret = rdtgroup_setup_root(ctx); if (ret) goto out; + ret = rdt_enable_ctx(ctx); + if (ret) + goto out_root; + ret = schemata_list_create(); if (ret) { schemata_list_destroy(); @@ -2523,6 +2530,12 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); + ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (ret) + goto out_schemata_free; + + kernfs_activate(rdtgroup_default.kn); + ret = rdtgroup_create_info_dir(rdtgroup_default.kn); if (ret < 0) goto out_schemata_free; @@ -2579,6 +2592,8 @@ static int rdt_get_tree(struct fs_context *fc) schemata_list_destroy(); out_ctx: rdt_disable_ctx(); +out_root: + rdtgroup_destroy_root(); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2649,7 +2664,6 @@ static int rdt_init_fs_context(struct fs_context *fc) if (!ctx) return -ENOMEM; - ctx->kfc.root = rdt_root; ctx->kfc.magic = RDTGROUP_SUPER_MAGIC; fc->fs_private = &ctx->kfc; fc->ops = &rdt_fs_context_ops; @@ -2819,6 +2833,7 @@ static void rdt_kill_sb(struct super_block *sb) rdt_pseudo_lock_release(); rdtgroup_default.mode = RDT_MODE_SHAREABLE; schemata_list_destroy(); + rdtgroup_destroy_root(); static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); static_branch_disable_cpuslocked(&rdt_enable_key); @@ -3700,10 +3715,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { .show_options = rdtgroup_show_options, }; -static int __init rdtgroup_setup_root(void) +static int rdtgroup_setup_root(struct rdt_fs_context *ctx) { - int ret; - rdt_root = kernfs_create_root(&rdtgroup_kf_syscall_ops, KERNFS_ROOT_CREATE_DEACTIVATED | KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, @@ -3711,6 +3724,20 @@ static int __init rdtgroup_setup_root(void) if (IS_ERR(rdt_root)) return PTR_ERR(rdt_root); + ctx->kfc.root = rdt_root; + rdtgroup_default.kn = kernfs_root_to_node(rdt_root); + + return 0; +} + +static void rdtgroup_destroy_root(void) +{ + kernfs_destroy_root(rdt_root); + rdtgroup_default.kn = NULL; +} + +static void __init rdtgroup_setup_default(void) +{ mutex_lock(&rdtgroup_mutex); rdtgroup_default.closid = 0; @@ -3720,19 +3747,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); - if (ret) { - kernfs_destroy_root(rdt_root); - goto out; - } - - rdtgroup_default.kn = kernfs_root_to_node(rdt_root); - kernfs_activate(rdtgroup_default.kn); - -out: mutex_unlock(&rdtgroup_mutex); - - return ret; } static void domain_destroy_mon_state(struct rdt_domain *d) @@ -3854,13 +3869,11 @@ int __init rdtgroup_init(void) seq_buf_init(&last_cmd_status, last_cmd_status_buf, sizeof(last_cmd_status_buf)); - ret = rdtgroup_setup_root(); - if (ret) - return ret; + rdtgroup_setup_default(); ret = sysfs_create_mount_point(fs_kobj, "resctrl"); if (ret) - goto cleanup_root; + return ret; ret = register_filesystem(&rdt_fs_type); if (ret) @@ -3893,8 +3906,6 @@ int __init rdtgroup_init(void) cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); return ret; } @@ -3904,5 +3915,4 @@ void __exit rdtgroup_exit(void) debugfs_remove_recursive(debugfs_resctrl); unregister_filesystem(&rdt_fs_type); sysfs_remove_mount_point(fs_kobj, "resctrl"); - kernfs_destroy_root(rdt_root); } From patchwork Tue Oct 3 23:54:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422363vqb; Tue, 3 Oct 2023 16:55:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcsUUrhUXnO8klxalgmCcnGTBEzxJ916OckcT0ORMlTjfhS9JMbKxS+eHH0PmZDSPAGvx4 X-Received: by 2002:a05:620a:29d3:b0:76c:a6ff:92c9 with SMTP id s19-20020a05620a29d300b0076ca6ff92c9mr1281924qkp.69.1696377328860; Tue, 03 Oct 2023 16:55:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377328; cv=pass; d=google.com; s=arc-20160816; b=oUCPc0Lau72AEtQm3nHo421SV83HHgGrKei7VkTdmalbI2bnnpY7q/keNZO52B5ZNA fMGbleTdp9ICF7cuxBEmXaAn8V5RxHNrKF2jTpJA1XUhcJfVGy2cO4eYytyvm/5dUvD/ 1LjOorNI7kHE42xNGqcRWAO7g9KfDmx0d70ZXTtmBmOIfSDVKIg2o2x2cpbI0KLz7gNE Cm7z0mrwLGPwh2oFHMt+KO9rkNBojjr4E6JHdB2bXO29X2hyloDLYEuNc4CiDFSwGSxK Jfo9VxZ+n7vou9oeBXeGcM49GucozXokvdvFW0OP54KuEynOhEaULzgJJvVRp4SwxlGf 1F+A== 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=yfZs/yf6pi1N0glw8R91wNVfpSW16yX8dWgEjBMLSDA=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=OmRzKOSRJGddQrF9bOAU0EoCppYrcd5m1NeE/sC/NjsQ6sLzbn+Me97T1v+iW07KBS IMpCKvMPVo8Qplgbgtlrjz9ZPX9r9cWOwxw3fp4RvMPNCqme49mja7xMBizM1+7u4X5d Di89vEe0+ka+YVTRr1+Si35d0qqVPyL9Xlx4EMtnHTka/Tldj6wC7h13TER/Ijb9PvLo RQZtzBd1n61Ja5/Nh7ObTOGMwr99JB2/ofsTm4JaPASOtXVb1ZeoBhw3Vxm2cp3xBk07 iYdYg5dA+awq/qXuzZ1gVVGVikTQW2fNygUMzoJWu5Mu6v6GWNVOwvIBBYOUQvSkvhEg G4Dg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1dzyhJ+I; 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 e124-20020a636982000000b0055c1760dd8esi2613039pgc.380.2023.10.03.16.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1dzyhJ+I; 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 0A70181BA655; Tue, 3 Oct 2023 16:55:28 -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 S239246AbjJCXz0 (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237339AbjJCXzI (ORCPT ); Tue, 3 Oct 2023 19:55:08 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18620AD; Tue, 3 Oct 2023 16:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=antMkCkeAClkJZjITvCN9UNyuez5EtmMVJhN+JChhLeAAPHZzcX9tNSM5GwK9ixAJhxxodCnx9NKEK3Ga780/W25877UDl0+8SUrEExXY9QhFeUeVvizO/kYm7xHSeumCeSl646/whoIE5qEFdyyPthwIdowpqvU4ujtQ2DLlUQWVj40IRJp5U+LDubeDE6tk4F5wPh92zfEjD+LgBKHyZ0FxZey0ma2bFUFzOoAciRBDAMgyLr8bRWmcMjjiY+ctD5JZnpWWHf0W6loM7zkZJhHCNbWg669rPi0sZhI0inc3SahiBNn4/rpaSxCL5qKuxKpVihf9gZ7KCQ71qQE/w== 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=yfZs/yf6pi1N0glw8R91wNVfpSW16yX8dWgEjBMLSDA=; b=Dea+CndGMUu1f2cUpaWNuT30AHwdvKX1v8YwhVlNJ2QcfnxQ4dWjzzBDMgBYH5ROCJDZpv3mm4+jIj5mdP87AOYqGL2gZ3Pml9kjLGoLeaVhD95HJ3V/kP7OVbtw4fvJ/oLnCSN1Hk7vCaY3el8C/OWmLxLfTJGpjzmqGaaiFFzh61zKYYYqdJgLVcYo13tRksnGmAiq+kfHqJzx8nOPAEwwBcIu6nRctE9dcVBXhdOw7Uwm8btkgbnI1Inqz1n1JyG3pQbbZ9yhyDKQisyHcRz8UhIm0//mwFwMbXYgRFkaiwTCC0mxJD34vLyJKj0iXPhhXYeOgATjd045JpUURg== 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=yfZs/yf6pi1N0glw8R91wNVfpSW16yX8dWgEjBMLSDA=; b=1dzyhJ+IsVjLPfN66IOV7TuLxbnieK27p2EBQydkbylhUcnCY7EbL99d6wyr+p7kzGFri7Ys17GJq6zKsnD5dNk2upnkbXhnEIsgjfjFV9NEOI+Ev0h2M/yRq5Ra3Er3FHMH08USQpliRGzZ/Pu3FfuFY27xHrF5MuS87hhAXi8= Received: from MW4PR03CA0103.namprd03.prod.outlook.com (2603:10b6:303:b7::18) by DM4PR12MB6301.namprd12.prod.outlook.com (2603:10b6:8:a5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.35; Tue, 3 Oct 2023 23:54:57 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:b7:cafe::ab) by MW4PR03CA0103.outlook.office365.com (2603:10b6:303:b7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.30 via Frontend Transport; Tue, 3 Oct 2023 23:54:57 +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 CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.9 via Frontend Transport; Tue, 3 Oct 2023 23:54:57 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:54 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 07/10] x86/resctrl: Introduce "-o debug" mount option Date: Tue, 3 Oct 2023 18:54:27 -0500 Message-ID: <20231003235430.1231238-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044F7:EE_|DM4PR12MB6301:EE_ X-MS-Office365-Filtering-Correlation-Id: 0494b466-3d87-417a-070a-08dbc46c25e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yGW02Bqc1kDMDV6dOwnwPMlVaAM6zXN9wWi9rjLAc1mvWMX156g9npOCmixs8WH5p5TqdamTRPFwXf7W8e3QOjGDn/rt2uquvgDa/DFQOO3gZzTR506pIppPziH5z15rUNN7Z3uKHzBy70qowr6zaYunVYu9njVrQs9AM2SmNJeI9SZq2DGOnOMfH3kDy6J58O95Q2qJkUM9vzfm4eH5U9PAHQUtIgbVgiX+r+rI/4PkXQ3+rR62EdebupOAxROnKxoY6aTViyVWEagq6ERKcLIF6bDXt+E4EV5Ebt5agIAK+C+s6O6VzTKfPfnhrOMrtFfP6jG7UjEjjc2vgGyNXDL/o7C7F5zN1b5wP5PP+vT/KpdfIRSn55GH3f/xiEwevsvKxQcwcX2bF6fzxbiZzBfHBqfZ8xokc6ce8J7AnoDHpivpOO6rPR0T7oAaLTht32P+7OmVOWxsXXQCGVQ7s+hn8VVCsUsfZTzqSyVIIwXmku+5Qx1FrFToIU/Yt3QNg++LX5xKme8fQqNmdu94Wkh6l54Y8vO36bOnprq835NpgP+FhkHvH0P861A/Wt/AdJAvwEFUQF9louy6idmLEPGmr9v0FGWhd0q3FSdWUA7+ZdWEOXsYh1DOtZXrwW5zcfdnDWVuNbrTZ4rTJUmoNy6SGaTvjCrgew1FCbje1LtaITsZWmj7inisLZuxbvzRcHf1kuixR1UTj7sdnWGT1LOZJDhVKjvldkcJMtBoRZyfRZphoInwYrjPd8OLU05rGorD3ZpgFXbWTiJ7Jbipnw== 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)(346002)(396003)(136003)(376002)(230922051799003)(451199024)(1800799009)(186009)(82310400011)(64100799003)(36840700001)(40470700004)(46966006)(316002)(54906003)(70586007)(70206006)(36860700001)(110136005)(4326008)(44832011)(40460700003)(8676002)(8936002)(5660300002)(41300700001)(40480700001)(83380400001)(426003)(478600001)(26005)(66574015)(1076003)(2616005)(336012)(7696005)(6666004)(16526019)(36756003)(86362001)(7406005)(7416002)(47076005)(2906002)(81166007)(82740400003)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:57.2576 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0494b466-3d87-417a-070a-08dbc46c25e2 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6301 X-Spam-Status: No, score=-1.7 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]); Tue, 03 Oct 2023 16:55:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780554170828184 X-GMAIL-MSGID: 1778780554170828184 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 --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 8154e9975d1e..28d35aaa74b4 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -35,7 +35,7 @@ about the feature from resctrl's info directory. To use the feature mount the file system:: - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl mount options are: @@ -46,6 +46,9 @@ mount options are: "mba_MBps": Enable the MBA Software Controller(mba_sc) to specify MBA bandwidth in MBps +"debug": + Make debug files accessible. Available debug files are annotated with + "Available only with debug option". L2 and L3 CDP are controlled separately. diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index b47a5906f952..d68f947c5a64 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -59,6 +59,7 @@ struct rdt_fs_context { bool enable_cdpl2; bool enable_cdpl3; bool enable_mba_mbps; + bool enable_debug; }; static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) @@ -306,6 +307,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index a34657f0bd0c..150105c21fee 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -59,6 +59,8 @@ static void rdtgroup_destroy_root(void); struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -1874,6 +1876,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) lockdep_assert_held(&rdtgroup_mutex); + if (resctrl_debug) + fflags |= RFTYPE_DEBUG; + for (rft = rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) == rft->fflags)) { ret = rdtgroup_add_file(kn, rft); @@ -2377,6 +2382,8 @@ static void rdt_disable_ctx(void) resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); set_mba_sc(false); + + resctrl_debug = false; } static int rdt_enable_ctx(struct rdt_fs_context *ctx) @@ -2401,6 +2408,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_cdpl3; } + if (ctx->enable_debug) + resctrl_debug = true; + return 0; out_cdpl3: @@ -2605,6 +2615,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2612,6 +2623,7 @@ static const struct fs_parameter_spec rdt_fs_parameters[] = { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; @@ -2637,6 +2649,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) return -EINVAL; ctx->enable_mba_mbps = true; return 0; + case Opt_debug: + ctx->enable_debug = true; + return 0; } return -EINVAL; @@ -3705,6 +3720,9 @@ static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl)) seq_puts(seq, ",mba_MBps"); + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; } From patchwork Tue Oct 3 23:54:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422732vqb; Tue, 3 Oct 2023 16:56:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/R3JNdysaGEuJjPEZboYyM0Ck9O/mcTfyPFrHsVSRdMfoxaOSfzSLZgxzoyabNGSuzgUd X-Received: by 2002:a17:902:e74a:b0:1c5:efd1:82b4 with SMTP id p10-20020a170902e74a00b001c5efd182b4mr6915321plf.29.1696377395832; Tue, 03 Oct 2023 16:56:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377395; cv=pass; d=google.com; s=arc-20160816; b=HcpjgjodHJe3xfDJMEBj2xsR1IBHlYN+mzSZeEPVnIQ7k0cPyGmm5lSI2HFrVyRcRH QRqTCaUCAH1tR/M423wRN2ZWsGa1MjdpOHT0/S7tzs+RMvSqCUCUpKXBa379pXIBehH+ 4p/r85goXbfhMmNiQ3ZT9V3ks9sxk26Jivg3NztuHBht/sKpaSG6SMRSjDE+U3f5bDYb oPJdzJKJKgEn6RScOhANlYrXOdev1a3iLOG+/m5d6Pu+BM4uzTvqhmH8aHIbfVqOF14T zx2hK10nFhuksDsOIvWHUPIHPVZJopRClcotEyT1soRI6DQzKUE7b7YLh5pjD2ibaY6B IKtg== 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=389FH+0iegUEcr2EbdZbKnrpgBuZjnZ4KaMTMilD9/Q=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=j9U4f4Omafd9X4KqRoEj6J5VnxQFdRaqYOtYXbse7kXCMTxtEDQDJFMOOkdDpbpPSC oc5AsDhdhVXoGDc3JYPt7ISmgGm61MGcdrxARLXl68x4Y6X4wuHTx7Hk6ChCJihlbokN /nW3WV1H6MceqxFVc5FrgJ0murstnO5VO4x+RjHMzAsxBLkKJx4Sswql1U1U5uy2vJMh ZM/IvoAwQob3xau5cUqnUhOF3Z5sQ10Bxf6ocPBCzg5mmhdl3wLoC3g12e2RWYidnctt 4Xi8/mzD8op5PmX1GedjZyEf/aSCqwe2fLn1g8TC90QhuJBFo+kMBEhPeK0CXwlpjCp9 d6yQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=OQ5KkGJZ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id t23-20020a656097000000b005855f67e491si2478553pgu.696.2023.10.03.16.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=OQ5KkGJZ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 33F6B8093D71; Tue, 3 Oct 2023 16:55:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239279AbjJCXz3 (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238145AbjJCXzG (ORCPT ); Tue, 3 Oct 2023 19:55:06 -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 3B419E3; Tue, 3 Oct 2023 16:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e+JNu7g8+XMZAnYdSnO65ha5mtZWbJi6PLFczWIDxD4b93d8X3Vol9P8kTeg4Q3FTvYyi7JEU9mJHH9V+YMT8Eah+w8bQdj+bIYZ6byfiSc6OR9pkeRVtOnHEn+3IvRpPhqo+otkYDE+Od7nAFl9R+W1KQuJu5k1DHcdWkBPXzb2eFsktGP/idsjOuI2ZW6ICOrGYJWfqGeyXSqR+FgXpb2Dp3I/Cjr9xHGHanr/0OiVtFnt4Sk78fyPQ+qbum52pdU9nW5sRNAog6s2yh+D9bfpfJJPCQ6bk7o5ZhpSYxDB8DK18ZHwh89mBc7I9nxIZeAx/JuZU/vBuNX1vX4AKQ== 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=389FH+0iegUEcr2EbdZbKnrpgBuZjnZ4KaMTMilD9/Q=; b=lWZq+tRuVIIDAmyyUZJFpJRk58ot8Z8QPl3t0h97TnoNQTG7wd6mfj/zUmoJFkF9ZPIWodxtLpBxyyLaT/l4XZ0T3W7phAlrJ40QZqtErduLqXG2N5kOgVdcMBfMQDzWSpQSTl78LNaxnhGqE1sXQChFZ4S8TjaIKiEhiK9p91LmeMxIMKpjj2BoN3F3Qcqh4ZFbUZya716YvnHJKKPCm5cOfavktiGI+H21K3JnNdZHwT4mXTB3kJeWybB8SmQMtBJx3EZuWl28rX8hON7iS1sD7MrQGSwF+R7OHUbXtHurcnwAvZaUIL8X1dn0KSnD0WluEXNUoUOCP/wPBsIwlg== 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=389FH+0iegUEcr2EbdZbKnrpgBuZjnZ4KaMTMilD9/Q=; b=OQ5KkGJZhSctRViV2lZGWTDv17Mf1HUiLWd4/AznCTPSEkJFmNlZRhbwLLuHZkZPA+N3wMqInPYs2pm7qjDcV7ydwom/Hkosri8Rnt5W1tn+rXCiV5bqFxjPRVHNsLtgaaQwJsrlsJ+qOQgfPvwpnUGn+MECaHZh23hcHUqqJX0= Received: from MW4PR03CA0107.namprd03.prod.outlook.com (2603:10b6:303:b7::22) by CYYPR12MB8892.namprd12.prod.outlook.com (2603:10b6:930:be::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Tue, 3 Oct 2023 23:54:58 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:b7:cafe::54) by MW4PR03CA0107.outlook.office365.com (2603:10b6:303:b7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33 via Frontend Transport; Tue, 3 Oct 2023 23:54:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.9 via Frontend Transport; Tue, 3 Oct 2023 23:54:58 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:56 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 08/10] x86/resctrl: Display CLOSID for resource group Date: Tue, 3 Oct 2023 18:54:28 -0500 Message-ID: <20231003235430.1231238-9-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044F7:EE_|CYYPR12MB8892:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a1f5b9c-5981-4b36-890d-08dbc46c2686 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tFeR3/wJvs34OjdG/EmDdVyBOII96K+X3nd7CvY0HwZqViV8MP9V30K8GCjte4qUupp6FY7VbTyhZsT1H/pWMW7cetpmYWYUjTXs6XZq9hMSh++3h/jWhXPN/uIs7+k4gShlpgXDhia1J+AYOPnM74dB8zKPbv3HKUu0Br9ZxqlRAS51dwT7D+DZej6nmgrDGjMAnDKwJNfNN4CMdT25naR9fbw9wl75VlNTKmp59VYy8AjOiMdhCZr1vXFnQQjqBP3xEsYVdkx4Ut1UYq3nSQJZq2CqfNyaLdVuyxe49x1y3wSJyVy3++oGgJX4LBvLBirdfKsOW2/zVzombGNbQIMGynczmnUZk1kl4+DrswgeAQY4rR8Q6GR32cSkBaamiPsU04I8WAPWyxKp8yv0AlRtl76jTMP1yKapughcn+OHAjkfz3WmmYw/1Cu2g9j+XJfJCiYDcZqzpyLS1yfEQK4vtFfwcFejCwq+mGLLSR80R++A4ZcI1rWAHG5/8dHni3Sl9rsHiUVjQsl/JmJOHHJ/8FiE1ieTy4s/fs6Ln2GicGIx6RqUvRhdtkecvK8u1nYDok4zxJcFpx11GTJfF5wZAcvw8/trF4wpzkGe1hLmMNdDta6PG7XI+g6QBjYOYUtvK/NpuisbQy1oH+bnfV4loTP1uvoJ0ELGyMfYVe5VzVL9X126s4Y1DuhqGo6MyMG4Jy4Y8cQRncLmvygGjNpuSFLr47JWu0CCmtB0BYzLVuGDVoyLQO+zmVeEHw92DLd7csKjTewWJd+DLhHLpQ== 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)(376002)(39860400002)(230922051799003)(64100799003)(451199024)(82310400011)(1800799009)(186009)(40470700004)(46966006)(36840700001)(36756003)(86362001)(40460700003)(6666004)(40480700001)(66574015)(16526019)(83380400001)(478600001)(70206006)(70586007)(54906003)(426003)(8936002)(336012)(41300700001)(8676002)(44832011)(2616005)(5660300002)(4326008)(316002)(26005)(1076003)(2906002)(47076005)(110136005)(82740400003)(7696005)(36860700001)(7406005)(81166007)(356005)(7416002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:54:58.3357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a1f5b9c-5981-4b36-890d-08dbc46c2686 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8892 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 16:55:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780624581278350 X-GMAIL-MSGID: 1778780624581278350 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 --- Documentation/arch/x86/resctrl.rst | 4 ++++ arch/x86/kernel/cpu/resctrl/internal.h | 3 +++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 28d35aaa74b4..54691c8b832d 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -352,6 +352,10 @@ When control is enabled all CTRL_MON groups will also contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". +"ctrl_hw_id": + Available only with debug option. The identifier used by hardware + for the control group. On x86 this is the CLOSID. + When monitoring is enabled all MON groups will also contain: "mon_data": diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index d68f947c5a64..eda5da9ab81f 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -299,6 +299,9 @@ struct rdtgroup { * --> RFTYPE_CTRL (Files for CTRL group) * Files: mode, schemata, size * + * --> RFTYPE_DEBUG (Files to help resctrl debugging) + * File: ctrl_hw_id + * */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 150105c21fee..953b082cec8a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -779,6 +779,22 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_closid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->closid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1863,6 +1879,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_size_show, .fflags = RFTYPE_CTRL_BASE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, }; From patchwork Tue Oct 3 23:54:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422731vqb; Tue, 3 Oct 2023 16:56:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQqvZezKg3shNEhNxiDguBoZEmMT3KLjAuQ2W/IJaZNf5MYy/WdVuZe49fxGptQvKzuwtF X-Received: by 2002:a05:6a20:1453:b0:14e:b4d5:782d with SMTP id a19-20020a056a20145300b0014eb4d5782dmr935313pzi.2.1696377395824; Tue, 03 Oct 2023 16:56:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377395; cv=pass; d=google.com; s=arc-20160816; b=BBWPuj6QVF2jLTQuGx6T+/U+k0SeFRWQxPljE5C7dTY8MbV0HFgvxYetpo2E8rPS26 +L0mWVFQ4zwIpZoxynB5Fspy8O6J0LXIUXJrUnHZSGwsN3n7enQuxeXuHwyOG2hwnzCC 0JKT/B7cIVDTRnR1uoGB+PAKG1Skc6B/68+Lrkhi4SWFf1pWoIEjWKjuctv0Q8U8qL7T 27rGxBLZlXhbtJayEBspty6pLDFfawIvXjGqWxHtaG+AAauNYiz/LCQtiYlnqzGoP/tq aBZhyPCH/aXPLcBzSgF+VZAYisSx1BtK343WbXz+tLNpFDzaf1c4S9co9Scf98MT2c/F n6Ww== 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=El+R91vxj0VCXjBZ0rmoHLthS65G5hbX50DjnSV+Q1c=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=muuUcW2gRKBmJ9qdgPduFD7tRmyb2qdII0Q1c1we/DHfW5sgw4DlfwsKd408NnTJEP ajRkGpJkF0wLrf4+tvszU1pXnBK7GCI0IfdkX1dKVcFyiXKlnnOSjNeF1tFTgpFfr3AU tipN1StbfSaAPvBQbAhp8HCun6e79UWdh3On74UoZ3tWYIAWc3UJyIiBAXFq3EPF0An/ uTEWwfHRn/KzrbFKedjgnq5SO0ccrXt5eLL5OX9WdUYvEGutGUKeUaUrmBAdNNn7pvvf IEqFKMawEpjXKIYy/BKa8hw+eIKMfftHagPn28rW9a1j4k6AwgkS3mm3rCiLzs8yoxYw EpBg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=WWQBUov4; 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.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e2-20020a637442000000b005893c5bd119si1470608pgn.425.2023.10.03.16.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=WWQBUov4; 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.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E716E80A07DF; Tue, 3 Oct 2023 16:55:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbjJCXzg (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238658AbjJCXzM (ORCPT ); Tue, 3 Oct 2023 19:55:12 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2056.outbound.protection.outlook.com [40.107.220.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3A2F0; Tue, 3 Oct 2023 16:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lc+W9+hL5L9SrsslAFiMpgPgFj+owG3cROoPBAXz5akHC+pBTOVB194SKVQ1Ik67kcIZ5WO29dq7aSmKjVICe82BH/fIn7eyX3c92mRScCtwMr3Kp/LrJDq0ndvGfvJEA80dP0AF4cRXflmbrpO77PJMUNf4jE4ZUzSpwPV6rYhL78V8+a5SqOPML6Vc8pD2lmOenalBaz38KVoYyHUIZXT3Nw0Ff4MNnMpFzxV21rVjEdy2DT9BkP0JZfxjAz7AU3y6+ugZqptwrm/CRTlw15cznPSmilF9tvf0evD3/xIaet1E0mbtStrDnrfQYS/2Rx0Y3qCQvsApcbhypEEWBA== 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=El+R91vxj0VCXjBZ0rmoHLthS65G5hbX50DjnSV+Q1c=; b=aCSMx8EFWHVn6P88UzNmCD9dK+m7tFfJ3pigLnfO/RKb9WTHiK/9C4d4UOLU8q/qyQ/WvkIB7AXuKhjV1gN4wZDWtba0fmzTxRmE77r1gFoL5KN2r/rZy7lyBkDz46+sEn9hxFRNTVIOYQcbHsD/9z/Jzq25KKsw/oplkagzsHWvkF2tZNy+5675bQANrYS+PcI9/OeSkpBewG9aZuebrUhUGtirQBOLoiLVUyzR6lrF/biB2EVfOGzHMJm0j/iPc0vLHYz22RJ+F4OfLzBjC7pAYGeyOVhqvg+a2LDAWtqNqu33vcQ6wVgNa9CWSMl5Bmqy/2rW3VBjoOcEdp+NZg== 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=El+R91vxj0VCXjBZ0rmoHLthS65G5hbX50DjnSV+Q1c=; b=WWQBUov41E1Xp9zQaxKhNblybCVuj2OsAGOIdQXT/BQDCjdCz2vfKPvmvCERzoVT+LrJYwuAK06Oo4cNziyyj1oGuhruQ37HLdMqOom5m8495zmRTeelZqxd7sbIhAY2wkDDjjVLTDDpSrND/4ZVGftDiIVTAEIKwYzuM8Lhi0w= Received: from MW4P222CA0007.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::12) by SA1PR12MB8966.namprd12.prod.outlook.com (2603:10b6:806:385::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Tue, 3 Oct 2023 23:55:01 +0000 Received: from CO1PEPF000044FB.namprd21.prod.outlook.com (2603:10b6:303:114:cafe::f4) by MW4P222CA0007.outlook.office365.com (2603:10b6:303:114::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.31 via Frontend Transport; Tue, 3 Oct 2023 23:55:00 +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 CO1PEPF000044FB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.21 via Frontend Transport; Tue, 3 Oct 2023 23:55:00 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:58 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 09/10] x86/resctrl: Add support for the files for MON groups only Date: Tue, 3 Oct 2023 18:54:29 -0500 Message-ID: <20231003235430.1231238-10-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044FB:EE_|SA1PR12MB8966:EE_ X-MS-Office365-Filtering-Correlation-Id: 9613220b-0988-494c-5586-08dbc46c27c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: by1PPhplV11+gjtMeuQbQGtqP5KZWTMumwyYFwTzGRuqNEeagqFzwjaMSN8sdvyPqOYLT4MkuWCFItEjTP/wgww2lVfDb/84AhcMiZA7ZXDKAj85X7JgxNZaaxi9nkHiMWy76FU08wyz2Kw530VHxdcNQ0EtSS/QtnW7jP+6BIliHPQ6gHRvkxNEoH1Jv4ViJ+P4fCGwlFeSG+DSBq9a4JEhpyXWSR+72w62x6mDc1PpzHCjXTegNGo9CH9JWeGI/QtcvUJHYi3U1epPPOPKEP/GPiydXFdd+9nRX3LXjJCSaoR1AXIfXbHlGbOAwryVWQ8EikQNS0IgbnEwX6+Pa+DwdWoMQ439j7Jp4gwK97mCTiQyyhbguF7woj1fuzLiQP+V7S6WFE8zCWJoM5WeeS3M/a7jEMxROM41sJgwiVNgLk7fU1A/NABJYQ2iBY+lH0WVgpGtw0FbcQ4uQArUFHBBpIU4AkamQYTZp7EWaJVUiI3+KTX+f/BS4/QHkIgjMbJ/03IythX2Ahv5LkCNdVnqLzSxfo+ry5mKywlM8JUGA5BF/B8Gg2takRzLalvM1F55vu9v7oeic0+nC9BQX7ojuFK6p91OSFftS3cDxEE/E98ZZbSc4vdq6zX9oD1DfalrE2qBlB0hFIUpMrRlzbnqvqfzrX7wfJx5F+nbr1+6i2i+YhHJcELzss4ufQk2ZoblZ8vw9xEAvJ0+K4581iWpqbiGMXabwuCdEPNJkWn6QKTuCAjCZbc9FgOoEIpNHma4iN7eqYm8xUMWz+rCxg== 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)(346002)(396003)(136003)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(426003)(7696005)(6666004)(478600001)(66574015)(336012)(2616005)(16526019)(1076003)(26005)(83380400001)(7406005)(7416002)(2906002)(110136005)(41300700001)(70586007)(4326008)(8676002)(70206006)(5660300002)(54906003)(44832011)(8936002)(316002)(36756003)(86362001)(36860700001)(47076005)(356005)(81166007)(82740400003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:55:00.3832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9613220b-0988-494c-5586-08dbc46c27c1 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: CO1PEPF000044FB.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8966 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 16:55:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780624341404188 X-GMAIL-MSGID: 1778780624341404188 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. This is not a problem because there are no monitoring specific files with the RFTYPE_MON flag associated with resource groups. A later patch introduces the first monitoring specific (RFTYPE_MON) file for resource 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 --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 953b082cec8a..55d1b90f460e 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2533,6 +2533,7 @@ static void schemata_list_destroy(void) static int rdt_get_tree(struct fs_context *fc) { struct rdt_fs_context *ctx = rdt_fc2context(fc); + unsigned long flags = RFTYPE_CTRL_BASE; struct rdt_domain *dom; struct rdt_resource *r; int ret; @@ -2563,7 +2564,10 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); - ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (rdt_mon_capable) + flags |= RFTYPE_MON; + + ret = rdtgroup_add_files(rdtgroup_default.kn, flags); if (ret) goto out_schemata_free; @@ -3253,8 +3257,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, enum rdt_group_type rtype, struct rdtgroup **r) { struct rdtgroup *prdtgrp, *rdtgrp; + unsigned long files = 0; struct kernfs_node *kn; - uint files = 0; int ret; prdtgrp = rdtgroup_kn_lock_live(parent_kn); @@ -3306,10 +3310,13 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - if (rtype == RDTCTRL_GROUP) + if (rtype == RDTCTRL_GROUP) { files = RFTYPE_BASE | RFTYPE_CTRL; - else + if (rdt_mon_capable) + files |= RFTYPE_MON; + } else { files = RFTYPE_BASE | RFTYPE_MON; + } ret = rdtgroup_add_files(kn, files); if (ret) { From patchwork Tue Oct 3 23:54:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 148116 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2422671vqb; Tue, 3 Oct 2023 16:56:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHP/cauRgtso+wC2PabvM59AEXGYZy179rSR5rokXA9Pih7cqrT3+FT5QOQFKu7HWFtrc0V X-Received: by 2002:a05:6358:72a:b0:139:bbae:1f3 with SMTP id e42-20020a056358072a00b00139bbae01f3mr998221rwj.3.1696377383413; Tue, 03 Oct 2023 16:56:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696377383; cv=pass; d=google.com; s=arc-20160816; b=Pw8dJKWrBm1tRGja+1Jy2AY5sR2poti3Mrhe5nD4F+6hFiN1B3RXAHnzRjz22KcBo0 hypWOEjkMLjTxrCsui+f8a1UGQPLjQRCwOHcmxGY9JlEsPGa90Sjn64K34u/kuzOVGk2 xPdhvuwh2PKK2bC3vRX1oSHVOFPq9Wq7NHr/Anw1H6sazGeFovLHTcofv4WzB82ZOx0l LwBREV0k5b9eABLslrwkEDm5ycvyy+hfCVHbI8kCUgSz/HXCrLY8iRvnQJYu7lxsNHgC VMn1uGdQtkNE/+eXoTmgPZumK30sAILZlwrwXU25TO5w262jEgGj9bv4kqIHe/79ucfT kVKQ== 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=7JiSYhzZ7ZrAaeGF3y7DlJvPqROP28FicXzZSrk25Ko=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=WMr4tKXXePAiEuAQizrf8wQttAY2TMSllh5gSzxjmyCQ8Hz2L9Nxg0nOd+q9B19iD5 VB42CR3SFKC1wboZRtk70MW8xMOsUorEnqy1s10C24Lz+hVh7G/JJHSXssCmYEwwAMxg Xk7qSp1jCP7bvL8h/y+nS6ITBItag74OyYZTkik1G2UbLw8oFB3p/HfGrJw/M/xNqEeK 7azoR3fYZDU0Phi8Wsa/cU7EiQW5+wELvi5608bP45HPcijdT/M+Vb0+XTesnMJjfv+l iDAqrFVKvqRIfuYRIoISpgY2OJ1uWwlDHR3Efgyli+9yH092tQyLvgazpG5oilXq9dul 2XaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=fii6Kc6V; 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 u15-20020a056a00158f00b0068c7033a5f5si2672508pfk.74.2023.10.03.16.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:56:23 -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=fii6Kc6V; 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 B9823809503B; Tue, 3 Oct 2023 16:55:46 -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 S238658AbjJCXzj (ORCPT + 17 others); Tue, 3 Oct 2023 19:55:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238856AbjJCXzP (ORCPT ); Tue, 3 Oct 2023 19:55:15 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2083.outbound.protection.outlook.com [40.107.100.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F0C103; Tue, 3 Oct 2023 16:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=miLX+OHuc4kz+CSxsyKWaVKcQa2FQD1q/vn+e2qL5Um5bpv/C+azQO2TlUnaGJRkZ8ppf1+8Dw47ZxBEaihKu2mKsj6hQ0a7eu/h//e87QiX83v2BL/6i7bK5dRtHv5NIulvI2wQtYGXuzsI3oBq5GOfpiq2+uXFndvAH47AVpbP0FhjCqkCS74A1K3gIBgY3ObspkRLBB1w1p1VkI+nSitwVcnnmeYD2BWk6E9/vAxwVDa4vY9y2dxHzLaLGXFHYEkHhHPGdmJT6cBBAIsdThIvKXhaII5MrLiVjt71vplrLmKjlZHhVZ0e9U9+BWe9dPnCkFI9m64YIfFTqWyDZg== 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=7JiSYhzZ7ZrAaeGF3y7DlJvPqROP28FicXzZSrk25Ko=; b=Bq5rC0C8AOWFOxwkJ+NiYeb+j1bxipRJ26jZy2jFmu0R5pUqQZ2y1GdjEscdgPsNNTFQ1ZgQX0Y/+PHoyeK2XPtxlgN5rWOICxSBc+Ltuk6TFdOLY22BSrlskg1T3/gwEBRhjivSbhMgdXKpX5oZgsQQZo292AbjZrvoikFxE4SBky0Es84ge3l5PZfWfdgJ6s3YirBFslLX9FP7P40SfZ9oSRBaGUDuNIbaIBPGO2k9lp92sM9jjNuSZF1/hCyj+ZTijqebnkL08l2O2082WiKcLhT5V4fkd9Z0Djl7ZQBwmKrmVRHoeGAVZ4Xz1kMRduc4ICHGeL396OtGBoMoBw== 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=7JiSYhzZ7ZrAaeGF3y7DlJvPqROP28FicXzZSrk25Ko=; b=fii6Kc6VqZAuKfi2+GxFRO1a92Z7vCq8jYFKpMmAUMNNejZw7WNddeJRHf9x2lgXfjbzBNMRFXpemgRp379sE1llT0QciEHXCQNm2lTInPoCcZhdxF+URxFAh1QD/pDeYIHpHsiZGapIhyTOcutsoVyn8F3EtrdS/uDSLmceSts= Received: from MW4P222CA0004.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::9) by PH8PR12MB7111.namprd12.prod.outlook.com (2603:10b6:510:22d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Tue, 3 Oct 2023 23:55:04 +0000 Received: from CO1PEPF000044FB.namprd21.prod.outlook.com (2603:10b6:303:114:cafe::e1) by MW4P222CA0004.outlook.office365.com (2603:10b6:303:114::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.30 via Frontend Transport; Tue, 3 Oct 2023 23:55:04 +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 CO1PEPF000044FB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.21 via Frontend Transport; Tue, 3 Oct 2023 23:55:03 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 3 Oct 2023 18:54:59 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 10/10] x86/resctrl: Display RMID of resource group Date: Tue, 3 Oct 2023 18:54:30 -0500 Message-ID: <20231003235430.1231238-11-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003235430.1231238-1-babu.moger@amd.com> References: <20231003235430.1231238-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: CO1PEPF000044FB:EE_|PH8PR12MB7111:EE_ X-MS-Office365-Filtering-Correlation-Id: cab93b6b-fd01-4e3a-8b54-08dbc46c29de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +xFmmYbHn7AShgaDiXC5Gr6G+SK+mDXXMuRifHCa1Mhb40R7qBmJ2uqw2NBAR1Ksgme/MDSVNhhSg1s4SYKO7ODqKXfIUz26ZbDsjFJYpG2K6UU8pjbaA/BlbMt2K6V3NSdp9bVkvmMcNHxGqACeP+0GzxnSNjqUYTyZX189xq3KdM9ydDhfUjguWjvqXoe7+ZhYvQidMQxaGdidxOApNYoFooZ28SyLs36gyv629f/4RRRJr8a7cB9mbLb2zRYM2YoMzSg41X3GKJAVEyRNXeKy4h1ptpUZPPNe9cl+R/u2JJ0Myxj5CX/SHHRLDIReAj1lHsQ09IatoEkclx86fGo+t8pLRi0EUvQbbOFUd4Yrg6f3ARx/APL0OCq4a5o7IUv6YjZGYchd5arc0m9VZeNxQ0wjX6DggVNbU9KTZ2CySmATthbQQdai70WinI4EvAKRfiIJc3gGm2sed8qR7fRa6BNtpsHS0UXURAJjFpPSF48U4FxbRiNe9b2jSbXcKt7Hnk5pyTHV7/a1Gjwyc+gxgBFe5pj9NKmcn/kx9UTidSekmiDx3vwCTOL0DVY88jrmNaFV8xKMQGUCKNh7uSCjSEH+6vVTw/CGNCVcydBDbCPKAz9+gaq/uEwk+J1nR11KmFTTUn9dHuFITcegY31kJ6BxubdWffvT0+hZgKcYMt378MylFN4RK1/QA/Pd9Fq4z8GI4VMTxt4SY375OYZMa59qocX+NxYzscgX1hBX2MdRInWpZK5WRez170StHwkehfcJx4UVeDDRafDv0A== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(136003)(346002)(396003)(230922051799003)(82310400011)(186009)(1800799009)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(316002)(70586007)(70206006)(356005)(82740400003)(110136005)(54906003)(478600001)(7416002)(7406005)(86362001)(2906002)(41300700001)(426003)(81166007)(2616005)(8936002)(7696005)(8676002)(5660300002)(36860700001)(83380400001)(47076005)(66574015)(1076003)(4326008)(44832011)(16526019)(26005)(336012)(6666004)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 23:55:03.8988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cab93b6b-fd01-4e3a-8b54-08dbc46c29de 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: CO1PEPF000044FB.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7111 X-Spam-Status: No, score=-1.7 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]); Tue, 03 Oct 2023 16:55:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778780611058861200 X-GMAIL-MSGID: 1778780611058861200 In x86, hardware uses RMID to identify a monitoring group. When a user creates a monitor group these details are not visible. These details can help resctrl debugging. Add RMID(mon_hw_id) to the monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Other architectures do not use "RMID". Use the name mon_hw_id to refer to "RMID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger Tested-by: Peter Newman Reviewed-by: Peter Newman Tested-by: Tan Shaopeng Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen --- Documentation/arch/x86/resctrl.rst | 4 ++++ arch/x86/kernel/cpu/resctrl/internal.h | 5 +++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 54691c8b832d..98b0eb509ed4 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -369,6 +369,10 @@ When monitoring is enabled all MON groups will also contain: the sum for all tasks in the CTRL_MON group and all tasks in MON groups. Please see example section for more details on usage. +"mon_hw_id": + Available only with debug option. The identifier used by hardware + for the monitor group. On x86 this is the RMID. + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index eda5da9ab81f..a25407fde6fc 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -296,6 +296,11 @@ struct rdtgroup { * --> RFTYPE_BASE (Files common for both MON and CTRL groups) * Files: cpus, cpus_list, tasks * + * --> RFTYPE_MON (Files for MON group) + * + * --> RFTYPE_DEBUG (Files to help resctrl debugging) + * File: mon_hw_id + * * --> RFTYPE_CTRL (Files for CTRL group) * Files: mode, schemata, size * diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 55d1b90f460e..ef4b18091e5d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1856,6 +1872,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "mon_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + .fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG, + }, { .name = "schemata", .mode = 0644,