From patchwork Thu Jun 1 19:01:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp564867vqr; Thu, 1 Jun 2023 12:29:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MVUC/mf7QPFcNXuo1W1sFCR3DvjQQsWdYzl+6mNQPKTqn6b6aqAK0K8gd2TmL1KJfPeLU X-Received: by 2002:a17:90b:93:b0:256:959f:3443 with SMTP id bb19-20020a17090b009300b00256959f3443mr308527pjb.25.1685647776076; Thu, 01 Jun 2023 12:29:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685647776; cv=pass; d=google.com; s=arc-20160816; b=walirs2gUPcY4DNVN08MxNnQBON6iLMaPk4CMnRKgwcQ4OnRnB39xrsYIQht4gA2Y2 iV0lKXjgOBO+Ht11zXUgDc/Ht8jEYEH/qSjd6MmuoKwLbjYWG3LYnIB8sk0AUuYA0pLl rYdYD2DvkSVxmdTixxJqpgY71whqxdped9/qwpUPVepubhQEMsQqYl7h1G043NXR3XCy ZJSIS+kxbMWguy3fSXBkNvI+IBIxW8V+lyXxc+2jCbLJTUOhsBjzzK8GYZ+VbUvpaBZi k665w1erouiWDgjZaIhzWkgj+ofC6WZRp1XMXXq+Bd7GS0Wy/AB5dzbc9Ad98TNfvAPZ ClLg== 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=Pc7gUMeTIQG06bGDJbpD3jGGCpa1NF77PZ/v+V6CXYs=; b=lJB4mtQdwcH0V/CjQby4Fp8A1Qlvr+8qErLHbmwe+XOxMkrQwL6fA18ZfBeQ7j5pTo fXmnRdcHFn9uGP9qDuHckK2EWT7jdH5cvZrsgXLEOxyXKyFkCatmeCW2BMuF7BrxTPDM MKV4xPEyxo/icImzlPI0DL8+NceV0dgcvv5vIyBn7xylnrMkuiGYP059MbRa5BzrA9dS TkJSpHkLxAwFaJBwbdRnK9+Idr7+sHWvMS7TXfI0AZrwLL4qiVgFbKQNbK5QzfFGZ8eW x3l6RBQgfXVLVVs3T54ecx9fpv0o9DkCaJyUttoP1OqC8Ti+SkHcaWjHw8sYQ5ldVRH0 +FmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RPQAelQR; 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 l26-20020a63701a000000b00534919e40fcsi3295579pgc.626.2023.06.01.12.29.21; Thu, 01 Jun 2023 12:29:36 -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=RPQAelQR; 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 S232885AbjFATC0 (ORCPT + 99 others); Thu, 1 Jun 2023 15:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjFATCR (ORCPT ); Thu, 1 Jun 2023 15:02:17 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31011B8; Thu, 1 Jun 2023 12:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q+GjEAZG90EUMswPrruQtJ7h/myQN6aRYaiCiMgr1Ql5V5k7xG6cp7AS+30Ij+cRN0VZtiDzgFEwSxV+Kc/J4ezia0rdakXCFfgw3oyKycloUni7+1/fj0gvjbc8NYgOEccua701M4/X3t8LF3snyr4fWnlrtOgA4UONyOxYyH2AzB7f6yfa0dqKosw5fEzWcwITfMd+rX+TfLD5iueJdy0X1c/SP7Sj1T/aaKodAg+r3EmjWy1IF8W77GrzFneMUsm7l/VHahvqQbuQ3zSJSt4po+bGYhSG1zSKVkZEk6bjhu1mMQ2GYVs6Qj4sQrrTNwtbHwNIwAqGTP5k6SwEpg== 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=Pc7gUMeTIQG06bGDJbpD3jGGCpa1NF77PZ/v+V6CXYs=; b=NDGEBoag0QrlgzGPCYpNUaakVDmnow6z7QjARnHebvRXj1Lq1oECk11aZ5ffTgMLY7XTkXd4RkL4vasOh1EeA3/tyGw26Lr3VJtzwJw3XIfblu3gnlxKSlS3BfBAFDpINyDGRf5eJ2W89rJhWR2qFJeeOBQtkl0kGProwffNNYvrle3OxhvfPB5e901aci0EQT/JTdXf1dpqblC8fYyKMe3v3RNHS4Ah7fB9pKYejhOsES/uOlFYT34fRm7obs3Z4PVPTnpxQvJ/KHlzBdBadIMfJVhOMd16kdN+QHNZ2lsUvBfS0E/apLdashgVQhfmC+ng7ZoNGQdPIoW/zhwmGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.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=Pc7gUMeTIQG06bGDJbpD3jGGCpa1NF77PZ/v+V6CXYs=; b=RPQAelQR3wf5eluYNGjy5HcMvnIprlw9YI14J5+Lpu0Yldjy7iUbSpzzIyvvZTZ8Ltpcpuv1uegl5rFmw7YL8AXTLNKul1G8pvsVMVT6UVmUEn90cRmZh8nNhn1IoYtob/bBuKhcRDaGjX7UAo/SUiBxIh07zCzlXI4esU8ayjE= Received: from BN9PR03CA0204.namprd03.prod.outlook.com (2603:10b6:408:f9::29) by MW4PR12MB6753.namprd12.prod.outlook.com (2603:10b6:303:1ec::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Thu, 1 Jun 2023 19:01:56 +0000 Received: from BN8NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f9::4) by BN9PR03CA0204.outlook.office365.com (2603:10b6:408:f9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:01: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 BN8NAM11FT009.mail.protection.outlook.com (10.13.176.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.24 via Frontend Transport; Thu, 1 Jun 2023 19:01: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, 1 Jun 2023 14:01:53 -0500 Subject: [PATCH v5 6/8] x86/resctrl: Display CLOSID and RMID for the resctrl groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:01:51 -0500 Message-ID: <168564611100.527584.7981937236207103115.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.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: BN8NAM11FT009:EE_|MW4PR12MB6753:EE_ X-MS-Office365-Filtering-Correlation-Id: 0cb3154a-6fbe-4109-9695-08db62d2ab78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PBdrmy7MTlTWcT64L/wGoBX6gH9+RXMZ5j0SI12SBEJEW2lVuzBltjJL4WZCGLJf52u+Ci8PYtElh5ks8/P6sjwx3BNxcaIet35VvZI5fxQ4m/F0qLCiBK6r/gbiEXDqi/hbNpxb7+fWjEQqlb3VkQiORGS3cQsLgxPtUEn3VazPgmoAsmk3cogoVkC1UPGcFbUEGXbXM/AXBR777Cd97WaSCAu3vWYERqib5EXnWFaNn9LugOXl2TKOcQVoB1lcF6UD46Wb+9FxpBmKilB4WoqkPLydGJi2C0J7RqfKddYqaMZP54qf5VXQibX46ZMMkLhmOXRVZClnrvbJTxPThgoMWet1Ro1lP3p3UeJVGTeqWbU9NNFxhJXBz8lqMVGLMBlJ8WNvl/ryJSWhHSlcg49tcU2iZKSiiGCOGW8tfd+qIqxnlShCzANJjozQgZ8f8YlDu+Dl9DXhntn3KGuGBt1qD6n2ZR/VsSOoGdEc6HWf7p7gNJCoedW+LplSnIynKy59f4GrLUjeHzPOignN5VymqGbaVZ917y6D+kQLDLwQET/AvZoEBscgbYyBeztEJt0wzZSsU03n+2ZBLGXGjEq84nlnNUlC8aVf09+XMaePYBfs91NzMsHRGka1f1hkEJkA1J7XM4jKbOyHnZ5XakINGbL0PVUybuwj2SKKwnwOF9CrGF8i2YEqoovUNqqlVgdiETlbXpUMUCIevVi9wQkVwJ2P6Kxq+dRe5n+q6jWzYCH775NF6hWGWKHDwqEI9E99iE73Cj5gtY4EabTXKioR9kDhOBjRaeu8YPPpn38= 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)(7916004)(4636009)(136003)(346002)(39860400002)(376002)(396003)(451199021)(46966006)(40470700004)(36840700001)(110136005)(7416002)(7406005)(54906003)(5660300002)(70586007)(70206006)(356005)(81166007)(82740400003)(8936002)(8676002)(16576012)(478600001)(186003)(9686003)(16526019)(44832011)(316002)(4326008)(41300700001)(26005)(426003)(2906002)(86362001)(336012)(103116003)(47076005)(33716001)(40460700003)(83380400001)(36860700001)(40480700001)(82310400005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:01:56.1893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0cb3154a-6fbe-4109-9695-08db62d2ab78 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: BN8NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6753 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, T_SCC_BODY_TEXT_LINE 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?1767529802230857053?= X-GMAIL-MSGID: =?utf-8?q?1767529802230857053?= 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 to debug the issues. 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 mounted with "-o debug" option. 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 | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index afdee4d1f691..1baf857ad8c6 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -344,6 +344,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": @@ -357,6 +361,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 be91dea5f927..2f5cdc638607 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -763,6 +763,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 /* @@ -1824,6 +1856,12 @@ 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, + }, { .name = "schemata", .mode = 0644, @@ -1847,6 +1885,12 @@ 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, + }, };