From patchwork Thu Mar 2 20:24:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 63557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp54999wrd; Thu, 2 Mar 2023 12:29:37 -0800 (PST) X-Google-Smtp-Source: AK7set88mQGkMZmrbN5OwdmcppRIn/5hodpsYfL5TNuS9SwADs/0IcWq+YkZGCNHCew3WLiAZ785 X-Received: by 2002:a17:906:bfc9:b0:88d:ba89:1837 with SMTP id us9-20020a170906bfc900b0088dba891837mr3322014ejb.8.1677788977412; Thu, 02 Mar 2023 12:29:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677788977; cv=pass; d=google.com; s=arc-20160816; b=GQdwyu96FP1frWPbFtRWbfXPpUA0bdGDCCKmzN3d9e3x0UG7ce/nA3F4fZJUKY8Qdt cDzIx2wred5qCPVvQO58NIMqXfwtARNEX3cwBCR/Mvnh9WJvQWNzl3xLclPWrYPWX1eD loG6aCOex4O21slp1paTjbJ6HOXbgFhGgqzrJ5YpkTYDY9QR26umzb6+hNhYN6I7fYUR mPm59pzIGbTm83Q0//9MlDRIVmTL1PATc3yGkqDWJ8NI3z5LVzpQdYjcAlyeWPvZDo/1 FfttYmuYP2GjUeof0nBF/K2ysp47BIDhws5uGh2eP9aTP1ApqmADGBB/NEn3p04BcGU4 +MgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=XyUD59BITbd8fWMDNt88HkpEY9h0zk2R4AB+rXjAUjE=; b=jRM9usAFhqpfNHzYrkc3a1lCEQPSYvp1qGhMMDr/11+Bh8mgLdcFzKMmY8C5fYQfw+ j5DxYl5Xwmfl6qFVB69Oh8wnIudCHUa/qZhSemf0JGoH8MSVU7yM+2UFEE28pWvkLE53 o2gLWABqQab2/q1bHkjt8OXeqiOGLm3z2zTihIiHIzBcTMHXiHzbXN48VtyqwRTZyuz4 +71anMSI+kAfy0to0vhgIUWpylZ49+kvaKdM37C+QahNlQ78GypNtldSynT5LU2IKYo1 VAwMECElmqi3hqIdCESb87YKlJ90jlWqV48LGyUky0NmOlKreOH9UwO6g+v8YdsdqC6M B30w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=i2o51191; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a17090631cb00b008d7cf1f87fasi150831ejf.955.2023.03.02.12.29.15; Thu, 02 Mar 2023 12:29:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=i2o51191; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbjCBUYf (ORCPT + 99 others); Thu, 2 Mar 2023 15:24:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbjCBUYc (ORCPT ); Thu, 2 Mar 2023 15:24:32 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2063.outbound.protection.outlook.com [40.107.220.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921AB57D02; Thu, 2 Mar 2023 12:24:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SAUI2dNXeTJHU0OjKJOLgrziHF5lXs66q1KrzKGkbokZmOWF07SJxdkW3+lXYToPqkS2N5RP+lSNwXsLYtZjPnM4+K6OpK77PwMr2HwCkI2TG8qV6ysftKOop+osTDKMwANwCz4UnFI+tSUMzBRgLKlWyRc43+SjdTJBApUp6zyMZZGWyU5uT7Vyw+HMunl/lj7rkda1nr7na+450YUZBnhd5aEuQRLkGrhCWxJgI79fnFdZth7GXs4w6MkHv3OvLD3CKnL/KegPEyQNGI7FIUCgfpC//TZks4LB2Oo4z9xFri7V3UoMtEgB8/xW9/sU2ODvb34TA/hS0n5V2s59/Q== 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=XyUD59BITbd8fWMDNt88HkpEY9h0zk2R4AB+rXjAUjE=; b=WuK3rxx6ceUQSOt9CuTXoOEOHhD4SunMVSCQEluq2CQCg032XwIItoReuZnlFMfAZO84Jk2mOhqcvNMZpY+nD0rIzxHZpHRcFMloCwfynIJ7rRxHWWWBbFXpmfMsWLxstdr+NbaMq7Uj6v3q4+AA2uVTOdUycf1Xanu3FLHWTCw/YWEdYC77jA4iRqq29y0ACxOqV/eXH3WIdalRjuijq7QPOztUuwL8OlOgSYyh9pNmseqi5HdmprYrKg57GR+49TVR1tlXtsOXH78V7MQK+7i+PPEtXsiVp4iq0nClvWsXK6F2wMTi37lMQ6AABcCzAHDtSNljCfHVXQHJIjNEPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com 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=XyUD59BITbd8fWMDNt88HkpEY9h0zk2R4AB+rXjAUjE=; b=i2o51191ny+h21Jww/qy3l0R8I5Z39u45ekCf8+1+PNQmkmmCP49F8yBqsPdSqKCg3o2NjhK9UuS6KKHwPo16lo7TvdFJIdi/V4MgT1U5BqXd1pjxNUAXsgDPTiczHNYc0TIoE0o/MSbptL1XScv/3tXPbAhS5oE4uUm6cAFWQY= Received: from DM6PR13CA0011.namprd13.prod.outlook.com (2603:10b6:5:bc::24) by DM4PR12MB6111.namprd12.prod.outlook.com (2603:10b6:8:ac::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.30; Thu, 2 Mar 2023 20:24:29 +0000 Received: from DS1PEPF0000E630.namprd02.prod.outlook.com (2603:10b6:5:bc:cafe::ee) by DM6PR13CA0011.outlook.office365.com (2603:10b6:5:bc::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.6 via Frontend Transport; Thu, 2 Mar 2023 20:24:28 +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 DS1PEPF0000E630.mail.protection.outlook.com (10.167.17.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:24:28 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Mar 2023 14:24:25 -0600 Subject: [PATCH v3 1/7] x86/resctrl: Add multiple tasks to the resctrl group at once From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2023 14:24:25 -0600 Message-ID: <167778866506.1053859.2329229096484796501.stgit@bmoger-ubuntu> In-Reply-To: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> References: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E630:EE_|DM4PR12MB6111:EE_ X-MS-Office365-Filtering-Correlation-Id: b499b001-eaf1-4c80-63c9-08db1b5c1fda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z2rqcRKCj2s1GXFex7gOBcHvkM+FlSgqQUO/rZOUTdWr5mKHslbqciOHWyoQnH8+KZKXGJPqUZHY0u/W1CSr0mS7Wx9drv24GXwAPhwk8ciGGshMiUutkpoPEHRMp7WZucq3qpNXdWCoASkF71ZwMtFw6aU1XKssw177Y4W6/0JWWKseeQKwI8SwP2lNjkxvZwX6lNlBL/3gYF2HNmt/i7uCow+9IQ2N8C9HGLv0fO9ycJTJZGjh5VSDaVWjx4DmZVfZlH+ROEJ3w0rKI1DJG8VnXBcYDJwxv1Stix50dTaG+J8FM0iTDua06sdsw4SmlIYqbCpLHxae5TITihXpqpPJ2FQNfN66orH4ButhJuczQgPzHrj8JL9n6U4uEhaes8Teqs6RU7Qx+S5hUvFZwTwSYUZd3u1Gw9EwoPjXeREbrgMfB5B2DAUsFzhCn1AtQTQu3mCMhjxIIFhH/D/NHLi1Yu4cNhMHODhzvNB2lILznVyJiwfW6VkDv4zq5+zuvYL5YY82voD7MLY0K9FMoIEOdvZ7ROuajli0qljjERMfcWfpxwwJUuprayqigawPNJwBmOZVdk5IlHKNXCxuWBsGTs0BNNS5DP5W7+j3TsgtvvTEeSjk6AmLUOtylB+f4r0turFOD+u4eVHiclaQJc4uguMxETUlBJ3Wodalw+A8b5RZMleTEUSmQkhXJ5bGcOAbFlO7zgxD87cOetfI6s62HXeJ34PYbFK3lcDOH2BDVWWKPE/o5+EH5/Q9Eyat 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:(13230025)(7916004)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199018)(40470700004)(46966006)(36840700001)(70586007)(4326008)(40480700001)(70206006)(8676002)(2906002)(54906003)(16576012)(82310400005)(81166007)(110136005)(316002)(41300700001)(33716001)(36860700001)(44832011)(83380400001)(426003)(47076005)(336012)(82740400003)(26005)(478600001)(86362001)(103116003)(356005)(16526019)(9686003)(186003)(40460700003)(8936002)(7416002)(66899018)(7406005)(5660300002)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:24:28.7466 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b499b001-eaf1-4c80-63c9-08db1b5c1fda 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: DS1PEPF0000E630.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6111 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759289255022833600?= X-GMAIL-MSGID: =?utf-8?q?1759289255022833600?= The resctrl task assignment for MONITOR or CONTROL group needs to be done one at a time. For example: $mount -t resctrl resctrl /sys/fs/resctrl/ $mkdir /sys/fs/resctrl/clos1 $echo 123 > /sys/fs/resctrl/clos1/tasks $echo 456 > /sys/fs/resctrl/clos1/tasks $echo 789 > /sys/fs/resctrl/clos1/tasks This is not user-friendly when dealing with hundreds of tasks. Also, there is a syscall overhead for each command executed from user space. It can be improved by supporting the multiple task assignment in one command with the tasks separated by commas. For example: $echo 123,456,789 > /sys/fs/resctrl/clos1/tasks Signed-off-by: Babu Moger --- Documentation/x86/resctrl.rst | 11 +++++++++-- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 24 +++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 058257dc56c8..25203f20002d 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -292,13 +292,20 @@ 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 assigned together in one command by + inputting the tasks separated by commas. Tasks will be assigned + sequentially in the order it is provided. Failure while assigning + the tasks will be aborted immediately. The tasks before the failure + will be assigned and the tasks next in the sequence will not be + assigned. Users may need to retry them again. The failure details + will be logged in resctrl/info/last_cmd_status file. + + If the group is a CTRL_MON group the task is removed from whichever previous CTRL_MON group owned the task and also from any MON group that owned the task. If the group is a MON group, then the task must already belong to the CTRL_MON parent of this group. The task is removed from any previous MON group. - "cpus": Reading this file shows a bitmask of the logical CPUs owned by this group. Writing a mask to this file will add and remove diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e2c1599d1b37..15ea5b550fe9 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -683,16 +683,34 @@ 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) + /* Valid input requires a trailing newline */ + if (nbytes == 0 || buf[nbytes - 1] != '\n') return -EINVAL; + + buf[nbytes - 1] = '\0'; + rdtgrp = rdtgroup_kn_lock_live(of->kn); if (!rdtgrp) { rdtgroup_kn_unlock(of->kn); return -ENOENT; } + +next: + if (!buf || buf[0] == '\0') + goto unlock; + + pid_str = strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid) || pid < 0) { + rdt_last_cmd_printf("Invalid pid %d value\n", pid); + ret = -EINVAL; + goto unlock; + } + rdt_last_cmd_clear(); if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED || @@ -703,6 +721,10 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, } ret = rdtgroup_move_task(pid, rdtgrp, of); + if (ret) + goto unlock; + else + goto next; unlock: rdtgroup_kn_unlock(of->kn); From patchwork Thu Mar 2 20:24:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 63558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp55017wrd; Thu, 2 Mar 2023 12:29:41 -0800 (PST) X-Google-Smtp-Source: AK7set95aRxgdW5Ym4PtzSLAJLXzVUWg5rp/c2JP3Bao9agfH2vbOJ+8/So0WeIzCFuO1JS/81Y6 X-Received: by 2002:a17:906:7143:b0:8af:4969:1bb4 with SMTP id z3-20020a170906714300b008af49691bb4mr11462960ejj.53.1677788980842; Thu, 02 Mar 2023 12:29:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677788980; cv=pass; d=google.com; s=arc-20160816; b=cT78krX4IzfqyQt0JNKkrhguVWVNUqmN8JXkjYfJn5PdhisYe8dB9JAVZI4TZBJiQc 9ZhyqeSK/934AeuDWTL5gUatliZennV4WDRnERdBQxsAQDqXNzovVLRYHPwFeH2jRGLF nniMMoIDuYS18IayCvZ6VDrffmI1eJJnDYqDoWsn0jD0jnYmAAHOheHtsYjQwFy7CURE UxXWhDIfWm1zgp8Psm2jpicb4vxwYr1TbE0KRCeShPUEtiOjkP2EszX30SE7ilBFjcjG 1hys9+Fx2n3R07rAMccZRf6QjASsB+Dj9WCkM/acZbYOod+X1T193+zgQeZKbHUyK1U9 wy2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=zAuZmTFRzC2XzIYM432jNnpzNS8EmX1ldEFl1zp4MPY=; b=VfrmTGDZN63kk5ngusgkhGoFu5FY8nzKHGFuwUoK5Eo38FRpE9K652sU8sLIR/0aOz Bl6pZ9x9AkblZwnm9zXm+ifChoz/psJQaV7o6msmn5KjgltxrmlB/ea6HJUyptgShn6k VDxY0sSNrVJ2AWeql4w4ucxrg5fSeoOE9udSgM/7403u7l9TsH80eEyMrCE/ZSdKPX26 Pn9Anj+IGrFE13X1pEGSfmQUqBvRDJX0PyJJUp4MyC97Ouv2uRSPRRQKDuZ+UPCgYZqk nlMpti9wqgEp31L4FWrTARPTe8EI1gLjL0chYZYWF9f+OCcno0sFi4HgkGmOLDZI4Eoo 6NCQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pXi4Kixd; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020aa7c90d000000b004ad0caf3dc0si523774edt.480.2023.03.02.12.29.18; Thu, 02 Mar 2023 12:29:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pXi4Kixd; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbjCBUYq (ORCPT + 99 others); Thu, 2 Mar 2023 15:24:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbjCBUYj (ORCPT ); Thu, 2 Mar 2023 15:24:39 -0500 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 F358E2F7B5; Thu, 2 Mar 2023 12:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lVYmm3TbMsTC6P0HAGzu41587VXuKO2Y+687Rd+j+UBIVSlv7B+dae77y8UziiLsDCsc4Ny4pg2eVd49qTdF4KV67Ok0TCaKxdBm9ANXGXiw/+naT9dIW08i0m0poU+ZU9KnQNMMytQOA3x57tg/TLh52XUu8tzBmtYA6D01f4htcU944wkdm05DcemE8AONC3Osa9UBDWP+6t5cz57BgoliTMo7lQIs8a7FIfgm04mRLeJGsfzmXu7xFNxE/yBRnNCZ+QZ0RaSHT+TNxZsrOddQQrLE2jqmWbCERB/DQ/xLd9VpOjweXt84wdpEkJ+tmhR9mWxUKaNkmSnFBfawPg== 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=zAuZmTFRzC2XzIYM432jNnpzNS8EmX1ldEFl1zp4MPY=; b=HHyEreJJRTgWrt3fe7JXrq5rRsBiS9Dyxff38HwynnVAO+uSyQ93OgSJpjspkM1523+LDqKt80pZL4cUM8UgT3sUYkCCqhJgvX7KXqXsW5ycCyUgSG8SxPjUOOFljQIkQN8GJ5delztN8YNqS4HeHCt3PxrbXKW3Tc85a0PCNd4JI6Lv8cP1oLQZkDNAhLH+XRWMRYF4fNoWkVM8KqdY1OfYRkS/9XzaOBvVkJcvzd2xR7J5hDqO/BVrQWx6+dMCXMLHkggNjofM+6XAqktxf3whxrZRnwuulBlS9qCQgtgQwM3RIYrxIELyJCXIvRZDg64xb6h9zQycSXO44Bn2rQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com 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=zAuZmTFRzC2XzIYM432jNnpzNS8EmX1ldEFl1zp4MPY=; b=pXi4KixdEymdA6hZXPDnASCms1nPFe0bZ3uJqw5WRXXyJ5L47yJWhWDmsP1cozdSsuqC2qMjixpaGXf/PN7KImb3tVMH9e4RZzdsagB4n/TKtKuOCyLgjfYCee6DhiUCE0w2XBRGRJmLr/18IXMaBlzUo8Cj+XcGhPxdQM6Xyjg= Received: from DS7PR03CA0173.namprd03.prod.outlook.com (2603:10b6:5:3b2::28) by PH0PR12MB8150.namprd12.prod.outlook.com (2603:10b6:510:293::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.18; Thu, 2 Mar 2023 20:24:35 +0000 Received: from DS1PEPF0000E634.namprd02.prod.outlook.com (2603:10b6:5:3b2:cafe::9) by DS7PR03CA0173.outlook.office365.com (2603:10b6:5:3b2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.18 via Frontend Transport; Thu, 2 Mar 2023 20:24:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E634.mail.protection.outlook.com (10.167.17.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:24:35 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Mar 2023 14:24:33 -0600 Subject: [PATCH v3 2/7] x86/resctrl: Remove few unnecessary rftype flags From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2023 14:24:32 -0600 Message-ID: <167778867236.1053859.12920879751317268318.stgit@bmoger-ubuntu> In-Reply-To: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> References: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E634:EE_|PH0PR12MB8150:EE_ X-MS-Office365-Filtering-Correlation-Id: d947cb8d-1d93-453d-5838-08db1b5c23a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lp6ggzQH8M/I94cN0JIGvsiV/fhAhhi9216IgVoHRQ8VXF/irq8FNKVkq3pkh9rcrPkIstAv7KLROrseaJvDdLe/7sJEtxEwi0csZ4ONwxGjMZIp2c49q4Np3JEZAGngVv5BuUkFle9WPIX4dqhzbCdrEHDX7BxC5E3i/rY0HBaNo4vtI44sOh7y4wvYklY4PBoeQFY4TL/3wHMderiWWHi5davaUZ9ESNvNtw1Am1j5s2KbDecTvPa0hOSOMQFH4A+tz6qvrvO6hNHhkqAtA7h0/E/VXAlSxEWMXR5jQxYe68Tcf36iynu8DLIWelFLpAWvw8BaMwQD4PNEM28tJ8rrUYItlU/I98gq4ZcOjpbkghyLv9NaIvtS8WB4zGAsH5bqYcML2f9Y/hVkgiOibARTuQ4wdqt26eOJM0zBG2Pycqwh8xu/xwjuGy3wSdJHf/X9rj/misRHPDYkWMbkjIHeJNc4NtdMmx0wnv2ZbkTuQz3ey/x1WQzl2abxrVs9zI+BVa8KQ/h17AED2KAHHDEidPRynC4mhFaByDJAKcDBEWSuB2IiN4r7DtNbnSzwQbTJAtyfTT+bth2Mze5AGhROo4ncfUIyh7ooEplRfM6KrmjLtgEkyhOov81ugVzc6SQLWy/CuFrYuYJYl5I/qY7xmYDCBcVMDJyUvOCxA5gkM/svuN6S85cbIXz+h2UU05mFMMZKtxBP1+LeHpy29kyU9LnEpr97XyB3+FOElvZ2+GB5pxavIcnBwQekZINPKorq5yN9rp88QggVJiFBeg== 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:(13230025)(4636009)(7916004)(136003)(396003)(39860400002)(376002)(346002)(451199018)(40470700004)(46966006)(36840700001)(103116003)(336012)(33716001)(82310400005)(316002)(16576012)(47076005)(478600001)(83380400001)(110136005)(54906003)(40460700003)(426003)(16526019)(186003)(36860700001)(9686003)(7416002)(86362001)(8936002)(26005)(356005)(41300700001)(2906002)(7406005)(5660300002)(70206006)(44832011)(70586007)(40480700001)(8676002)(82740400003)(4326008)(81166007)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:24:35.1124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d947cb8d-1d93-453d-5838-08db1b5c23a3 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: DS1PEPF0000E634.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8150 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759289258676340952?= X-GMAIL-MSGID: =?utf-8?q?1759289258676340952?= Remove few unnecessary rftype flags and simplify the code. This is done to further cleanup the code eventually. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 9 +++------ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 10 +++++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 8edecc5763d8..571145d75d29 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 15ea5b550fe9..3c86506e54c1 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3163,7 +3163,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, { struct rdtgroup *prdtgrp, *rdtgrp; struct kernfs_node *kn; - uint files = 0; + uint fflags = 0; int ret; prdtgrp = rdtgroup_kn_lock_live(parent_kn); @@ -3215,8 +3215,12 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); - ret = rdtgroup_add_files(kn, files); + if (rtype == RDTCTRL_GROUP) + fflags = RFTYPE_BASE | RFTYPE_CTRL; + else + fflags = RFTYPE_BASE | RFTYPE_MON; + + ret = rdtgroup_add_files(kn, fflags); if (ret) { rdt_last_cmd_puts("kernfs fill error\n"); goto out_destroy; From patchwork Thu Mar 2 20:24:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 63559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp55025wrd; Thu, 2 Mar 2023 12:29:41 -0800 (PST) X-Google-Smtp-Source: AK7set+SeFkiNHjLpZ9Zaz03gulbGIMqrfoZvc8qrG14YPU/if56BFIuNuylCJ+JBhoMOd7nDNlA X-Received: by 2002:a17:907:2117:b0:87b:d3f3:dcf3 with SMTP id qn23-20020a170907211700b0087bd3f3dcf3mr11665403ejb.35.1677788981445; Thu, 02 Mar 2023 12:29:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677788981; cv=pass; d=google.com; s=arc-20160816; b=v6oQPBYgzva6SAFeiUOSlw+Yhd2z+mMclfyfjv2ywsbb7Uyq9Iqz+8GzPlHsOyEsiq ZkuXF0fB2MqV8xtiTQVOdllF+KM8hEc2ekBrpALoVzlD4XoKAkfOXqBjVZgOCygoggWn lPhV1rjnu9E0fykeAWmMydP4c0UPw8FuhCYj8i/FzzIbZALoWwW2JVS1i3JUdCEsb2cb NYXnP/wNMtCp/ftVlbdcawfp3HGNjy2772yXiM7ejnIl/S4+MuWyAdY5QG3LeN3tTQ4D KDPSNVl9w6yx9Bve8NAxLdm1lBLyRLcnPWFbs1ftVt9RUwd5qISYvKQ9maBfWgxry6EN 2AqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=OdTd8HNBAa7A+5TsTnvnb1X4tNBgd+K9CEuP23cV5LE=; b=qzWua9BwTALREhnp71dt5IW1KEdK8XnrywgroCsvat3Xp+qknWwkzXew7SR2RDMiRn 2pkkBcs9CCl9AxN4fbmFE9JK1dbyNGK5sWpnjOsrqfBMbW+odpHEu1K1plAFDyxq1Ax/ rHZmWlJjeX6rnOChjJioG9J+SDD6iUumzoOu9pxU6SEtKienGPro/6bpZDnJNqNB8Fm1 vokmD+lI1JsT46AZS3GN8NTPhtwcOwxp1gNTr7XLLswksBquye69SxF8Tbeo747gKWAo NlxQ8iEQ/qxXGakETdTFfShbjZJIsRQoLF+ZrO+TsnO2q7HwGuiciIMilX7K7Znmk5QO 8zwQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Xyt05WYD; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a170906339300b008f4625e4c26si202534eja.480.2023.03.02.12.29.19; Thu, 02 Mar 2023 12:29:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Xyt05WYD; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbjCBUZE (ORCPT + 99 others); Thu, 2 Mar 2023 15:25:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjCBUZC (ORCPT ); Thu, 2 Mar 2023 15:25:02 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C411555060; Thu, 2 Mar 2023 12:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DUKm74O44RkBqIp71/ZnN3xCFgszgenCse/QlrxO2LX6ZNNesS04N61jEt1DhKM009/JlCCskX3PbWhavFnJKki8BrlzKwPk0iic3e47jn8heifITPDjph89xoGV3UyWCGIpJaM1k6PRqE3MKoKJV8zITkl368Hq0CsJBVCiXbtLyVD4MRmC7X+ys50aNFo9N6nchl9eOG3folt0WG7C3m+ceuMnoWC9PkvJX+UDHCBuCnAB976U303z8vaPKD+rjpbab6jzm9DdCCCEYo00xtGusY456oE+TCjy28I2vxJIAgAIQR1nUcE5rPsC/wVekC1HCoZi+LpcGV8yqvVJvg== 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=OdTd8HNBAa7A+5TsTnvnb1X4tNBgd+K9CEuP23cV5LE=; b=L4HFh7Btr64sMaj1ZRw8bZ126lJZN/MkFGBnSHdbSuURKM8fZUV1KMBo7O5TtxptSxa7JXUIpAwmWvz+X7N589+ThoU/iWoaw4LroeMA9s0NzXj7fbEWglLYwFKinZlWpxLLLi1CnViokrR02IpwJLm3PplTzFb4CvD3VpbLCiAH8VYZ/oiOq9qnpMXonu6lMSQ1p6yhoqTsYYdN2L/kewkhXNcjNNOHavFtAR0Axma5+MwuxZMPHPvxYy8CxpgCDC6eLb6X72XF6LhOhnQi148jSAP3feur45sWSYrYf8a03jpQTxpBYBopedYMw4ECOwuFhvF9DByxwTlaDcSmjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com 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=OdTd8HNBAa7A+5TsTnvnb1X4tNBgd+K9CEuP23cV5LE=; b=Xyt05WYDZ+tdTOlsTI1AZpBnDIwS0bwNDe45K+Tfd2AzLSWQiQqzU9t4IcCDh4dJxNGs0JsamQy0XRDNX2psNwj+/xYVE2PHcb8b7qdh209vySxpqdKNQ6iuPG8PSphqGV6yhkls7dXV7osrLvwKcBFlYDyNAi4+IY3KJ6kaV9k= Received: from DM6PR10CA0030.namprd10.prod.outlook.com (2603:10b6:5:60::43) by DS7PR12MB5743.namprd12.prod.outlook.com (2603:10b6:8:72::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.17; Thu, 2 Mar 2023 20:24:42 +0000 Received: from DS1PEPF0000E631.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::54) by DM6PR10CA0030.outlook.office365.com (2603:10b6:5:60::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19 via Frontend Transport; Thu, 2 Mar 2023 20:24:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E631.mail.protection.outlook.com (10.167.17.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:24:42 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Mar 2023 14:24:40 -0600 Subject: [PATCH v3 3/7] x86/resctrl: Rename rftype flags for consistency From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2023 14:24:39 -0600 Message-ID: <167778867966.1053859.17317446376632380238.stgit@bmoger-ubuntu> In-Reply-To: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> References: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E631:EE_|DS7PR12MB5743:EE_ X-MS-Office365-Filtering-Correlation-Id: 355c1a32-e162-4ec2-e6d7-08db1b5c280c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qaV05FEy2Dgm1lsX+24cQ9p0h0fS+OcQ66dwufocjRxxr76LoX2VS5Ytst+ti8aQwXljF418meeK0fQcbZyiqUyoLgb98reEhBLPUqXCOc6tfxcKUZwgimJ+huoa2PYsEDvH+8cjvjyQ1hqXP0n6/VdGFZrc+PAypq3CAYACOqMEXVs9CXvWFgkMGnf53gqD4eR3ABTAPpYYrV88xcZ9bBGVBVndwcB4bOLgFiFf44yywea6Px6CHmhZiLKk6HHiGqkYVt7DJz2x3WZnF5/nDCjvFrl74jclAk7KIZ2LVENX2bZQphswbC2VNHtTPLKXYrUaK0JW/Iun7P/qfe3RJH6x80y2Srf4UuT4IqiskOauVi6ptpmJzKuZWIIBr0ZLIWO9RGDQ00tfvaAJExbKXAOgcukM6jkbqHJ0xf8y9YpO+VLwguAf4xtwOLrKd2ojve7wPvH9IqD2dOu2H+cmPXuCWuB3Whcdxaq8Zm+JYVbsHAUsMQw0U5b7AJB+wLEBboorLrfoBk7zDxvqvAdeoBkcxvk0j0kgWPG7hgnizEoiuywZfFSvNxwbwjIYA8AmucG5ntOiU+3aw0IcMS4JWLaCNA3z3iN5bjeou3dgpjnuxv29JaPRqxWw8BAUjhtNJG4te9do1Vn19z2wNHheGEVYlU/wxO/2v8ni8tlHRMf7bnv/L85bQ6no5iglEyyHU05HahB/WPIm2ZeUHjyRU36db0Mk1c5TD7AKwYQ6CVQERn1NCrb1R/Dxw32yr9OciEQOBuSsM1WVCFfzHSomdg== 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:(13230025)(4636009)(7916004)(39860400002)(346002)(396003)(376002)(136003)(451199018)(36840700001)(40470700004)(46966006)(103116003)(5660300002)(4326008)(44832011)(2906002)(7416002)(41300700001)(40480700001)(7406005)(8936002)(70206006)(86362001)(81166007)(356005)(8676002)(82740400003)(36860700001)(54906003)(82310400005)(316002)(16576012)(478600001)(110136005)(33716001)(70586007)(83380400001)(426003)(47076005)(186003)(336012)(40460700003)(26005)(9686003)(16526019)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:24:42.5151 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 355c1a32-e162-4ec2-e6d7-08db1b5c280c 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: DS1PEPF0000E631.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5743 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759289258903768391?= X-GMAIL-MSGID: =?utf-8?q?1759289258903768391?= The rftype flags have two different prefixes even though they are used for the same purpose. Change the prefix to RFTYPE_ for all the flags. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 8 +++--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 ++++++++++++++++---------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 571145d75d29..2cfc3c431d5b 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,10 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) -#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) /* List of all resource groups */ extern struct list_head rdt_all_groups; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 3c86506e54c1..fc7d1e778bff 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1691,77 +1691,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 @@ -1780,7 +1780,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", @@ -1827,7 +1827,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", @@ -1835,14 +1835,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, }, }; @@ -1899,7 +1899,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) @@ -1908,7 +1908,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; } /** @@ -2043,21 +2043,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) @@ -3554,7 +3554,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 Thu Mar 2 20:24:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 63560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp55034wrd; Thu, 2 Mar 2023 12:29:44 -0800 (PST) X-Google-Smtp-Source: AK7set+p9Hf9KpwQT6jFCT66MjajR1FtjzZ7M91KvpGycfnJsqZ5mbrJYtRazq95A6sRag9BHpHM X-Received: by 2002:a05:6402:1643:b0:4a3:43c1:8431 with SMTP id s3-20020a056402164300b004a343c18431mr3296085edx.5.1677788984255; Thu, 02 Mar 2023 12:29:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677788984; cv=pass; d=google.com; s=arc-20160816; b=TjAP8WCMe6xyazu0qJNNJnfZRBFbu1rbv7+YT89Fx6gCBoWLyHcun3YfK5ZlgATtmA JU9aHvWwy6RKsXh5Gm2RHZ6EC5legoGxwpnQetTk4ePcujJ4wO3M0kg9V4Ojpuaxa96b eLJuwW0FNftZOcBNLXvUb/zTzWpK5aI/MEkbR6KrRCVdUbj1zJrEsN3auBo77vJLQhyv a+w56ULX4jlcyBkOLgveP84jhO8yH1xFOdLuCFPPNIltQJEvf5Q/aGUxYztxFaI5wy+E +VdQ2ATBUxqyo+5mgILEyiFs12+JOckeJui8FceCyw1Wnwtjgbnp1CyZTMazupWyTo0H edFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=CuBQ+BwcsjFgt2n25b4Jx3ABbjC1XMRl0btoiXYYkXU=; b=YWIfxTnUG06X5ok8r+4ToPwGB04mzi0v0MNUYRjmLo9WXK7zaOjnijHGzD1Hhe9WMz //TNFd+dyYf19YR28S+2DCSFnbon+imvXlidH/YQGxnPtqa+kh9yLr4K+hsYnJDZhQa0 tWehAY+PeFe4C3ZWC8/tLDq6c3IB1iJrtlgT1OcGIcyupaVk37f+6iUR88XqpzB1KGfi x3rMXOR1lPpLwnhCSUxqDV9t53a4TlRIws9ZyUYD2KlJh12/RN9AfK23i0EQWL9qfzhm nGZzwOubYCH0C0VifzDtrZnULvR/r0uizZv35pJj9mgLwWN7xircMWl9Kxpx4UFVJo9c Eytw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4mpdd+8l; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020aa7c3c6000000b004bf8bc671besi562595edr.408.2023.03.02.12.29.21; Thu, 02 Mar 2023 12:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4mpdd+8l; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbjCBUZi (ORCPT + 99 others); Thu, 2 Mar 2023 15:25:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbjCBUZO (ORCPT ); Thu, 2 Mar 2023 15:25:14 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2043.outbound.protection.outlook.com [40.107.237.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0379857D13; Thu, 2 Mar 2023 12:24:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MvxUI3rxv6n/I1a+cwdKuPCALUW14rjPAtR5cV0/lcPS3htso0LtEXadnUQhQOmG/sG3/pmlu4RDMYrGPo+YUX0qKuWH0BptBA7hfGcoWDpVj4/FbNdUWvo2KR8vVlsHMJuMAMVCQkVw32O23rABLZO8I6kj0f8xA7ZoLvaYnz+h3rasDMoaJVkroAspOHACO9AO+GSuHJsBjHR2lMLtbcfHeIq1uB+z0WCcu/ycR9Nokm6nA5NfGla0UVCQQ5c9oo/DkJ5ktY4po0ZgkZYveGNQXCWN7oUUk5yh+0xCmso2NOH9qU7qq8SUaRy84kbuPJfFQtz9UUL2u5556XB8rg== 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=CuBQ+BwcsjFgt2n25b4Jx3ABbjC1XMRl0btoiXYYkXU=; b=MKkfRY7nb2tSQbNswfLyoTES5IYNFulatEcULKbo2/SZ7HR0pnBWuLmDIiXUmk16tBTLMq1/a2JF4h3y4CpRqa66/aOZMxb9voH3VOBCU6/mqezP7YCpHAahzvvfDoDCpX10TDkG9BxqdJY0CRbx3YluGoqlETLeUevVuuG7XivkOUoRLrOCEMA4CAj/NInFzZ67WqSEAMoAVcNL2fYa7AQH4XhIxv8df3uAyuLpDdcxsBp1FRMAK5jCnQfNH5E99UZ3dQmjNIUYkfF7FrZeJoHUSoXeqbWkiZnIpkRP8kDnm48eovi8hsGTYkE1BjF66NaT6chYqy22EtguQSveSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com 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=CuBQ+BwcsjFgt2n25b4Jx3ABbjC1XMRl0btoiXYYkXU=; b=4mpdd+8lDmAPMette5rUzv0alrtuX5GdT/jVUnC050xZbxxks7buw7dkGOcQdKCHZXIihElNsiekYXMyDsgEFLKJTdcrRowNzwWv3ahSNEg7KtpYDMuWBeeoYNrtKYY7IZh664jo5q9tPHalMrcl8JPXUk3HWVvU6vCQypqNQE8= Received: from DM6PR07CA0123.namprd07.prod.outlook.com (2603:10b6:5:330::24) by MN0PR12MB6127.namprd12.prod.outlook.com (2603:10b6:208:3c5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.18; Thu, 2 Mar 2023 20:24:50 +0000 Received: from DS1PEPF0000E632.namprd02.prod.outlook.com (2603:10b6:5:330:cafe::a2) by DM6PR07CA0123.outlook.office365.com (2603:10b6:5:330::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19 via Frontend Transport; Thu, 2 Mar 2023 20:24:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E632.mail.protection.outlook.com (10.167.17.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:24:50 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Mar 2023 14:24:47 -0600 Subject: [PATCH v3 4/7] x86/resctrl: Re-arrange RFTYPE flags based on hierarchy From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2023 14:24:46 -0600 Message-ID: <167778868692.1053859.13490646651097380957.stgit@bmoger-ubuntu> In-Reply-To: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> References: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E632:EE_|MN0PR12MB6127:EE_ X-MS-Office365-Filtering-Correlation-Id: 89e7a836-7679-473a-2921-08db1b5c2c86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7F5p2xx3I9QPpF3flnYttoPVz/nmCnuB8yqrR1ndUPdm8AuqUquuw6CGoRUf8D0pWkZeXb5DF3mo1/CiEwFz1Sa/XZNKgnLKyv0rGKgYiPiy7ooFioPUKjcd4pUdt8yS4G4mwpQhkt55s5ZHP3/hqozmhe6ukwX/AHzFCRlvjGjG8WF5Jcb1kwoPr5wIvMfAwDMoxmYLVpF/IRAO4KoMlsTv/6zAi2InhQogacgR0m5U4LeOkyLmV4aOsiDpLGwC+Nu91YCZb86qt0DGGk/CyGVBLGmrxejMgzgzRE7Ws757X+rRmNfGGty7FloRU/GaMcA4WRB3bhC4HTBA53IqezamOeU8zIfdi21P/AdYjiW1pcjUTjzuU7yoFpgC0Sfp9byyAZGmsYUzSQAhBJIoywS09iTkd6Vmdg8sR7nmX9atib4UajBjMbz216PutaYd7RDw5smu7jWVO+1FjcwMiQT449/xbMsvycdkJ2I9B/8fmyGtnCpPCTw7WolJdvi1946C36OZwyM0+067v5JuwLmah8f5IVN6BGrGOxFnM3gYWbmPzHgzb+q54JWH6eI+RVMmWUZH7ZV79/kSnqYcQjjfBPIQRnbJEWWsAbp8Cbfo7I3EuBShuqrCisnfr8LQD1t7dKXMhSodkUCuqzsihCOt847oqGHYnEBNQDMTUSik51U7MGycadUX0Q9we0T0H7j3dRDkQ0S5AFlTeQNC+sWEPGSW7ONdk+4hd9bNM6Mgcuyy5yOAADUT4P/JXdpGY+xtveRli64P9ai6w7rTGw== 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:(13230025)(4636009)(7916004)(39860400002)(376002)(396003)(136003)(346002)(451199018)(36840700001)(40470700004)(46966006)(83380400001)(36860700001)(47076005)(426003)(40460700003)(33716001)(356005)(5660300002)(8936002)(81166007)(478600001)(7416002)(82740400003)(7406005)(86362001)(40480700001)(103116003)(82310400005)(9686003)(16526019)(186003)(26005)(336012)(44832011)(2906002)(8676002)(4326008)(70586007)(70206006)(41300700001)(54906003)(16576012)(110136005)(316002)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:24:50.0206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89e7a836-7679-473a-2921-08db1b5c2c86 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: DS1PEPF0000E632.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6127 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759289261847549155?= X-GMAIL-MSGID: =?utf-8?q?1759289261847549155?= RESCTRL filesystem has two main components: a. info (Details on resources and monitoring) b. base (Details on CONTROL and MON groups) The rftype flags can be renamed accordingly for better understanding. For example: RFTYPE_INFO : Files with these flags go in info directory RFTYPE_INFO_MON : Files with these flags go in info/L3_MON RFTYPE_BASE : Files with these flags go in group's(control or mon) base directory RFTYPE_BASE_CTRL: Files with these flags go in only CONTROL groups Add comments to make it easy for future additions. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 8 ++-- arch/x86/kernel/cpu/resctrl/internal.h | 64 ++++++++++++++++++++++++++++---- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 44 +++++++++++----------- 3 files changed, 81 insertions(+), 35 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 030d3b409768..d1c6b2cc8611 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -69,7 +69,7 @@ struct rdt_hw_resource rdt_resources_all[] = { .domains = domain_init(RDT_RESOURCE_L3), .parse_ctrlval = parse_cbm, .format_str = "%d=%0*x", - .fflags = RFTYPE_RES_CACHE, + .fflags = RFTYPE_CACHE, }, .msr_base = MSR_IA32_L3_CBM_BASE, .msr_update = cat_wrmsr, @@ -83,7 +83,7 @@ struct rdt_hw_resource rdt_resources_all[] = { .domains = domain_init(RDT_RESOURCE_L2), .parse_ctrlval = parse_cbm, .format_str = "%d=%0*x", - .fflags = RFTYPE_RES_CACHE, + .fflags = RFTYPE_CACHE, }, .msr_base = MSR_IA32_L2_CBM_BASE, .msr_update = cat_wrmsr, @@ -97,7 +97,7 @@ struct rdt_hw_resource rdt_resources_all[] = { .domains = domain_init(RDT_RESOURCE_MBA), .parse_ctrlval = parse_bw, .format_str = "%d=%*u", - .fflags = RFTYPE_RES_MB, + .fflags = RFTYPE_MB, }, }, [RDT_RESOURCE_SMBA] = @@ -109,7 +109,7 @@ struct rdt_hw_resource rdt_resources_all[] = { .domains = domain_init(RDT_RESOURCE_SMBA), .parse_ctrlval = parse_bw, .format_str = "%d=%*u", - .fflags = RFTYPE_RES_MB, + .fflags = RFTYPE_MB, }, }, }; diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 2cfc3c431d5b..6767c85b9699 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,18 +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 (Displays information about control and monitoring) + * | + * --> base (Displays the details on resctrl groups) + * + * ------------------------------------------------------------- + * info directory structure + * --> INFO + * --> TOP + * last_cmd_status + * + * --> MON + * --> (L2_MON) + * --> (L3_MON) + * max_threshold_occupancy, mbm_local_bytes_config, + * mbm_total_bytes_config, mon_features, num_rmids + * + * --> RES + * --> CACHE (L2, L3) + * bit_usage, cbm_mask, min_cbm_bits, num_closids, + * shareable_bits + * + * --> MB (MB, SMBA) + * bandwidth_gran, delay_linear, min_bandwidth, + * num_closids + * + * group structure + * ----------------------------------------------------------- + * --> BASE (Files common for both MON and CTRL groups) + * cpus, cpus_list, tasks + * + * --> CTRL (Files only for CTRL group) + * mode, schemata, size + * */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) -#define RFTYPE_CTRL BIT(4) -#define RFTYPE_MON BIT(5) -#define RFTYPE_TOP BIT(6) -#define RFTYPE_RES_CACHE BIT(8) -#define RFTYPE_RES_MB BIT(9) -#define RFTYPE_CTRL_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_TOP BIT(2) +#define RFTYPE_MON BIT(3) +#define RFTYPE_RES BIT(4) + +#define RFTYPE_CACHE BIT(5) +#define RFTYPE_MB BIT(6) + +#define RFTYPE_CTRL BIT(8) + +#define RFTYPE_INFO_TOP (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_INFO_MON (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_INFO_RES (RFTYPE_INFO | RFTYPE_RES) + +#define RFTYPE_BASE_CTRL (RFTYPE_BASE | RFTYPE_CTRL) /* List of all resource groups */ extern struct list_head rdt_all_groups; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index fc7d1e778bff..1eb538965bd3 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1691,77 +1691,77 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_last_cmd_status_show, - .fflags = RFTYPE_TOP_INFO, + .fflags = RFTYPE_INFO_TOP, }, { .name = "num_closids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_closids_show, - .fflags = RFTYPE_CTRL_INFO, + .fflags = RFTYPE_INFO_RES, }, { .name = "mon_features", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_mon_features_show, - .fflags = RFTYPE_MON_INFO, + .fflags = RFTYPE_INFO_MON, }, { .name = "num_rmids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_rmids_show, - .fflags = RFTYPE_MON_INFO, + .fflags = RFTYPE_INFO_MON, }, { .name = "cbm_mask", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_default_ctrl_show, - .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE, }, { .name = "min_cbm_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_cbm_bits_show, - .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE, }, { .name = "shareable_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_shareable_bits_show, - .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE, }, { .name = "bit_usage", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bit_usage_show, - .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE, }, { .name = "min_bandwidth", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_bw_show, - .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_INFO_RES | RFTYPE_MB, }, { .name = "bandwidth_gran", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bw_gran_show, - .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_INFO_RES | RFTYPE_MB, }, { .name = "delay_linear", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_delay_linear_show, - .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_INFO_RES | RFTYPE_MB, }, /* * Platform specific which (if any) capabilities are provided by @@ -1780,7 +1780,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 = RFTYPE_MON_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_INFO_MON | RFTYPE_CACHE, }, { .name = "mbm_total_bytes_config", @@ -1827,7 +1827,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_schemata_write, .seq_show = rdtgroup_schemata_show, - .fflags = RFTYPE_CTRL_BASE, + .fflags = RFTYPE_BASE_CTRL, }, { .name = "mode", @@ -1835,14 +1835,14 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_mode_write, .seq_show = rdtgroup_mode_show, - .fflags = RFTYPE_CTRL_BASE, + .fflags = RFTYPE_BASE_CTRL, }, { .name = "size", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_size_show, - .fflags = RFTYPE_CTRL_BASE, + .fflags = RFTYPE_BASE_CTRL, }, }; @@ -1899,7 +1899,7 @@ void __init thread_throttle_mode_init(void) if (!rft) return; - rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB; + rft->fflags = RFTYPE_INFO_RES | RFTYPE_MB; } void __init mbm_config_rftype_init(const char *config) @@ -1908,7 +1908,7 @@ void __init mbm_config_rftype_init(const char *config) rft = rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags = RFTYPE_INFO_MON | RFTYPE_CACHE; } /** @@ -2043,21 +2043,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, RFTYPE_TOP_INFO); + ret = rdtgroup_add_files(kn_info, RFTYPE_INFO_TOP); 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 | RFTYPE_CTRL_INFO; + fflags = r->fflags | RFTYPE_INFO_RES; ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags); if (ret) goto out_destroy; } for_each_mon_capable_rdt_resource(r) { - fflags = r->fflags | RFTYPE_MON_INFO; + fflags = r->fflags | RFTYPE_INFO_MON; sprintf(name, "%s_MON", r->name); ret = rdtgroup_mkdir_info_resdir(r, name, fflags); if (ret) @@ -3218,7 +3218,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, if (rtype == RDTCTRL_GROUP) fflags = RFTYPE_BASE | RFTYPE_CTRL; else - fflags = RFTYPE_BASE | RFTYPE_MON; + fflags = RFTYPE_BASE; ret = rdtgroup_add_files(kn, fflags); if (ret) { @@ -3554,7 +3554,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); + ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_BASE_CTRL); if (ret) { kernfs_destroy_root(rdt_root); goto out; From patchwork Thu Mar 2 20:24:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 63561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp55046wrd; Thu, 2 Mar 2023 12:29:45 -0800 (PST) X-Google-Smtp-Source: AK7set829l6/2QQ1uaGX2bu4+ZP3SNefp5vbj6aXe7yL+boK7qIs4wf7vLs3gui8cGSdp36v3TM5 X-Received: by 2002:a05:6402:1b06:b0:4af:7f6e:297b with SMTP id by6-20020a0564021b0600b004af7f6e297bmr12656695edb.35.1677788985697; Thu, 02 Mar 2023 12:29:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677788985; cv=pass; d=google.com; s=arc-20160816; b=l8muoJQ2Nm/G7D4Uqfxo7Kpo/vZLX/p9202l1/zSJmeIvVizT+oqZxXUr+IopTvpb8 ZdDIZRKzEnCHcLDVx8k/VvsLz8+HISxlAU3ksszYJMZ6snpEuuiF067qjc7ObA5aakal b9yBRRp1tL9F1aMpVL/4cEwbTvB2T8TDoLCriqDIlQ8xWm2aZKd0pAWpBJMTqOeqk33l a4X5q2zMACWiYn+vrCCWECLnl29PnT92+CGh5gPlQVp5l7QtK8Dixtcx/lvfQlCIkXuQ RzlbQlvnvys+oMot2ssEClnlC964ELDY52mAueVUMojlP8JDF/AjWnfvlQk5bllt1HMF Cy0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=AHYM3f0BQdq5Sq2aeopo9p/HK6fR//kM+KW9AWlxysc=; b=alq07pnv1BCp1EidiJz8LamkUKMs7RdAeWknWft2USvP3JIH0C8aGtU/luuNHSKNHP krKqtC1mDf3+b7I3OJZqdu8vceh8T5xaOZ9Rp2z/xstvQcD9oTowjm7c3CVkQMlhXqa6 +nKuQKfxk/V2ohPxzIlZYdyeIsVnbmebt61kq3w3fl7tVprRIhU6dp11RToIZy4uxY9i 5LHJJELZMQbIMaT41/R03L6WDp6F2CZrm8y1KjwnzayB5QIxPypdxM3CFxNqqSLZItNS muPWfgZlNomDe2liuCerzQYwumbtwFsQAKJ3hHxqLfAW2pU28tauQBZSExbsD2LOS4yn OkRg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=invNYSyX; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb39-20020a1709071ca700b008d6b51de6bcsi331747ejc.32.2023.03.02.12.29.21; Thu, 02 Mar 2023 12:29:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=invNYSyX; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229913AbjCBUZl (ORCPT + 99 others); Thu, 2 Mar 2023 15:25:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbjCBUZ3 (ORCPT ); Thu, 2 Mar 2023 15:25:29 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74F7257D11; Thu, 2 Mar 2023 12:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gDG0aKi7tovdKXNMiRGJjDSVbNTjCYgNrgLE7cbe3uG9FeE7aHb8dAm0v3PaWqUdOaI8mC1p727kNkE02yLAMUgK4l0boG7ua56T7/OpKX3Rq6mx8sK0kbAyc03LTPBdf5rR8cnFjqjeNGslVP8/lT7mhLYyuqJIgrf2VOeunvEP4ijKiE8ZL160+faG2Os8nhAm8D1/OPz+vSSvOtR01QDxz1ezlqPMWp8Jbg+l8uH12tC05NXB+k/QATLw+wlAHflm70W9c41BTJFbqsFL0MmP9XVlFLAF73j27G1SWjAUM18s3dt0iDchffQFDHe705eWU+tfbqApDzBGNlUtYA== 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=AHYM3f0BQdq5Sq2aeopo9p/HK6fR//kM+KW9AWlxysc=; b=ZIeW3Op9OKCI3NqEKGC7hTT1IL87tSKym8pQJB3JxZt5fYMYHAXVW09UKnuwT5C1oVKbsVdBsLgtW7RXyGMSlKquepDcLIUz6JtxOAxMRJYZM/btRWJ7GZsu2Yd+VlTydZd4Y5O4zUZjPPBQKBsun4DVQ6fdlyG2pihx74H9rx4qpkssP/d3XP/wZl+6ctKx6AcSdg5e7igEHZAEflO2jwEc5MjW5OGbput5TmSyvHSq87vT9uCUgMSSxnp1tr7Dnrb1ccapN1RwI3H4goMbGx/fqn/kn6XfNQ887L/RLZ9r/pboWFXnbBHtaE8FjLWxA90T3zQB/yaXrNUng7VpLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com 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=AHYM3f0BQdq5Sq2aeopo9p/HK6fR//kM+KW9AWlxysc=; b=invNYSyXSMrDw67tfAIrNlX4bNfpWZ5pwfP7C5ctUrwULqm6Z0N9K7MeF50ZBaNvrs3h4gLPttIOkX24Q6I1PGhPKandolIezo6tQsXJUK/o8EubwQMwtv4yezicbpeb/6eWgsD9WrWAj45bWL2mmvfXwrG3iGZgmGjFjvWTON8= Received: from DS7PR03CA0179.namprd03.prod.outlook.com (2603:10b6:5:3b2::34) by IA0PR12MB7649.namprd12.prod.outlook.com (2603:10b6:208:437::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19; Thu, 2 Mar 2023 20:24:56 +0000 Received: from DS1PEPF0000E634.namprd02.prod.outlook.com (2603:10b6:5:3b2:cafe::50) by DS7PR03CA0179.outlook.office365.com (2603:10b6:5:3b2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19 via Frontend Transport; Thu, 2 Mar 2023 20:24:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E634.mail.protection.outlook.com (10.167.17.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:24:56 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Mar 2023 14:24:54 -0600 Subject: [PATCH v3 5/7] x86/resctrl: Display the RMID and COSID for resctrl groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2023 14:24:54 -0600 Message-ID: <167778869402.1053859.6094569492538617564.stgit@bmoger-ubuntu> In-Reply-To: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> References: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E634:EE_|IA0PR12MB7649:EE_ X-MS-Office365-Filtering-Correlation-Id: b001c721-0903-4f9f-ac0d-08db1b5c3065 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ObPIVEl7puWIlxT6orCAtphkuuW2UsEzs9EKoNnaljLJwAYxh7rD1jmITKqHKuPCyQiz666aFSdfUrC1bVLAUK5d2YkzAeJvVvTGCePycYZFn+nLdxdli/2AZ6chHDpNkAyVMTvvPN+EKbsDP5ERYEWexaUf1/g165lz/Ali0klcuZ/0/XKTNLojgn0sXmGMY7b3tS6L/wA5msPgq4PZMRanRyr9cnSpUwMYXG5YdVURzRRi6UKOkirlC0QSvYi24DEm5Q7YHlc6mVyygXsnnxr5VYxh+aZv4/9i+H1vMQTRT92LjQ2M9UuDLM6Fu286aJ3eKdpyJ17+ujW01hlP89t+N1aFZdWi2KijeoaIYXszSEhDk+Ww8HyNwAxCnE8A+MmQ4GnAUNCU62rFKdoLG+Uz6VN6UVkw30BGgWr8NyS3MvRg4Xe4480DDEbNOizmxF7/5dW1JOTfkxv0yNaHySszOUaevYOT5FFQDhAHaz4Zuk5yTHTKrpouakbzq5mHRb/xbfixec21PwLp7IqY+1E3emmEhJIkcdox2zuNQKuFIdLmM2fMQgOjtmEaJM7QEYHphTQkfQFw69Wb7MM7HZq0Fw7oM+FX42iKUnO4z+s0tTrQ3GKQXdGbhtEMYuJO7qehKu17FPDMBVly8OFtyl5i/c94DG2KWF27PEub2rpnxb8DZip61Q1qBufwG3b7+8IBjc9fg1aRzoqsD4zSOKB/hM2Omulbk5+1cJRaoeWSA4drmj+6z52aHsZB56ksmrFRyBKEG+uXwiC7daIHbw== 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:(13230025)(4636009)(7916004)(396003)(376002)(346002)(39860400002)(136003)(451199018)(40470700004)(36840700001)(46966006)(40460700003)(47076005)(9686003)(336012)(26005)(186003)(16526019)(316002)(54906003)(110136005)(4326008)(41300700001)(8676002)(44832011)(16576012)(2906002)(70206006)(70586007)(7406005)(81166007)(7416002)(478600001)(8936002)(5660300002)(82740400003)(33716001)(86362001)(40480700001)(82310400005)(103116003)(356005)(36860700001)(83380400001)(426003)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:24:56.5185 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b001c721-0903-4f9f-ac0d-08db1b5c3065 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: DS1PEPF0000E634.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7649 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759289263408569161?= X-GMAIL-MSGID: =?utf-8?q?1759289263408569161?= When a user creates a control or monitor group, the CLOSID or RMID are not visible to the user. These are architecturally defined entities. There is no harm in displaying these in resctrl groups. Sometimes it can help to debug the issues. Add CLOSID and RMID to the control/monitor groups display in resctrl interface. $cat /sys/fs/resctrl/clos1/closid 1 $cat /sys/fs/resctrl/mon_groups/mon1/rmid 3 Signed-off-by: Babu Moger --- Documentation/x86/resctrl.rst | 17 ++++++++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 25203f20002d..67eae74fe40c 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -321,6 +321,15 @@ All groups contain the following files: Just like "cpus", only using ranges of CPUs instead of bitmasks. +"rmid": + Available only with debug option.Reading this file shows the + Resource Monitoring ID (RMID) for monitoring the resource + utilization. Monitoring is performed by tagging each core (or + thread) or process via a RMID. Kernel assigns a new RMID when + a group is created depending on the available RMIDs. Multiple + cores (or threads) or processes can share a same RMID in a resctrl + domain. + When control is enabled all CTRL_MON groups will also contain: "schemata": @@ -342,6 +351,14 @@ When control is enabled all CTRL_MON groups will also contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". +"closid": + Available only with debug option. Reading this file shows the + Class of Service (CLOS) id which acts as a resource control tag + on which the resources can be throttled. Kernel assigns a new + CLOSID a control group is created depending on the available + CLOSIDs. Multiple cores(or threads) or processes can share a + same CLOSID in a resctrl domain. + When monitoring is enabled all MON groups will also contain: "mon_data": diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 1eb538965bd3..389d64b42704 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -760,6 +760,38 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_closid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->closid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + +static int rdtgroup_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1821,6 +1853,12 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "rmid", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + }, { .name = "schemata", .mode = 0644, @@ -1844,6 +1882,12 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_size_show, .fflags = RFTYPE_BASE_CTRL, }, + { + .name = "closid", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + }, }; From patchwork Thu Mar 2 20:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 63562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp55050wrd; Thu, 2 Mar 2023 12:29:46 -0800 (PST) X-Google-Smtp-Source: AK7set9V60K5gTh4r2epY+R/ImnXHVBEFPu8Z2OTWQqzZJuFg0rWuNba0Mntw57Ym4An6bjNmqvM X-Received: by 2002:a17:907:1deb:b0:7c0:e30a:d3e5 with SMTP id og43-20020a1709071deb00b007c0e30ad3e5mr11329406ejc.18.1677788985849; Thu, 02 Mar 2023 12:29:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677788985; cv=pass; d=google.com; s=arc-20160816; b=BWJGBKnub6UI3qshG6OFh3rIKGG5ucE0/0JO1M0pgEzia70G27UGzx2yeAQ27EfwwQ PxbozjLpusKzzsG9Jyp6VzGJDQIvVqxbbgOmXUiY1u/y9+VSkXLOHHCw/ivZVyTdYBGJ zy2hTyCBF3eh4UynFq48BtCJiojrEkPCrxtvAMOLWT5sohC5H6J97zwxxDOAbE5HRsgy 4icQy+Ap7qvEnBBXVQhMF4HbXjUuL15DwXG3e3fBVBEJ3Dw005qWOnTdEU4jcPq8ZQqI 4GY/7fS/FUwnVG2RMxY3bmFsDt9NGvDloCqiw8Sckd1HlXf4FBoC8GyO6EEWZ1aLnprD N/6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=FvBn5SIrSfI9gR5HDFhw8W4CA0A9jPC55GhGmzRT5DA=; b=C6vS6QBaR5vuXq3/GCsA7jDK8TWCwGMk75cWlQvPpRCa5xo/M4gf638JFZhRImKAY9 mxWqjGLqQSIUxML4GM4Xvk9GBUH+7I6pZ+w/8YvyeG+auHWcLZP+DYEHD0+wqrhKbrrL qIjDweIny8BGuyur4hllipYh+BNp6T9OdwnBZI8Rkag0bW7vlW1A3wSkhD9pJrTp+WMV I6Qp6SAPPClLgzTY+zWrV9AeMCRp6aV3NZE52E20n8Mt+Hg1oZJU0PTHhpAdJASHqKW7 8GXebSrbHmcGCfwOAgzgY5kAUcMDYIYeZOr70nsRb5//umASc78FbhwOut4GQbI+nx5L 12sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UPeyjZC0; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a17090631cb00b008d7cf1f87fasi155629ejf.955.2023.03.02.12.29.23; Thu, 02 Mar 2023 12:29:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UPeyjZC0; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbjCBU0K (ORCPT + 99 others); Thu, 2 Mar 2023 15:26:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjCBUZn (ORCPT ); Thu, 2 Mar 2023 15:25:43 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2061.outbound.protection.outlook.com [40.107.237.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADE22820E; Thu, 2 Mar 2023 12:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hWAiWILIYV6bYPnUTCk51xGjNH77owCkQ0BjtW6eFxCBKz1m2yve3/9oHkyQpwZXb9lvPZ2b7lBxkuu5fVqfG0VeyvAQPwGhHuDxeGq9qxc/rrsFzpo9f6kRPcpv5yiRbW8A64XlhB+P1Wm1bvc8Xfeip6Q/a9lFcYrTGWK14OzYCZ4MVqVG8lSJlmy9alEfwWmtU8N2JpFOYpoYvuyM+R8z+eJwrDkpS8DstZg/T+1F7URTdjnfidDDFKnS+74MoIM9Ufe8ZHqE67Xa0nvDcTMwYjOgy/V6bYzP+aj0NkeRIntbp5qMSnZWFJGO0nSdytP5sEQq1SRXxigIWn8HxQ== 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=FvBn5SIrSfI9gR5HDFhw8W4CA0A9jPC55GhGmzRT5DA=; b=Mld1elsbiQIP+yufIJ8f9z1Sp5/kCbfHNWwPW6AWd7LHsN17fbQdB+EItu6VcpAY2jbGCbbvWR7NPTY7oKNrtcS6ekQwlno8PQYE6uCtoMTxgtISYkrpL53I9VsEZSMRK4cVmjIOe7UJac0IIsqeFqVMpArPQNuP1g9gQkfxX0NYPlmvDVv/asjEvbZY9txDXPyF72fEeZ8Z713SFzd1QERr9DCcSTXLHUA7TdySYPgVBzy0VrorklYJT/jmHiAoKerZx010MFcOaoVZEyhj2eR27olr9R5QX1BozfWIgppF2WSmuYBcxVNXMSXpQcy07haQQ64y1Zy9PW6VsLNXkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com 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=FvBn5SIrSfI9gR5HDFhw8W4CA0A9jPC55GhGmzRT5DA=; b=UPeyjZC0BfHAwhNNoMpQ/69J0sRN3qP9sKOx+tTLb53RbTgeiAjRoSmNIsbWFIqjE1d/ree4erUmdPEOeKl+57s9EszsEaoKanJKG7+InIDS6S6OUrrAPHWzgrDMf5Mh+qbdgE66nVIrQlbz/z5Sg6aSWHVQK1FwMcj0IhCh1h4= Received: from DS7PR03CA0267.namprd03.prod.outlook.com (2603:10b6:5:3b3::32) by DS0PR12MB8443.namprd12.prod.outlook.com (2603:10b6:8:126::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19; Thu, 2 Mar 2023 20:25:06 +0000 Received: from DS1PEPF0000E62E.namprd02.prod.outlook.com (2603:10b6:5:3b3:cafe::b9) by DS7PR03CA0267.outlook.office365.com (2603:10b6:5:3b3::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.18 via Frontend Transport; Thu, 2 Mar 2023 20:25:06 +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 DS1PEPF0000E62E.mail.protection.outlook.com (10.167.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:25:06 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Mar 2023 14:25:01 -0600 Subject: [PATCH v3 6/7] x86/resctrl: Introduce -o debug mount option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2023 14:25:01 -0600 Message-ID: <167778870113.1053859.9553109061915206299.stgit@bmoger-ubuntu> In-Reply-To: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> References: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E62E:EE_|DS0PR12MB8443:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d8c1e02-7f82-47b3-7515-08db1b5c364a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f+Rbvhx2SIS+Z+qpY6jSzGPVumbmTjOttUi8xtA3r2gE5H87CVCaJeTHjcPv6dBGQ4ysqYMH9ybAl8RmaLcABjMOjhQ2ehy4OMiEzwDm7Pju5cb+6JM5momFvjnIHzAa1OCdofwjwQpRmTZ4JSM6IhpnLvyTL8TUAxFEB/3X+yqAxUKAjJgL0qPF7mYwudePPT5UZGk0b6dWCk9U1bcqDXO+fTqb6owl5n10sp13S7Nj/uK5clt2G1e+C/KxYn9U3Vn2Qli5/tKHP3CV6xELNaNl0vqRR9JnP1Rc2B9lWgrDGRa5BbXLr1LyoAMXx7I+ZXUwFzClF/USsnAkj8pBrihgzdr37InnPzqDp7zZDe/+q+GFm/I7lGzwffda9AWOz3ITyhxaDf1JvGKY2iNUyM7w1E5eckGaAVr0FGhPUe7LpDnUFHfCGCeZZbkMuy+Kyf91yoZMG67s/475peJ9k+gDaEVx4QXG7WDKpK0WAwm9tRZk7iO20cZFgSNnfSnNI+sNynCBlG3Mezpd1244YCsL+tXvWojPzXI9Gzx+Iq0KRpkJ5+I32uuqLMq6eoKeEpNJWbT29k4w7zOaMFPxAWSXVho0dbUaW0M3egf56S71/7m3iGtqIOg3byoYs7wpp1bjxZR5AKffoCGiR9yG/2Fwwf3ts+Bmo8Qx4VS8BDPvahqAOTIBk9rbvdJr6hJDiTeYrpdRe6LyA20aJS0x6Nsk553iF/NK02d1vQPZo+ubDWyrnOYy2syEsssORWw/O4tlGDmFFkK7rQ4fnvUIfA== 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:(13230025)(4636009)(7916004)(376002)(136003)(396003)(346002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(40460700003)(103116003)(26005)(336012)(16526019)(9686003)(186003)(16576012)(54906003)(316002)(41300700001)(110136005)(4326008)(8676002)(70206006)(44832011)(70586007)(2906002)(5660300002)(7406005)(8936002)(7416002)(478600001)(81166007)(82740400003)(33716001)(86362001)(82310400005)(40480700001)(356005)(36860700001)(83380400001)(426003)(47076005)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:25:06.3753 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d8c1e02-7f82-47b3-7515-08db1b5c364a 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: DS1PEPF0000E62E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8443 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759289263143962944?= X-GMAIL-MSGID: =?utf-8?q?1759289263143962944?= Add -o debug option to mount resctrl filesystem in debug mode. Debug option adds the files for debug purposes. Signed-off-by: Babu Moger --- Documentation/x86/resctrl.rst | 2 ++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 3 files changed, 16 insertions(+) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 67eae74fe40c..1ada4e0650dc 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -46,6 +46,8 @@ mount options are: "mba_MBps": Enable the MBA Software Controller(mba_sc) to specify MBA bandwidth in MBps +"debug": + Lists the debug files in resctrl interface 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 6767c85b9699..35a9ee343fe0 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 debug; }; static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 389d64b42704..a1f13715a65c 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -56,6 +56,8 @@ static char last_cmd_status_buf[512]; struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -2411,6 +2413,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) if (!ret && ctx->enable_mba_mbps) ret = set_mba_sc(true); + if (!ret && ctx->debug) + resctrl_debug = true; + return ret; } @@ -2599,6 +2604,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2606,6 +2612,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), {} }; @@ -2631,6 +2638,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->debug = true; + return 0; } return -EINVAL; @@ -3569,6 +3579,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 Thu Mar 2 20:25:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 63563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp55076wrd; Thu, 2 Mar 2023 12:29:47 -0800 (PST) X-Google-Smtp-Source: AK7set/f9XXoswx3QvOmdOdnZeZOZxlACENCn150C2Q8gtTiH+QGk6ql1NxD75HV/NT9eLNjGgWm X-Received: by 2002:a17:906:4b4b:b0:8b1:77bf:3bdd with SMTP id j11-20020a1709064b4b00b008b177bf3bddmr11924737ejv.36.1677788987604; Thu, 02 Mar 2023 12:29:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677788987; cv=pass; d=google.com; s=arc-20160816; b=SXbP3bROYYOXHMjUJAt7Zk2HVBNNCxntLxOt1j94VO7jSK2/BdKFuasJ7Qi1aGsvuw zudIeM0xAt1U8/QAqU9pobXo9a4Uvx7dxW1ww6TFGt6PYJuTxY/mATrYOdIN66ZlfYmV 65gwqR0lK0L/tl/UsHSZwtIKLk2j6f2su0ByEckfDxMxE7ueKwwyBIHyh54K4yvkQNuZ Mq3jD98/HKu0DWAjy7xoDey1PYLabpqjkzWVgr6a4VKYe7Indn8rNlYWRI61q3fE2PJy mN6rhMkrhfOvzBXvwuGyBZ9uq6CCSufvzJ2nM39XUXpPCmlGh6O5QLZu8PQAEEWOPlge F1pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=eO6qZ4CmidKPoh+G1DsI+9CoKSqfSijLIjt12ZB+cu4=; b=D/nsgRjZEpVjocTtDrqTngb4H58viSCMvplupJ4m1Rl9dRIpqW8EFgTzQza5gGx9Yf 1fFJFWyAG2gfg58OgYPNkMOsowSsPBiWqpz1QYYefSE5Y4ZQmHIWo9CJD1OwxTzQd02k xd5mY3JxBDrz+97imNyRrAGnVZUA6GFgDkLTHg5iWlQV6A+45fKQjJxjWoQ01tLfUlF9 MtFDarDBKdGMy5o/XOQwWtRJZXdXls0i4u9mHAaPPjqDARhqpbugAT6iCq/w+88Y9VoH 07MJJRn1HZCUwbjWV6xx9pH+e6xT8UfD49KcuTgbsU1QTd9DDhqKe9NKnEPDVn4nMugD Xq4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=B8gwZZLp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p20-20020a1709060e9400b008dfe8ec40ccsi172088ejf.814.2023.03.02.12.29.25; Thu, 02 Mar 2023 12:29:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=B8gwZZLp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbjCBU0N (ORCPT + 99 others); Thu, 2 Mar 2023 15:26:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbjCBU0A (ORCPT ); Thu, 2 Mar 2023 15:26:00 -0500 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2059.outbound.protection.outlook.com [40.107.96.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F462521FA; Thu, 2 Mar 2023 12:25:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mp0XneEosqS8ohwEmaBNwian4YyAs+ZkNrgw5h5wCkX13D+SveZjoFPGPKWQlSVJ78Wp0rTjuWWbqp3x91akhfHVVQKsMDZ2UA3XNycbcxFVbTvcyyz2jD7sRrk+iAbRHFqdYALkugBlO+371Rzi0TqU4Y83oBemovCCVd4NwFgjnIYin6sg0EYVRqiL1zY/yRQRlmZIVEjjPkz1et7v+WboRt6wSSfTbQpRJthjdloMJxplJLv+aZZCYMJUPthtWrR6lRHqGwxcrMlaISKA0mVgcI6t+bUu/V4hbCnoSIRYynigC+Qu5T94BbyzXtYwfK9PiIKdlMBtATE1htDgQA== 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=eO6qZ4CmidKPoh+G1DsI+9CoKSqfSijLIjt12ZB+cu4=; b=OLS4MXBqKxCLoIuIpg2HIKoPmuiTdgxW8sAbEFJibom86Ebi82Lr2AJUUz4wdyedQQZOTHWYbnfZvDVtIoAp0N8sg4JDGz623kXuGx4ZTc288VSPDBMOVRwbJg3uTicBf4v8teW+1KW8FyAXGfBYLhHGbVbFJzrVU2P/6MdMT16AjzaHsgTOXOZcLSTpC9JEM1oLxgRxrDcLusZ6wOZhqtVh7NjW9MKbvfpUl+GyHNx5JsLZeQrO8GpQ5p5gS35lovWwvOTofI1s+P8g9xe+/HfvaayocUEBy8gOGMbN32duxw4lSjpG4n/CpMf6Qb1GniV/dw8DTiYzEF3WLVOksw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com 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=eO6qZ4CmidKPoh+G1DsI+9CoKSqfSijLIjt12ZB+cu4=; b=B8gwZZLpxz/69Lnilcm+I0qawck1JukfqAQCNOVuZVNlF4vhBrpFmVeH7krWrGBTj4ycifwP+GR4IUGyYnjLePoLJjQOhteoKTB5rmcCpHe0LZLxJyoJ8V7HRZujx+2hE+02Ll4dR4DHqXqFirQAEbLV53uoYzW48hM1oA0/Tts= Received: from CY8PR19CA0037.namprd19.prod.outlook.com (2603:10b6:930:6::11) by CH3PR12MB7667.namprd12.prod.outlook.com (2603:10b6:610:14f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19; Thu, 2 Mar 2023 20:25:48 +0000 Received: from CY4PEPF0000C970.namprd02.prod.outlook.com (2603:10b6:930:6:cafe::b) by CY8PR19CA0037.outlook.office365.com (2603:10b6:930:6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.20 via Frontend Transport; Thu, 2 Mar 2023 20:25:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000C970.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:25:48 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Mar 2023 14:25:08 -0600 Subject: [PATCH v3 7/7] x86/resctrl: Add debug files when mounted with debug option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2023 14:25:08 -0600 Message-ID: <167778870823.1053859.9940104139782066465.stgit@bmoger-ubuntu> In-Reply-To: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> References: <167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000C970:EE_|CH3PR12MB7667:EE_ X-MS-Office365-Filtering-Correlation-Id: c51c3882-3c0b-4167-f604-08db1b5c4f35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u5m3pFvpMKl7PKA0A+xgTpoZAf+zFjoWX+8Qza/ARnlH0wWHflm6h3ytLPc9/xCxrjPtyDJMO1+PR1UBfD2phOcfrdsx7/n5naMDcFImzwn2m3zljmKsf6s7L1lko/7bryqhe2hWYDhpXhOAloJ8Q7lacgYi6hWqBCVe6bTuJSW0y50eIdKtxu3J8UbroGIxQHPKIf02lI5czOBAKNeu4LCzYbjZ53Nq5KexxPqzTm2qd7N62NnS5D86kP2jaXPnz8Fh/EYjU7y855M7h+KCAfrX4d0uqcLhXG6stPp0ZmSzyRFEyYbah+8JM5Y1GtcD6/pinJIS5+7owfpID1wV3NmYdyTTMyPpnwViFD+ciPlbBaZjEJ+Je+GrI5KKYbDbfs7n1KaHq3iXvpaEor5iFmHFQUS4SkAF5o6UnPoDkunp49fhGNbsA8ebIL37kRZ7LggyXxOK+oCl8cCbRxOChVHVjhB+1U4wqYuJx/BKsmeiRzXx4puqb94mKEa4pxax8adTmuTOe74Me9y91rcSudxX1LksWcseLFsT3lZAGJnwVD0uerZSPhw5Cj/u2wTkGpuD6AnZypk8gIba0gxmUkQ/29crokYH1dXCzOgmlUnhrEX/NxxRSkcq/CsLiB9W2iQx6FtSmrAgaxpHhGnSPjICfgkk3I5NCTqUoBltFloFta5KoOHxm2ICkmmV2z0VMz1luELZTomV8S4f2+GlawvPmBA+bJB0aI0BqnytoslC8yhfr6QlKXvQ8TwA9Piu 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:(13230025)(4636009)(7916004)(136003)(346002)(376002)(396003)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(82310400005)(33716001)(41300700001)(8936002)(54906003)(40480700001)(16526019)(40460700003)(336012)(9686003)(70206006)(70586007)(186003)(4326008)(86362001)(8676002)(103116003)(2906002)(47076005)(36860700001)(44832011)(83380400001)(7406005)(426003)(7416002)(316002)(26005)(5660300002)(110136005)(478600001)(16576012)(356005)(81166007)(82740400003)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:25:48.1996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c51c3882-3c0b-4167-f604-08db1b5c4f35 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: CY4PEPF0000C970.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7667 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759289265254256231?= X-GMAIL-MSGID: =?utf-8?q?1759289265254256231?= Add the debug files to the resctrl hierarchy. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 48 +++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index a1f13715a65c..790c6b9f9031 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2400,6 +2400,45 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, struct kernfs_node **mon_data_kn); +void resctrl_add_debug_file(struct kernfs_node *parent_kn, const char *config, + unsigned long fflags) +{ + struct rftype *rft; + + rft = rdtgroup_get_rftype_by_name(config); + if (rft) { + rft->fflags |= fflags; + rdtgroup_add_file(parent_kn, rft); + } +} + +static void resctrl_add_debug_files(void) +{ + resctrl_add_debug_file(rdtgroup_default.kn, "rmid", RFTYPE_BASE); + resctrl_add_debug_file(rdtgroup_default.kn, "closid", RFTYPE_BASE_CTRL); + kernfs_activate(rdtgroup_default.kn); +} + +void resctrl_remove_debug_file(struct kernfs_node *parent_kn, + const char *config, unsigned long fflags) +{ + struct rftype *rft; + + rft = rdtgroup_get_rftype_by_name(config); + if (rft) { + rft->fflags &= ~fflags; + kernfs_remove_by_name(parent_kn, config); + } +} + +static void resctrl_remove_debug_files(void) +{ + resctrl_remove_debug_file(rdtgroup_default.kn, "rmid", RFTYPE_BASE); + resctrl_remove_debug_file(rdtgroup_default.kn, "closid", + RFTYPE_BASE_CTRL); + kernfs_activate(rdtgroup_default.kn); +} + static int rdt_enable_ctx(struct rdt_fs_context *ctx) { int ret = 0; @@ -2413,8 +2452,10 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) if (!ret && ctx->enable_mba_mbps) ret = set_mba_sc(true); - if (!ret && ctx->debug) + if (!ret && ctx->debug) { resctrl_debug = true; + resctrl_add_debug_files(); + } return ret; } @@ -2831,6 +2872,11 @@ static void rdt_kill_sb(struct super_block *sb) set_mba_sc(false); + if (resctrl_debug) { + resctrl_remove_debug_files(); + resctrl_debug = false; + } + /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r);