From patchwork Mon Oct 17 22:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 3784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1670129wrs; Mon, 17 Oct 2022 15:30:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41dMoFk9ZRr7xJpM6hylC/4VSbbxWb7T1kRWhpz9MVJW5YQhqqz+OgjsHP8D6IFfhEYkgn X-Received: by 2002:a17:90a:f417:b0:20b:6d04:a502 with SMTP id ch23-20020a17090af41700b0020b6d04a502mr37006369pjb.76.1666045856437; Mon, 17 Oct 2022 15:30:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666045856; cv=pass; d=google.com; s=arc-20160816; b=Pyk3LS1PBwkuQVuSA3UzClm6uhzWWIATm7UIh89bNOEk91Ai+oNEv5T0zTX0ldmDo8 xiA/E6WNTR49jRHAb1I6GyTOEolMjrILPUZZPg6zapG4HcAMldQLQwhDNvcwQG5ACZro GHM5S0xKspeCPpPZaKO/lE9UH5A8x02B4FStN6p/8yIag78vV/iSJHEFnqwN/A3SExcW nIjt/wE4pkAZNsUhEmoqKGkNyrpF4hXSh6RrfYJqndcpz7K99eK1/5VQxXEGFQ04E+LM Tx2t0mf2Gx0aNdX2XD+7Gz1ZT9NHzzjFNPcXRVYaG5OnhkPuxf76twRsC4J/58n8Gj01 zbzA== 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=RmUmdOUT/+idtnOSNOzH0DTMOQ4xeQprS5+AjbtNBc8=; b=pgIOscSXCRN9ESOhvQ0f3WZIgSaYXtQ2tuzyg8J5nqRcjscehj0LqNVZebB+/yA+P3 DH1x8Qe59gQtPyOmFQDx80N16aPjoCDlnQFObGIxnrYaLJ6wdhjSaTWEzjq03sQSYSQe AO5DDiGUF4dHwii3ogRAhbVyabIDx78XgFQbPUPDy65qmRMPmL+2FWC2fjAfkW9ZIJLO ZsFERI7uKGHN3wegTjlKCt6LCUmWy1RQz7aqGTO/sq0nKqvEg1/bIVOmeqEDVEP1jlBF wt3cqW9hc9aM4brs/daekd2n5i4Q3Rx2SAa6LyfJeI7zAN2bImSvxu5hlDYW++5Moi+6 +F2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=37zUg8wQ; 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 e23-20020a635017000000b0045a6c6c559bsi13252479pgb.305.2022.10.17.15.30.43; Mon, 17 Oct 2022 15:30:56 -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=37zUg8wQ; 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 S230262AbiJQW3M (ORCPT + 99 others); Mon, 17 Oct 2022 18:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiJQW3I (ORCPT ); Mon, 17 Oct 2022 18:29:08 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AE8A8112F; Mon, 17 Oct 2022 15:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TNJN51S7izkPFyzDznIKfOHDDaiE8ThZ6qceHofkkRTh/ylGC23EZXWTtN2fd+NgdB2PFe57lyFsv9RWHa1W4vVGxRddJj2+7+QWKI+vO1I8J5UAhwlgs7fAsVa0MBwo9vSwkdpar8qSwg1hODci77ryPXJxu+HS1a4JjZ+oI9KueifhoWMtfAEOuwl8RpFL9j3eFiilkKfZEfJcLoR55UHvdCywrqI3OgtOHt3kx/fyR0CGIajS/qFzLJiYBNOOhJMThdpzu7TFhwgBueP5CDek2JXx0eeQqwXw18ZfOWMzPWZdEGldXI8mPuEmmy7LUD/IovgASqpweSbuMMr1JQ== 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=RmUmdOUT/+idtnOSNOzH0DTMOQ4xeQprS5+AjbtNBc8=; b=mJF2tz/nxfp5RkbarxS7iFevxSl8O2jl8/nMsP9joT9W7ZP6333TvBr12gGAU5yBkj3N81z5BB1pMuuKCnDmqTFf73E3lINCPh8GiuQSf1WhiiXjad/qZ5ESF6shUU5ARJLx+xlED7OBakc0trlABGft2BokZ5hukYTrjHrE3HiQQTh8dN3Y0y2gfgwzCCEezK5Z5pTETltwHzcGRufLhpN9hGAq84ONb/vwwrcZJzLP2j27bGboWdL4yW9Gt5t4AKLuSyzYzj2zhMEtApw/tHjn2GuEuKIfvkHc3dClrACI0K7TKJ2kDwQm0lKJpl+wkeExDTnXLeNdBAg8PPoIEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=RmUmdOUT/+idtnOSNOzH0DTMOQ4xeQprS5+AjbtNBc8=; b=37zUg8wQ76TQ+DkFxP8D8eWDfBq4xYwqxy2oW9qgzD5/u6t0P6lZub3iyG5xonED6PYV50mT2zIMhCgxuru6Sou0jHrxYsZ9WwCT2myBfGJkZDHoB++I1CAX2XxChR+WRA0oqbKeQYvGN8a/ZywjHGqy7TLcLfMID2KmuizvUeU= Received: from BN0PR04CA0133.namprd04.prod.outlook.com (2603:10b6:408:ed::18) by PH7PR12MB7260.namprd12.prod.outlook.com (2603:10b6:510:208::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Mon, 17 Oct 2022 22:27:38 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ed:cafe::40) by BN0PR04CA0133.outlook.office365.com (2603:10b6:408:ed::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32 via Frontend Transport; Mon, 17 Oct 2022 22:27:38 +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 BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.20 via Frontend Transport; Mon, 17 Oct 2022 22:27:37 +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.31; Mon, 17 Oct 2022 17:27:34 -0500 Subject: [PATCH v7 12/12] Documentation/x86: Update resctrl.rst for new features From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 17 Oct 2022 17:27:34 -0500 Message-ID: <166604565437.5345.14867510739122394750.stgit@bmoger-ubuntu> In-Reply-To: <166604543832.5345.9696970469830919982.stgit@bmoger-ubuntu> References: <166604543832.5345.9696970469830919982.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: BN8NAM11FT048:EE_|PH7PR12MB7260:EE_ X-MS-Office365-Filtering-Correlation-Id: b739b5cc-791d-47f0-0aed-08dab08ecbaf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lI2tudMtwB/+u7Acas2dFTfHCy+65lxRFS7swMw8W/Q8tfuI8S5Th8JwPS+pJnP/ARp6l6X2bBLTPPiv3hGG600uVEW77E9e8APvL1n4InFM2cTotoLJq83cbyzFAaHsLOMgOXm3EWtGxQ15sZ0nX0aKRt/w+EkmpOZ8Vh1HJ7MRilWjWEXpe45jCnzQTV93Mcfud+aOynJ3gR3nsZb/urI0VE/9xkhG0d9/imjEDM4pYzuSKMxcjSppCcjgfXWpihGerbxdrDdqmd14IYEUyWECQqVDv9wFgRfKviho06ugGLwvcrDHXtPgja2Mp4dFFjZJBrHyWiuNc98+HVJFjnTEVfXlARX+s1BPDcfI1BJVaBP1RfSCCImY92L3vJgMVICgjN4jAA/jyV9Op8WWyiZyqh6SBM+8Y4CR00MlFg5nbFA9lvraks4bqhl5ZauE/aIQkNhO0FXh2EN94qUKA4XeHqgCd+ECK3jPGU2Jo19z/n20j0TDqdSBt2xcm3oOG482Muk+kQKC58ZS5jeots5Ejo6RqKJpQGtVgjBxSpe2d1An/4LFUDco5WLjynJCQ2RbJyENlhdGBICny4c75FL7pGE/WijmnQZRLF7aDS8F8urgI+pXwpW2fBZuWm6JkdxJW4ndQyDlMk99YZa/toVOzncH1gpaD4nJlfEuHqfkcHHlJl/0O0u3DEaJP/jZyN0rZPgZ0EvK2KwF9JG3yq6zZ4HIRlqYjKMmTfw7Fvq8aAJ9QAY67aOyud5veF0YwqvcRrovltMwJUCGESWQeuSto8w13PaNuo4xmD7yC+a3fyo+TyUM4FIKGpzPKnFL 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:(13230022)(7916004)(4636009)(346002)(136003)(376002)(396003)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(54906003)(110136005)(5660300002)(44832011)(7416002)(70586007)(70206006)(316002)(16576012)(41300700001)(478600001)(8676002)(9686003)(26005)(4326008)(16526019)(336012)(2906002)(186003)(8936002)(15650500001)(83380400001)(81166007)(82740400003)(356005)(33716001)(82310400005)(426003)(47076005)(36860700001)(40480700001)(86362001)(40460700003)(103116003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 22:27:37.4968 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b739b5cc-791d-47f0-0aed-08dab08ecbaf 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: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7260 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1746975700231103139?= X-GMAIL-MSGID: =?utf-8?q?1746975700231103139?= Update the documentation for the new features: 1. Slow Memory Bandwidth allocation (SMBA). With this feature, the QOS enforcement policies can be applied to the external slow memory connected to the host. QOS enforcement is accomplished by assigning a Class Of Service (COS) to a processor and specifying allocations or limits for that COS for each resource to be allocated. 2. Bandwidth Monitoring Event Configuration (BMEC). The bandwidth monitoring events mbm_total_bytes and mbm_local_bytes are set to count all the total and local reads/writes respectively. With the introduction of slow memory, the two counters are not enough to count all the different types of memory events. With the feature BMEC, the users have the option to configure mbm_total_bytes and mbm_local_bytes to count the specific type of events. Also add configuration instructions with examples. Signed-off-by: Babu Moger Reviewed-by: Bagas Sanjaya --- Documentation/x86/resctrl.rst | 139 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 2 deletions(-) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 71a531061e4e..d0b4e1a2cb8d 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -17,14 +17,16 @@ AMD refers to this feature as AMD Platform Quality of Service(AMD QoS). This feature is enabled by the CONFIG_X86_CPU_RESCTRL and the x86 /proc/cpuinfo flag bits: -============================================= ================================ +=============================================== ================================ RDT (Resource Director Technology) Allocation "rdt_a" CAT (Cache Allocation Technology) "cat_l3", "cat_l2" CDP (Code and Data Prioritization) "cdp_l3", "cdp_l2" CQM (Cache QoS Monitoring) "cqm_llc", "cqm_occup_llc" MBM (Memory Bandwidth Monitoring) "cqm_mbm_total", "cqm_mbm_local" MBA (Memory Bandwidth Allocation) "mba" -============================================= ================================ +SMBA (Slow Memory Bandwidth Allocation) "smba" +BMEC (Bandwidth Monitoring Event Configuration) "bmec" +=============================================== ================================ To use the feature mount the file system:: @@ -161,6 +163,79 @@ with the following files: "mon_features": Lists the monitoring events if monitoring is enabled for the resource. + Example:: + + # cat /sys/fs/resctrl/info/L3_MON/mon_features + llc_occupancy + mbm_total_bytes + mbm_local_bytes + + If the system supports Bandwidth Monitoring Event + Configuration (BMEC), then the bandwidth events will + be configurable. The output will be:: + + # cat /sys/fs/resctrl/info/L3_MON/mon_features + llc_occupancy + mbm_total_bytes + mbm_total_config + mbm_local_bytes + mbm_local_config + +"mbm_total_config", "mbm_local_config": + These files contain the current event configuration for the events + mbm_total_bytes and mbm_local_bytes, respectively, when the + Bandwidth Monitoring Event Configuration (BMEC) feature is supported. + The event configuration settings are domain specific and will affect + all the CPUs in the domain. + + Following are the types of events supported: + + ==== ======================================================== + Bits Description + ==== ======================================================== + 6 Dirty Victims from the QOS domain to all types of memory + 5 Reads to slow memory in the non-local NUMA domain + 4 Reads to slow memory in the local NUMA domain + 3 Non-temporal writes to non-local NUMA domain + 2 Non-temporal writes to local NUMA domain + 1 Reads to memory in the non-local NUMA domain + 0 Reads to memory in the local NUMA domain + ==== ======================================================== + + By default, the mbm_total_bytes configuration is set to 0x7f to count + all the event types and the mbm_local_bytes configuration is set to + 0x15 to count all the local memory events. + + Examples: + + * To view the current configuration:: + :: + + # cat /sys/fs/resctrl/info/L3_MON/mbm_total_config + 0=0x7f;1=0x7f;2=0x7f;3=0x7f + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_config + 0=0x15;1=0x15;3=0x15;4=0x15 + + * To change the mbm_total_bytes to count only reads on domain 0, + the bits 0, 1, 4 and 5 needs to be set, which is 110011b in binary + (in hexadecimal 0x33): + :: + + # echo "0=0x33" > /sys/fs/resctrl/info/L3_MON/mbm_total_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_total_config + 0=0x33;1=0x7f;2=0x7f;3=0x7f + + * To change the mbm_local_bytes to count all the slow memory reads + on domain 1, the bits 4 and 5 needs to be set, which is 110000b + in binary (in hexadecimal 0x30): + :: + + # echo "1=0x30" > /sys/fs/resctrl/info/L3_MON/mbm_local_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_config + 0=0x15;1=0x30;3=0x15;4=0x15 "max_threshold_occupancy": Read/write file provides the largest value (in @@ -464,6 +539,26 @@ Memory bandwidth domain is L3 cache. MB:=bw_MBps0;=bw_MBps1;... +Slow Memory bandwidth Allocation (SMBA) +--------------------------------------- +AMD hardwares support Slow Memory bandwidth Allocation (SMBA) feature. +Currently, CXL.memory is the only supported "slow" memory device. +With the support of SMBA, the hardware enables bandwidth allocation +on the slow memory devices. If there are multiple such devices in the +system, the throttling logic groups all the slow sources together +and applies the limit on them as a whole. + +The presence of SMBA (with CXL.memory) is independent of slow memory +devices presence. If there is no such devices on the system, then +setting the configuring SMBA will have no impact on the performance +of the system. + +The bandwidth domain for slow memory is L3 cache. Its schemata file +is formatted as: +:: + + SMBA:=bandwidth0;=bandwidth1;... + Reading/writing the schemata file --------------------------------- Reading the schemata file will show the state of all resources @@ -479,6 +574,46 @@ which you wish to change. E.g. L3DATA:0=fffff;1=fffff;2=3c0;3=fffff L3CODE:0=fffff;1=fffff;2=fffff;3=fffff +Reading/writing the schemata file (on AMD systems) +-------------------------------------------------- +Reading the schemata file will show the current bandwidth limit on all +domains. The allocated resources are in multiples of one eighth GB/s. +When writing to the file, you need to specify what cache id you wish to +configure the bandwidth limit. + +For example, to allocate 2GB/s limit on the first cache id: + +:: + + # cat schemata + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + + # echo "MB:1=16" > schemata + # cat schemata + MB:0=2048;1= 16;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + +Reading/writing the schemata file (on AMD systems) with SMBA feature +-------------------------------------------------------------------- +Reading and writing the schemata file is the same as without SMBA in +above section. + +For example, to allocate 8GB/s limit on the first cache id: + +:: + + # cat schemata + SMBA:0=2048;1=2048;2=2048;3=2048 + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + + # echo "SMBA:1=64" > schemata + # cat schemata + SMBA:0=2048;1= 64;2=2048;3=2048 + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + Cache Pseudo-Locking ==================== CAT enables a user to specify the amount of cache space that an