From patchwork Thu Feb 2 21:47:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 52181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp491804wrn; Thu, 2 Feb 2023 13:52:34 -0800 (PST) X-Google-Smtp-Source: AK7set/sgX2q+TL4JVPSpNsw5Sl3JLm2UV2pQ4Q0jMnXul+3bsBsC/ftaigjr4YwcXB5Asrh4O86 X-Received: by 2002:a05:6a00:b8c:b0:592:5885:8634 with SMTP id g12-20020a056a000b8c00b0059258858634mr7168524pfj.14.1675374754504; Thu, 02 Feb 2023 13:52:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675374754; cv=pass; d=google.com; s=arc-20160816; b=OG5d+wDVTJ81diWr0ZO2ecweVQ4YVe2JHeWgYHosvrhlWdgEvSpLbe5IVqSBwY8QyW UksjezpnbzODQ4N0M2Gt6Uiazi0Vi7wrdDGXPLnci4lJ1Sao/GfRWvSJ518uEKyJBlpp NlnTC8zsmddBFVewZGEAsPTlFIeb0u7edJEy5FUc0U7OGRcZCZdiSBsNAuw26vrgiufd hyPtZRX/6CISFyb8P1K3J4NmmNpr7wFwNG3yBP2BU/oDDkmrmXnjA1eYN88IDNQB89Zz m71+VuC0nFi66fdu6DlDyLyebm5rOWUnk+EKONfSz1AGGka96nA1pvqLkI7SSJo0Kggv KzPQ== 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=0smFb+avJ9Wx8MwUlb3vlWOOpjCo4cU5/TxwWHUvKKU=; b=TF9Ivxz9LLssroOgOvot4zygm5N7dGTO+bWQXPzYqikVLhbqUfsgz12KoOi0XVHSIm jmQmCmPFJBiINklgDCtFl0UPeCsDXkqqQOHnylhoUmwFQfKNrjdGRXIqN+jwiwwxZKQw vhEus3eYK7Hf7yWFUB3ivIgAhckVywy0HfMZZDgVktKBoN2mBAUTzNMUoP1+mAEriWWT 4wfx+r8c/m58g6Adtfu2uwjMpe27aRC40AEu17b6m6AzJe71KEoVj9LaBjG4JAKfW1BX I1r5xnfKhkKDhUDTFHhznj2iiVcv0U1svn02x1cRL1+Rfex6YMWubiAM/DtuvAsOVjK9 MsuA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ALeSD0xR; 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 cp8-20020a056a00348800b0058ba826a404si567634pfb.24.2023.02.02.13.52.21; Thu, 02 Feb 2023 13:52:34 -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=ALeSD0xR; 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 S233146AbjBBVr7 (ORCPT + 99 others); Thu, 2 Feb 2023 16:47:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbjBBVrn (ORCPT ); Thu, 2 Feb 2023 16:47:43 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2084.outbound.protection.outlook.com [40.107.237.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7DF78627D; Thu, 2 Feb 2023 13:47:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ENRfhL+H6Loax3Y7mMO1QQlXqFEZ7bgmpOP/lZsYbBNtl3WNNjjq0Cx/3Ajinu8jh5oIVIqSfL5o+vOEcKZgt1kEk/4tAhSi4Zc3M6bwGemARcKmSiB/d/+LflAvNCPHS3zCa6ntf73cOWNUEdwUUgMv4qTIa9sDt99QHNUrYQ2OwEYDB6c1eOeFdCLUs2BPqwxW2bazODV/3lwiVVyWcVDRNq85CfrYflQ6t567KdxzfTpmpu3kbOk9G+9MmLbyYx/zex2HmbUVFufYBmudjDhRMvP6C/k1fZpqlYKICF37enLjK7DFZ+Ped/1hKjRT/wrlooouOQGZEXmWUMLN0w== 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=0smFb+avJ9Wx8MwUlb3vlWOOpjCo4cU5/TxwWHUvKKU=; b=SO92bjjO9/tcZ4ZQVVoK0Fv+hA1oN4oTnwqP3waZrEkdY0n3tkDQqtjRGf9PG/1xwPjJA6raslJ5/g4/9pa/n37iLe2FpfLj5U+h6AjUwpz8Ac+3q5vfUfAuyDvOkesF3LS2i/8K59XCIZzgRh+n/gAKxzfYTKyNWrxnVvPw53Qu57VFq7CRWY5LuoG4MSzFqbKNrqLObms43t5wr4sjrOmbi/4WvpclieOsrn0L+QqdExye0Zv4XtaARAfHL7KAuntOnGS+YslPX7y486VTGO4PH3Bp2MW8/paE88ohi5I30AAf90dFYYnXNmWLpZT93eKpHqBGKX75DzthSx1glA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=zytor.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=0smFb+avJ9Wx8MwUlb3vlWOOpjCo4cU5/TxwWHUvKKU=; b=ALeSD0xRoaohhiNwy7yIUuXH8vCuvm2ZK9iv+Ms3x/5wIKQHosrvrKn0N9QhsfRhvOQ4iYqr6nKA+Z62IoJcswuEO0kKN26BO0KFPEc+/c4wowFkiP8sE3Fey6WGOQ/qMK4D7Utkedm2frCStmc8/4okqGbXtQV0elLrZh9oXRQ= Received: from MW2PR2101CA0007.namprd21.prod.outlook.com (2603:10b6:302:1::20) by MN0PR12MB5932.namprd12.prod.outlook.com (2603:10b6:208:37f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Thu, 2 Feb 2023 21:47:33 +0000 Received: from CO1PEPF00001A60.namprd05.prod.outlook.com (2603:10b6:302:1:cafe::a0) by MW2PR2101CA0007.outlook.office365.com (2603:10b6:302:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.7 via Frontend Transport; Thu, 2 Feb 2023 21:47:33 +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 CO1PEPF00001A60.mail.protection.outlook.com (10.167.241.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6064.21 via Frontend Transport; Thu, 2 Feb 2023 21:47:33 +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 Feb 2023 15:47:31 -0600 Subject: [RFC v2 PATCH 6/7] x86/resctrl: Display the RMID and COSID for resctrl groups From: Babu Moger To: , CC: , , , , , , , , , , , Date: Thu, 2 Feb 2023 15:47:31 -0600 Message-ID: <167537445137.647488.9039585071837467840.stgit@bmoger-ubuntu> In-Reply-To: <167537433143.647488.9641864719195184123.stgit@bmoger-ubuntu> References: <167537433143.647488.9641864719195184123.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF00001A60:EE_|MN0PR12MB5932:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ab6f7a6-91ef-40a5-60e3-08db0567178a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NPnuE0iPcCQTEWwTgu+oy4Jh+5Sa6R+vafp6fkgkdPdDZZgwAgjbDsBcmX2Ltuf9ke46yyPExxLcx86Gx3R0vlRYMMBjDjOVZ4c7ShpZ3rJmrhb0ywOcaRaauNs+fybIExHQ6Jjz4MTo6bsj3Tg5Y2/tl6QPd6PCnb1obdxQKeptaR71mTGVYX2t0fr5ZrmGq2cyY6rzfyCSN4PyT4c79HIUXMIaupTb9JMpam3EHbbpoUqsuZVKfXxSlEtWE5WgyyOewkp4z/PVTwdefj6MWlae/AROcWvdNCzZ+0f9x+3Ujm2LmyGYNjHkktcIq4n+AZb8sub2x4iYMzh0FDrSLOAPr+N+TBxtq4Ie7Y9OzJA/W6p70F7mHrQ4jJ+JyL8rG/+wvohYwPwr5eYw7+Xw3z2JzNU0Z+P5ZBZplS6NCxM7nco39Y/Tq4l8s32GBf3b0dVGhIeHFGqtjOdyit/yj4ps/ZcwSesLCVAGkle7Oda6XdOI0kxxW8YIedPYtFUJS3JAdtH6HTrkDk+FMmkFVSAQoCguNWM7/qn+Fn880/Vi9Wf+Dnnjn8CgM0CnNG/WlBph35qHhx+wB/jUvUlpD+ddAQiL+c0+W7/jI0dwjbYzA+9+g8+Pr2d5LDtp87JDWdytF7ZL6hlB3rSCDGa1ArFEIDYJ8xXqvOOIrTJjXaE5LwDtuWRgcPy60tzOpfn4hp0rRx+K8CmgOHMnknYJQ7u/rN3Y3rxBpYAW2OYlxfDYDX3tyNMkuR3hSI39ofSuAcwJpzOdUW2DnYXrFSN1FQ== 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)(136003)(346002)(39860400002)(376002)(451199018)(46966006)(36840700001)(40470700004)(356005)(40480700001)(36860700001)(47076005)(82310400005)(81166007)(40460700003)(82740400003)(44832011)(426003)(2906002)(8676002)(41300700001)(7416002)(4326008)(16576012)(54906003)(70586007)(316002)(110136005)(8936002)(70206006)(5660300002)(86362001)(26005)(16526019)(9686003)(186003)(478600001)(103116003)(33716001)(83380400001)(336012)(71626013)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2023 21:47:33.6053 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ab6f7a6-91ef-40a5-60e3-08db0567178a 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: CO1PEPF00001A60.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5932 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?1756757758572338841?= X-GMAIL-MSGID: =?utf-8?q?1756757758572338841?= 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 2c013c5d45fd..de332c242523 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 Resource Monitoring ID (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 9b7813aa6baf..c35d91b04de6 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 /* @@ -1844,6 +1876,18 @@ 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, + }, + { + .name = "rmid", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + }, };