From patchwork Wed Jul 19 23:22:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2790532vqt; Wed, 19 Jul 2023 17:17:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlH74JCjZMuyLfEvio29dCtFpSlgpY5FLQbMi+HKk09BD3gxTSGl69k1n0xaWwJcPL4Vudbj X-Received: by 2002:a17:906:51d9:b0:993:a379:6158 with SMTP id v25-20020a17090651d900b00993a3796158mr3923388ejk.17.1689812236852; Wed, 19 Jul 2023 17:17:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689812236; cv=pass; d=google.com; s=arc-20160816; b=z3jLssZZqbZ9JZnndJCmS8xqky7nyFek94lwriJznGR1LonKLC2mCKZHhmxO128eec RJ6Em87kJqQ+p8YvyNUZbwC5TaNvfcmCLEJum0cGk3WRkfIC0anc6LVRZOQHs0CPUu81 W4ifmOansZqVbIDYq6gB0CNeT4gETX+GbQK2fyMdokR0VGgbbhHlvutXjH7+HpVJMUtk oIWKvG3zRySiJhl4RCsy3mN/ZUgSd4/BXzCkz4j7VUvHf9Hy9B9LYLna+2W4X10dDACD 0AJKGRghy73FwNHAWr7Kf3s3W4iVvsNJZPW9YawAx1kiE6ObcaWGWNP46wbODApddmc1 5eCQ== 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=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=RwVqFUTUMi2pf68/NjTQhpNDNaENIiK6H95/cwXEmxc/RJo0uLk6sC8qqWUX8bxsMk iEQru/58pnVffLM4Q2kb98dug2AFycA7DNUxiWZbCUR2WdNHjRHenRpBwWZbjG2nXn5q HCu6tW3RLtd7pKZoo2lMMzs2+5/YodOZRKEdYCRKRwhc4/lB2B2AheME3IZwaK9PFC2a D4vo70ELaPj8mFsEtQB1K9/aSWPQM35n/YYfCZJRDRD1LoGRU+Ijy72FnKEqolWZqCqP rkWxNrwj3nBwFp0Vd6a7hlqIXUSSr2yAea3cUsyQWHXqKCal4a2vwVBzC+TqkmnK6Nm1 vBAA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=uuDtBnO5; 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 t27-20020a1709063e5b00b009945340230esi3572915eji.174.2023.07.19.17.16.53; Wed, 19 Jul 2023 17:17:16 -0700 (PDT) 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=uuDtBnO5; 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 S230128AbjGSXX2 (ORCPT + 99 others); Wed, 19 Jul 2023 19:23:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjGSXX1 (ORCPT ); Wed, 19 Jul 2023 19:23:27 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2089.outbound.protection.outlook.com [40.107.237.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C955172D; Wed, 19 Jul 2023 16:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mr3PsYlPJPT40QGh1Q5+tWdo3tJZ6wTcxQFIgQzjQVHRd3+Pa/JdUkTidfAKFwnehm7JaeIbAM24xZJgmi8RwCZLZg1JsrJsv4EtOIT1MnQK/U3NiA8y+Y7pocuEZdvENgty3OpKQOJajFVwc+WCwcUez/XheXaUlvQbLzE6Hv7kN91p3YDkQTTFg+5KWwDVZcLJNBwq79IKh1xp6gZuF9e+8+bMBtJcYyu6z6Iy8m2nKTcxbZYGAPRaOPgCM7RjK74CmXorshn8HgldN5B2qbevnNtR0vZITeEBEQZA9JY9RFWo90iI/0pErAYRHyme8gCYA3TVTiAdcih/e1Vm9w== 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=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; b=d/UIwHGLS0GZ3wgt+DHJmpEE8A+yX8gG8KfKyybU5pKLfXOieHRN/P812+q8CAVKAlOfRp7wn7hgDm49InrioAQtL1No6J93Hwc2e2RqSkTgw1ayHputnFu8zXsqO3YcdT2DNUxxRfqvldDrQ3dDE9eDm6++DwypkNE/iN8RrQpGXd6MigiwTLAGQqPZLyaL1RnmB3VDDcKIas/zdO+soofX/jy3pzQchazuXGXSMs+ES1vmdb8VugOym8+p0jDByO3s/mRNFOQpRBdsjx3CvfdiMoyT12H60vtaGTmQ5LiHLv8PXS1QefL6CvHsj2onDnZEh5WdX+y96AFghitSUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; b=uuDtBnO53EgLY0lAUFuNHQf6EETNGxPCxDxs7UZF//1d7YNmHbtSuULt14hQTecRsJQVMa9KR+CPJmtSMSKwRUGAKsmlMJa1HqikQ+CCOa2Pl9UVscpUNFkMFvYbp8Q9x1m4hcZWftxIbc3RyOjbMtwQYv9A31KuYqAtY+QDZh0= Received: from BY3PR03CA0025.namprd03.prod.outlook.com (2603:10b6:a03:39a::30) by BL1PR12MB5826.namprd12.prod.outlook.com (2603:10b6:208:395::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Wed, 19 Jul 2023 23:22:42 +0000 Received: from DM6NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:39a:cafe::2) by BY3PR03CA0025.outlook.office365.com (2603:10b6:a03:39a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23 via Frontend Transport; Wed, 19 Jul 2023 23:22: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 DM6NAM11FT094.mail.protection.outlook.com (10.13.172.195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:22:41 +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.2507.23; Wed, 19 Jul 2023 18:22:39 -0500 Subject: [PATCH v6 8/8] x86/resctrl: Display hardware ids of resource groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:33 -0500 Message-ID: <168980895303.1619861.15190945847281698454.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.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: DM6NAM11FT094:EE_|BL1PR12MB5826:EE_ X-MS-Office365-Filtering-Correlation-Id: 7861284d-c289-4c43-babc-08db88af0cdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fXlzLOBc4zRU6lr/SNxddMN4wqJPvLEFBcP5nYtOLqc8K3dS5WbmWFIHHwFAtAxdVKtoMC4FG0XNPIwXSiWb5dmWYwph6RduWJlvRTcjXtUw+I1Usm3QKng/7hcjrcHkyfXV2ZYgc29OSstcUKxqQ0m4llVD2pvIGxW8NKPnaarvJcKry3/g6W113YEJT0OoHiObU/FmrmCxkbXVot30yjx/inlxtgxW5TZSGZtSDtOzw1B6FHY2RaTJZ4bM59tkTrnwoUgsLEpC56EdGo6kloU41u+K9Pmm9ok9AOP8OGvavYTKOgEIgS+A6ZXR8iUvxcBLiG4CnBkBYoMypUAlkvWdBvh0rcfthR6fVLVDysiPSSJfm3+KwmOMlzLsNjYISK33a0FsMcp6shzwmMp3K6BiXCjubXWZxt85n8M58QqaaZRodca6XHW0as9HTqzLCN9aHmpSn9/qgq/aq1znaTqRG+Exrvei3pkJ0gktiMG82BCwfcTzyHVRfGmdrGUtRvicQJJouOQyQGBMW9gz9e8RVyFPglREXVOiLO2/NILBCam4q7FpkagQtMBbwkM38DIb2vUFsNq2D/0iIhDNxVCH5nq5Lk6HG8DBDf9Izs6VbnUajzj9og/9nOTlyTJvkMqBSYeZ1UL5VFfh6jXM/AAeDOMV4IeumbutLzdPsCfdYYb4qBdMtC2oxtLTZy9b53S1vuu3yfnfdv08ydjm6CoJXx4LY4LxdiIUTjSCQhVb5yooQigJo9FE+7+B3R7E+1q7ikG+dnMDhVHBmfATLjygMiJilab8eeE51ox/xuE= 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:(13230028)(4636009)(7916004)(376002)(136003)(346002)(39860400002)(396003)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(36860700001)(8676002)(40460700003)(8936002)(47076005)(83380400001)(2906002)(103116003)(82740400003)(426003)(81166007)(33716001)(356005)(86362001)(7416002)(7406005)(40480700001)(5660300002)(26005)(44832011)(16526019)(336012)(70586007)(6666004)(186003)(316002)(16576012)(70206006)(4326008)(478600001)(41300700001)(9686003)(110136005)(54906003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:41.8919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7861284d-c289-4c43-babc-08db88af0cdf 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: DM6NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5826 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_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771896556200204905 X-GMAIL-MSGID: 1771896556200204905 In x86, hardware uses CLOSID and an RMID to identify a control group and a monitoring group respectively. When a user creates a control or monitor group these details are not visible to the user. These details can help debugging. Add CLOSID(ctrl_hw_id) and RMID(mon_hw_id) to the control/monitor groups display in resctrl interface. Users can see these details when resctrl is mounted with "-o debug" option. Other architectures do not use "CLOSID" and "RMID". Use the names ctrl_hw_id and mon_hw_id to refer "CLOSID" and "RMID" respectively in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 8 ++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 5a2346d2c561..41ad9b1f0c6a 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -351,6 +351,10 @@ When control is enabled all CTRL_MON groups will also contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". +"ctrl_hw_id": + Available only with debug option. The identifier used by hardware + for the control group. On x86 this is the CLOSID. + When monitoring is enabled all MON groups will also contain: "mon_data": @@ -364,6 +368,10 @@ When monitoring is enabled all MON groups will also contain: the sum for all tasks in the CTRL_MON group and all tasks in MON groups. Please see example section for more details on usage. +"mon_hw_id": + Available only with debug option. The identifier used by hardware + for the monitor group. On x86 this is the RMID. + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 058c1dedb2d7..e8b35013d7c1 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -776,6 +776,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 /* @@ -1837,6 +1869,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "mon_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + .fflags = RFTYPE_BASE | RFTYPE_DEBUG, + }, { .name = "schemata", .mode = 0644, @@ -1860,6 +1899,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_size_show, .fflags = RFTYPE_CTRL_BASE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, };