From patchwork Tue Jan 24 09:26:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 47624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2063444wrn; Tue, 24 Jan 2023 02:04:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuy9ok2gQlzixBarhaGaGZbdD/iysjOhUtqyth6SwAOf7MGoE7hp+D4BPvCamJ93gGRE/hV X-Received: by 2002:a17:90a:1c01:b0:229:60d2:5769 with SMTP id s1-20020a17090a1c0100b0022960d25769mr28952071pjs.16.1674554657060; Tue, 24 Jan 2023 02:04:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674554657; cv=none; d=google.com; s=arc-20160816; b=Ohz8dZ417pTJ3CLFq29wEjYJzEAoGk72jy26vD/xL/CInsZklxIHJ9w5at2kDd4ng2 cbIKZGUcQu1Z/LrpKw3LLfIP27VG8y8l83k5u8zVnviBSlCQpzCs4AFiK/O+3hfJqTYi u54M/fQYz+ogAyUuhA/3vrlIxXJ6ZCewqrfJ3a1abLwSib/XS00ovV+rUu9XwpVhOgPg 7EMFTrTanH90LQQ62Z+ufuNfEvfdY0gKMPHnZZCbTVM79MRMEAQb5KDPkqT8KFImmeLq WJqkYYVpYwmqv5HUPEOryFrN2N6UvdAqW2w2TpISrfsnooRppdM9AS0/3Pn4hb1xizYk rsYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=qBHFgcaEcxCbJ7SxUpWAqaqoMPzAcjZlzyfygvrnkQk=; b=wahrI4OjQHFTa+69a/DU+47U4kc5RMkIL3lg9FZXFGPu8x6qcNZcaydOZZg2Z1XXVo 2Xe8ZqZn5hHBLE9G++fqUPYnEYmn5d9xgKQu7sKeqHY0OWQPaEkUR0neGbq0NjxQLlA/ tZ4+4Rw4PfDne/gjwZ+QVrCqL0oWy7LhCUz6FDDH+xl8DnWfdi9BMbDTsADDUcGHoagz 6mdBn5KJhJlFGc+PJtJAd1UXekefH1lVdasO54xreQc7mdb6+KuqmKKeZphFGWl5kcgq i6VxjrphTaCDn4OVwP33Dd0mUe39fa4sh1tuT90xBsVY2lgkTLVpVuoM7vaGKku5P0c9 m9Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RXdOuvn6; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me11-20020a17090b17cb00b0022bb873fd4bsi14980702pjb.132.2023.01.24.02.04.05; Tue, 24 Jan 2023 02:04:17 -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=@linutronix.de header.s=2020 header.b=RXdOuvn6; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233621AbjAXJ1P (ORCPT + 99 others); Tue, 24 Jan 2023 04:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbjAXJ0y (ORCPT ); Tue, 24 Jan 2023 04:26:54 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C403EC6F; Tue, 24 Jan 2023 01:26:42 -0800 (PST) Date: Tue, 24 Jan 2023 09:26:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1674552398; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qBHFgcaEcxCbJ7SxUpWAqaqoMPzAcjZlzyfygvrnkQk=; b=RXdOuvn6rlxrkus98XtVA4j1lMLAuVPzgjhnIy1hrkajWPfPtOPtQWDNO5RvIlyV4+/p8e e9a6rrkFH4l7qSyq4/EbzZXHaADTfHMRlEWuO+w3Fy487jUsXTXBaZX0TD7+oHSNEuLmG0 pWp08OcU80uYRQ/gC9QQoK/ifT9f/32J/GJFeflRuVksAWKWAys1J96GbaKtDb58xaSySI wc1ttxRT2Ka05wI+WJjRMy5zhnfZit6773+b/6NUuANTYqgPHjR5puS5yVnrnt0Q0XFEjF SyTyk7CMbc3ykOK5j38TFxfkUc1t7I3Qv2iVnYrUxqm4svx9Fw0hjkqY2L46mQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1674552398; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qBHFgcaEcxCbJ7SxUpWAqaqoMPzAcjZlzyfygvrnkQk=; b=LWQqDlGWxF8wxMVnsHqmQEpMBjyiDBxP89FomWdWb2eUD2xQ4UDmM1VE+lu4eW44cg9v6K vds0Aw0aLjT4obAA== From: "tip-bot2 for Babu Moger" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag Cc: Babu Moger , "Borislav Petkov (AMD)" , Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230113152039.770054-3-babu.moger@amd.com> References: <20230113152039.770054-3-babu.moger@amd.com> MIME-Version: 1.0 Message-ID: <167455239836.4906.13232602625549629109.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, 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?1754921900393641461?= X-GMAIL-MSGID: =?utf-8?q?1755897823860808330?= The following commit has been merged into the x86/cache branch of tip: Commit-ID: f334f723a63cfc25789b1cdf70a08ffbaea4bf2e Gitweb: https://git.kernel.org/tip/f334f723a63cfc25789b1cdf70a08ffbaea4bf2e Author: Babu Moger AuthorDate: Fri, 13 Jan 2023 09:20:28 -06:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 23 Jan 2023 17:38:17 +01:00 x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag Add the new AMD feature X86_FEATURE_SMBA. With it, the QOS enforcement policies can be applied to 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. This feature is identified by the CPUID function 0x8000_0020_EBX_x0[2]: L3SBE - L3 external slow memory bandwidth enforcement. CXL.memory is the only supported "slow" memory device. With SMBA, the hardware enables bandwidth allocation on the slow memory devices. If there are multiple slow memory devices in the system, then the throttling logic groups all the slow sources together and applies the limit on them as a whole. The presence of the SMBA feature (with CXL.memory) is independent of whether slow memory device is actually present in the system. If there is no slow memory in the system, then setting a SMBA limit will have no impact on the performance of the system. Presence of CXL memory can be identified by the numactl command: $numactl -H available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 node 0 size: 63678 MB node 0 free: 59542 MB node 1 cpus: node 1 size: 16122 MB node 1 free: 15627 MB node distances: node 0 1 0: 10 50 1: 50 10 CPU list for CXL memory will be empty. The cpu-cxl node distance is greater than cpu-to-cpu distances. Node 1 has the CXL memory in this case. CXL memory can also be identified using ACPI SRAT table and memory maps. Feature description is available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication # 56375 Revision: 1.03 Issue Date: February 2022" at https://bugzilla.kernel.org/attachment.cgi?id=301365 See also https://www.amd.com/en/support/tech-docs/amd64-technology-platform-quality-service-extensions Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Reinette Chatre Link: https://lore.kernel.org/r/20230113152039.770054-3-babu.moger@amd.com --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 6101247..3f5f64b 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -307,6 +307,7 @@ #define X86_FEATURE_SGX_EDECCSSA (11*32+18) /* "" SGX EDECCSSA user leaf function */ #define X86_FEATURE_CALL_DEPTH (11*32+19) /* "" Call depth tracking for RSB stuffing */ #define X86_FEATURE_MSR_TSX_CTRL (11*32+20) /* "" MSR IA32_TSX_CTRL (Intel) implemented */ +#define X86_FEATURE_SMBA (11*32+21) /* "" Slow Memory Bandwidth Allocation */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */ diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index f53944f..d925753 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -45,6 +45,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, + { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { 0, 0, 0, 0, 0 }