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, + }, };