From patchwork Fri Nov 4 20:01:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610329wru; Fri, 4 Nov 2022 13:03:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F4/4ULsQwFZovA8BUZHQeU5Hq+TzHCnqbzbVA/TXLDyKJSUK3pC4mIN+1OmMmlg7PCAw1 X-Received: by 2002:a17:902:d58f:b0:186:fd58:c6fc with SMTP id k15-20020a170902d58f00b00186fd58c6fcmr36731881plh.125.1667592211194; Fri, 04 Nov 2022 13:03:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592211; cv=pass; d=google.com; s=arc-20160816; b=WUi9GvHmjfs458IK8p3x2lxtyvlr9idVS+ZElXyEoKxfegHWcKiFOk3Lwz49Jydy3p HHBcDFe9Ws0fbOXk8J9ijJiH9OV+gDIbRBfrzGRe+coqwit4LgF83acQzBm9hrGYBerY rQtGFJI69I0fPn4WSZcRBUfT7e3J/RpjPg/oqbD1SwaDP09IlZZ+/jm6Nq3Sf5jfGKdL azXZQYhOdt7WOM/g/HSQ1RhiUJ5rjHjoKMFWxZkf1QlJCm3zax1KXZU7PQKtQH3W8RKE v7FYH2yt5VV48oK0s12y5WMRkx9o78y1KrJDooT5vF2qXwJK5/vZppw7CXfczBR7Sg75 mlUA== 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=+s4l4zkGjAI//GM6I9DveLbzsB6+BhZ4ms4R4KpxxNE=; b=B3HFw6HQRbS9CM+RRsprTIrFZUHeoTFXXVNB3AebefqK/HkICxa90d3cW9gwsmkXEj 7r9a5o71PtBwgc69s3PNyBB0O+C3PAPdvKBE8NRNOJD7io0lqGOK/Jx43paALQ8vwHpu Gns/xb9Uwvv41Ow7NyhieMnSiaRru15VR8pdC9Hx0ijbf66tQ15TREtvHHzhbHxWPNRL P/cKbHYqnslG6t7D90w7Z/De6h9y+NsPTD0im1XXg7Rsg+bLq5HKMTv26GdHejZQIFJk hFFQNlGjkxwWkH6OQB52OWJvW8kD7UgwMgfNbroIhIAZ68syWAd76IJpJOS+I4KJ6k8d ARVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wLnjMCtK; 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 d1-20020a63f241000000b0046ef23ae9a6si362045pgk.848.2022.11.04.13.03.17; Fri, 04 Nov 2022 13:03:31 -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=wLnjMCtK; 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 S229805AbiKDUCi (ORCPT + 99 others); Fri, 4 Nov 2022 16:02:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbiKDUBy (ORCPT ); Fri, 4 Nov 2022 16:01:54 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2043.outbound.protection.outlook.com [40.107.94.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1D34AF3F; Fri, 4 Nov 2022 13:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GOscMAck0Sx2lzrEBhfUpbA1hTxmqP/64ZRPqMc/6dFOMEM4RhEIc6MLBbtZNO8rUkghhIycqWWmCFgi619hblSzSsQJyShoevrzVJPIfjekybelytWzbgXCcrpThs7YCfXOS4002Rd9SwcgL8tbOyNfFHO152jQyZlg3cTAoLA2BQ3cT4VOTnBWvKaDVIeKPjh537JPzODolh17hF7oBZse3Q+jenSODhQCRPrY49l4VPDtC+jW1CmbP2g09qKjiaY+iqddPsB8mo4eDWlIzTjM35yeHg7oHRisb7o21QZtHsYCHKYtkG+JbV9sfQ8LiVV3hEp2I/7g9v5HfbV5UA== 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=+s4l4zkGjAI//GM6I9DveLbzsB6+BhZ4ms4R4KpxxNE=; b=VeR9OM+t9grn9NuXePRb/jat9m2hFJHGzWVDln05bJ/gLKIs3I+fDw7CKXt1rK6xaB0v1uFbw7HSV4U6TFm5LMay3NJ0PJDToID0SpoA/hozcMoufn1hv5Pe7D4cJS6Cy18NEYj8qiJlOCDFp9QqrZ1OOigk6z6xaDV+1S/NrsQG/i2bKtN4UcylRAqIn/RFuQVukpLAT8hxtJspnUw957DukWy8hsIId85v29/q0QE5/q0dPFN3kaaEb1HFuVlbXgndjNT66lW7bNRwgPxQFCTUb4nBdogQxp4Rd72hH0R403SBltFZkm7Dp7xO3mqd0P33DVdUTv4wI1a/SEG4zA== 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=+s4l4zkGjAI//GM6I9DveLbzsB6+BhZ4ms4R4KpxxNE=; b=wLnjMCtKLLY6nUdtj1QcMAqQj9s/LBWfdj5tWbBTIjR1Dwy6zxb/2wsmENN5P3mMrassz8hqjlhJNIZ8zR2ahwyhWBuvYwxyeE55+lmKPxfV1aEmEuT9Js8b0gcFCmAdire8bHEXaUFoArHasGVjtrhAgupV6i7WZGfpmDB2s1U= Received: from DM6PR11CA0059.namprd11.prod.outlook.com (2603:10b6:5:14c::36) by SJ0PR12MB6880.namprd12.prod.outlook.com (2603:10b6:a03:485::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:01:32 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::db) by DM6PR11CA0059.outlook.office365.com (2603:10b6:5:14c::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:01:32 +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 DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:01:32 +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; Fri, 4 Nov 2022 15:01:30 -0500 Subject: [PATCH v8 13/13] Documentation/x86: Update resctrl.rst for new features From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:01:29 -0500 Message-ID: <166759208987.3281208.3199784740546752454.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.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: DM6NAM11FT065:EE_|SJ0PR12MB6880:EE_ X-MS-Office365-Filtering-Correlation-Id: c256ef78-ce43-4667-f48a-08dabe9f5ea7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9NLPLuCUHvmPR8lPctqdDaVPWas8HS79j1dFqQ0cjh6xfz5qSsz3aDW9DngRxYX1vxi4WIf0jIY/vq6XChnjKhsdwfU3RZ+P1adUbFfHh+loL0HVreHUKy/s4eULmtUHL9voJCZjT7nsXhB9cl//FjrtY9UzCcCgY5mEVhYhvXUZOG8TSHBKAmyvRYf0FE+MSgoAdpZEvOBiR2Y7ALqM9VUbi94sWx6G/QJ5W7ZMv/5J8U3lSdMVJFE+dcHM70qqsJq7AMqDu5RkQznBIyLA/KPhaUozwqVTNXSBhLpp9VflPJ7fKjqe3hEm3i+Pke0fNp+7KEwb2DNyoPThrcigkSpXD3WCxtTwTUkiqbH6cwkR6B4Fs5rrpIDoySCvfw/XrQq8mJioM3Ycmy68YokmPf4O3bk54q6fVAgwhPvLkZW4KEKiKJGh1czx2eH5LihYx7xijH4ToGkpEIpY3rcxa4RUlbDsMIGDxsWy33ZjZdgbgy7+W6p3dhkbADXgeP86Hfl2KmGMF/TFi3XmKNWzZveM/ybv2CeWEz/OM04ai1VnvnY9EL914KR0uWHk+RbD4oGWlun6/Aui3eIWR2DKs2jE1x+hI92Vz3/hHyN4YVy5V5AcYUA5U9nOBkPpsSA++08BPoitxqBV8uCn1ksyTUzxfdUXK9jjxYuTzfpblKwW0a33AaL4fERVTJwjIuzoy1DloaEZb2W7dAGGsVhghpLu3rbAjnStZrLvi7Cd2VYhXwSBJuXrNCv2KdH9heguyshLmL0gB8XnkDJB97+lcCPD8dwo/v3mptKMB8Tb+ofT+MH1UO8PatvhWoE5C9C5 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)(4636009)(7916004)(39860400002)(346002)(136003)(376002)(396003)(451199015)(36840700001)(46966006)(40470700004)(2906002)(33716001)(110136005)(26005)(86362001)(82310400005)(356005)(81166007)(103116003)(40480700001)(7416002)(36860700001)(41300700001)(9686003)(8676002)(4326008)(70586007)(70206006)(186003)(44832011)(336012)(8936002)(16526019)(478600001)(5660300002)(54906003)(15650500001)(40460700003)(316002)(16576012)(82740400003)(83380400001)(47076005)(426003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:01:32.2708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c256ef78-ce43-4667-f48a-08dabe9f5ea7 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: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6880 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?1748597170309813019?= X-GMAIL-MSGID: =?utf-8?q?1748597170309813019?= 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..12adba98afc5 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_bytes_config + mbm_local_bytes + mbm_local_bytes_config + +"mbm_total_bytes_config", "mbm_local_bytes_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_bytes_config + 0=0x7f;1=0x7f;2=0x7f;3=0x7f + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_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_bytes_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config + 0=0x33;1=0x7f;2=0x7f;3=0x7f + + * To change the mbm_local_bytes to count all the slow memory reads on + domain 0 and 1, the bits 4 and 5 needs to be set, which is 110000b + in binary (in hexadecimal 0x30): + :: + + # echo "0=0x30;1=0x30" > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + 0=0x30;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 hardware 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