From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3906BC43334 for ; Mon, 11 Jul 2022 21:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231572AbiGKVi6 (ORCPT ); Mon, 11 Jul 2022 17:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbiGKViz (ORCPT ); Mon, 11 Jul 2022 17:38:55 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A91898053C; Mon, 11 Jul 2022 14:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ddLWuGOiN2P/92+9QvkfpLxLu1tNEeY9z+k9JnuE9mmMKrXvfirvT1/tMOkCLffGZ+FyNnNAJvd2FbfaSWLVUJ38W1QzkTzaaNctm2TrU7ZK9HOlex1O1OKlAvHPpNIstDzV6c+AEO3/2hWaB8BBKPR/pdaPd9CHwo3u1hlig+HZqzWzniGWgOnDMbzcjIvxYIGAlMyqqnvEQ3wnQuivmvKfDvJBN4AzXnev38dLRWpPlHJ2EnHF2LyOE7MNk2hiEWokcjE+uhidZPr5ZZ/EooECkhxwsdueh1e8rKsdwLTzVyQ3xG6wte0AWVZ9C9Oih4jNlgYadA0ZO14ZXDrLFA== 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=vZGnTrbimGFtsYyt4O1WLDmtwYwjwML65fYW/EoszZU=; b=Vx6JYIHvnqg/P60IaSgY0uVCcArA+eDlJxb9beFHw7UlBG43uXU3F1vZS4dMxTMA8H9bcsTaVvXEZaj5eQdGG0EeI042ncohLH8HTepuPGe8badRbNkqmwA4ITr17rtp9erE+hcZ2R1hW2mqSSJ0jw8WYOD3N12G+EiNSEGA9rBI8c+phzFNPntGwFUtwui/je+TPB3Enkec/50h6p7vxIUjNosf3LCRKFFPnsBLajJfkFwXktyGXssHwMuT5q4jsh3AyXrq7mwTV4Es0rp5THx0h66e4dfRleHxhc82oWEUbAgAm2FCk3op/fzdfyNJRGLUflXuafRcVHPcvS6wHA== 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=vZGnTrbimGFtsYyt4O1WLDmtwYwjwML65fYW/EoszZU=; b=X5Enw/NRWF97qyyA7d1kf6abCdWcMYuepObt3ibqM0TeDiVULffPRmBF3v270XHDmk1/zCBpL0oFQ2K1gVfUoJ/Swika9MAFXqgfPvGDcri+IZsWv0UZiZkj6N4AMke6S/xgVoZFcDmyW/K/XNiHTOFF8g6CApPwsINbBA7NkWg= Received: from BN9PR03CA0942.namprd03.prod.outlook.com (2603:10b6:408:108::17) by DM4PR12MB5182.namprd12.prod.outlook.com (2603:10b6:5:395::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Mon, 11 Jul 2022 21:38:51 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:108:cafe::ea) by BN9PR03CA0942.outlook.office365.com (2603:10b6:408:108::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.17 via Frontend Transport; Mon, 11 Jul 2022 21:38:51 +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 BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:38:51 +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.28; Mon, 11 Jul 2022 16:38:49 -0500 Subject: [PATCH 1/9] x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:38:48 -0500 Message-ID: <165757552870.416408.15207014474202893147.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: 51c01ed9-f32e-4a36-901f-08da6385bef3 X-MS-TrafficTypeDiagnostic: DM4PR12MB5182:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ChFY3FM0L+qZPQhPD1NNo4Em6r0wzdD5M5BrYsDAxAjoNoCThXV/RDOpoGVIhk0piYzDNWqeiYtA+mydyt81TwUloklmmFCyyZJmeD8cZx2KNmjwNV+lg44TbfrZ1RoTrZ0P2XPmvxSdIZg5Mgo4gWTEjWcspfdaGK+su8tKbE7Wz/tCsoOua4BTJSxbvL78X6PkL9aRTZHwkWLGd3foF3fLiZ2Rchy6NiDv7rw+8oaN5JjM8+UdwFubZcKuVXWNJFELsGucql4Mu0eRf8L+5C9kKgxQTP1X0ZaF7x47C0xL5AdaGSR2xfdZ7l6ZmqTw+xeUCaGzFebgz3py3n2KOxgwBZMO9bG7IW8K6WHR0vZaBS6nthzV3veCnGPTTAN+jnKN87uoWewjkBe3z255Nu87q69tAZIWHopKrliNS3fQF84x+r9BFHV8Clz2RHvOj2VtOj24+jTTc8xKmwiJuP4YU8oOO278052uLrFzLxfr8DzOESvXPrOxHUTNOIHKaMv82Jxd1EAY66DSiA6Ss6ymL/18WQUZn9X+cmY1Dkb4fD1h9kFNuLAIyd0uAjbHcPhoEQkSrjq3PCjrWMJOvSuRQhDN7dZHAslVP0JxFr2ozzlHX85CKBYYoOojx1T878XkEh1W7sE00XtOjDLDh5J4DD48XdUdZuwEeaawR4vuG/6h2HSooz7NYuEitaLhBOKn7ZICu45YH36RYGNoUcjvfekKC8fy7eE3Fj0umy3wpDbkddVHMYXhqPkofFIeUq+485DEFo4qFIr9oT3tlXz1t0oY7USzUkt0YyODZumSVVmo+FCE3lYhF8hd+mLNthAhy8ZEIfOO4bia/cpycctjDcR/6m7FAHxSH0wL5js7k1vc1uWcWIQ35pgwe6gVpMUtnoQfT+mhzSBGwIXwlU6m/APAAhEqKnjHfUs04i7oLlSjT4QcVXtpLOZJMEwa 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:(13230016)(7916004)(4636009)(136003)(39860400002)(396003)(346002)(376002)(36840700001)(46966006)(40470700004)(356005)(36860700001)(103116003)(81166007)(82740400003)(83380400001)(336012)(86362001)(186003)(26005)(47076005)(40460700003)(8676002)(16526019)(9686003)(426003)(54906003)(16576012)(110136005)(316002)(41300700001)(478600001)(966005)(2906002)(7416002)(8936002)(82310400005)(44832011)(33716001)(4326008)(70206006)(70586007)(5660300002)(40480700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:38:51.1154 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51c01ed9-f32e-4a36-901f-08da6385bef3 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: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5182 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds the new AMD feature X86_FEATURE_SMBA. With this feature, 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 8000_0020_EBX_x0. CPUID Fn8000_0020_EBX_x0 AMD Bandwidth Enforcement Feature Identifiers (ECX= =3D0) Bits Field Name Description 2 L3SBE L3 external slow memory bandwidth enforcement Feature descriptions are available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication # 56375 Revision: 1.03 Issue Date: February 2022". Link: https://www.amd.com/en/support/tech-docs/amd64-technology-platform-qu= ality-service-extensions Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D206537 Signed-off-by: Babu Moger --- 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/cpuf= eatures.h index 03acc823838a..1db319f3ce71 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -296,6 +296,7 @@ #define X86_FEATURE_PER_THREAD_MBA (11*32+ 7) /* "" Per-thread Memory Band= width Allocation */ #define X86_FEATURE_SGX1 (11*32+ 8) /* "" Basic SGX */ #define X86_FEATURE_SGX2 (11*32+ 9) /* "" SGX Enclave Dynamic Memory Mana= gement (EDMM) */ +#define X86_FEATURE_SMBA (11*32+10) /* SLOW Memory Bandwidth Allocation */ =20 /* 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/scattere= d.c index dbaa8326d6f2..08e9c78f65e9 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -43,6 +43,7 @@ static const struct cpuid_bit cpuid_bits[] =3D { { 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 }, { 0, 0, 0, 0, 0 } }; From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFAF5C43334 for ; Mon, 11 Jul 2022 21:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231869AbiGKVjL (ORCPT ); Mon, 11 Jul 2022 17:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231926AbiGKVjH (ORCPT ); Mon, 11 Jul 2022 17:39:07 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2058.outbound.protection.outlook.com [40.107.212.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6902820F4; Mon, 11 Jul 2022 14:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BhOamA4bkz60SaE2MUlkPaHiWSHpeF8wnvWDY/n/1ZxuKvnBB1RnNnNCO6K8q4Bv8IloL56u182VtVkV9+612K7QrTkyVT0ZUHAhzo/CJ3QRlc9DgDrmnGJj2LlTLYjMoEgXiN9V9lOu+Za12JlV9iWJDAtp7bNwvgilT8+ngQEYlHVpt+VnPb1tcn+Xbb8uE2XQfVe8P+OixHl2kZehzvtZsBjzMyYNTH0g22SxQTd5Y9CCzXtSkrmHmgvZ+8At98UuRy7A4gyVPAc2nQs6n3JDr7cTlGXWAB/WNfxT6dUTbUDWBam5kJ2ah8m3D86NKV+wzt01M+joMMlEgA2Agg== 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=oXd55s1pYNCPlCnqRTRwXoSGItYfuw7Gl37f8vDKr1M=; b=JsiyXuRJ8jX5itZX731OkF+2L6P5QNKwPUjaQc/Ub9fBE7lh3wtJahqPc4B7nsI1DuUYgvH2Lh2ZG7WvI2oosOzuLENORmYzAty7p3n0qcXDpTVeDrxUkpI4WdPUejGF7XoXLOV9ZAuz+hqyu9FX+yxxG2p7ztckJmgK4rO/LI62AvJEtvMJ9h0Z1Vgs/UkQBDeW0PmJrgv4AwIRy9Pse/g0tqFo4Y/2O9bbw4AsUctclBToTFTRiy9vksos2GMMtPfE7UH05IC/J37zbcX6y+4MIZOWM2FH4Ac2wHyn8/exrzv2ONlym+jpZnDkDeTXE4VgNGEBqeyZttu8ItE0sQ== 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=oXd55s1pYNCPlCnqRTRwXoSGItYfuw7Gl37f8vDKr1M=; b=I9MrxQ7KH6ga06zOjthbn1mtR6XTgLQ4M9Dyp4o1yudlrk4gGQf6Y4FVfT6wpPr/yJ53uQa/8CuxoRyWZ2hUs2b3YyM2RtteQH46uwYa1BnBF6m+GXvEc9A6BNlnIRsrkaf0eMnEqESRA/57jDu3+U+X6CZJ3vgRlVISqf+eyQ4= Received: from BN0PR04CA0138.namprd04.prod.outlook.com (2603:10b6:408:ed::23) by CY4PR1201MB0232.namprd12.prod.outlook.com (2603:10b6:910:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23; Mon, 11 Jul 2022 21:38:58 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ed:cafe::f) by BN0PR04CA0138.outlook.office365.com (2603:10b6:408:ed::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.19 via Frontend Transport; Mon, 11 Jul 2022 21:38:58 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:38:58 +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.28; Mon, 11 Jul 2022 16:38:56 -0500 Subject: [PATCH 2/9] x86/resctrl: Add a new resource type RDT_RESOURCE_SMBA From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:38:55 -0500 Message-ID: <165757553569.416408.8259197582419583314.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: 6110092a-a2a1-4134-c0c4-08da6385c35a X-MS-TrafficTypeDiagnostic: CY4PR1201MB0232:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xnBPr8NFrPbmDpVLH/7fp4bBK5RF/jtP46lM3az4B3JxqboFBCuorFRTxeWGNjVe4nS472M1raVxTzoF7S+eLK/t4mmfx2e6upW8keIehsMFebEDg+jTitLmLI2T0+sOXvCDXJvY7QAilnahGaNiI7DFadETx+9s3mKIBHfLLD07rNUDYvD4tzHy+ZGuRk2BZwD3I4Yev5MKeLOwDz6uvBsFS2SgYWJGNGUxqj7NfEC3sxgHzxnSptUNeW3zHnW2xTxB5ZloZmouApIgQTIJ90aem00T63h2TuoL7gtLI5iVkp7pHqqbOjKbHSGLzDQcZCyN4mutAPt+uuZCjC34dyac0cTpzxfHnCtQTni95hUioRJqhLBnsa7W41frJkS9Ric83GbzIsFWzL75SKYzWQrQWY8iPJq6xcBNNpeA9wcJ2DnyOVX7ntv55907DgavWWzSCSlCIx+8ZFJNt/DyGe5yVGjnrZ2NmhHbSjfKjTqr4AfSKm1Wn5/Gz1VF2Fht+vQD6pihxEEBoOjRy2b2xxohMgeBlx6+7YupJ9+oTtAVtGVvxvHHDMmWADFdY77KmM+IPTkVtt2aa+2loRCTlrVQVTNK7XL6cyCuvadXx7CUWjAXu6EVFqLjd6EPWBMWqoYRpoVMNdsjdwI9j55FdGGaV/QXWlWhRenp0+gi4wqqDZqRru90Ebbli4ZRGJk4itJyA48UKW4YKEriFntBtcDdjSc3C86rvdv5UvT8/BGi5lRfDRsBpYsttvVyMiH1fp2uIg+fwgafj3+TIotoDYe5iUKLxWizSK5hLDJ8nPXfrmrRNgLwtX1zb1bgi8hSegaSP0O+EOvAwVZE5VaNmw++nzHiWhhBokonul6kSGhDc2ByM9sz0IEQw5Ot1jBq 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:(13230016)(7916004)(4636009)(136003)(346002)(39860400002)(376002)(396003)(36840700001)(46966006)(40470700004)(86362001)(103116003)(8936002)(26005)(316002)(7416002)(44832011)(82310400005)(41300700001)(478600001)(2906002)(40460700003)(16526019)(336012)(81166007)(426003)(40480700001)(47076005)(33716001)(82740400003)(8676002)(356005)(70206006)(16576012)(186003)(70586007)(36860700001)(54906003)(110136005)(5660300002)(4326008)(9686003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:38:58.4870 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6110092a-a2a1-4134-c0c4-08da6385c35a 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0232 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds a new resource type RDT_RESOURCE_SMBA to handle the QoS enforcement policies on the external slow memory. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 12 ++++++++++++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + 2 files changed, 13 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index bb1c3f5f60c8..004d809ea675 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -106,6 +106,18 @@ struct rdt_hw_resource rdt_resources_all[] =3D { .fflags =3D RFTYPE_RES_MB, }, }, + [RDT_RESOURCE_SMBA] =3D + { + .r_resctrl =3D { + .rid =3D RDT_RESOURCE_SMBA, + .name =3D "SB", + .cache_level =3D 3, + .domains =3D domain_init(RDT_RESOURCE_SMBA), + .parse_ctrlval =3D parse_bw, + .format_str =3D "%d=3D%*u", + .fflags =3D RFTYPE_RES_MB, + }, + }, }; =20 /* diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 1d647188a43b..24a1dfeb6cb2 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -418,6 +418,7 @@ enum resctrl_res_level { RDT_RESOURCE_L3, RDT_RESOURCE_L2, RDT_RESOURCE_MBA, + RDT_RESOURCE_SMBA, =20 /* Must be the last */ RDT_NUM_RESOURCES, From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44A3BC433EF for ; Mon, 11 Jul 2022 21:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbiGKVjQ (ORCPT ); Mon, 11 Jul 2022 17:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231614AbiGKVjI (ORCPT ); Mon, 11 Jul 2022 17:39:08 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2078.outbound.protection.outlook.com [40.107.93.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51E4082448; Mon, 11 Jul 2022 14:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bsnKlob87+ST3JACNrhbwhjk1vosVmVFJ0a9ApyHKd98R5t3QpFVu/3mm+UanHIkLMzqESEiuixY8WyYhBSjH3oTZn4xpP9n2x2M4oXMMbSq8+qKDSWMssMQVCT2yaNuQNNEmeRv4wCLlIiYZpSuwGLt+YpJ9AitL4yJex77qb1BhlYRLl5XDo7YWz98Jk/qrCZ6PcwJ5QKrV5Z8OhHeGp0lugQLNs00gUNcKzgqhLE64aInE8zvIPdMquYBh3btw37/rq4X5c4DAkhZj8+HpRCB7nnZaZB0tmtvzx3fZSvmn6vps5zmFC1F1oGQmh2v6xS/Pni4klq/YjdoexEmWA== 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=MBlbgPQIUhU3819N5xr+cxrPlWG+JpJnpwv9nWAI8Rk=; b=DqoiM1irIBDRjBGeV9XW5MaU/UvanPzp5tvzrssVcx4PgFgGmPpODb2D+Mdz+iT0il/zo8emd0pkvmJVkfRLdt0jYeP09d1TLFAQD/uzVI5k1gYxq5zP9t+gF2P7ZEzzxb66do5RyzL3PePznOAkap/aDnfZwr3TfQK3hpKXldKsibKKimlGJmHkgKJymdoiVlW7NQUFf5dn0GTD5DWnoI833jzQADP9CK27C/gvp4OEQijzBhSJSV/0AjAr5Cdm4OE0tvbNyvhAXThVWAmiqjavvTSuTOMZXx1zxkaVcub/m85HAybDMKQZ7JaAr/67wIssuRQoH26OW0XJGtrW2Q== 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=MBlbgPQIUhU3819N5xr+cxrPlWG+JpJnpwv9nWAI8Rk=; b=fvaAdh8VYSXBHooQq+sFRIteKZxuDJXOhxkcgtV8bzm/yeIr/jqea1PLEvWZjOxDLKFTepADoKQWXH9GHs58MCzK+2fKLwUU/vNqlJzh5Qj8RZh9XlRiOOduzxxtieTOTt2R+nrASXEmuIwnJNrxpj5a0i6iNe76PVGmBoeSVqs= Received: from BN9PR03CA0170.namprd03.prod.outlook.com (2603:10b6:408:f4::25) by CH2PR12MB4309.namprd12.prod.outlook.com (2603:10b6:610:a4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23; Mon, 11 Jul 2022 21:39:05 +0000 Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::b4) by BN9PR03CA0170.outlook.office365.com (2603:10b6:408:f4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20 via Frontend Transport; Mon, 11 Jul 2022 21:39:05 +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 BN8NAM11FT040.mail.protection.outlook.com (10.13.177.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:05 +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.28; Mon, 11 Jul 2022 16:39:03 -0500 Subject: [PATCH 3/9] x86/resctrl: Detect and configure Slow Memory Bandwidth allocation From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:39:03 -0500 Message-ID: <165757554305.416408.7233306354670176238.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: 0ef86907-2b41-4fdd-54e6-08da6385c751 X-MS-TrafficTypeDiagnostic: CH2PR12MB4309:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XN/eyaiA4XXOSkxwxCibgvOEbMVE6U8adLRsSjGyueVjJC3aEPSug79Qsm1oYLKhqmgOYMK4DSTs7iE6TpBjyQUeRPKyLo5/POLnGw3s23DzVe0aY7DnaUOfhPGhh1vLe8B40MupOTPHLP4obq8cifPkGwcbCDOKRWCQzKc+eHLOXdLCEWb2uuOwJtZJxKliYIVPaulRKkFPhMcMMR7I+38xDnItoWBA/SaP8H59sfjRq9bVJZdXYBLweE4oioPKi/hRc8DmCUo1AvtaaAeALMJOxAJMFfh8aiXaZ6pUkeXZGMjDVNLMDMn4ZvR/kJh4PAgF7jKZJY5EatmkeR7ftN2+06peJff+99WFjQIekhRKHlD4l1WByFIgptXieJaF4bibQSCP7OvVPa/VRUQ38OAYY1sphyIsEaaWX/YVXPyrzdQPPLy7KIHZQXzcemLZI8cUgOh6Fo5FSFNn24fFu61v7zkRVlo7eVT9X7hthfJa1kWwKir31xj/xQEw4ep2sd3a2Qov2n0RBekkOiPmJR9eJqqgjB9O6oCAG2L0n/iRhOfANajMjTW2LBSqo/TB2F1C40oPgcL0wHrZqsxefCgrFfXh+DyE28eUDwhHCipdfs8kiH7HyGuOVSluAndoOH5y3PZS2nxc2V+hk5yg1CWFGbF1WIcnXG5jwH6nlNufOgj44yeYkMkCPrajBVBMSz16JBo2MZsVb0A4XBgL1LSrnAAYmRy5ClC3Wh04IOtcZGis1drJEf7HhmM9Q/8ykiMyrWs0oBArdhMpTC3CNKlGtpw3QVxNxJEbqMPZMUovL3lzPO4gcuKKMnIJEFO+nfsRR9+iNvCeeMGhVjkWBUoMxIck0osrCCTqzotEhxGGBCzb8hcfrgDZwvmH4K25 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:(13230016)(7916004)(4636009)(396003)(39860400002)(136003)(346002)(376002)(40470700004)(36840700001)(46966006)(426003)(9686003)(5660300002)(336012)(7416002)(8936002)(478600001)(16526019)(40480700001)(47076005)(41300700001)(186003)(2906002)(103116003)(44832011)(26005)(82310400005)(83380400001)(70586007)(70206006)(356005)(8676002)(4326008)(316002)(110136005)(82740400003)(16576012)(40460700003)(54906003)(81166007)(33716001)(36860700001)(86362001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:39:05.1361 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ef86907-2b41-4fdd-54e6-08da6385c751 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: BN8NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4309 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The QoS slow memory configuration details are available via CPUID_Fn80000020_EDX_x02. Detect the available details and initialize the rest to defaults. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 50 +++++++++++++++++++++++++= ++++ arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 2 + arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 9 +++-- 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 004d809ea675..bb5071b91de2 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -259,6 +259,37 @@ static bool __rdt_get_mem_config_amd(struct rdt_resour= ce *r) return true; } =20 +static bool __rdt_get_s_mem_config_amd(struct rdt_resource *r) +{ + struct rdt_hw_resource *hw_res =3D resctrl_to_arch_res(r); + union cpuid_0x10_3_eax eax; + union cpuid_0x10_x_edx edx; + u32 ebx, ecx; + + cpuid_count(0x80000020, 2, &eax.full, &ebx, &ecx, &edx.full); + hw_res->num_closid =3D edx.split.cos_max + 1; + r->default_ctrl =3D MAX_MBA_BW_AMD; + + /* AMD does not use delay */ + r->membw.delay_linear =3D false; + r->membw.arch_needs_linear =3D false; + + /* + * AMD does not use memory delay throttle model to control + * the allocation like Intel does. + */ + r->membw.throttle_mode =3D THREAD_THROTTLE_UNDEFINED; + r->membw.min_bw =3D 0; + r->membw.bw_gran =3D 1; + /* Max value is 2048, Data width should be 4 in decimal */ + r->data_width =3D 4; + + r->alloc_capable =3D true; + r->alloc_enabled =3D true; + + return true; +} + static void rdt_get_cache_alloc_cfg(int idx, struct rdt_resource *r) { struct rdt_hw_resource *hw_res =3D resctrl_to_arch_res(r); @@ -793,6 +824,19 @@ static __init bool get_mem_config(void) return false; } =20 +static __init bool get_s_mem_config(void) +{ + struct rdt_hw_resource *hw_res =3D &rdt_resources_all[RDT_RESOURCE_SMBA]; + + if (!rdt_cpu_has(X86_FEATURE_SMBA)) + return false; + + if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD) + return __rdt_get_s_mem_config_amd(&hw_res->r_resctrl); + + return false; +} + static __init bool get_rdt_alloc_resources(void) { struct rdt_resource *r; @@ -823,6 +867,9 @@ static __init bool get_rdt_alloc_resources(void) if (get_mem_config()) ret =3D true; =20 + if (get_s_mem_config()) + ret =3D true; + return ret; } =20 @@ -912,6 +959,9 @@ static __init void rdt_init_res_defs_amd(void) } else if (r->rid =3D=3D RDT_RESOURCE_MBA) { hw_res->msr_base =3D MSR_IA32_MBA_BW_BASE; hw_res->msr_update =3D mba_wrmsr_amd; + } else if (r->rid =3D=3D RDT_RESOURCE_SMBA) { + hw_res->msr_base =3D MSR_IA32_SMBA_BW_BASE; + hw_res->msr_update =3D mba_wrmsr_amd; } } } diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cp= u/resctrl/ctrlmondata.c index 87666275eed9..11ec3577db40 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -203,7 +203,7 @@ static int parse_line(char *line, struct resctrl_schema= *s, unsigned long dom_id; =20 if (rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKSETUP && - r->rid =3D=3D RDT_RESOURCE_MBA) { + (r->rid =3D=3D RDT_RESOURCE_MBA || r->rid =3D=3D RDT_RESOURCE_SMBA)) { rdt_last_cmd_puts("Cannot pseudo-lock MBA resource\n"); return -EINVAL; } diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 24a1dfeb6cb2..c049a274383c 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -14,6 +14,7 @@ #define MSR_IA32_L2_CBM_BASE 0xd10 #define MSR_IA32_MBA_THRTL_BASE 0xd50 #define MSR_IA32_MBA_BW_BASE 0xc0000200 +#define MSR_IA32_SMBA_BW_BASE 0xc0000280 =20 #define MSR_IA32_QM_CTR 0x0c8e #define MSR_IA32_QM_EVTSEL 0x0c8d diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index f276aff521e8..fc5286067201 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1218,7 +1218,7 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgr= oup *rdtgrp) =20 list_for_each_entry(s, &resctrl_schema_all, list) { r =3D s->res; - if (r->rid =3D=3D RDT_RESOURCE_MBA) + if (r->rid =3D=3D RDT_RESOURCE_MBA || r->rid =3D=3D RDT_RESOURCE_SMBA) continue; has_cache =3D true; list_for_each_entry(d, &r->domains, list) { @@ -1399,7 +1399,8 @@ static int rdtgroup_size_show(struct kernfs_open_file= *of, ctrl =3D resctrl_arch_get_config(r, d, rdtgrp->closid, schema->conf_type); - if (r->rid =3D=3D RDT_RESOURCE_MBA) + if (r->rid =3D=3D RDT_RESOURCE_MBA || + r->rid =3D=3D RDT_RESOURCE_SMBA) size =3D ctrl; else size =3D rdtgroup_cbm_to_size(r, d, ctrl); @@ -2807,7 +2808,9 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgr= p) =20 list_for_each_entry(s, &resctrl_schema_all, list) { r =3D s->res; - if (r->rid =3D=3D RDT_RESOURCE_MBA) { + if (r->rid =3D=3D RDT_RESOURCE_MBA || + r->rid =3D=3D RDT_RESOURCE_SMBA) { + rdtgroup_init_mba(r); } else { ret =3D rdtgroup_init_cat(s, rdtgrp->closid); From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54788C43334 for ; Mon, 11 Jul 2022 21:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232027AbiGKVjU (ORCPT ); Mon, 11 Jul 2022 17:39:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231769AbiGKVjP (ORCPT ); Mon, 11 Jul 2022 17:39:15 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4AD5820C1; Mon, 11 Jul 2022 14:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHYZ4Fuld2i2B7HvN1reONWgAU62qsYJJjaRBVLFz+p2P0TVkh94jPUXRpVWcNHvau65knmBLtFLawCpW9DuNXBhA3BMZ0wwarXKbvGiTMwUoFcsWw4C5JBZdCe+9YNfR9601SXBj7rf721AGL6gekjvBB5v+ZUxWX+Mrr1sxzGr8RN3x24pMyZK2HPam5ne+P9Uz8kCNJDUXfXD5eK0tOWoL0WCXmNRB+pGZ3JiyB821Vyt5cuT1Oq4TRc3RathA0H3gDdsQcMTKOG2wozumyTWWjJsydH11HUl3aWfbl1qFNxppfnv17n1L6oqeMmdOEwK1oD3qDmJ+NzUYIO4BA== 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=68xiRkQBoAk7unH5La+w52ocY7zrfZGJvnR8n8NZ7Ik=; b=GaHi8IxrWd4ys+brvqm7uI6Q+dfqYh9PfryTuglSUNSMHDUUpRWRGnEgCZCzTwc9o1wWGHOso7knegpJJmLZZMSnkaMNMGLnaKIDjtjzN4LHVm/MOXNYB+F3DRFD4QI9f0ozzKH54crU1x/+R/KajLBgnfzuWV9p+SoUs/RUYKpj3Uj5u5h1BpOt/vUaUxoTbeqJ9B4IjMJPY/h6CURWc5HVQoLHMlKtNnudEyz7G9t4CKLs7ruS/byU2zMs8GH0zV8OFpbE8g7mL0IjJ019XkpUcE0I8/y/I/xzj+0HArSFCT2G5woWuUYz6kjWr3VdP0Bv4Or4zfHBjDOkouG2EA== 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=68xiRkQBoAk7unH5La+w52ocY7zrfZGJvnR8n8NZ7Ik=; b=PrNByzwf63FqPelbPeIsOysB7DD9lRHKXwkoQBSdWPVDhLYIXBbCTxaliIG6TzPSzMX0t00WGI/Ogk8194iGi1OSlh5jiB1Luerg8HV6kAcWv4jwwshwiHTuuNMKLfE8nLvyNQlt5EDElhrxQkTPRFxPYenUztgYIXO62oO+hgY= Received: from BN0PR03CA0004.namprd03.prod.outlook.com (2603:10b6:408:e6::9) by BY5PR12MB3780.namprd12.prod.outlook.com (2603:10b6:a03:1a2::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23; Mon, 11 Jul 2022 21:39:11 +0000 Received: from BN8NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::90) by BN0PR03CA0004.outlook.office365.com (2603:10b6:408:e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:11 +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 BN8NAM11FT034.mail.protection.outlook.com (10.13.176.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:10 +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.28; Mon, 11 Jul 2022 16:39:09 -0500 Subject: [PATCH 4/9] x86/cpufeatures: Add Bandwidth Monitoring Event Configuration feature flag From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:39:09 -0500 Message-ID: <165757554924.416408.8349826854010563682.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: e0ae4334-efe2-4b60-fad5-08da6385cab1 X-MS-TrafficTypeDiagnostic: BY5PR12MB3780:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bQFvQt3gpnDZqvTgKpKFogWPwdHjNBHKkitY/CWpP/Nt27D22G5Q+qolFbST4gMt0dNShN3zZHq9kTOzZla/93/ghMw6dr7sZ/3z1HD77fE4S1AcLVEawnIHG1bvUoqPzC+CNvtCCumx+JL7kWXK99BLPXQECH3TnmyTpwIl81M+uxJh23K5ayXWIEkv8NPMaF9xZvy5ly+4lO9CA5VjkiTakV1Xl2HOmjO6rsy9dp+WImBtNInodU3B/xdRp1Aw53SvG1WRQ4s6DCl/AhPOjSCs88OHs30t6SyT72pEsPjObXxuTdI7d24pXg13/sY4dWAew8avp+hJJp4szaFW4R7T7FrdN72DPMxFcOaWqFD9K4aY1HVqlcnH/OmuPyyNkgMHUuqJ2VmBB92DbYkbCLNpNv3ptj/qjcnUhCsNVEvfbBnenn15mR0B01EPm2Z0oIHr349n3m0pAK7Dv/ySXvnUA2gPZ/LwTB8xChnm431Oq1KEX60ddQP7K2AeBb9OJJvnRC48y1+KqvPXfX3KrwemQN7cjiuHL/843CFeSCvFDtJNFv90hfIpCRRFZ8dmIbsmre6pn1dYOfZSHuRY9CC5oe2pJdv33h7nGlkQ7hroSCKzUN6TLuWZo5W9inMZbqUX7tY2UomVM1wWWD8mMd5meTiVj6XI/FdtponHNQTHPMN8i7S5qYpE6tLSNdzsmax1bDo0BPt7jyIY3rUvTECirzLli50RsTAGN7MxU+Gm93yJp8CBICmD8duU8xflACOl6h6qcfssTe7qUuqsgMpC2CxsccFt94y5pkX/3Bk2KWklCLrq+VZYA6Tq9ZtYP1ygTwZmqbWKONYn5rx36hZzCJut1gFOOfjiPMkzTieskxIZF7cBcW7zH+UPenlx9AiygVXee+01itiqzMYLnquzgPox2b1kQ/dPTZSCPTM3mTHh5V5gnNK2pbtEU3Wa 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:(13230016)(4636009)(7916004)(396003)(39860400002)(376002)(346002)(136003)(36840700001)(46966006)(40470700004)(16576012)(316002)(70206006)(16526019)(8676002)(2906002)(426003)(86362001)(26005)(966005)(478600001)(186003)(47076005)(5660300002)(9686003)(336012)(40460700003)(70586007)(82740400003)(7416002)(83380400001)(82310400005)(356005)(44832011)(81166007)(8936002)(110136005)(33716001)(36860700001)(103116003)(54906003)(40480700001)(41300700001)(4326008)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:39:10.8027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0ae4334-efe2-4b60-fad5-08da6385cab1 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: BN8NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3780 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Newer AMD processors support the new feature Bandwidth Monitoring Event Configuration (BMEC). Support of this feature is available via CPUID Fn8000_0020_EBX_x0 (ECX=3D0). Bits Field Name Description 3 EVT_CFG Bandwidth Monitoring Event Configuration (BMEC) Currently, the bandwidth monitoring events mbm_total_bytes and mbm_local_by= tes 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. Each BMEC event has a configuration MSR, QOS_EVT_CFG (0x000_0400h + EventID) which contains one field for each Bandwidth Type that can be used to config= ure the Bandwidth Event to track any combination of supported bandwidth types. The event will count requests from every Bandwidth Type bit that is set in the corresponding configuration register. Following are the types of events supported. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 Feature descriptions are available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication # 56375 Revision: 1.03 Issue Date: February 2022". Link: https://www.amd.com/en/support/tech-docs/amd64-technology-platform-qu= ality-service-extensions Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D206537 Signed-off-by: Babu Moger --- 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/cpuf= eatures.h index 1db319f3ce71..bbc1db70ad27 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -297,6 +297,7 @@ #define X86_FEATURE_SGX1 (11*32+ 8) /* "" Basic SGX */ #define X86_FEATURE_SGX2 (11*32+ 9) /* "" SGX Enclave Dynamic Memory Mana= gement (EDMM) */ #define X86_FEATURE_SMBA (11*32+10) /* SLOW Memory Bandwidth Allocation */ +#define X86_FEATURE_BMEC (11*32+11) /* AMD Bandwidth Monitoring Event Con= figuration (BMEC) */ =20 /* 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/scattere= d.c index 08e9c78f65e9..13b6763bd767 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -44,6 +44,7 @@ static const struct cpuid_bit cpuid_bits[] =3D { { 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_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { 0, 0, 0, 0, 0 } }; From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D4C7C43334 for ; Mon, 11 Jul 2022 21:39:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231954AbiGKVjg (ORCPT ); Mon, 11 Jul 2022 17:39:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231663AbiGKVjY (ORCPT ); Mon, 11 Jul 2022 17:39:24 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2066.outbound.protection.outlook.com [40.107.243.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C4D2820CC; Mon, 11 Jul 2022 14:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F+1FHBC0+m/i/k8G/3oloi2IsLrCkGPiC+kHflLDghMDEYR1M3SpMktahAGiBV5eGuRBHpdLaw+4k1S6hhzl/xOvQKNgTgIK5a9v1/fxAXr38KVBjwpMvZ7AB6ZR2oxvI8W1DwloTduEP0fofjIR+KF3rPKCRnC0YUkepuwjh3ar37AFi0UZ1nd7n2SCRZIKeBdVg/GwXL+XcMuV/cnNWW/YGCkNPDNcGUm3D4MRuuD4o6KAzqFui+RDQn53hYPL429QVXDGIJepzwm9YKd6CeV9I3vrxpb/xa83+NgujKO2Ry3VRtBezzuCcSiFDUPZccgX+J+HMtYJ/DvqiYqKVw== 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=pFfgMuYkADALOBUFl88SwOIHqs3XC6t28Gu6oy2MR1s=; b=YjsOVXHVUIcBMMlr9e0swIZC2ftDantbRvWAQ6rnvexFMRideKT0Uo2DEemOAtqJCuNwS5n+P8V8ZpAiKGB5S79q43U+VXpDfmzeDPCI83vZ+9tK+7XPQYlIcKvF95kCJlU91E9iVjc9wiaB9A1O7TiYBAMyA4YxtXeDoI4BMuyvLyYM+mDry28WSyQaEYU7k+yVL/PKrO2DXWoGd0wp9r317ltxal80B46L6UmIsiqcjZ5r889VBMs8W5kRkP4r8Dqly4eN/fq+rPKHNJ5pf+wI3ICA30hRe5X11HV1tjQikM2wfc/2Aw2TyLWOJlC5Smu3ib5/Fw3xJOf8ttNgYQ== 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=pFfgMuYkADALOBUFl88SwOIHqs3XC6t28Gu6oy2MR1s=; b=tKLVmNvX9ccUFtSoMNAVWYJ3OQHOPMAFdXNc58TDWl4IYKtqN2xu/L8aFj9gJ3/zPy+XYNJfmgykA9jlzW9ZrWotWlIoNuvLu25zjzio/Q5Io4ljSC3L1Csd7X8Rr27CG0lh0cQHAwymb2tEYcj93HxlEw1K3Raw0mlR+IrAJ3o= Received: from BN0PR03CA0029.namprd03.prod.outlook.com (2603:10b6:408:e6::34) by BN8PR12MB2963.namprd12.prod.outlook.com (2603:10b6:408:61::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Mon, 11 Jul 2022 21:39:17 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::4) by BN0PR03CA0029.outlook.office365.com (2603:10b6:408:e6::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20 via Frontend Transport; Mon, 11 Jul 2022 21:39:17 +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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:17 +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.28; Mon, 11 Jul 2022 16:39:16 -0500 Subject: [PATCH 5/9] x86/resctrl: Introduce mon_configurable to detect Bandwidth Monitoring Event Configuration From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:39:15 -0500 Message-ID: <165757555546.416408.18035193047484698923.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: a07513ee-d1b3-448b-6bb7-08da6385ce8b X-MS-TrafficTypeDiagnostic: BN8PR12MB2963:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GAzfKfkDs9GHxNzxQERYIyZjQyBRbC3ssVm/y2VTUIrIdnYOGuA1JSgl7SgSNaSq3ln4BfIFWz1bzEitKPEZg2pFyAlZ3IOb8caItCDK1x6TLldjEfHK4Nnta5bg3t1mx33g7/5lkvdUEVDMwUb+sI5t9PVCpNlME61bLcDQSjkrBFlPguLOcErEyXJdPPVg+flSHCGCzmvmD6IGTUSsiUbQaOXL1J9U0THybq8BSzB+mj9MT1E2wixvLXkGGpQZWkmU4J3jInRdFYej3iK7twWBLZJxU1EKmwg5qU5ov41JRb0/TVbn1xd4iYt8RR3iz1DYw78G7r2QShvVCPllgVJWZM2+pfgISKUozGog/Xic48Uvqm4kMRlXQZs1ty56gMZjzRQE3RJyAHm7zWzjpLfUKwdDHX+06l/WB0Rbh0/7j642R1FbNoRQtFrttT5y3+saAKS3LHWDeQ6cO9lwUFgNoUQAi+wRydt2R0TSNO9VMMbR22O0qGCsYmTvUOqAHNLnLR2gtGkebJK7nwF+o8i9fykeQwtjgr+ZTLONlf8rKMScCLCSKM2xDkBxQ4XN2pYmOhs1ShkFpX8fNpFRPZkB6Q4O8v0b/8afgq7f2wgm6Qe4x5p+ybHRjGL7pjLYzhGhoz3zDtMZqSgRpwcFkIrTh8Ap4AJ81LjfRD6MIfOMDAAOCF7YS+zXXZAURB9sC6903JQcisdlS4+jM9SE+f0PyGwoJxhy0n9s5skmC/sKW2vFm/HgB6YvZLLpa5stgf8zT9XXNdjc85+xIJbdqGdDJ/+cFue/57odUxWBiu4Yys1fjSc6O5nCCWa/4gDhZXVzvt5EwqbVD7VIlzVu/0W1lKmxdp/Su/vcfV4ndtuId8d1REbDMRla7ATZoi4+ 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:(13230016)(4636009)(7916004)(376002)(396003)(39860400002)(136003)(346002)(36840700001)(46966006)(40470700004)(2906002)(40460700003)(478600001)(103116003)(36860700001)(336012)(47076005)(82310400005)(426003)(356005)(33716001)(40480700001)(44832011)(16526019)(5660300002)(7416002)(316002)(4326008)(8676002)(70206006)(81166007)(8936002)(16576012)(54906003)(86362001)(70586007)(26005)(110136005)(82740400003)(9686003)(41300700001)(186003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:39:17.2765 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a07513ee-d1b3-448b-6bb7-08da6385ce8b 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2963 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Newer AMD processors support the new feature Bandwidth Monitoring Event Configuration (BMEC). The events mbm_total_bytes and mbm_local_bytes are configurable when this feature is present. Set mon_configurable if the feature is available. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/monitor.c | 14 ++++++++++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 17 +++++++++++++++++ include/linux/resctrl.h | 1 + 3 files changed, 32 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index eaf25a234ff5..b9de417dac1c 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -682,6 +682,16 @@ static void l3_mon_evt_init(struct rdt_resource *r) list_add_tail(&mbm_local_event.list, &r->evt_list); } =20 + +void __rdt_get_mon_l3_config_amd(struct rdt_resource *r) +{ + /* + * Check if CPU supports the Bandwidth Monitoring Event Configuration + */ + if (boot_cpu_has(X86_FEATURE_BMEC)) + r->mon_configurable =3D true; +} + int rdt_get_mon_l3_config(struct rdt_resource *r) { unsigned int mbm_offset =3D boot_cpu_data.x86_cache_mbm_width_offset; @@ -714,6 +724,10 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) if (ret) return ret; =20 + if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD) + __rdt_get_mon_l3_config_amd(r); + + l3_mon_evt_init(r); =20 r->mon_capable =3D true; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index fc5286067201..855483b297a8 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -995,6 +995,16 @@ static int rdt_num_rmids_show(struct kernfs_open_file = *of, return 0; } =20 +static int rdt_mon_configurable_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r =3D of->kn->parent->priv; + + seq_printf(seq, "%d\n", r->mon_configurable); + + return 0; +} + static int rdt_mon_features_show(struct kernfs_open_file *of, struct seq_file *seq, void *v) { @@ -1447,6 +1457,13 @@ static struct rftype res_common_files[] =3D { .seq_show =3D rdt_num_rmids_show, .fflags =3D RF_MON_INFO, }, + { + .name =3D "mon_configurable", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D rdt_mon_configurable_show, + .fflags =3D RF_MON_INFO, + }, { .name =3D "cbm_mask", .mode =3D 0444, diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 21deb5212bbd..4ee2b606ac14 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -154,6 +154,7 @@ struct rdt_resource { bool mon_enabled; bool alloc_capable; bool mon_capable; + bool mon_configurable; int num_rmid; int cache_level; struct resctrl_cache cache; From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25F5CCCA47F for ; Mon, 11 Jul 2022 21:39:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbiGKVjp (ORCPT ); Mon, 11 Jul 2022 17:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbiGKVjd (ORCPT ); Mon, 11 Jul 2022 17:39:33 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2071.outbound.protection.outlook.com [40.107.96.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D41582476; Mon, 11 Jul 2022 14:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8OxU6D4yyuMBZU508aOyoaSJc1TU1pUSSsDUtFi3+0hzvXk6EvrQvw7U1Uj3MYWTOKhzBrbqkbpL8gu42ZHKTFJX8juBhrTinfkeIoiBh4eUWfbE+5/FtBupCnSsFL3P/BFcA6HFtvRCjYspN+bgLNzK1FnTAeBN0S0tHzWH4qnzJinrYWaMDE/kzossHczN+0ydW6MbHpd1GWT+FIgSVBxgk3+U5usABeaPU8+/tM0WvYm6Ry0HcbmCkHckBl1uzU1BYzLbruTFhNnGDhB4bF/hXO/wmYaemuVybBBNlcFLvRUBzFBggNxXUQ2Plt7K9cRonyyTrUTCtOqjvwZmg== 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=G3fZJkFhRUUUFr/3d0O5Va6YqlFxUygGur86daiW3D0=; b=IcPJXosgnsmdtjyIcJpHPB8UNhkV0fNyGE5ZgcXbAHn8uGByS/bfQUqaE7PYgg4dwOMroJvg02d/Y2gQZ/PcVKGepl1bfwqiCqSCdQ8nOJaMPLOIj29wcaE3/Szh3s2ZubRi85jfdfl/675Kw4Qww+7B8zyAgEz9u1sTIaRI8F2SjVA8fp/7hx1ZkwF3sxSo83cDxbWqDjXKuW8iy0NTBBYdAqubg2E9iGfSe9LyTnoq+Xzucz/HBGIDkVgvsrgZsKIm8F07ZmE4RSM7LfeeGDtGEsj9ulzRtCkZuWVFHAKnd6O47esLHSfzJZckt1Xh+VWov3j1Ux7Qzo36FesfhA== 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=G3fZJkFhRUUUFr/3d0O5Va6YqlFxUygGur86daiW3D0=; b=3X4vFdd8QVfw5T0pLV7CAX0Lyq1O9JQ8PsnMseUs9rDob7GCB2iDnHAoi2HC0pGZKysZuYYAW9WEXhygnj8R1SXJOK+YX1n3Y3MiGiNABrJ2iY9+g6kRyklWzhclTgco42zgak/cj0FUCKwWKCj+o1hOGVEJvcWhMba9CPWIQUs= Received: from BN8PR12CA0032.namprd12.prod.outlook.com (2603:10b6:408:60::45) by BYAPR12MB3480.namprd12.prod.outlook.com (2603:10b6:a03:aa::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.21; Mon, 11 Jul 2022 21:39:24 +0000 Received: from BN8NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::b9) by BN8PR12CA0032.outlook.office365.com (2603:10b6:408:60::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.24 via Frontend Transport; Mon, 11 Jul 2022 21:39:23 +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 BN8NAM11FT026.mail.protection.outlook.com (10.13.177.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:23 +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.28; Mon, 11 Jul 2022 16:39:22 -0500 Subject: [PATCH 6/9] x86/resctrl: Add sysfs interface files to read/write event configuration From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:39:21 -0500 Message-ID: <165757556181.416408.7184075871766868847.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: da7c2618-ff0f-4662-56cb-08da6385d24d X-MS-TrafficTypeDiagnostic: BYAPR12MB3480:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U7M2IVmL0yMMFXC1o83WGMVOeowNWE8HWujs3t7vzJL1KpEz4mwtSpoc5Jj0xa2ZYr11RX/46qnAhSlZumwnwHeeQHlzn+zSUkHoLU/MKs7HtzYFJ9DjhF0tKW2omgFKkRMRuxZAz0zZV37ekOOvkkgWcXFIj0LG+KVz3iAoNonKMV7XIIieUL+JhD00ScqWIM0zXybHZzGf8M4Tz/GT936ufpUixuTylbB0o3hI3xtT8UFqRh/YdezqxW118x4CEpMKu/SY/hDZMTTnZTFXPsm0MrLTA71jEOTc5p5piaFBCSMxWaF8U9g1ytPuD0WO8+SoRt/2OGSqCJalJp6LtIQ1+9hKc6mcC6bfAAuMms4QkGEeto7fi8ABgtrW9buC2rkiimBFE6ZZ+CmWzwxMCDeB/sdBR+4+pqpe1OzbEcSs871i7Rhm4hVdDL8BqtjfSMvQ3P4s+ulj41T1kNw7cGa6UQqSK9oU2Lqa1MxOiABevve58KthOgHcnKAUggIj7iZjHs1cq/fksQEzjm2RQncQBSbMx3uB8ha82agzlnm6FZB6KUQUGgTPF2sOF9WRzNEvpBvt09B1GffSz4Xz1amRKMxOhG3XZrz1SsEfnEmF6a6eTEkE1ccSsXo5HTXeRq5wtHNo8SRST+ff4fEcBEgFdk/9kfzV7i4CjGRnMLeGNTwHL8p6WLncfMFGwgOPsPmRYUo7L4GuSf9obXu0tospWt5aWmrz6jBet0XSV80unEJIHuAeOura3ciVLLNKW4eJ4Pv1AapmGGB3N07xaiX+3DVDW/le9tnO0oxsqCzQhuqUycenf30/bH4zG1X21hDdDrRhptYkHbmXtr/dynlsLbcnL/tFPjmNXEIc/ZM4qfA0fbMpLx0ck5Kxyofb 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:(13230016)(4636009)(7916004)(346002)(136003)(376002)(396003)(39860400002)(36840700001)(46966006)(40470700004)(16576012)(40460700003)(81166007)(26005)(54906003)(336012)(4326008)(8676002)(44832011)(2906002)(33716001)(70206006)(82310400005)(41300700001)(70586007)(316002)(82740400003)(356005)(426003)(110136005)(9686003)(5660300002)(186003)(8936002)(103116003)(47076005)(16526019)(40480700001)(86362001)(36860700001)(7416002)(478600001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:39:23.5805 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da7c2618-ff0f-4662-56cb-08da6385d24d 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: BN8NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3480 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add two new sysfs files to read/write the event configuration if the feature Bandwidth Monitoring Event Configuration (BMEC) is supported. The file mbm_local_config is for the configuration of the event mbm_local_bytes and the file mbm_total_config is for the configuration of mbm_total_bytes. $ls /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local* /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_bytes /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_config $ls /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total* /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_bytes /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_config Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 3 +++ arch/x86/kernel/cpu/resctrl/monitor.c | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 32 ++++++++++++++++++++++++++++= ++++ 3 files changed, 37 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index c049a274383c..aaafee112fa6 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -72,11 +72,13 @@ DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key); * struct mon_evt - Entry in the event list of a resource * @evtid: event id * @name: name of the event + * @config: current configuration * @list: entry in &rdt_resource->evt_list */ struct mon_evt { u32 evtid; char *name; + char *config; struct list_head list; }; =20 @@ -95,6 +97,7 @@ union mon_data_bits { unsigned int rid : 10; unsigned int evtid : 8; unsigned int domid : 14; + unsigned int mon_config : 32; } u; }; =20 diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index b9de417dac1c..88421316c816 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -656,11 +656,13 @@ static struct mon_evt llc_occupancy_event =3D { static struct mon_evt mbm_total_event =3D { .name =3D "mbm_total_bytes", .evtid =3D QOS_L3_MBM_TOTAL_EVENT_ID, + .config =3D "mbm_total_config", }; =20 static struct mon_evt mbm_local_event =3D { .name =3D "mbm_local_bytes", .evtid =3D QOS_L3_MBM_LOCAL_EVENT_ID, + .config =3D "mbm_local_config", }; =20 /* diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 855483b297a8..30d2182d4fda 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -254,6 +254,10 @@ static const struct kernfs_ops kf_mondata_ops =3D { .seq_show =3D rdtgroup_mondata_show, }; =20 +static const struct kernfs_ops kf_mondata_config_ops =3D { + .atomic_write_len =3D PAGE_SIZE, +}; + static bool is_cpu_list(struct kernfs_open_file *of) { struct rftype *rft =3D of->kn->priv; @@ -2534,6 +2538,25 @@ void rmdir_mondata_subdir_allrdtgrp(struct rdt_resou= rce *r, unsigned int dom_id) } } =20 +static int mon_config_addfile(struct kernfs_node *parent_kn, const char *n= ame, + void *priv) +{ + struct kernfs_node *kn; + int ret =3D 0; + + kn =3D __kernfs_create_file(parent_kn, name, 0644, + GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, 0, + &kf_mondata_config_ops, priv, NULL, NULL); + if (IS_ERR(kn)) + return PTR_ERR(kn); + + ret =3D rdtgroup_kn_set_ugid(kn); + if (ret) + kernfs_remove(kn); + + return ret; +} + static int mkdir_mondata_subdir(struct kernfs_node *parent_kn, struct rdt_domain *d, struct rdt_resource *r, struct rdtgroup *prgrp) @@ -2568,6 +2591,15 @@ static int mkdir_mondata_subdir(struct kernfs_node *= parent_kn, if (ret) goto out_destroy; =20 + /* Create the sysfs event configuration files */ + if (r->mon_configurable && + (mevt->evtid =3D=3D QOS_L3_MBM_TOTAL_EVENT_ID || + mevt->evtid =3D=3D QOS_L3_MBM_LOCAL_EVENT_ID)) { + ret =3D mon_config_addfile(kn, mevt->config, priv.priv); + if (ret) + goto out_destroy; + } + if (is_mbm_event(mevt->evtid)) mon_event_read(&rr, r, d, prgrp, mevt->evtid, true); } From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 721C8C433EF for ; Mon, 11 Jul 2022 21:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231663AbiGKVjr (ORCPT ); Mon, 11 Jul 2022 17:39:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232147AbiGKVje (ORCPT ); Mon, 11 Jul 2022 17:39:34 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE6F7868A6; Mon, 11 Jul 2022 14:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K0Nm9DvNXLPDjm7ImWGAIrkxHe0FZ5BcWWtGa4hFJdN5GZ04aKqrA65GoBskc7ralGbLM4vXbBgBx8P992uKsnhdACNoUIa3aYQK3sYPF2SiBgZKV7ldp1jo4t9C3wP2y5tWaqvmV/KEiVPp+uc810c1Jt7ZovWMqTB6mnKm1ikUMqw6zQQxgKM3PdE9ChRQ0O01fZLMHORzqjdGUa73W5lWPiOwCNXDhNC9RDeEsp8PIQzvuoenN+xBLxpolMrf1bolWzx0ariK4OnamdTq3YfQYmB7DcUtSen4XYGKWzufjpZlNTf8zVgYqfFSsbrUizrVgeT+D+fbUknJ5L6Dkw== 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=dspl4qODCwlrLJJG6Z4doqnJIGvQjbJ4A4d4uYHpUxQ=; b=gXARnMqML4wvx6sRciOU3zZmR1g/1l62boE+sCMgcxvRSQLLfbpcVJZvcBowliTJb1hinlmJtupsFhL9hJ8XYH+3vMe3kP5Evcb4nfxsidGNnfoouKVG3DNHADtfX/nwQIxUGwJg7DaCAUrheDI3Kix2FcQRnR4eqWxJ2FhqJedwKSdhmnsel0ht8nG+KZRGo0aOwzEAqY/oSL1FSclARwct+T72fuLWh3PIdFFzYA/gUGIhqD2OrpMqntYebVmlftA3OjFdYkB50xhJh8wNnWwHyk20r0t9sqqVsKbrNRFRI685IZnRGULagni23GGw/KDUvAU4CVfZ58WlJyJNxg== 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=dspl4qODCwlrLJJG6Z4doqnJIGvQjbJ4A4d4uYHpUxQ=; b=WafYHQRtyCDxI8lvNMxpqVncz/hKmB0661JqJaFFcofqUnWWtkeJu/SQ10skjhWM7GAucnxASYBI5a2OEG6bIF956bkXL3IsVUcwM2mQoXH8zNVMdghM+A/R8brxVeztKZ3iTa3Mkcbt4nI8QBBFN/85Zyyl9JTxHohH7aQdErs= Received: from BN9PR03CA0395.namprd03.prod.outlook.com (2603:10b6:408:111::10) by MN2PR12MB4517.namprd12.prod.outlook.com (2603:10b6:208:267::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20; Mon, 11 Jul 2022 21:39:30 +0000 Received: from BN8NAM11FT008.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::95) by BN9PR03CA0395.outlook.office365.com (2603:10b6:408:111::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:30 +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 BN8NAM11FT008.mail.protection.outlook.com (10.13.177.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:29 +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.28; Mon, 11 Jul 2022 16:39:28 -0500 Subject: [PATCH 7/9] x86/resctrl: Add the sysfs interface to read the event configuration From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:39:28 -0500 Message-ID: <165757556812.416408.9921153753932958176.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: 2e3abce2-42b7-444b-0948-08da6385d61d X-MS-TrafficTypeDiagnostic: MN2PR12MB4517:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fZi1CXQyKbkcST2bo2jxmQF72oTiWUtQz3Lh9qUi5GJe0ivTuYBu2FSNUWsXM3h1ZjmT1YSiJWv5mlTWrQjv2i0pzlzQMdRGFDpVWlgVBikVIqdWkgsz89IGv/KexyKBj8I4MbynEq8N5D0WPsaUuA94dyr4S87at0ydTuRPDN5CPcqv7eNRAWfrCgqgUdwfjlY753WtuZEQm/wnMiC4vXc0MONELA+N6jm+OMXMkmn1k3kwUyqAR9XzNIiMVbx49hja8tH3FAS0/LrCd4IsMW8mEya3QL2JkvOVBIpJqDO7JOLetgZGJdGnteJWrkdqcajRzm5ZnYO0HF1R4XPrliGDqpefzs0WrhCq40Eviu70XisuXMJtd64W9kV1r7QODqtWvs8QSVTH9F2+wPTckygGvVmc1g9Emy62kLkQYU+K3HpJ8I344BFtgvoicvJBh414A4f24TXlCrYD8HNl5+0AlrG1pniQiSXUC9RDct5MGOqu0aYBndnFtWlLRJSCDIVomyXeUsvy6VKDGqpdK0WERsb31ULYO+kxJ5Ote42hhBHGhF1MoGDVoeRK9BWaQ+a551QLL91b6NIvJ8V2DyE43RxCktzum1BSYGahD3H1McCVJHHHebZF+0l9PRYoi1ekzVFqE5LPyWjXYJLqZwfNBTIG4ThC89HCmc5JEUF/suVW5gBnQ8nbE2RePe1OpSiiiPqE2MHoUhg7lw1ilpFStmIXTvnYz8/Y3iyDT8hKXA1HcObqd1Z8lhrMKZEO9wTaBG8YiMWxzevtKEYBLlh4DImlmMNvflUyAqstgBAO3c2I75nHHt42ye674dxrCAMaJIuzXR+xTeHTs7aXYkuUjOVdsvIXAFw4qKAp4ZAP6iL5RULepta4t7EU77tS 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:(13230016)(4636009)(7916004)(346002)(376002)(136003)(39860400002)(396003)(40470700004)(46966006)(36840700001)(82310400005)(2906002)(478600001)(40480700001)(16526019)(41300700001)(186003)(54906003)(110136005)(8676002)(86362001)(316002)(33716001)(4326008)(26005)(16576012)(70586007)(103116003)(9686003)(70206006)(7416002)(81166007)(356005)(83380400001)(82740400003)(8936002)(5660300002)(44832011)(47076005)(336012)(66574015)(426003)(40460700003)(36860700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:39:29.9748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e3abce2-42b7-444b-0948-08da6385d61d 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: BN8NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4517 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current event configuration can be viewed by the user by reading the sysfs configuration file. Following are the types of events supported. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 types of events and mbm_local_bytes configuration is set to 0x15 to count all the local memory events. $cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_config 0x7f $cat /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_config 0x15 Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 21 ++++++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 70 ++++++++++++++++++++++++++++= ++++ 2 files changed, 91 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index aaafee112fa6..9f494ba463b7 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -15,6 +15,7 @@ #define MSR_IA32_MBA_THRTL_BASE 0xd50 #define MSR_IA32_MBA_BW_BASE 0xc0000200 #define MSR_IA32_SMBA_BW_BASE 0xc0000280 +#define MSR_IA32_EVT_CFG_BASE 0xc0000400 =20 #define MSR_IA32_QM_CTR 0x0c8e #define MSR_IA32_QM_EVTSEL 0x0c8d @@ -50,6 +51,26 @@ */ #define MBM_CNTR_WIDTH_OFFSET_MAX (62 - MBM_CNTR_WIDTH_BASE) =20 +/* Reads to Local DRAM Memory */ +#define READS_TO_LOCAL_MEM BIT(0) + +/* Reads to Remote DRAM Memory */ +#define READS_TO_REMOTE_MEM BIT(1) + +/* Non-Temporal Writes to Local Memory */ +#define NON_TEMP_WRITE_TO_LOCAL_MEM BIT(2) + +/* Non-Temporal Writes to Remote Memory */ +#define NON_TEMP_WRITE_TO_REMOTE_MEM BIT(3) + +/* Reads to Local Memory the system identi=EF=AC=81es as "Slow Memory" */ +#define READS_TO_LOCAL_S_MEM BIT(4) + +/* Reads to Remote Memory the system identi=EF=AC=81es as "Slow Memory" */ +#define READS_TO_REMOTE_S_MEM BIT(5) + +/* Dirty Victims to All Types of Memory */ +#define DIRTY_VICTIS_TO_ALL_MEM BIT(6) =20 struct rdt_fs_context { struct kernfs_fs_context kfc; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 30d2182d4fda..e1847d49fa15 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -254,8 +254,78 @@ static const struct kernfs_ops kf_mondata_ops =3D { .seq_show =3D rdtgroup_mondata_show, }; =20 +/* + * This is called via IPI to read the CQM/MBM counters + * in a domain. + */ +void mon_event_config_read(void *info) +{ + union mon_data_bits *md =3D info; + u32 evtid =3D md->u.evtid; + u32 h, msr_index; + + switch (evtid) { + case QOS_L3_MBM_TOTAL_EVENT_ID: + msr_index =3D 0; + break; + case QOS_L3_MBM_LOCAL_EVENT_ID: + msr_index =3D 1; + break; + default: + return; /* Not expected to come here */ + } + + rdmsr(MSR_IA32_EVT_CFG_BASE + msr_index, md->u.mon_config, h); +} + +void mondata_config_read(struct rdt_domain *d, union mon_data_bits *md) +{ + smp_call_function_any(&d->cpu_mask, mon_event_config_read, md, 1); +} + +int rdtgroup_mondata_config_show(struct seq_file *m, void *arg) +{ + struct kernfs_open_file *of =3D m->private; + struct rdt_hw_resource *hw_res; + u32 resid, evtid, domid; + struct rdtgroup *rdtgrp; + struct rdt_resource *r; + union mon_data_bits md; + struct rdt_domain *d; + int ret =3D 0; + + rdtgrp =3D rdtgroup_kn_lock_live(of->kn); + if (!rdtgrp) { + ret =3D -ENOENT; + goto out; + } + + md.priv =3D of->kn->priv; + resid =3D md.u.rid; + domid =3D md.u.domid; + evtid =3D md.u.evtid; + + hw_res =3D &rdt_resources_all[resid]; + r =3D &hw_res->r_resctrl; + + d =3D rdt_find_domain(r, domid, NULL); + if (IS_ERR_OR_NULL(d)) { + ret =3D -ENOENT; + goto out; + } + + mondata_config_read(d, &md); + + seq_printf(m, "0x%x\n", md.u.mon_config); + +out: + rdtgroup_kn_unlock(of->kn); + return ret; +} + static const struct kernfs_ops kf_mondata_config_ops =3D { .atomic_write_len =3D PAGE_SIZE, + .seq_show =3D rdtgroup_mondata_config_show, }; =20 static bool is_cpu_list(struct kernfs_open_file *of) From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5BFEC433EF for ; Mon, 11 Jul 2022 21:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232222AbiGKVkF (ORCPT ); Mon, 11 Jul 2022 17:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232101AbiGKVjm (ORCPT ); Mon, 11 Jul 2022 17:39:42 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2082.outbound.protection.outlook.com [40.107.102.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51C5A83F0B; Mon, 11 Jul 2022 14:39:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hRTpw0A4hml+b0vwrUWgmKIUbSJV/kGjqPGFyCoCX363Tcfx52zUT2+TG0UhpGjBvKsIZntaKM/xgk0TIwDIKXYV8FvPi78e+fu8Z4UlfcTnPA3OmYjjXXjGLXusJdzQ+7MKUP7fM3lXl4+OE9So6PFsOOuGhBRvX+JErq5B4GHuT/WT44aYa0o2pPzb0RWPgw2IX0NhQy28vVUMPMYaJ3KSH14CCxEtK2ERic9QiTvt6zSMft4OOlfBp/Z/k2XKNFbFhNnix2sH4sZu3l7hEgrkeetVkVw8Als/8VbzYyUanLuMDoEz7gPpXE5PtuSpATEchr2nhVqbZIM612ShFQ== 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=H3SDTR/kL4O1R4+mhUqund24vBhQUTOpem5bZn5n4P4=; b=CF1TFWsh2Cckq9VTwjeurmkFOhQKzh5QX+jXwsYFtoazekX+Sp60dDFkZzVi8HEKW45C3m53Q7mPGNwqFO2Z0bRcIEQIWJaeaqhxxhwzuJ4drsi4P+nq2mXUjnWo0sQmYYeUo4u71+4agPVlOnPcUvp8VKByxGdZzSmBoPUZNucmjKh+5vFJbXDJMpvOAvbHEm1Msd32IdlkhoCo2LC516eRzTRd3aKOm2607ewv9m33WgvSOKQqSsWbN/vEnFh0ZA5KWQe0Su8dBKWpG0q197Uzk/aWNBrouwvbzyfIt5sZmV29ZwY1hpCbVI+SmInUesDgrg/Rhz97V04j4O14aw== 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=H3SDTR/kL4O1R4+mhUqund24vBhQUTOpem5bZn5n4P4=; b=BDMIQlR3wp15tyzpvNQqcHPykKOh/vicf1KuqxW5W8ddoGb6y1MKngVphXdYY+vfJQkmKBd0ljFOC8SRJBe6t0DS5bsXTZCXZA4kyUpCn/XeEAXkUj4RGsNIps3vKfp1P8nYYFz+ZmscW/AUm+4ZZ8ReHoj/feTnmpm2SwUaWy4= Received: from BN9PR03CA0356.namprd03.prod.outlook.com (2603:10b6:408:f6::31) by DM6PR12MB3866.namprd12.prod.outlook.com (2603:10b6:5:1c6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20; Mon, 11 Jul 2022 21:39:37 +0000 Received: from BN8NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f6:cafe::fd) by BN9PR03CA0356.outlook.office365.com (2603:10b6:408:f6::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.19 via Frontend Transport; Mon, 11 Jul 2022 21:39:37 +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 BN8NAM11FT058.mail.protection.outlook.com (10.13.177.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:36 +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.28; Mon, 11 Jul 2022 16:39:35 -0500 Subject: [PATCH 8/9] x86/resctrl: Add sysfs interface to write the event configuration From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:39:34 -0500 Message-ID: <165757557476.416408.6689961473424844894.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: caed0c50-cee8-41f6-8557-08da6385da34 X-MS-TrafficTypeDiagnostic: DM6PR12MB3866:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3VbuoDjxf10lmZ8HclP76pe5SZp2nublnMLbpnnPj8bUs0LliK+2ElJ4KNXOwP2e3CD0t5n79gw1gGpC1c1hG2yUf0QfeTUzbcBlkAyR60apLDPG//8SWx7asqiyXP4oeChGIu/wA26I3VCWdpesVva17JFyp4akFzs1VKS6DckiHyaG093BxrYzc+27P0j0GjPzlC7ZDW2SVuK0NGfzkQ7/lkQCt/GOfTocYJGqVl/R5OTPbhZN9u+/EAnI0U3ZyOL0GBXyAbr6EGDNMa+J0iXxiB/H6rqTmOjMYwig+YFSBnxNGqd+CaLRlb9gLl+GmAETry4dWStaAWuq/0OS5kIvYjuSwyD5HjBFOeAFaM4C+MFTGQZBouF6swTeOm7dxW2Zf1gm5pdz76FDTpQMQbMlmSPBeJPuMxUIGtOM2jP9M/3noGg1mAh+CJ3xYwhJgxgDBcem8rUORRxB+dusY3vVFPTBdEXxbbPSvZHiAZaDCQ66whbTiJSt6+9NrhUZFecyNARD4RZEs1ff6NP7WZW1Kvb8sgxA8V9HnncarrwPSizRY1pFUkfMPDaLZ1cetYxBjPSFeQG7rseu4wGzMwUB/tUjaeJV7v5p/d/c/xS6v0atd5jrUGU9Rs+baMOpMKfy1wCLz64fi0GCgMMk6WBzvli/voR5HpE1LaXuQMMDrT8gH0CL3yTyIqvnLLg6roUmPIT4StV4A0PPN7Z2s6u1Lf8B+F1Ta15/JeW02tfWmlOpro3zCXSsDYR5dcMnR+HVlLhgYtJaOytRvJl/TwXdoaVA5YJrWE6BLBzkqkRJWgY22tSYPVzuFTLhRQnmU5r+LIVPKC4YxhGW3JXmrMYWP3LKaCuSAdDc15t7HiEx/J6Y+Vqp6LnQM3HjqQwQ 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:(13230016)(7916004)(4636009)(396003)(136003)(346002)(39860400002)(376002)(36840700001)(40470700004)(46966006)(83380400001)(316002)(16576012)(70206006)(26005)(81166007)(70586007)(33716001)(47076005)(110136005)(54906003)(8676002)(40480700001)(4326008)(336012)(9686003)(186003)(5660300002)(16526019)(82310400005)(86362001)(426003)(82740400003)(2906002)(103116003)(478600001)(44832011)(40460700003)(7416002)(356005)(36860700001)(41300700001)(8936002)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:39:36.8240 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caed0c50-cee8-41f6-8557-08da6385da34 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: BN8NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3866 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the sysfs interface to write the event configuration for the MBM configurable events. The event configuration can be changed by writing to the sysfs file for that specific event. Following are the types of events supported. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 types of events and mbm_local_bytes configuration is set to 0x15 to count all the local memory events. For example: To change the mbm_total_bytes to count all the reads, run the command. $echo 0x33 > /sys/fs/resctrl/mon_data/mon_L3_00/mbm_total_config To change the mbm_local_bytes to count all the slow memory reads, run the command. $echo 0x30 > /sys/fs/resctrl/mon_data/mon_L3_00/mbm_local_config Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 109 ++++++++++++++++++++++++++++= ++++ 1 file changed, 109 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index e1847d49fa15..83c8780726ff 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -323,9 +323,118 @@ int rdtgroup_mondata_config_show(struct seq_file *m, = void *arg) return ret; } =20 +/* + * This is called via IPI to read the CQM/MBM counters + * in a domain. + */ +void mon_event_config_write(void *info) +{ + union mon_data_bits *md =3D info; + u32 evtid =3D md->u.evtid; + u32 msr_index; + + switch (evtid) { + case QOS_L3_MBM_TOTAL_EVENT_ID: + msr_index =3D 0; + break; + case QOS_L3_MBM_LOCAL_EVENT_ID: + msr_index =3D 1; + break; + default: + return; /* Not expected to come here */ + } + + wrmsr(MSR_IA32_EVT_CFG_BASE + msr_index, md->u.mon_config, 0); +} + +ssize_t rdtgroup_mondata_config_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, loff_t off) +{ + struct rdt_hw_resource *hw_res; + struct rdtgroup *rdtgrp; + struct rdt_resource *r; + unsigned int mon_config; + cpumask_var_t cpu_mask; + union mon_data_bits md; + struct rdt_domain *d; + u32 resid, domid; + int ret =3D 0, cpu; + + ret =3D kstrtouint(buf, 0, &mon_config); + if (ret) + return ret; + + rdt_last_cmd_clear(); + + /* mon_config cannot be more than the supported set of events */ + if (mon_config > GENMASK(6, 0)) { + rdt_last_cmd_puts("Invalid event configuration\n"); + return -EINVAL; + } + + cpus_read_lock(); + rdtgrp =3D rdtgroup_kn_lock_live(of->kn); + if (!rdtgrp) { + return -ENOENT; + goto e_unlock; + } + + if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) { + ret =3D -ENOMEM; + goto e_unlock; + } + + + md.priv =3D of->kn->priv; + resid =3D md.u.rid; + domid =3D md.u.domid; + + hw_res =3D &rdt_resources_all[resid]; + r =3D &hw_res->r_resctrl; + d =3D rdt_find_domain(r, domid, NULL); + if (IS_ERR_OR_NULL(d)) { + ret =3D -ENOENT; + goto e_cpumask; + } + + md.u.mon_config =3D mon_config & 0xFF; + + /* Pick all the CPUs in the domain instance */ + for_each_cpu(cpu, &d->cpu_mask) + cpumask_set_cpu(cpu, cpu_mask); + + cpu =3D get_cpu(); + /* Update MSR_IA32_EVT_CFG_BASE MSR on this cpu if it's in cpu_mask */ + if (cpumask_test_cpu(cpu, cpu_mask)) + mon_event_config_write(&md); + + /* Update MSR_IA32_EVT_CFG_BASE MSR on all other cpus in cpu_mask */ + smp_call_function_many(cpu_mask, mon_event_config_write, &md, 1); + put_cpu(); + + /* + * When an Event Configuration is changed, the bandwidth counters + * for all RMIDs and Events will be cleared, and the U-bit for every + * RMID will be set on the next read to any BwEvent for every RMID. + * Clear the mbm_local and mbm_total counts for all the RMIDs. + */ + memset(d->mbm_local, 0, sizeof(struct mbm_state) * r->num_rmid); + memset(d->mbm_total, 0, sizeof(struct mbm_state) * r->num_rmid); + +e_cpumask: + free_cpumask_var(cpu_mask); + +e_unlock: + rdtgroup_kn_unlock(of->kn); + cpus_read_unlock(); + + return ret ?: nbytes; +} + static const struct kernfs_ops kf_mondata_config_ops =3D { .atomic_write_len =3D PAGE_SIZE, .seq_show =3D rdtgroup_mondata_config_show, + .write =3D rdtgroup_mondata_config_write, }; =20 static bool is_cpu_list(struct kernfs_open_file *of) From nobody Sat Apr 18 19:16:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07A45C43334 for ; Mon, 11 Jul 2022 21:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231769AbiGKVkK (ORCPT ); Mon, 11 Jul 2022 17:40:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232136AbiGKVjs (ORCPT ); Mon, 11 Jul 2022 17:39:48 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2086.outbound.protection.outlook.com [40.107.94.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F06823A5; Mon, 11 Jul 2022 14:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XG6q6NhlFlJCB2MXyab53/ZJJwXONr73bWpqDZqh87S1Mph+d5CDRBzfYoUAZlER7ukDccCh0qRGwSezulfLXTp9aVnrTew6faTMtuy0GgKxOTX/C/p9S/6Wg4QTMEklyOcIR4GxWH/nFc85MN2Cti5VJuhqPbcicXm3xu+bJkjDdfJWbmc0OG8FxLAKuechVTuI1mUyeVR8Lz82qmWuq3heiErBl1zwvCZ+RzYaRiwFWetH+2RyCTG5NMY8IxM72eZsnYfXO0KVrAeQTdA6zsbNXKf4WZUgwDNU+mfBzupwd0XgWcuSLrpADSCSGznbfBy7/W92aNo1jqybgEhR2w== 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=vzV/5UKOEXQ1aWkvy3MLfQYcwg/lS7eP/U+HnXFQCOY=; b=lgQa11DEz2cKnYUJ0my07ferX2VQ6+2bdCoUFMgiH6pwrBsCWyLVHMykiUJ1yhovfCuwfPGVzYzhQVCqDzyxaEa4U68S0w6OOwiul+taoxTlyYdzlrUp+ma6Trs/qkVLIiYdBgnKLnkwtl0qCuOc7X21lXqoEjCSn/0IJrWtGWSSGsIcRXqdrIwZEtZQ5x5B2zjeaX1l0Rp7sFjPb8dwWrOBSmnE97ADG+45MGv3WPWMsK3aTSxAVp1Aj9nTcJAjGsKBPkfu7JNwc8S3Zp8mPDoX/OBcRBJ4ZBiaPq07eEw4hMIGZ6+3v6EIXhbcumERz3JRWjKaAIyk7inOrxqELA== 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=vzV/5UKOEXQ1aWkvy3MLfQYcwg/lS7eP/U+HnXFQCOY=; b=GDBtPNAPQGn6Z1vfXwOll0JW84D6ISkxRapBYLhc+GfV6uxEx/efyJxyIAYf4Ol5OCBqNu7YRRLiHeOxrIMTn6SX1egAyIlBLuZaMh19Ic996rVJu+YMcetM0vnZqn8s7nctHY8+8r9ZenEFQpZgu3NA48q9olHnTt/cLk5Yj0E= Received: from BN0PR04CA0164.namprd04.prod.outlook.com (2603:10b6:408:eb::19) by BYAPR12MB2616.namprd12.prod.outlook.com (2603:10b6:a03:66::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Mon, 11 Jul 2022 21:39:43 +0000 Received: from BN8NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:408:eb:cafe::93) by BN0PR04CA0164.outlook.office365.com (2603:10b6:408:eb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.22 via Frontend Transport; Mon, 11 Jul 2022 21:39:43 +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 BN8NAM11FT068.mail.protection.outlook.com (10.13.177.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5417.15 via Frontend Transport; Mon, 11 Jul 2022 21:39:43 +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.28; Mon, 11 Jul 2022 16:39:41 -0500 Subject: [PATCH 9/9] Documentation/x86: Update resctrl_ui.rst for new features From: Babu Moger To: , , , , CC: , , , , , , Date: Mon, 11 Jul 2022 16:39:41 -0500 Message-ID: <165757558140.416408.6012140649170583649.stgit@bmoger-ubuntu> In-Reply-To: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> References: <165757543252.416408.13547339307237713464.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Office365-Filtering-Correlation-Id: cbf3cc2b-891d-4d93-2737-08da6385dde7 X-MS-TrafficTypeDiagnostic: BYAPR12MB2616:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: otH3uJb993JgGwDaWOoVefR33t6E5hX/w94E2EgfWGJQLuiE0B7XFRZkWVC5TEacPVlrCHuhsAjTV6+hzA3nyD1/Z4F5th+pQnYvj5jkBtxbRdTJyFtameFBfY5uf4btFCAzvEUR7uyvHl1F/9JeOzgLcySk1Ie6kDcuQcWMGX/e4JipCiT9xf61rT0qeP/xIKjfe5ZX+PZD05YmTlxd/rh/OEgOwHB0aCNZLC1J2S0qmH9OnmsVSGatDMy/Tm+bYat110HigAgsGodCXZ7WKYOq8AgB4sag3QNhAFOJDo5uibnMpU7GrE0lMxXRFn5sxlKlm7xITM/qztRxpdFIYiTAZL8odbCS+LbT9d1B/T5z/YDKYLHgrJtXWuru1iWQK7gnGooDhNuDzHMmSMq7LP27dh/1kZNYbiRyDCgN6i/slvx9MRQcYYsV+2okppMF1CJphKmPd7wq8Jx7kjDLPa1oHZODPhe9QorvqGJAlR1y8PV4fIEcXzw4r8Q4Cb5eAekWkF6zTJ9Kb+8nmwqGzkkNx8HLbfROliETpE+4WsAUUWiJf8IUuCmnozQx+T+pSc4yBk7g6xB6mbJowAPK4y9bokbfRArQ1kAn+kjOiYzotGHXwDfxAuxS6J1DgVdZOb4LkxGXdYoTMAtw7x0gC24B2IPaGX+wGUlOnFAyxnTy8ipBkDAjSryeCXXlmtY4r+15i+5IAhhXq7pfSjGQIgTBVRKJhxqyMbJeAG6Rn+NE7INyKkin0SkdnbbURFlq86wWWWMqLt23XILRahQ5Jaqo3jMsoo3/ZiWA3bz5oNY8NuJL879fUxGTQRBVChbqsAJt+JP7TJxyzgm4CdQweARcWddNp4rgDb+VjwOUU4E1iSRGD4ZjKjOCBdaGfUlr 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:(13230016)(4636009)(7916004)(396003)(136003)(346002)(376002)(39860400002)(40470700004)(46966006)(36840700001)(110136005)(44832011)(2906002)(478600001)(81166007)(54906003)(36860700001)(316002)(7416002)(16576012)(186003)(103116003)(15650500001)(82740400003)(356005)(5660300002)(336012)(40460700003)(86362001)(16526019)(8936002)(9686003)(426003)(41300700001)(47076005)(82310400005)(40480700001)(83380400001)(70586007)(70206006)(8676002)(4326008)(33716001)(26005)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2022 21:39:43.0435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cbf3cc2b-891d-4d93-2737-08da6385dde7 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: BN8NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2616 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update the documentation for the new features: 1. Slow Memory Bandwidth allocation. 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 are 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. Added the instructions to configure with examples. Signed-off-by: Babu Moger --- Documentation/x86/resctrl.rst | 123 +++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 123 insertions(+) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 71a531061e4e..bae36a4d1b2b 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -167,6 +167,12 @@ with the following files: bytes) at which a previously used LLC_occupancy counter can be considered for re-use. =20 +"mon_configurable": + Provides the information if the events mbm_total and + mbm_local are configurable. See the configuration + details for "mbm_total_config" and "mbm_local_config" + for more information. + Finally, in the top level of the "info" directory there is a file named "last_cmd_status". This is reset with every "command" issued via the file system (making new directories or writing to any of the @@ -264,6 +270,29 @@ When monitoring is enabled all MON groups will also co= ntain: 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. =20 +"mbm_total_config": +"mbm_local_config": + This contains the current event configuration for the events + mbm_total_bytes and mbm_local_bytes, respectively, when the + Bandwidth Monitoring Event Configuration (BMEC) feature is support= ed. + These files are organized by L3 domains under the subdirectories + "mon_L3_00" and "mon_L3_01". When BMEC is supported, the events + mbm_local_bytes and mbm_total_bytes are configurable. + + 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 co= unt + all the event types and the mbm_local_bytes configuration is set to + 0x15 to count all the local memory events. + Resource allocation rules ------------------------- =20 @@ -464,6 +493,14 @@ Memory bandwidth domain is L3 cache. =20 MB:=3Dbw_MBps0;=3Dbw_MBps1;... =20 +Slow Memory bandwidth Allocation (when supported) +------------------------------------------ + +Slow Memory b/w domain is L3 cache. +:: + + SB:=3Dbandwidth0;=3Dbandwidth1;... + Reading/writing the schemata file --------------------------------- Reading the schemata file will show the state of all resources @@ -479,6 +516,44 @@ which you wish to change. E.g. L3DATA:0=3Dfffff;1=3Dfffff;2=3D3c0;3=3Dfffff L3CODE:0=3Dfffff;1=3Dfffff;2=3Dfffff;3=3Dfffff =20 +Reading/writing the schemata file (on AMD systems) +--------------------------------------------------------------- +Reading the schemata file will show the state of all resources +on all domains. When writing the memory bandwidth allocation, the +user only need to specify those values in an absolute number +expressed in 1/8 GB/s increments. To allocate bandwidth limit of +2GB, the user need to specify the value 16 (16 * 1/8 =3D 2). E.g. +:: + + # cat schemata + MB:0=3D2048;1=3D2048;2=3D2048;3=3D2048 + L3:0=3Dffff;1=3Dffff;2=3Dffff;3=3Dffff + + # echo "MB:1=3D16" > schemata + # cat schemata + MB:0=3D2048;1=3D 16;2=3D2048;3=3D2048 + L3:0=3Dffff;1=3Dffff;2=3Dffff;3=3Dffff + +Reading/writing the schemata file (on AMD systems) with slow memory +--------------------------------------------------------------- +Reading the schemata file will show the state of all resources +on all domains. When writing the memory bandwidth allocation you +only need to specify those values in an absolute number expressed +in 1/8 GB/s increments. To allocate bandwidth limit of 8GB, you +need to specify the value 64 (64 * 1/8 =3D 8). E.g. +:: + + # cat schemata + SB:0=3D2048;1=3D2048;2=3D2048;3=3D2048 + MB:0=3D2048;1=3D2048;2=3D2048;3=3D2048 + L3:0=3Dffff;1=3Dffff;2=3Dffff;3=3Dffff + + # echo "SB:1=3D64" > schemata + # cat schemata + SB:0=3D2048;1=3D 64;2=3D2048;3=3D2048 + MB:0=3D2048;1=3D2048;2=3D2048;3=3D2048 + L3:0=3Dffff;1=3Dffff;2=3Dffff;3=3Dffff + Cache Pseudo-Locking =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D CAT enables a user to specify the amount of cache space that an @@ -1210,6 +1285,54 @@ View the llc occupancy snapshot:: # cat /sys/fs/resctrl/p1/mon_data/mon_L3_00/llc_occupancy 11234000 =20 +Example 5 (Configure and Monitor specific event types) +------------------------------------------------- + +A single socket system which has real time tasks running on cores 0-4 +and non real time tasks on other CPUs. We want to monitor the memory +bandwidth allocation for specific events. +:: + + # mount -t resctrl resctrl /sys/fs/resctrl + # cd /sys/fs/resctrl + # mkdir p1 + +Move the CPUs 0-4 over to p1:: + + # echo 0xf > p1/cpus + +View the current mbm_local_bytes:: + + # cat /sys/fs/resctrl/p1/mon_data/mon_L3_00/mbm_local_bytes + 112501 + +Change the mbm_local_bytes to count mon-temporal writes to both local +and non-local NUMA domain. Refer to event supported bitmap under +mbm_local_config:: + + # echo 0xc > /sys/fs/resctrl/p1/mon_data/mon_L3_00/mbm_local_config + +View the updated mbm_local_bytes:: + + # cat /sys/fs/resctrl/p1/mon_data/mon_L3_00/mbm_local_bytes + 12601 + +Similar experiment on mbm_total_bytes. First view the current mbm_total_by= tes:: + + # cat /sys/fs/resctrl/p1/mon_data/mon_L3_00/mbm_total_bytes + 1532501 + +Change the mbm_total_bytes to count only reads to slow memory on both local +and non-local NUMA domain. Refer to event supported bitmap under +mbm_total_config:: + + # echo 0x30 > /sys/fs/resctrl/p1/mon_data/mon_L3_00/mbm_total_config + +View the updated mbm_total_bytes:: + + # cat /sys/fs/resctrl/p1/mon_data/mon_L3_00/mbm_total_bytes + 104562 + Intel RDT Errata =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20