From patchwork Thu Dec 1 15:36:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp329303wrr; Thu, 1 Dec 2022 07:36:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Pcs83R5s61qM9wLo3atSMayy/6PuknmbRhZwEUrOrePddpaPvAB0tQz47X1BA7J1MRTdm X-Received: by 2002:a63:4e4c:0:b0:46f:dc59:aab6 with SMTP id o12-20020a634e4c000000b0046fdc59aab6mr60600315pgl.35.1669909008505; Thu, 01 Dec 2022 07:36:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909008; cv=pass; d=google.com; s=arc-20160816; b=EsKXcLPs4MfxNdV3xSHhdY0Rt9aXmq3z7fN6wxxEBMEZvF2RWrE4B+XeotIhU47HCp pktmLF0ZhTsPlO+TO9ejoKZ7t+wGsA5EjusiR/PXGhuRBq5bcVCPGJE0SxGMTESunBBh TYvgunVrt6997u12jP0vNElOhsULwUdvJUSoKbg19QU9NPDzj65+hI4vqaCjv6DIIBUR JFhxqB/7BRcSp/8OgacvaDQD/9t9eQnsh6vZASOBQdbVvLAwSAV0XdtDW4KUa/t1YPkE x69ANkrO9VJR4lS8PRTF+BJhpfKQTlI1sA6nf5mE62GJtjo4zniZjfZlxcUUPQCzcOpj uoDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=kkLVrTvLw1WU7zzDUJHpOxIQIKxihpI7OP3U/SqQUNM=; b=MvEWj21vtNCLVIVY5B4PMYu8XNnyrftY242ES8TJJQPZZiy/SUHhZEXOSX4hRAncSF 5Df9yPR9vUngvatYNglaRK/uF7qp2g6NcsKvzWBPo0BDZV9cq9pQv8HU98N4KozIdM44 Cs/twPdgRjh5JiDR4oY1y/KYkxq6Su8hZlO2ZG9PFYN0ENJOm4vSsGUcFaOLmpGfMdSr wU6yX/dwFwjf/1T6zo0HUack7uay7Br1D2NZYjgJbMw0eiYalwX4rQVa4fTP5Nk57ogW tqQ97an1F/tARkKqkQ6aAuA2r6zRDa+JNMe1JO4sTcS3+3sFqHmQzgfs0PWMV7F1RGMy kgnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=P7OOupJT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a65584b000000b0047873dedf41si1783351pgr.415.2022.12.01.07.36.35; Thu, 01 Dec 2022 07:36:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=P7OOupJT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231934AbiLAPgZ (ORCPT + 99 others); Thu, 1 Dec 2022 10:36:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbiLAPgM (ORCPT ); Thu, 1 Dec 2022 10:36:12 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D4AC113D; Thu, 1 Dec 2022 07:36:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mEfJ4/U7n1Xp33FLSMwL94rxbjd6nhqG60yTrtpct3Y46pVxMq5ben+HYR1D2wByeza6ObqWjJZg0KeXZDz6eYL8ywWiBK1Tie5S7oRyJV30j3t811eoznezdvnjXqDV04PX2G0Aawrih1JA41HbuhIsDVA7L+f4GPGtDgAQ7hVPNs1l3zuswRbgvo+kiP0QmzskoOngldn9h3RNjwdGEq1oQQpiE7fZI5JXT/Xb1Opi0gz1mJf5HbrY6qvwpUXigF5SQBhWcUORyLW3li98xIJXP8+j+yEUUe+sDcoTHsTvY0sIY4/D7KX7mscVyMAM8r6fd/G+6yQg2NWX7xeIXA== 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=kkLVrTvLw1WU7zzDUJHpOxIQIKxihpI7OP3U/SqQUNM=; b=n3ZiX4M5CTb5f8z/J4dEMgzEBmUWsv7WYlWhnZuHewEdTue+P5Hrv3Wc0YJcZVs0gEs/To0Egd1mjKl+deIaSddt0xEO86jjF+cvlDWJPxKela+BKb0qWBFl7VJAjcZMUmAazczp1mvUXN2QC23QHIqy2KS7GHd7Z3kmRZ+w+oJ/whMKg8Kcu8X5BUH0HM4y5GmRsAcy6TLvQ/zzEZ2ZjMVkg8J3YU6zEOFsL8vtUElMrNS+uWJHSvWe6StkG/uq7MnN4dCXzz8+AvdG/iMF5qdgQqNy3upXvtbE2ZTPllE7ZdE4uUZpuIzD/folaL2UeC+CGCMZ0QteVeHw4ZuzvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kkLVrTvLw1WU7zzDUJHpOxIQIKxihpI7OP3U/SqQUNM=; b=P7OOupJTVuJjIf08P/fdnXWA4ACMITjbCaPzhtBTpRGbF/72JzMToqrQgwvYghRW2ZBJG3nPRZ5yrBNZmT0qiYmqonCTBgLTBcxdp0CbVJrIKMEEpuy/InfSFYpiiy9xez9qU6MyRE7HrWs3551CY7+OEW3adjspjD2DANj7zTs= Received: from MW4PR03CA0158.namprd03.prod.outlook.com (2603:10b6:303:8d::13) by MN0PR12MB5953.namprd12.prod.outlook.com (2603:10b6:208:37c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Thu, 1 Dec 2022 15:36:05 +0000 Received: from CO1NAM11FT103.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::25) by MW4PR03CA0158.outlook.office365.com (2603:10b6:303:8d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23 via Frontend Transport; Thu, 1 Dec 2022 15:36: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 CO1NAM11FT103.mail.protection.outlook.com (10.13.174.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5857.17 via Frontend Transport; Thu, 1 Dec 2022 15:36:04 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:36:00 -0600 Subject: [PATCH v9 01/13] x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:00 -0600 Message-ID: <166990896023.17806.9274990355490405865.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT103:EE_|MN0PR12MB5953:EE_ X-MS-Office365-Filtering-Correlation-Id: 5875e2a5-7db7-47a1-8cf8-08dad3b1c270 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v7t3fdq9H0isSgQeJRcTEEGxd2wlmFv60dxf0/1NmOmOq3vkacAnGsZ3CiOfnku6O4oGVaNiJRY7dCtChrGMM1qBQexlvBuvrktzT7es41uSEmryQUy+GlHsqd0UQAHV42fVsEuZbLGqBRCHeAAg+chZQtPgcZPqc5sxSw4PkPLRxayZLK65ipGM68XrZAI3Fi99rPywvDFNuFOSnZCxpLshzO+Zk79Pk6tRNQaAOJkIngajngEv6OBECbkIIrw0UaZGGoEuJcfgVl1Uv9+GsHk8OMIyX8OL+EQO2rM9QX3rbzgiO3y6lPoNaTTueBSxiBdWS9TjChzwjYiLayRuzWNgFXJSJk6PdT24TdyBaeakn3sL1SRc8qN84eMaMJ1JxxN0iyQ3ECHSy8CrUBixF778qIX/0RmM3mFkG8TCnr7nKAmK6Gu1SYBUfKRpfoqZOHynKSk+XnyPxLdImtcSGU0kG1SWTOfrOJgaB4HL2h4+iEvu0cu56KVOZgwdBWTwg60yu14ROP3NTByCMu67T5ATgOdJwF7cG98IQdZy3xh1M8zdMj6Yqt1pPWXVXHUpMztq2dizM9W6pVKnSHlcg5Jh5Klmz0O4xK1RZkxPURmq7fTaPE2L7iMR2ODMGEDgGTb/4+5/MyLcEfvaVgMKerAn2SxjVKc/rXpI/h1BPaQBavPck45iWj9a5FuTYaUudOD/jAA7Srhyr0VG7UD5LKZRwUsZBvnmiaYLzvT2mCZdAhxdDzWDZY8bazD8FkiM1EfstOI3KhjUf90Qk/0AOkoHfPM4i/Fwjvd5UE4hW1pkAytm/agvaX/zeTtExnYTyUhuSu+HejSMuJxDVO74Mw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(7916004)(4636009)(136003)(39860400002)(396003)(376002)(346002)(451199015)(46966006)(40470700004)(36840700001)(86362001)(81166007)(40480700001)(103116003)(40460700003)(966005)(478600001)(2906002)(9686003)(26005)(44832011)(4326008)(5660300002)(41300700001)(70586007)(70206006)(8676002)(16576012)(54906003)(316002)(110136005)(7416002)(8936002)(7406005)(82310400005)(36860700001)(82740400003)(356005)(336012)(186003)(47076005)(16526019)(426003)(83380400001)(33716001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:36:04.9612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5875e2a5-7db7-47a1-8cf8-08dad3b1c270 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: CO1NAM11FT103.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5953 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026508842044893?= X-GMAIL-MSGID: =?utf-8?q?1751026508842044893?= Add 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=0) Bits Field Name Description 2 L3SBE L3 external slow memory bandwidth enforcement CXL.memory is the only supported "slow" memory device. With the support of SMBA feature, the hardware enables bandwidth allocation on the slow memory devices. If there are multiple slow memory devices in the system, then the throttling logic groups all the slow sources together and applies the limit on them as a whole. The presence of the SMBA feature(with CXL.memory) is independent of whether slow memory device is actually present in the system. If there is no slow memory in the system, then setting a SMBA limit will have no impact on the performance of the system. Presence of CXL memory can be identified by numactl command. $numactl -H available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 node 0 size: 63678 MB node 0 free: 59542 MB node 1 cpus: node 1 size: 16122 MB node 1 free: 15627 MB node distances: node 0 1 0: 10 50 1: 50 10 CPU list for CXL memory will be empty. The cpu-cxl node distance is greater than cpu-to-cpu distances. Node 1 has the CXL memory in this case. CXL memory can also be identified using ACPI SRAT table and memory maps. Feature description is available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication # 56375 Revision: 1.03 Issue Date: February 2022". Link: https://www.amd.com/en/support/tech-docs/amd64-technology-platform-quality-service-extensions Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 11a0e06362e4..b6a45e56cd0c 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -307,6 +307,7 @@ #define X86_FEATURE_SGX_EDECCSSA (11*32+18) /* "" SGX EDECCSSA user leaf function */ #define X86_FEATURE_CALL_DEPTH (11*32+19) /* "" Call depth tracking for RSB stuffing */ #define X86_FEATURE_MSR_TSX_CTRL (11*32+20) /* "" MSR IA32_TSX_CTRL (Intel) implemented */ +#define X86_FEATURE_SMBA (11*32+21) /* Slow Memory Bandwidth Allocation */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */ diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index f53944fb8f7f..d925753084fb 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -45,6 +45,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, + { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { 0, 0, 0, 0, 0 } From patchwork Thu Dec 1 15:36:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp329413wrr; Thu, 1 Dec 2022 07:37:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf5E3XhllOgINras1/mT9dQClEpIVFtSq2sndzxnvf90SMPdCQ8ZiowzUqKKIn1XQmcaD5Mi X-Received: by 2002:a17:902:8548:b0:186:8398:350 with SMTP id d8-20020a170902854800b0018683980350mr47428433plo.6.1669909020144; Thu, 01 Dec 2022 07:37:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909020; cv=pass; d=google.com; s=arc-20160816; b=kxGHkWK5pevtbe/OHMgqCs46p3euj3x3VjqEieI8QQxF8NRLBdHR4RfQCYNotPPDiH WYnGPPL+CLnGhJhJNekxje1VLMcBzl3ekcvniN6jtuZ8rG73VBT6EHY0ep18rxe5efab +pIE85VR4L1fW7eaGhwKDgKNM8Ul5TavOgZj4mVaf0D9tdJa9HaXUQ3RiJKLPzFv8N4n BC409SbJM3AlfStfDWSA3SHOiMKRjR69VmY2VeRUCLxliFzhWz0DrSCUiaD9Vh4Tp/hH fWBIX4xB3PWC7nLKvW+46JDnpP5RomUD5zrjR3bfxswWsHfVGqjPX11pbjcwVRJfQbR0 zezw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=EqmqaHy5wf2Bf15//G3fdDODZMrh5F7I64ht4ch8z/o=; b=dgqRXCWLzXdbctCeEJe6I92zO+6lGoEaZteBAbFiupGO8LUG52K5tSDOt5oD+nLaBe kKe7rI8RM8Uq71Zp/IhZfkOS3zxqHnzmsjFruK9g+Aza3hcs3leovbFHQIwAig64eTNV vzkSkN1VcrvCp/wcVKqrf+5G3AJ74jI5u2KKmiUntjCVAyD5lGotGC6GpRJwmK3taaEQ ZhHDVA4hTrVVhLygIf1LEaQhTTPRxCUD9wkma9NkbsN4j06Z6FwXi3508nPCZUFy3tbG sQFR/3SKFD8c2T2qYsw9piuetTfcsZRWDbl0MberUip2Ej9vUFqNuVdRm3NX0So82hcX 7Yjw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=v9IZvcsi; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a17090ab38400b00218e451806dsi7412381pjr.39.2022.12.01.07.36.46; Thu, 01 Dec 2022 07:37:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=v9IZvcsi; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbiLAPg2 (ORCPT + 99 others); Thu, 1 Dec 2022 10:36:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231940AbiLAPgT (ORCPT ); Thu, 1 Dec 2022 10:36:19 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2054.outbound.protection.outlook.com [40.107.237.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FAD01FF8E; Thu, 1 Dec 2022 07:36:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AQ1TWKgf0VHKsvhgXrHJRllwSNt2TqSJQqBNnide/OWMZfXRwKC5iYizStlghguI1DxQh6vrZHYuK/p4W3zrq51gWzb3w03jxOEOcgfWvlsMp9VHFSzPHBLyL3Gen4BenAG6HxqUMDrhGrYz1N63jYQmlj+Yw/u/DM5gZybqYz77d5CXaem2G2ydcNamDU7d2HG5xJzzoGftYYUeamPOKKhy72IRCvt97Zh5wZMsR3WHlZU74RMgcXSjl8BbVPo72fOzRd0O07m8LZwgrWA99xYEE9tC6OwTRWmdILi8WBULgqqHWOMBVUoLZ5aDU43I/RNYTNfZQrxVpbRvJbDcpg== 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=EqmqaHy5wf2Bf15//G3fdDODZMrh5F7I64ht4ch8z/o=; b=d++VA/FoullOeQoyq79U4zFFewOcKNA+ioUifG+3UNsmTcss6tO+4tgxnlrY6m4Ie5okN0j7XLwyNp3lSnVssZPky9BjaDUi92W1QqQZ0h4fDFkqTcKyw3jQILkWGt2wsg8EStwzoZgtpqLC0zPiz6E//Es/+OiIZipGj4lhlpL5DPc+YTzX0C6njaYtKRRtZzUkY7mooWiO8NwTcgNtWmbZHRDJi5GoFjtrWSL/iLzDZPbJJWAdJS2Y59uG2uVEzVzNmxNwN4qBVRFBhCH9sOiZPlOf/cib3f6ypJuBbN4/kCMT7tm9ueB6VCJvkj7HcYmU5t9Drfvlzc1fK7uiTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EqmqaHy5wf2Bf15//G3fdDODZMrh5F7I64ht4ch8z/o=; b=v9IZvcsiRGJcRuw20PJuAaFHAYm06oVusFPkSpdMr4LqQ9NMYNDJReSl59eSOZlaiatkT40hRhKOK2nZ2X0MAAVxBBhh9vZ+NY502sAexeBt5KkehhnMK6cPvUksao7oM+IVH54iZYgcEMKHw4yj9P4Vt075S1yv2yYoeWVdInI= Received: from MW4PR03CA0298.namprd03.prod.outlook.com (2603:10b6:303:b5::33) by IA1PR12MB6458.namprd12.prod.outlook.com (2603:10b6:208:3aa::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:36:15 +0000 Received: from CO1NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b5:cafe::33) by MW4PR03CA0298.outlook.office365.com (2603:10b6:303:b5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36:15 +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 CO1NAM11FT003.mail.protection.outlook.com (10.13.175.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5857.22 via Frontend Transport; Thu, 1 Dec 2022 15:36:15 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:36:13 -0600 Subject: [PATCH v9 02/13] x86/resctrl: Add a new resource type RDT_RESOURCE_SMBA From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:07 -0600 Message-ID: <166990896761.17806.7084760980218047026.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT003:EE_|IA1PR12MB6458:EE_ X-MS-Office365-Filtering-Correlation-Id: 24b39381-904b-4081-b16f-08dad3b1c86f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xduJVruW/BKjlmHeYOT5Z9JF/glwMnJYeJfbYK/mTiWd99PcIRyEDhzw1zlyjgk/NIvRrSJAne5bFg7F3zp5q4onuQMS0KJqjZlXw62sVMp+c4D9ZMtp/imVD4BuF8x3tbe+TvfyK17tXpcPAW58nxSVK4bLxF7xdlo5lJcnyVrS73PNkp9Iod7VfJXJuhtAcCeJV9F2i8X3HPyC7ukbmGPBdVlSHYt5f4Rvl6QuQrXfHF0qcf6maRZaRmJyF2rH6lu0tkEppdJVpR/vj2tVM5kv5JqUPKvaYjTL4/hqees+mlczDpHIVnGD6xy/EWXUkEyOXlZXFWLAHFCD9H0xj/LBNQhh0yi81hyg6FsE1HuGZgspJHzB/5kpn23qt99qm6vsBXNz0ICIayKVHjoYUdxv/myPRlag8//eEuS0f5HwrpUycM49/lEIUg6bHIVNwVWIXb4fSfclonFgsKAXxg/Rd93pcyov6FtM8V7SAd0F2Q0wo5DW6ZysGwtMbqwCbsYmhasElGWd+XuBEhKIY/v4ZQzs/K8KL4GHVD8uKAdTCidmrpsHGGeqeoZKO+ALaZJodLbhJfFFVYLry5kKbhIVg0/LMCujT7GaYdyncYhJu4uMjQhyP3jK3BRVmhWewLapQ9YGQooYwmtFUav4STF3VAkfvbFqE4LjTN7sdGBE/eKa91f75Aw4xXgyz1f2Fokak9bIUcTe8bpKNJ92D/UpQh7SVu3NRvCmosZhI2wuSgxAeDfUzXxUDyS1dcbb1CzfkT0bXqm3W26HMn180Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(396003)(136003)(39860400002)(376002)(346002)(451199015)(36840700001)(46966006)(40470700004)(6666004)(478600001)(82310400005)(103116003)(44832011)(40480700001)(110136005)(54906003)(316002)(4326008)(16576012)(70586007)(8676002)(82740400003)(9686003)(41300700001)(7406005)(8936002)(336012)(16526019)(40460700003)(186003)(70206006)(33716001)(426003)(86362001)(5660300002)(81166007)(7416002)(47076005)(356005)(26005)(2906002)(36860700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:36:15.0219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24b39381-904b-4081-b16f-08dad3b1c86f 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: CO1NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6458 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026520367361014?= X-GMAIL-MSGID: =?utf-8?q?1751026520367361014?= Add a new resource type RDT_RESOURCE_SMBA to handle the QoS enforcement policies on the external slow memory. Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- 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/resctrl/core.c index c98e52ff5f20..f6af3ac1ef20 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -100,6 +100,18 @@ struct rdt_hw_resource rdt_resources_all[] = { .fflags = RFTYPE_RES_MB, }, }, + [RDT_RESOURCE_SMBA] = + { + .r_resctrl = { + .rid = RDT_RESOURCE_SMBA, + .name = "SMBA", + .cache_level = 3, + .domains = domain_init(RDT_RESOURCE_SMBA), + .parse_ctrlval = parse_bw, + .format_str = "%d=%*u", + .fflags = RFTYPE_RES_MB, + }, + }, }; /* diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 5ebd28e6aa0c..fdbbf66312ec 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -409,6 +409,7 @@ enum resctrl_res_level { RDT_RESOURCE_L3, RDT_RESOURCE_L2, RDT_RESOURCE_MBA, + RDT_RESOURCE_SMBA, /* Must be the last */ RDT_NUM_RESOURCES, From patchwork Thu Dec 1 15:36:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp329442wrr; Thu, 1 Dec 2022 07:37:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf5I9EvdtdMKIDWzGK3GkKauW7F0URwbxJFH5Eeuc/BEFMRlasg69FJzLZ0i2rUdrKqnD6K8 X-Received: by 2002:a63:5a56:0:b0:46e:9bac:17f with SMTP id k22-20020a635a56000000b0046e9bac017fmr43738465pgm.420.1669909024149; Thu, 01 Dec 2022 07:37:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909024; cv=pass; d=google.com; s=arc-20160816; b=hH7O3VcDX9d8O6NsSdscfSOvljt+iRMZzk9m9Y99YMFlg/DOaT4lXTEOLDkN3Jatyi P86U2c2IOaC1HQW7UWgsi+dxH2u8q4DVKDJd89WggU11BDnfaPmkWAZguh/gL/KveFtq qDsu/mJym3BaMNY9FtwsZPzmioClnhESnL20VPru6sBQ5oVXZqE+XCaqeH12Gn5FcalO A1lEjrjWb1gy393lMXl7f4KIReQB//r+mRjLnWW8twbJGgFfCNl5K3AuOqhyHdAAhuZL aGtd7uGsfvE6Ypba4Y/BpvD0DVYfDuGS/coELWoL/4vBfQPEuueMFw9IoVlnD5/pgfoh YJeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=VgNbgOAPy8YioWxJmvlFQuLCkJsioW4F/62dgyZePsA=; b=bi00lNcniW8Veonp7uf/LdPRaKq/N7vUTpCUmOD440PNNiNVCThj7wYmuZbVB3ZXEb lNx3ITjzSqKGpqgAZpEK5vZH73UiZ5+HA65ZYxcMqcBgmZiiFFIBCVy4QhNRNi+CPVFR uQuI66ebFUcxw1NxBxYM+1TY472tQAUBssI+wgcUoJheQrAPH9w3jyEiCwwnkA10+EgY JmdgOdbVr0K+2e6wy5cewWDYOtIRIGDPHgPNpB5aV3yKbqRkQjYS2xQSCrgk1KTcfImS GRXsvribyRvnKnXUMC3NsAYlFhKAFkI4bwcYi9uokE3hwIcDL/0mFw1dxQqdl6mF8NiY zTag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=d4JRI4wP; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o23-20020a63fb17000000b00461bf5f86fdsi4893196pgh.403.2022.12.01.07.36.50; Thu, 01 Dec 2022 07:37:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=d4JRI4wP; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231969AbiLAPgd (ORCPT + 99 others); Thu, 1 Dec 2022 10:36:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231941AbiLAPgZ (ORCPT ); Thu, 1 Dec 2022 10:36:25 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2042.outbound.protection.outlook.com [40.107.101.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C104063F9; Thu, 1 Dec 2022 07:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehCz4xXHgOhlTA1U2U6v93RNOuNYhhD8rLPy6q5IVlOB0fXxr+MF3GAMvAYzg8TcAOZtKqde6XZqgD3zMlrj9IaJzM5BfyCp5X0BSVP2QazYbYXnFJoFvHCyeeVPv387C+Tmi8YoZBD3VgCB02U+UyJzWcYOLSdXyAl75TMFg1cnOw7Q0eBvhGUUzCfBz7q8wT2BF3Ux9vGAvLjSLNHBNcO2tW+jWF6jtjZ8j4vtfwIZQUuvXETtgLBmcpo5NZQguleFZOyI/YToKVRTwLMP/a+uKgXeRD/jgFlONGbXTdqtOiS8Y9jgC6YVC6sT9TbnMtBW4bgr9juyF6li3iuuMg== 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=VgNbgOAPy8YioWxJmvlFQuLCkJsioW4F/62dgyZePsA=; b=eGN40sbEwAcpVt25NabQRwdmDaXbu5jEwzM5/0FKOAs9r9qQJAmkGrD9M10qBYne1be9y3meUs0YctbNo2lA11/nY5fmM/GXX9jHdQqTz0B7MDRighjnEcJ3A/HCRPLxGfpNUPXnayKXp6vdEjYEOlOvTnU150xFtLaJrsEsnV219bHzritfvHZRQabctpiwHX8YsuMNRZJHSqNMnfwXQBTnOT9CVh4c1yBAJG42/akRjYUlLUDePisdnv0JXlcANz7xoz0hsmiAsZunfd3d66wfWQ3782KjNkrA93lb/su96R5F3utCw8ufNcvyTR5xavnCxt/H9tpWoy5N/nOHpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VgNbgOAPy8YioWxJmvlFQuLCkJsioW4F/62dgyZePsA=; b=d4JRI4wPWMMMz1wLoE0L8HS6yQTBFwVczvXbfxCiEHe1zW7YlqWmQWbzXogDSQsxndJkajVA/P8krkp/LVgasjd8lon2PCYI6Cu6kajszokwzmCcDo8a4g4hcoXeaI7jbiyT0oI94sNEn3xCnqmz2wCQbeCybR/cV90jJm4iKn4= Received: from MW4PR03CA0197.namprd03.prod.outlook.com (2603:10b6:303:b8::22) by CY5PR12MB6550.namprd12.prod.outlook.com (2603:10b6:930:42::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:36:23 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b8:cafe::ab) by MW4PR03CA0197.outlook.office365.com (2603:10b6:303:b8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36:22 +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 CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36:22 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:36:20 -0600 Subject: [PATCH v9 03/13] x86/cpufeatures: Add Bandwidth Monitoring Event Configuration feature flag From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:19 -0600 Message-ID: <166990897968.17806.16187773270520553795.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT046:EE_|CY5PR12MB6550:EE_ X-MS-Office365-Filtering-Correlation-Id: 98cd4971-5ad4-440e-b2e9-08dad3b1cd03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9/9R15tZnmTzk4hAzC/k/4t8yNyYCK4xrRX8oTAOPLWOaX2Bhhr4tYXtdCVvv0s0rYaqQcG4Hu40KvAbSCiNMaQzKt0211pJEhhrvnG9OEwJ1BzNvhzgRZHwBpAmQ9E4h/DGq0KaONazjkUug17W0lRXCAt5TFJVXLPwusn41eOQkEBl321u5LI0eD+RCFQToCyucNA/dBIiYiwbBh7lXywi6jpwDChgV2YwB8vTYWa0vNd+f5VNiz8R8JrAwmiFlNoFjEZiElFHDo/aKxjS5N/gOPmzsaW/yAALq8Y6deMqISPZJ+q0bH74zrvUP7EB7+673OSMSFmdEY8PLYUYyantuBH6FMxMgoqB5QjFmddZE3iPdzk0qOLI4XX/oyrjOd0TnPvlyjl5r5GmTBtKyhTDXb97V5JMUJKEtk3TG8Q2A6PrP6XGVwyumN7RYWSz4mzUMF7Tw0W3ZDDeoJo7q72V6/YUKJssdJvTsMjsyYcjc3+2N9MSeaEH2WDqDfPfsCptuyEXpHBYv7FQQjqFUcY1Frk5d9mRVPWML6mMJtiaMf/PorGOVExFTkmFLsODfsEaqv/oxZEuHYpOOPrQrwqUPEDnFxm6dZta5xE6DFHPkvQIzu4jp8i5l9kz6kG6raTSNtnlWEdBvGDynu3UWNSIFw8VrTbGSl0R3sbe1eAIzEw64IncfLKSx53APRWm0wqsUlDQu0Gj/gW0oFLjbLm94unlGVz//jxTSUIogksO+Wr79SPb1Df1dRHlZPy8iC3Gt/A9laU6Lqy4/Jk+Le9FIb2mILbBNWJAhfY9LL9iJUf9+8UwutGNoe9T3IpEev2iZG3q8LIoZv0Xo9m9ow== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(7916004)(4636009)(136003)(39860400002)(346002)(376002)(396003)(451199015)(36840700001)(46966006)(40470700004)(40480700001)(16576012)(7406005)(103116003)(5660300002)(966005)(8936002)(7416002)(316002)(86362001)(478600001)(40460700003)(54906003)(83380400001)(47076005)(70586007)(44832011)(8676002)(33716001)(16526019)(4326008)(110136005)(82740400003)(356005)(9686003)(336012)(82310400005)(186003)(81166007)(70206006)(426003)(2906002)(26005)(41300700001)(36860700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:36:22.6246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98cd4971-5ad4-440e-b2e9-08dad3b1cd03 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: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6550 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026524842704302?= X-GMAIL-MSGID: =?utf-8?q?1751026524842704302?= Newer AMD processors support the new feature Bandwidth Monitoring Event Configuration (BMEC). The feature support is identified via CPUID Fn8000_0020_EBX_x0 (ECX=0). Bits Field Name Description 3 EVT_CFG Bandwidth Monitoring Event Configuration (BMEC) Currently, the bandwidth monitoring events mbm_total_bytes and mbm_local_bytes are set to count all the total and local reads/writes respectively. With the introduction of slow memory, the two counters are not enough to count all the different types of memory events. With the feature BMEC, the users have the option to configure mbm_total_bytes and mbm_local_bytes to count the specific type of events. Each BMEC event has a configuration MSR, which contains one field for each bandwidth type that can be used to configure 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: ==== ======================================================== Bits Description ==== ======================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== ======================================================== By default, the mbm_total_bytes configuration is set to 0x7F to count all the event types and the mbm_local_bytes configuration is set to 0x15 to count all the local memory events. Feature description is available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication Link: https://www.amd.com/en/support/tech-docs/amd64-technology-platform-quality-service-extensions Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/cpuid-deps.c | 2 ++ arch/x86/kernel/cpu/scattered.c | 1 + 3 files changed, 4 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index b6a45e56cd0c..415796d7b309 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -308,6 +308,7 @@ #define X86_FEATURE_CALL_DEPTH (11*32+19) /* "" Call depth tracking for RSB stuffing */ #define X86_FEATURE_MSR_TSX_CTRL (11*32+20) /* "" MSR IA32_TSX_CTRL (Intel) implemented */ #define X86_FEATURE_SMBA (11*32+21) /* Slow Memory Bandwidth Allocation */ +#define X86_FEATURE_BMEC (11*32+22) /* Bandwidth Monitoring Event Configuration */ /* 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/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c index d95221117129..f6748c8bd647 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -68,6 +68,8 @@ static const struct cpuid_dep cpuid_deps[] = { { X86_FEATURE_CQM_OCCUP_LLC, X86_FEATURE_CQM_LLC }, { X86_FEATURE_CQM_MBM_TOTAL, X86_FEATURE_CQM_LLC }, { X86_FEATURE_CQM_MBM_LOCAL, X86_FEATURE_CQM_LLC }, + { X86_FEATURE_BMEC, X86_FEATURE_CQM_MBM_TOTAL }, + { X86_FEATURE_BMEC, X86_FEATURE_CQM_MBM_LOCAL }, { X86_FEATURE_AVX512_BF16, X86_FEATURE_AVX512VL }, { X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW }, { X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES }, diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index d925753084fb..0dad49a09b7a 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -46,6 +46,7 @@ static const struct cpuid_bit cpuid_bits[] = { { 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 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { 0, 0, 0, 0, 0 } From patchwork Thu Dec 1 15:36:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp329723wrr; Thu, 1 Dec 2022 07:37:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf521/7K8+cap5ujENNliIwjTViiom0RT/7RUwuXj5BCTLVdJRtFqPzX/2Si7Do4O5njv9lI X-Received: by 2002:a17:90a:4a85:b0:20a:dba9:ebe2 with SMTP id f5-20020a17090a4a8500b0020adba9ebe2mr78966407pjh.136.1669909055962; Thu, 01 Dec 2022 07:37:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909055; cv=pass; d=google.com; s=arc-20160816; b=q0NSPJ014TdKf/0Yezc9rTMNLhpO8uXIizy++Zq4NQakyTs8TnOH4hZVNwDZqz5Aus fMaOProlImcZC6bc1U1yOe6tvOqEQl+MQrMfDjuHJAhZIVme6b8zUWGZA+t166vAmJX+ Rx1z8noQsOIHlNrx7K6lMvyvOXGWPK5bBvjo0GFnaBEk379jGWqfIclWJnoGjzZ75HTY sITh5JEsGju5JXYOLDJofkgM3xp2vy1djg0NYUJRT8fqCwdKTP0AaBJaZMGo7W4e2N0y qCDnvRSBiOIHATwnACIXP59MOLUPoAsBgbWbfKh4sYHr3TfZ3SsAHkG8VyF7gsApw73C pNrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=LhgL6i4JEcY9+QVUte286D9t8xhROvUeJPLIDM1M5q8=; b=pGhcUYSsmy77msR4Lk29Pf7wSn17+BImvkSs28zzkloMd4zCGqIXn6MgIQpspTQFeJ ecWS1as3bTUa3UQSA0PH/ODN4wE5xmm3t3NZv3Va52zmp+kkyzHk2AZ20/gMNBFUVll7 uX/j0GGr5qmL7mEaLbwNfdtgRfaLZUN+y50JkTI+m8rJ81yrrnvaEqZXhV44JuIeORII /b1usCnT6WsHYvoWSQjG6AymZfmi3DAd6oYJf7E4zY6WbBhxPcUpM78WKJ9fmF9pasxo L47Ck8wWjmjXizpeqjGyNEYZ7t4qoLHaZkxkKx+3YNP5Jb12elmrdiZFsPSwctNr5GIA bftA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=49PNzIAY; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a17090a9a8800b0020053614bd0si7620304pjp.148.2022.12.01.07.37.22; Thu, 01 Dec 2022 07:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=49PNzIAY; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232021AbiLAPgp (ORCPT + 99 others); Thu, 1 Dec 2022 10:36:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbiLAPgi (ORCPT ); Thu, 1 Dec 2022 10:36:38 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2070.outbound.protection.outlook.com [40.107.94.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8826AD31D; Thu, 1 Dec 2022 07:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PEp9kiUDE/zylQ44wv5CQEZebdf8oWtiIrvWAePHA53r4aYCQ4GzN+UK5kA0q5CtHfFR7PWWlXb9NEDxFUyC7MTltwojzyBRpboMJ9GyIp7pjRqCtFnMdmyfNhrHWhxLX3EPQO4aq8EM9d8M9fK57QEP7gr8IyjB2xQ7j1eyW6+i3mwi8ExW+YQ7NotVJoD6YupUrqEueZn+OWCwsWAkjzC10CUbYjcStMjeGNq38mguzqb36v1p6KhAlRe2aR3b4HSPNu1nVlG8eWFe9injptX00EWRozw1pwbxkJ5cxuZQs08pgAT/Af9YqhwWEopHYkqV5wiajuiQUH8/EsHy0g== 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=LhgL6i4JEcY9+QVUte286D9t8xhROvUeJPLIDM1M5q8=; b=Bi7vNnTlLunOgT+p/8SUwv++0AOeHnYxP66zdwHdxUspjA1Y5J2T7yjUt8HG8FqxYjJF2PEx52Fn/8YVwF4yFM8EFEDMPmWcDz3gYnh8KwMBi9FEjEszNKIOydCbC+OX5s2YijdfO317+Eq+BLxFtqUiukoMbRc30fF5eD+6NmLCLG5t2uHfS+wiO2qzAY37u9JTy+DaOnTYzMmPhZ+xWIxAyITeZaXPEoJhNg/d75jcIGdh0GjuSBORStnpUYD13QK10Dqz+hkaYiAQ7tSzC3XMNLqZvjVsJe+ezbsdkwa6jcFPsmkwHYKYOWoJWkd82MPTX/pDe/bbx6GnroVu9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LhgL6i4JEcY9+QVUte286D9t8xhROvUeJPLIDM1M5q8=; b=49PNzIAY9BshvDSV1ZeDB8IG+7E3XTVKdQ6QE2fXGEyi40teakpUWEGXLWad//8LXH528rApLcL6iDgpNwNHx65aukm/NLOsUuzQt0N1COjCFZVv8X46+xTP7SbvG7q3sEQmxJq2hJKX218qA5pcwUKqe4eDHNyx5UIMlGfkKE0= Received: from MWH0EPF00056D03.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:d) by PH8PR12MB7231.namprd12.prod.outlook.com (2603:10b6:510:225::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Thu, 1 Dec 2022 15:36:30 +0000 Received: from CO1NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::201) by MWH0EPF00056D03.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5901.4 via Frontend Transport; Thu, 1 Dec 2022 15:36: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 CO1NAM11FT024.mail.protection.outlook.com (10.13.174.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Thu, 1 Dec 2022 15:36: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.34; Thu, 1 Dec 2022 09:36:27 -0600 Subject: [PATCH v9 04/13] x86/resctrl: Include new features in command line options From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:26 -0600 Message-ID: <166990898682.17806.2447018872734886554.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT024:EE_|PH8PR12MB7231:EE_ X-MS-Office365-Filtering-Correlation-Id: bafb2e31-e618-4eac-069a-08dad3b1d13e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QnQNyo5CqeU31aWbkoN0tiCeCTF0//4OO6eEe+Qo5JCpEXqpPf9CXhaQp5r3WZU6SiZfwkmcjxgr7PeSujghhpR3lED6oFOS52Nox+fdMDp4NfrN6CtL4bS684X0A1JUfLaR2hkSjxZ86gOSdxXMF35FEbL9pQzKVVtoUHVmQy3elk08zQJyrT4dQ6/Z910sBQGhSgB59VDUPGMZ0cB0smZzzCNTK/i7zrtkEoEXEFxUB9DiVpem5L4FEsWt6HFr+Z3x5CXk5jnmRMB7mzkVdP092m5ZlMUWi7I/5Tjafk9PZev0aI3BSpE7WOjGYbfIpOELpBgEPoNg2+v2FhRAXwrHiqH9SFfDBWOCsxGgHjZUDV8upU/kCb5CHTDU0uwVrXizLYkpxRLjB1xbiYOME5uMhaW9OLb3fF65/NF2EMrPQXQsiJZ0N4kIcVwyKKcgH7YrjsmA8eyhOSVtlcIEENKJ+BXzDY7sB7ZsvPuugzfBWA+Hr7t+kM7anFk9o8McTUwinGLx2iCY3IojLibu9AuMHvisjry0iiBupfeDQ6/hOrP75p0XAi4Ga7wzonRTlT7C75SfAPX8wy68pox5AicV1ZZ4ohKOmOrFulrlBL1mrpCbHeY+a0qdkQyKnvNtYv87g2wsIBtTItCt1JNLRy6fANgqbgCSJf62eItoCIGxlrPBKtnaF0QbsTuc6txB6NeGd2erwTOpkvrg1xENOquCvjdka+apK5KiUnH2B+UH9hQPXnS6X3SwWJ7F/HTUTaLKTz6KzrM6dtyyeNCrOg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(376002)(346002)(136003)(39860400002)(396003)(451199015)(46966006)(36840700001)(40470700004)(33716001)(81166007)(40480700001)(356005)(40460700003)(86362001)(103116003)(478600001)(9686003)(110136005)(5660300002)(7406005)(41300700001)(7416002)(2906002)(316002)(4326008)(54906003)(16576012)(70206006)(36860700001)(8676002)(8936002)(70586007)(44832011)(82310400005)(16526019)(82740400003)(336012)(186003)(83380400001)(26005)(47076005)(426003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:36:29.7959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bafb2e31-e618-4eac-069a-08dad3b1d13e 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: CO1NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7231 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026558127869966?= X-GMAIL-MSGID: =?utf-8?q?1751026558127869966?= Add the command line options to enable or disable the new resctrl features. smba : Slow Memory Bandwidth Allocation bmec : Bandwidth Monitor Event Configuration. Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- Documentation/admin-guide/kernel-parameters.txt | 2 +- arch/x86/kernel/cpu/resctrl/core.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 42af9ca0127e..a7b6634f4426 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5190,7 +5190,7 @@ rdt= [HW,X86,RDT] Turn on/off individual RDT features. List is: cmt, mbmtotal, mbmlocal, l3cat, l3cdp, l2cat, l2cdp, - mba. + mba, smba, bmec. E.g. to turn on cmt and turn off mba use: rdt=cmt,!mba diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index f6af3ac1ef20..10a8c9d96f32 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -659,6 +659,8 @@ enum { RDT_FLAG_L2_CAT, RDT_FLAG_L2_CDP, RDT_FLAG_MBA, + RDT_FLAG_SMBA, + RDT_FLAG_BMEC, }; #define RDT_OPT(idx, n, f) \ @@ -682,6 +684,8 @@ static struct rdt_options rdt_options[] __initdata = { RDT_OPT(RDT_FLAG_L2_CAT, "l2cat", X86_FEATURE_CAT_L2), RDT_OPT(RDT_FLAG_L2_CDP, "l2cdp", X86_FEATURE_CDP_L2), RDT_OPT(RDT_FLAG_MBA, "mba", X86_FEATURE_MBA), + RDT_OPT(RDT_FLAG_SMBA, "smba", X86_FEATURE_SMBA), + RDT_OPT(RDT_FLAG_BMEC, "bmec", X86_FEATURE_BMEC), }; #define NUM_RDT_OPTIONS ARRAY_SIZE(rdt_options) From patchwork Thu Dec 1 15:36:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28433 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp329767wrr; Thu, 1 Dec 2022 07:37:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ChwIGGcflDU0FnuklaOg7MhWvC9RAq1zCPxgtJ/K4MSHserFY8mBB6x18IourzHxZc7Cw X-Received: by 2002:a17:903:452:b0:189:6574:7ac2 with SMTP id iw18-20020a170903045200b0018965747ac2mr34188061plb.65.1669909063347; Thu, 01 Dec 2022 07:37:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909063; cv=pass; d=google.com; s=arc-20160816; b=jJhpc1cUmPTFn2GTje1iSuG2By3+imn0VCdxsE1blVO0GnUaHWFQc5Pf7h43ClX+2D xc8EF1SPOuA3XxBPknXT9E1/tn65pj2Q/8GAz65hhiVhHQ6ywuDBsu6PQN7fl0flYUnb XIj0JeXJgtg3n45nBeNAAQAXBOFFi4NCroMKsdA7uoG3Ve0Bqcr3GiJFiW0vjnYaUc4e kxT5KyRn46oM2b6CqOTT5fFluRIXhJrrIuxGjN0WpPJhmXxBXsU4nlJItuW0ihBUO6bx aJ/Vzs9zSstyIpdhpc27PdTr6Zn6f5rx65CiCLaqT6SSgR6w8nLC2fK1zpSa215Cc76M eraA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=AW2zd7jFywMJXdOBOuCf1XiDGPqCamz7HHcj07GWYDE=; b=V0L7qDV3nPEukV9BS0SqQ+baHQrjf8p0hOETolbVFFYBVK101K2iArphBXoNc6uRJn DRN4+B1Hvvhk1v/+CnmP9t48WEb+prpFAH75SIzmiuzjhHEL2PSpV6G6A6yZ+wN2WxXW 618A+wJDwzo9Y2A7OJXovILdbtE8tFIDhfI8WXpgk3lhxTQgs0FDJbFTDoSEAdGGGK+M rqGKQJvC7OMLnI/Zu5h/Y5AaC0yo2nIb0jWlrJbkMokprdQRi/zMepAckmx1gQUsW9UM 9ie+G9U3rnBkZD3rE6EeqAW32/Ye0IrT1n3vRDqF2QbeJru6aIWrHun5KmcnYLTjgbUC e5Sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xWF9mnZ+; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a632c15000000b00477a3989772si4870900pgs.12.2022.12.01.07.37.29; Thu, 01 Dec 2022 07:37:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xWF9mnZ+; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbiLAPgu (ORCPT + 99 others); Thu, 1 Dec 2022 10:36:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231967AbiLAPgn (ORCPT ); Thu, 1 Dec 2022 10:36:43 -0500 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2084.outbound.protection.outlook.com [40.107.96.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB7C240B1; Thu, 1 Dec 2022 07:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nN4ivzPGuurbaOPAfXeeaLVHXTLCf7gHnuH6bCgdDbFqsZisjtpN+AOtgey1JBMAC4s/6uGUlF9L/uJ6HpjfrsHQA5Z3qF8abYwkvwHdMMtNyxTbIzKIpNF0ZW/KAmDJvtQx24onkFKGaFRj4XbOm2UZPAl/2fNR+iqDTfwjxT0/QcwhiIXjMThuaJC8LexgP47wVrwLxbHDp6uxQIAHCSHfJRx4nBX7wm2UOfLcBN2H7g+7H50zeybnBMU2OmyKBksEBwLfEIuJov+KtDl8Xpu3oxB8VZCTmGRjyW2MF81VR3bS0Kpar9V0yHQaxUDfsBcyhOybMohFmB/o8GToAw== 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=AW2zd7jFywMJXdOBOuCf1XiDGPqCamz7HHcj07GWYDE=; b=e6nc3ofGC3SErpeGJnjZNTIGNDXABc+3vFf910jL8ViWRAa+Ut2bYhWLSWFQqooq1Rlr0Wkf50HQmk6wt4B2vVqeeElco83maml0nvdpGLm0GocjjP8beumvUwH1/G90XGNFYr2T/lIVBvXfc299ac3tqVGVB8WEQ0nst1k5/5bt6KRBKWto51AyjdXTGtc2WAMpvzzQHrf3L7BNnI921U28b4zW13bBw4FddPc37V5wcn5B2ZEh8I7cP6f7AObgROZ7EC/xjrFeDEd+rwyOQV9NHvkMsvD1WM/zElS+UF4EuViNAOYBvz7PyYB0DFYmW9Bw6E72cKwnOYgXOyAnSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AW2zd7jFywMJXdOBOuCf1XiDGPqCamz7HHcj07GWYDE=; b=xWF9mnZ+B+8eLOWVBXN0QcLU3/pZW5NVe5+npqatzAmlISBlGLT0hfHSV63rYAI8DKKsYVL3QROh3v2b7wGPUqo7vGEW0QaqwaZvd3I9KJ70YsozG2ImxBOEDjzT+ZLLGuDW/b8+AlTxEp6E5PxLlzuRYmW+V7/LkMY1DVD8GB4= Received: from MW4PR03CA0192.namprd03.prod.outlook.com (2603:10b6:303:b8::17) by CY5PR12MB6153.namprd12.prod.outlook.com (2603:10b6:930:27::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:36:37 +0000 Received: from CO1NAM11FT110.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b8:cafe::ae) by MW4PR03CA0192.outlook.office365.com (2603:10b6:303:b8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36: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 CO1NAM11FT110.mail.protection.outlook.com (10.13.175.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36: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.34; Thu, 1 Dec 2022 09:36:34 -0600 Subject: [PATCH v9 05/13] x86/resctrl: Detect and configure Slow Memory Bandwidth Allocation From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:34 -0600 Message-ID: <166990899399.17806.8574636266624372983.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT110:EE_|CY5PR12MB6153:EE_ X-MS-Office365-Filtering-Correlation-Id: 044ff21d-6125-455a-79ba-08dad3b1d57f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: daxT0xhPBWeYmJpJfrrRgQsW/WOQ5h2RTmm7OWDTPIu2TmSqIYJYf/pOd0bo8jo521YLG4Lm7lyUVbABYyUX8fvyFsYSR/MX6ZCRCnuiq2MEd1orRFKRmw3GKNdKMJFqt25TMxajkq+EubzXTpzNDKHsMe/aez3jUPB5EiChEhFD6BsdxWUrzixmf/ghseitPnxz67m8A4gKMbBO7q6Q4tYqtd5Pk6vzrD09eCerb4Za0xCse2pyBPOxX1skYIPDq6TXiO7yw2vJiFmskl3ZLDfjK0L7g7XJLdVK4V/QvEYEUmygDHstqTyEYQajLwzIeDgnW+cAsrGI+hBDffttSAGTjzQ4qdPBQYg6cEAWazbXm9Abzd47911uUwd0jP+iUvanE6EL8XejwSHfqGQb/3GSIzDH9XCgExHWYylqA1ATy7y1MU9I+tDV8eTa21GrbLqFEKp4/8T5JJcXH0ZHCi/tb5jcWFzWtBIaxM1NiLiS+6CQKNJ7GF4gHhz3a8D5pmVw4vtKMF33r7FeZPW04cOFypkprJ1/ZBhjsaPRl+oTHu83uxsow7ly6eWU0k+Wm8xEb3rkMv2db7kjFyPQEwZb1MmYrMUBMbeWpPiJziNq8QRYpYVWk53RnBIYEzAIia+BSeDSd2hgZTtaJfGrj7CrkIGAMu5VqWq8xw4LNuLh7oRliyFnKZoFrTelkszmZMkqfR8HwtxzUgwMgMit2I2AGXO7PQNFDv8OCnB1XamIOImhy8Dc3fKCM/4Y4LbgGMVBBGCt8ttI2ra+t6H37Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(346002)(376002)(136003)(396003)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(103116003)(356005)(8676002)(82740400003)(2906002)(7416002)(7406005)(41300700001)(40460700003)(44832011)(426003)(81166007)(36860700001)(70206006)(16576012)(86362001)(83380400001)(47076005)(316002)(54906003)(478600001)(110136005)(8936002)(186003)(70586007)(5660300002)(26005)(82310400005)(33716001)(9686003)(4326008)(40480700001)(16526019)(336012)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:36:36.9357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 044ff21d-6125-455a-79ba-08dad3b1d57f 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: CO1NAM11FT110.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6153 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026566125115399?= X-GMAIL-MSGID: =?utf-8?q?1751026566125115399?= 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 Reviewed-by: Reinette Chatre --- arch/x86/include/asm/msr-index.h | 1 + arch/x86/kernel/cpu/resctrl/core.c | 36 +++++++++++++++++++++++++++-- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 2 +- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 8 ++++-- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 37ff47552bcb..e0a40027aa62 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -1061,6 +1061,7 @@ /* - AMD: */ #define MSR_IA32_MBA_BW_BASE 0xc0000200 +#define MSR_IA32_SMBA_BW_BASE 0xc0000280 /* MSR_IA32_VMX_MISC bits */ #define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 10a8c9d96f32..b4fc851f6489 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -162,6 +162,13 @@ bool is_mba_sc(struct rdt_resource *r) if (!r) return rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl.membw.mba_sc; + /* + * The software controller support is only applicable to MBA resource. + * Make sure to check for resource type. + */ + if (r->rid != RDT_RESOURCE_MBA) + return false; + return r->membw.mba_sc; } @@ -225,9 +232,15 @@ static bool __rdt_get_mem_config_amd(struct rdt_resource *r) struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); union cpuid_0x10_3_eax eax; union cpuid_0x10_x_edx edx; - u32 ebx, ecx; + u32 ebx, ecx, subleaf; - cpuid_count(0x80000020, 1, &eax.full, &ebx, &ecx, &edx.full); + /* + * Query CPUID_Fn80000020_EDX_x01 for MBA and + * CPUID_Fn80000020_EDX_x02 for SMBA + */ + subleaf = (r->rid == RDT_RESOURCE_SMBA) ? 2 : 1; + + cpuid_count(0x80000020, subleaf, &eax.full, &ebx, &ecx, &edx.full); hw_res->num_closid = edx.split.cos_max + 1; r->default_ctrl = MAX_MBA_BW_AMD; @@ -750,6 +763,19 @@ static __init bool get_mem_config(void) return false; } +static __init bool get_slow_mem_config(void) +{ + struct rdt_hw_resource *hw_res = &rdt_resources_all[RDT_RESOURCE_SMBA]; + + if (!rdt_cpu_has(X86_FEATURE_SMBA)) + return false; + + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) + return __rdt_get_mem_config_amd(&hw_res->r_resctrl); + + return false; +} + static __init bool get_rdt_alloc_resources(void) { struct rdt_resource *r; @@ -780,6 +806,9 @@ static __init bool get_rdt_alloc_resources(void) if (get_mem_config()) ret = true; + if (get_slow_mem_config()) + ret = true; + return ret; } @@ -869,6 +898,9 @@ static __init void rdt_init_res_defs_amd(void) } else if (r->rid == RDT_RESOURCE_MBA) { hw_res->msr_base = MSR_IA32_MBA_BW_BASE; hw_res->msr_update = mba_wrmsr_amd; + } else if (r->rid == RDT_RESOURCE_SMBA) { + hw_res->msr_base = MSR_IA32_SMBA_BW_BASE; + hw_res->msr_update = mba_wrmsr_amd; } } } diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index 1df0e3262bca..2dd4b8c47f23 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -209,7 +209,7 @@ static int parse_line(char *line, struct resctrl_schema *s, unsigned long dom_id; if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP && - r->rid == RDT_RESOURCE_MBA) { + (r->rid == RDT_RESOURCE_MBA || r->rid == RDT_RESOURCE_SMBA)) { rdt_last_cmd_puts("Cannot pseudo-lock MBA resource\n"); return -EINVAL; } diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e5a48f05e787..8a3dafc0dbf7 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1213,7 +1213,7 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - if (r->rid == RDT_RESOURCE_MBA) + if (r->rid == RDT_RESOURCE_MBA || r->rid == RDT_RESOURCE_SMBA) continue; has_cache = true; list_for_each_entry(d, &r->domains, list) { @@ -1402,7 +1402,8 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, ctrl = resctrl_arch_get_config(r, d, closid, type); - if (r->rid == RDT_RESOURCE_MBA) + if (r->rid == RDT_RESOURCE_MBA || + r->rid == RDT_RESOURCE_SMBA) size = ctrl; else size = rdtgroup_cbm_to_size(r, d, ctrl); @@ -2845,7 +2846,8 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - if (r->rid == RDT_RESOURCE_MBA) { + if (r->rid == RDT_RESOURCE_MBA || + r->rid == RDT_RESOURCE_SMBA) { rdtgroup_init_mba(r, rdtgrp->closid); if (is_mba_sc(r)) continue; From patchwork Thu Dec 1 15:36:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp338555wrr; Thu, 1 Dec 2022 07:58:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6YF9OEd2zvZnBR8rZNSZnYZBiSsolh/i3xWbMyfTA1TN4HT8gOmgFuPs/0Tb54iJW5NdgQ X-Received: by 2002:a63:f00e:0:b0:477:5e25:6d4c with SMTP id k14-20020a63f00e000000b004775e256d4cmr42896879pgh.159.1669910293837; Thu, 01 Dec 2022 07:58:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669910293; cv=pass; d=google.com; s=arc-20160816; b=ZTBqpxh8nh+2zQS2kwXwC2W7hVsEYSjj++HDgiJibPSRFofsxCESMCBrjzNBgzDiza Wn0Moq0kmwVYRmv1MQPcqWrVAD0lAge/qiTwd3q3PeNmDQc+f30hs2wOWl+ahJnGBbvR +ZRdbkG4vS3dHeh82puo5Uw8pLF3prgAcpvxr2PtWkeRNODMtw81CBLsaBh7Mprzd4Hz ipAu9cBoxsf+oqKUV8R+DsP16aATvYYE057BmDIjF9ugPSOzR+R9OeQ50IZCYXPQFhGi 3cklho7xMsznJf/OH8eLIYXg2wh9HL/RTkonq38Q5jq52KT6gLNu0WTDIAyLR+FGkE+G hT1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=YhymE8J2J2VKrJKj+eoQdxHpbz1Uz67GFmgMCMjBxeQ=; b=HSIeRrD6tX7CoxdzHHDe8NrO0l3MaY7qdXD6vt+A+uIzk4buDRj7GD8iHF7Yw6+PsL yVjpdGxJfbBKgF8X8VVcYjR9BhhmhtHVdzAk6dBqluogR/CJchvEjJeo4gao4ds6gPHb WhQJBse1BBHqHn/X+7opeOg7j6xf9EmNcZ/xGB5BycjrSgBxD+VgryBcMgBFDZ+/98dX RqHUDPtHAmkqlwT4+/gkuO0YyOSkzUdkiQLu3IzkNRTOTQWbLJINjEwTUgjVanSDhy2U yrlCKPrSSapnH5/vv9PTxRj1w8UHkU5VswFa6gBr5UfOROGqdjJDUjI000Q7tmSJ/BX3 LL7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Kihilvyb; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm9-20020a17090b3ec900b002190ba4112dsi5204353pjb.94.2022.12.01.07.57.56; Thu, 01 Dec 2022 07:58:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Kihilvyb; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbiLAPix (ORCPT + 99 others); Thu, 1 Dec 2022 10:38:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231998AbiLAPgs (ORCPT ); Thu, 1 Dec 2022 10:36:48 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430688D649; Thu, 1 Dec 2022 07:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WtX/1umaSO58/yBN/I//OsPMQt4OQQ05FutZl1k3wZahCmbst2PE+/JckY8Hyg3pSXxn5qRqxwGjC1XvCflT8yVyjhxFVvk43wYXaNiE69a276AYHxr7KQTFiW91C94ygwTnnb9C8XmPUQLon8yIrvyYBKfY1cPV9KHSgt8HXfhBuGE7s9/NmRVQHyiU+O62UD9Dn1x7yNFXCltLurIjXVEuo1C4GQGdkGL9C/iVoaAlbPVVUOZLKz4F9egHfkZE4q02Xi2dI1dvLZFskm/ihsr3lckeLBjtdkqWvFMEDG41bOAoABMBrd6HvXp51CgI8pcK1NARCO/17rfmBAOuvA== 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=YhymE8J2J2VKrJKj+eoQdxHpbz1Uz67GFmgMCMjBxeQ=; b=g17tJ3POxoOdL4cOseOzhGsRCyjElo14uvuF5vlW2EmYlaSqqWRqM3nq0cadMvg7D7gY2de4nrx1DdJDXfK3/Ntec0mKeOnwhiCFeEvluk/OsX0ifWbq1NVG1/iSKiSVVYL31VqRpFX9fQhAHgysJ3E9jByDKvtGGrnQTmfPL43F7Fq4OQTn7OCo3vYh8PKl07dt8KMUFarg/FhEXC6A9874JcgaW0M5Dq3HMRYV8jm8iBpZvIbw7tL49fN6QraxjqWIelFvzDVW86Yb8iW3ztNJW5nQKj4v1IJ87I3/qTvxiPnuMrb4ulofHOVOpZWQlJI81+X+yucq9Gk5szYa9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YhymE8J2J2VKrJKj+eoQdxHpbz1Uz67GFmgMCMjBxeQ=; b=KihilvybwvmCs2l9PpV7NN6dCYfq3HE4UNhRBUnGihOx264nbtjeuL3z5ncLMWoeCP+LdzwbQ2IAgcx8BCpcOoAKwd5bgIFESf7vhJ4fl/tldlgBNiX0rpRmxhpiSeEAFBLx7Vg+ww9crLPOJNS47PuIB2JnVTSrAsHG9UXfwVw= Received: from MW3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:303:2b::27) by PH8PR12MB6865.namprd12.prod.outlook.com (2603:10b6:510:1c8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:36:44 +0000 Received: from CO1NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2b:cafe::8a) by MW3PR05CA0022.outlook.office365.com (2603:10b6:303:2b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17 via Frontend Transport; Thu, 1 Dec 2022 15:36:44 +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 CO1NAM11FT011.mail.protection.outlook.com (10.13.175.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36:44 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:36:41 -0600 Subject: [PATCH v9 06/13] x86/resctrl: Add __init attribute to rdt_get_mon_l3_config() From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:41 -0600 Message-ID: <166990900117.17806.4506067708943298894.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT011:EE_|PH8PR12MB6865:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e0b8140-a62f-425e-2186-08dad3b1d9e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vJFR55M4jFpguM2lXfcE33iVFauBpUa6+SyasIkQ9Il1hGeaRoJ4WnGg73j7Yeukgg39TN+mfn+W8QMYo6CEJWcEyaaOqFbB9Ve4WWLi7Swb+ztjf5UQkupYeHtju8sfgUARJewFG81zLZBKXwEc4bC39ozyhFLD7eXZKDKi0unbA54BHTgX4t/gNyUdT+T/L1RgeSC7iMbq3wv+8nGgFLhn3mcwQdPuNcTv3BRCRre9S7FaBGVT4h9vZBXfXNZvgS+W+yavlxQZQGNEo1IEu4Kip/GPU07RXA87cvyY2df/uHxFT3XvnmcwVhdptp73CdKmo/8F0yVsJxMqyRm5hvdWK6Yk7hKRkStstAN+JXwA+/23hkigOmiqogmlKMCroNPUDK7oL994B61YHPl0LvjBs0s0BSUG7umkpVHMw0OTRf1FVOp1tb2utZq1niPs4SW3Tg06tEnw2JZijBkzRxDE321QT14PR9vbTtkyRp41H+cpiMZ1WCW+zRCJDMbq1A7xINBKq69GQW7qHd4nv7pv0U3qoY6C6zGe/+hnAhWspNN1MY25NzoaOq6gThzt3AzF3s3l48hlX2q6uiQP/Xv8gkW6iumEeE3XxIVud9sJHUNQV3qisMvUwvAR6THNqu5WKjRdIflafU2oCXuw35+SpR8TkQgmIKrbGFgAPxkXDWfQS/NyjHEdQaasnLXHVjXKcu341JkoW0In6ifaBrddRoDIBSXmfkp0cowxA+B5Z2rUT0biBMuwsxOGP2V02YzD4RHDc7HM4jB57AmfSQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(7916004)(4636009)(136003)(346002)(39860400002)(376002)(396003)(451199015)(40470700004)(36840700001)(46966006)(83380400001)(36860700001)(2906002)(186003)(70586007)(70206006)(16526019)(336012)(40460700003)(41300700001)(7406005)(86362001)(40480700001)(82740400003)(26005)(110136005)(54906003)(81166007)(103116003)(82310400005)(5660300002)(8676002)(7416002)(47076005)(426003)(16576012)(356005)(4326008)(33716001)(44832011)(478600001)(9686003)(316002)(8936002)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:36:44.2997 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e0b8140-a62f-425e-2186-08dad3b1d9e3 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: CO1NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6865 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751027856341634527?= X-GMAIL-MSGID: =?utf-8?q?1751027856341634527?= The function rdt_get_mon_l3_config() needs to call rdt_cpu_has() to query the monitor related features. It cannot be called right now because rdt_cpu_has() has the __init attribute but rdt_get_mon_l3_config() doesn't. So, add the __init attribute to rdt_get_mon_l3_config() to resolve it. Also, make the function rdt_cpu_has() available outside core.c file. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 2 +- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index b4fc851f6489..030d3b409768 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -728,7 +728,7 @@ static int __init set_rdt_options(char *str) } __setup("rdt", set_rdt_options); -static bool __init rdt_cpu_has(int flag) +bool __init rdt_cpu_has(int flag) { bool ret = boot_cpu_has(flag); struct rdt_options *o; diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index fdbbf66312ec..7bbfc10094b6 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -512,6 +512,7 @@ void closid_free(int closid); int alloc_rmid(void); void free_rmid(u32 rmid); int rdt_get_mon_l3_config(struct rdt_resource *r); +bool rdt_cpu_has(int flag); void mon_event_count(void *info); int rdtgroup_mondata_show(struct seq_file *m, void *arg); void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index efe0c30d3a12..e33e8d8bd796 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -746,7 +746,7 @@ static void l3_mon_evt_init(struct rdt_resource *r) list_add_tail(&mbm_local_event.list, &r->evt_list); } -int rdt_get_mon_l3_config(struct rdt_resource *r) +int __init rdt_get_mon_l3_config(struct rdt_resource *r) { unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset; struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); From patchwork Thu Dec 1 15:36:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp329815wrr; Thu, 1 Dec 2022 07:37:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vFQNENTCPWHEZtwSFD1GF6Cu0RdnZBlFVZPIF4h0tlUV9JzsGXkUBpX151jzjMsF29/vC X-Received: by 2002:a17:902:8f96:b0:189:3803:23e6 with SMTP id z22-20020a1709028f9600b00189380323e6mr45619379plo.77.1669909071126; Thu, 01 Dec 2022 07:37:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909071; cv=pass; d=google.com; s=arc-20160816; b=sn7apVac7nggEnjwxjf2MXDSCCFC4zeb+AssCLaCXi0aU5ZAXKMSGfvX8+JFk7DSaW DZMpamtmpEHBwaxAiGRv1PO+/0Ym4xgoPA+iNagLXmIQ8tiHLL+v1GipVFiAjFn85PX0 v/7uwUZk2+MsmfYB5cWDB4adiuSyBdL8pADKd2aJHxlQ5cpqSiXxdo0erkxWnVU8BpdB xGiy6P7PIOGAQY3B9Osicib1dLj9AgTS49opudYLyLdOrmRO2FV14Mf/W2wmx3OyVI7d CGyWOG4jmQoF9yEtkS0fZujN0NiFGx+JljBkxhxyLbVrV9j/RWYKyhwzzuG43vLdrUfl xkLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=kp0l745S1XIu7+8yr6l2+/6YQvSMNkE6vuVre9tAq6o=; b=S51ggYg8/3SpJO6GJ895/ktChVw+8uamvLJyBs2QhfQPOCHgTwPKfHyWZO7glIZj+O JITO75Mh0RY74z/Zzf9Q3aEFk21cwAHVYQXP4OYboUtLo0ohcJuBWPBc4PF+303OlaOM abrGimxgZqksBNF3RY9EGgLwM6E//JGxzi4YySInHLWho2X6yiEXqQ8Mxvd2gAY5EC/X OQK42oaDZX0tM5yjFGbijm1XclEVPqTEBpRBkegHNjibfcg/pzjiZ+j7cFi5bFiIRD56 mdgFbzvjbyJBL5ZzjRskgM4u0wO1rBOEYouQAuG0fHVZEhQkE/NlGCE0Dkhmg9mLwWIW AqDg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=LmR5H0NI; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s27-20020a63ff5b000000b0047789ad499asi4464493pgk.862.2022.12.01.07.37.37; Thu, 01 Dec 2022 07:37:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=LmR5H0NI; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbiLAPhV (ORCPT + 99 others); Thu, 1 Dec 2022 10:37:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232151AbiLAPhB (ORCPT ); Thu, 1 Dec 2022 10:37:01 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25A5BAD308; Thu, 1 Dec 2022 07:36:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VRDxha4wk3V4zxArTH5aG+HhIn8UoiWw3GoUlU9pjidApCb768hT+W7q0a2OAxOAh1IHYD3RBf0hLTU77MsCeMaQ7m0buVUbrx5t4znr/5NzxjgYwMeZnH2k3XqSRVfBlKePtWwoBoGT5Q1GLDUT0ckLFwW8NaIgrqLhn7RyNtM7/+APqaOAeS4PfzBNl8Ht+zpatPsxUVmU+zPYK6O9eoNHMg+gEJjDPcEVUWYa82q435NzBcb61NQSY/az6s4owcJzds73NCYGmuYwsO7jJ0+uGB7EkpxwKVYA66V+QrKr+q3ODEZKSY6oxiGbed5Ewig4Tq3mkM/q3d2u+xfIKw== 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=kp0l745S1XIu7+8yr6l2+/6YQvSMNkE6vuVre9tAq6o=; b=Ojxdvwi+ch/1Nx6D8I39OU5L/QiduejIb1DruvlEX4BT3nrr2EAxH4r2+2P1rEoT9uPseAWmztx176dDsC0t/JRqp/eDhSt1HssMoZg8+7N2481nrfustktyNs3bnXrbWOILqJlY0A5GK6/4CkvIjwvvNdwWv+gEoVjgYKWee5LCUWGi4Siskb/fS6HaEsrELKQcODLZmiADv2Rvyi6Er30Dz3uoZWWAw8hFRSn1UiOwCJUiM7q/ULFnKVekGBI2OZJYBF3a/2e3IBha7rItscv1TQ0tuGzli3gpzYFFTgPEgx5nra2BJ8eUs1Z0o7/+ffx2u+OtIB1c2mNt1BMfow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kp0l745S1XIu7+8yr6l2+/6YQvSMNkE6vuVre9tAq6o=; b=LmR5H0NIS5vC/2Y7Jnu1KlpeOTVyHSabtbU6doE14hi/WvSJxddV3s/G18QBLN8yI7ExqN9QroN0qmeLqAo+RQDXm0RO3Ur+KYnsqxVvj4EFZWp3vZfG9KRJHXSaEcMGMJaEpnMGTC8EfYOB/PDyE2GT3pUaR9n/VpSszT2iZWw= Received: from MW4PR04CA0282.namprd04.prod.outlook.com (2603:10b6:303:89::17) by BY5PR12MB5000.namprd12.prod.outlook.com (2603:10b6:a03:1d7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:36:55 +0000 Received: from CO1NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:303:89:cafe::2) by MW4PR04CA0282.outlook.office365.com (2603:10b6:303:89::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36:54 +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 CO1NAM11FT050.mail.protection.outlook.com (10.13.174.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:36:54 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:36:49 -0600 Subject: [PATCH v9 07/13] x86/resctrl: Introduce data structure to support monitor configuration From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:48 -0600 Message-ID: <166990900849.17806.5346239458898437535.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT050:EE_|BY5PR12MB5000:EE_ X-MS-Office365-Filtering-Correlation-Id: a5a37182-d919-4846-e2d6-08dad3b1dfec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q2tlRxIJGysZvD8ohQWmJ9Z0RRWdtUCFQ2+TbxFBGviW7oB0e1NNOLj1OEqI1EgoczgdzheacekEQGExzrkXIu+3YDAoivKDbd/DZSeaxZVxvqiqiPuaVPS7U41+xStSb+blKkleagcbOfOCzBRlSuzH+RAc7M8h6pB/cKBQNfqbC84r3UIQxVb1gyBo4eG6Y20gbBPggYyMoXQ4NnZKBdrA3B8xQalUFvzSC3b2e2VYtIrikfnG6VcgWrXxbqlzSzdJG8QZnabr0yhcyCQWYAREnVZQGkIKIr3RzMmhN5kcb+DB7AC4nnDgq7QQIBmQMp4IblRBzn3axapZh0d6reo74tDzwEU/CSVyYqEAqxMySva4U1qD90ejw16XKYkhXKxCR9+l+uigaIpl3RwFFdl7B/tBQ8H1m/IIDKD2s96QXTemezuD/tBJKm8juWRUX9bE7vfUrGjXnfD9mrwqHXgn3lqcZiVLUqhUgvlNBhYxRA1qtEkwyxDBQuxmqKWH92E899g1rG9AuUXzBXMhB0wN5eL2Q3z9cwubYS/in5rfNserGoOdyqRTsEAx5ovdAi1Y3lYfRokucV4EGab5ahK2jOztjj3l58Lfvoh+G09IuZb3lJzpQfd/LRWIW5j1OFALc8u0zpPrCIvBnG/7+l6JJARI+bG3eQoFnnEVQ7WbS9lDRry+UnjqC76M3aOQynMejsBEwt6KSTtoOz8VAqSLqSISfH+B27Jzd+/6FC3SzqMpKak0Hc3sEO097iljTCvuZdtYSc3sX1wlegVuDQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(7916004)(4636009)(39860400002)(396003)(346002)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(7406005)(41300700001)(7416002)(8936002)(5660300002)(44832011)(4326008)(8676002)(103116003)(110136005)(40460700003)(81166007)(86362001)(478600001)(316002)(70586007)(336012)(70206006)(2906002)(16576012)(47076005)(26005)(9686003)(186003)(16526019)(54906003)(426003)(356005)(33716001)(83380400001)(36860700001)(82310400005)(40480700001)(82740400003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:36:54.4299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5a37182-d919-4846-e2d6-08dad3b1dfec 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: CO1NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5000 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026574224813669?= X-GMAIL-MSGID: =?utf-8?q?1751026574224813669?= Add a new field in mon_evt to support Bandwidth Monitoring Event Configuration(BMEC) and also update the "mon_features" display. The resctrl file "mon_features" will display the supported events and files that can be used to configure those events if monitor configuration is supported. Before the change. $cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes After the change when BMEC is supported. $cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_total_bytes_config mbm_local_bytes mbm_local_bytes_config Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/monitor.c | 7 +++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 7bbfc10094b6..b36750334deb 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -52,11 +52,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 + * @configurable: true if the event is configurable * @list: entry in &rdt_resource->evt_list */ struct mon_evt { enum resctrl_event_id evtid; char *name; + bool configurable; struct list_head list; }; diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index e33e8d8bd796..b39e0eca1879 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -783,6 +783,13 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) if (ret) return ret; + if (rdt_cpu_has(X86_FEATURE_BMEC)) { + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) + mbm_total_event.configurable = true; + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) + mbm_local_event.configurable = true; + } + l3_mon_evt_init(r); r->mon_capable = true; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 8a3dafc0dbf7..8342feb54a7f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1001,8 +1001,11 @@ static int rdt_mon_features_show(struct kernfs_open_file *of, struct rdt_resource *r = of->kn->parent->priv; struct mon_evt *mevt; - list_for_each_entry(mevt, &r->evt_list, list) + list_for_each_entry(mevt, &r->evt_list, list) { seq_printf(seq, "%s\n", mevt->name); + if (mevt->configurable) + seq_printf(seq, "%s_config\n", mevt->name); + } return 0; } From patchwork Thu Dec 1 15:36:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp329901wrr; Thu, 1 Dec 2022 07:38:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ZllSzUq8Nq46pnlge+rnXY7Bjq6KTLVPQpUERAyXFk171NZABAGWQII046Pzbz+H1bOQR X-Received: by 2002:a05:6a00:2181:b0:574:5c9e:c1f2 with SMTP id h1-20020a056a00218100b005745c9ec1f2mr41930604pfi.52.1669909081668; Thu, 01 Dec 2022 07:38:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909081; cv=pass; d=google.com; s=arc-20160816; b=uc+7Zj+goBXB2+l8+sBGlV+AM6I+0KmaFzZk7G3U28kVJW8AeB8Sx3aX0kulyqs4Ua OLMgjczrhSuBNWWYLbO6eJo+qsG8PdHXXPMCBamt8uc9Y6JgQCQ91trUCs/EGoq5YQ5K pmuqkexPTbgEusdCl0AyUF8dnUWK3D5stD4xDzo9Q1j04Fimu7V7CCtZpJWI3eYCKd90 xWl4u4UUJY/vCShWvrcdRWYMOwoKf+JcMy34TSaetRRMHltND/5Ssn97KzDrtIJAbYAM yBd96cYGsZ6ZCqoqfCxjHZ/o2bQWTlFG3OtTSevut2Mcb6sqcs6rVEh+7t7YHSz3D0G2 AjGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=NiG/9RARrO/kQegglLrfX8Om4FftYr91k2tO+rZZ6NA=; b=MeSo2BtJpA3Qh22hWOH+UKw8Q0pMKbJmdLwo/48HudlCTGTut82/0Zi07jPUiaBkpW hASXQ80AaAo6WHMQmAHv6VXahT3jMvWcegTXADNa9ugmxDwFl67yOLkD7YeRTqBzvU2n fc/pn1LNb+kgqeViMqWISgf/Qsxhc3aoVKh8OGCitBJO0ze5jTVeTkbCsnvU2X4DdtjC vppUkpNauD1+y4xqBo09XQLdBHEio1QSwOixLNyTP/irx0qS1A+a5HJSB1t7OSB/tElf P/jOJ8dEN3BiO0cYDNwjGfnFM+LPcMKIejzsucuS9R6yXxH+jRGBTtknzkQprvv3KM9Y 6IIQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=iwdUnEsf; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a17090a4ecd00b00212f7abe85csi7346215pjl.41.2022.12.01.07.37.48; Thu, 01 Dec 2022 07:38:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=iwdUnEsf; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232057AbiLAPh1 (ORCPT + 99 others); Thu, 1 Dec 2022 10:37:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232190AbiLAPhI (ORCPT ); Thu, 1 Dec 2022 10:37:08 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2054.outbound.protection.outlook.com [40.107.223.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20AF1AE4E2; Thu, 1 Dec 2022 07:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bwM6epcZk7f1RyCbYJ8BNidLtUi908/E5t9tHw/cFO5YI94ly4TKVm4+gCnbhis42kkbaNK2FGLMY+ROXJM9d/+4CwLOBsXy75fFLQFoq5k48M8DYYCVTa4fUfF7avknHOxc70RXFGgEu8FQN6QauxuuW1NDnPz9uM2HAcreel0Z6Xcm+f1BkiQLQfNDEK7lTYuBmA3hMaRn+xfqCCB8m1YTNXNDC/d60MeVMBb29Np1S1m1ADYxK/QDfCVnD/EindYajHj5yr8hhuRab4Krm4jRAu4mNgfSHURh/YP71VnlLeZyc89NbMG3S+o7z64r3XY5PRWgF1u+qLaUO2NQjg== 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=NiG/9RARrO/kQegglLrfX8Om4FftYr91k2tO+rZZ6NA=; b=jWY5iDnBw4Y0NsbIop7Kmvs4WR0BNwiUHpGo0KthtdoQSTg4ia3HLB/0dUVV9fwoL9hhjJ9yHRFtjkuDcYn+okI9PhtauMpUEZaWBBrGxSiX7fZcLtzG1LGE75BNFWx2TY2wljFjR9+md4ZM7xICb2Gam0BEZGL6mpMw/+2pjY0jtnm7VJlu33MreoBz5RD7F6H7a0QJwD3Y83WRy/7YoB9gJEa9l0AV57hUsiwhtMm5jqWN6hTtz++XZ/obXkfEWDP5B+ztCFazf/25qCbZOItV5O5WbOM61uZOpqk55DdELAV0sY5AuN7C/VaLztsuxdrTbpaU5OJfSUSMmz/Jig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NiG/9RARrO/kQegglLrfX8Om4FftYr91k2tO+rZZ6NA=; b=iwdUnEsf4tRcnyEYWxHmikckmElFqHEpNZfjVZzVkHqP532slJFLuN8igLX6Y1aaPlqbJvzrqxPekY0OLALg67G28TCJlLSjrQuj8EGJzW5aEx8M2vwlvwLBNJsgTPIEZLJEgcNCiKj/Dio5kpFg+Ptq8E0Pf5GHBf5Inj069XE= Received: from MW4PR03CA0031.namprd03.prod.outlook.com (2603:10b6:303:8e::6) by MN2PR12MB4357.namprd12.prod.outlook.com (2603:10b6:208:262::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Thu, 1 Dec 2022 15:37:04 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::28) by MW4PR03CA0031.outlook.office365.com (2603:10b6:303:8e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.25 via Frontend Transport; Thu, 1 Dec 2022 15:37:04 +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 CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:03 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:36:56 -0600 Subject: [PATCH v9 08/13] x86/resctrl: Add sysfs interface to read mbm_total_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:36:55 -0600 Message-ID: <166990901578.17806.14559688057407662110.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT023:EE_|MN2PR12MB4357:EE_ X-MS-Office365-Filtering-Correlation-Id: ca28995d-45b0-43b7-18e0-08dad3b1e59e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P0PmAK1EZmeMDgYGHMEA/3NCO19nwiOZvtjWiOoZbRQ1a1LJ8LnbE5h22AVPUo8jCIbOIV+UQyjiGoBKn1Wghu5YT/cVHRIwLzL71CRWJ96Sc+zExvqhYcYk6CKAUEVmRIB8EvQjR/re/Hq85mG5+R6vKI7cX1JogI2fSj6+LolxcFsNFAxQIaS3rCQBlX112LEHCYC9Ul0rC3qTF5FTwnjrPERXtR2Uau42JzU47aHuXpHDwivNVv4UOABv5lLQ2t5HzOusU7tYbbmVSF8KPmsBS18dSOe7+N4LREf9DAg7JVBR9MKUYURbHg50HlP7PzuLgdQXtSVp/KXDyjYPvrjqpgjQJSxGuqz8DKK1jFq0dr66L/bd6wzexRmQn7LPFT62bi8wCpOfxJXwhx0S3lQbBjdbxbwU5A708qNTya6AwkQHdO8fx7a+gFTbTAe+HtO8wpZEfXa5RA2MUlQQdiEDUZU66iAipQ+bdsEE/4MwQSH+X+/j17PVDDu8wR/qi5qVBV3cV716bdYjCIQRdjFJBrPHfZG+5Z7ZCtI0ctnGi7vP9du3k56tCUNjelVfEEZywoWUfj1bzLFCfFUwY/g8i/d0gvuSPuj3XFAsYBQtwqlQB6fqr5omhVnMx9ciEJFxvQLiHhKpNnKLylrEvdBnA2Kh6f5ZFuFX6Em6oT39ko4EUBEuXRUuDpJka1or+gmd+C6Hu/Qjn4IjAaDh8kl5qp+u/aJZWh0VXHLfEd00aHtFNW24UUOfN1Jws0U5 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(346002)(39860400002)(396003)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(16526019)(336012)(40460700003)(103116003)(54906003)(316002)(16576012)(110136005)(40480700001)(81166007)(356005)(86362001)(82740400003)(83380400001)(426003)(82310400005)(26005)(47076005)(186003)(9686003)(2906002)(5660300002)(7406005)(44832011)(36860700001)(33716001)(478600001)(8936002)(70206006)(70586007)(8676002)(4326008)(7416002)(41300700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:37:03.9643 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca28995d-45b0-43b7-18e0-08dad3b1e59e 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: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4357 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026585400046559?= X-GMAIL-MSGID: =?utf-8?q?1751026585400046559?= The current event configuration can be viewed by the user by reading the configuration file /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config. The event configuration settings are domain specific and will affect all the CPUs in the domain. Following are the types of events supported: ==== =========================================================== Bits Description ==== =========================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== =========================================================== By default, the mbm_total_bytes_config is set to 0x7f to count all the event types. For example: $cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config 0=0x7f;1=0x7f;2=0x7f;3=0x7f In this case, the event mbm_total_bytes is currently configured with 0x7f on domains 0 to 3. Signed-off-by: Babu Moger --- arch/x86/include/asm/msr-index.h | 1 arch/x86/kernel/cpu/resctrl/internal.h | 24 ++++++++ arch/x86/kernel/cpu/resctrl/monitor.c | 4 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 99 ++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index e0a40027aa62..2e5f57c93605 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -1062,6 +1062,7 @@ /* - AMD: */ #define MSR_IA32_MBA_BW_BASE 0xc0000200 #define MSR_IA32_SMBA_BW_BASE 0xc0000280 +#define MSR_IA32_EVT_CFG_BASE 0xc0000400 /* MSR_IA32_VMX_MISC bits */ #define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index b36750334deb..f7fc69e82e8b 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -30,6 +30,29 @@ */ #define MBM_CNTR_WIDTH_OFFSET_MAX (62 - MBM_CNTR_WIDTH_BASE) +/* 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 identifies as "Slow Memory" */ +#define READS_TO_LOCAL_S_MEM BIT(4) + +/* Reads to Remote Memory the system identifies as "Slow Memory" */ +#define READS_TO_REMOTE_S_MEM BIT(5) + +/* Dirty Victims to All Types of Memory */ +#define DIRTY_VICTIMS_TO_ALL_MEM BIT(6) + +/* Max event bits supported */ +#define MAX_EVT_CONFIG_BITS GENMASK(6, 0) struct rdt_fs_context { struct kernfs_fs_context kfc; @@ -531,5 +554,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d); void __check_limbo(struct rdt_domain *d, bool force_free); void rdt_domain_reconfigure_cdp(struct rdt_resource *r); void __init thread_throttle_mode_init(void); +void __init mbm_config_rftype_init(const char *config); #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index b39e0eca1879..2afddebc8636 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -784,8 +784,10 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) return ret; if (rdt_cpu_has(X86_FEATURE_BMEC)) { - if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) { mbm_total_event.configurable = true; + mbm_config_rftype_init("mbm_total_bytes_config"); + } if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) mbm_local_event.configurable = true; } diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 8342feb54a7f..e93b1c206116 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1423,6 +1423,90 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, return ret; } +struct mon_config_info { + u32 evtid; + u32 mon_config; +}; + +#define INVALID_CONFIG_INDEX UINT_MAX + +/** + * mon_event_config_index_get - get the index for the configurable event + * @evtid: event id. + * + * Return: 0 for evtid == QOS_L3_MBM_TOTAL_EVENT_ID + * 1 for evtid == QOS_L3_MBM_LOCAL_EVENT_ID + * INVALID_CONFIG_INDEX for invalid evtid + */ +static inline unsigned int mon_event_config_index_get(u32 evtid) +{ + switch (evtid) { + case QOS_L3_MBM_TOTAL_EVENT_ID: + return 0; + case QOS_L3_MBM_LOCAL_EVENT_ID: + return 1; + default: + /* WARN */ + return INVALID_CONFIG_INDEX; + } +} + +static void mon_event_config_read(void *info) +{ + struct mon_config_info *mon_info = info; + u32 h, index; + + index = mon_event_config_index_get(mon_info->evtid); + if (index == INVALID_CONFIG_INDEX) { + pr_warn_once("Invalid event id %d\n", mon_info->evtid); + return; + } + rdmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, h); + + /* Report only the valid event configuration bits */ + mon_info->mon_config &= MAX_EVT_CONFIG_BITS; +} + +static void mondata_config_read(struct rdt_domain *d, struct mon_config_info *mon_info) +{ + smp_call_function_any(&d->cpu_mask, mon_event_config_read, mon_info, 1); +} + +static int mbm_config_show(struct seq_file *s, struct rdt_resource *r, u32 evtid) +{ + struct mon_config_info mon_info = {0}; + struct rdt_domain *dom; + bool sep = false; + + mutex_lock(&rdtgroup_mutex); + + list_for_each_entry(dom, &r->domains, list) { + if (sep) + seq_puts(s, ";"); + + mon_info.evtid = evtid; + mondata_config_read(dom, &mon_info); + + seq_printf(s, "%d=0x%02x", dom->id, mon_info.mon_config); + sep = true; + } + seq_puts(s, "\n"); + + mutex_unlock(&rdtgroup_mutex); + + return 0; +} + +static int mbm_total_bytes_config_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + + mbm_config_show(seq, r, QOS_L3_MBM_TOTAL_EVENT_ID); + + return 0; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1521,6 +1605,12 @@ static struct rftype res_common_files[] = { .seq_show = max_threshold_occ_show, .fflags = RF_MON_INFO | RFTYPE_RES_CACHE, }, + { + .name = "mbm_total_bytes_config", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = mbm_total_bytes_config_show, + }, { .name = "cpus", .mode = 0644, @@ -1627,6 +1717,15 @@ void __init thread_throttle_mode_init(void) rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; } +void __init mbm_config_rftype_init(const char *config) +{ + struct rftype *rft; + + rft = rdtgroup_get_rftype_by_name(config); + if (rft) + rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; +} + /** * rdtgroup_kn_mode_restrict - Restrict user access to named resctrl file * @r: The resource group with which the file is associated. From patchwork Thu Dec 1 15:37:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp330060wrr; Thu, 1 Dec 2022 07:38:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf7P+b1HK9wPXrrUhGmtVAJxtm0IL/m9GNjid4HVhyFA8herenavRrn/4EONi/yrUTpesBRI X-Received: by 2002:a63:1763:0:b0:476:d5be:4511 with SMTP id 35-20020a631763000000b00476d5be4511mr33695717pgx.139.1669909099952; Thu, 01 Dec 2022 07:38:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909099; cv=pass; d=google.com; s=arc-20160816; b=HLDQwrCUz/wGP0ZcPv3dRg06DS4/vIjwsSV4DsGTTwjBhTLBS/+j3Fe+h0McnD2olh s6z/P5lSvyn8Wwx3ka87tU4hHkau9wN4HEJ9quDaBUgHsikP0MvGstoBBUm6buGsd6Mu ReQWu2hQd4YKMj0as9T1xyyYz2Yfe1vlgEP4qe8v8qFkmbun36bpHMpxkVhRUmzxwt0A KehAuBTNrAn+w0nLVzF/1JEWbVbgSm5iHXbooob9jec78va/Wxry3kGvkHNYBCI4EAfO JIEiWo2ehq0UUgrrutG2jHPqSaI/L+tK8lrMsxUyR58xZRnaBirIpFDrUzuhvS3StZex Q6BQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=vSPaLBPKryxvsIaZH6p9iqxAa87bzU1121Sb7imypRc=; b=ndRrBEiAkyxR95ldmGwmApPiBHzvGlHtDMTGjnczpk2AMwmD7QM+8t6g8CjjdOtDnl O9ZK8TqtlCNy222OAsOmL2uBm8nvEMQSfRoz0pHGC7qsDdcqf8FVNolTs/ypr2E9TVB7 ViffPkcUgXXsfyfn7fzAJkmDitmrLRD+lYU3yGZl5VW6+uc2bjQsriepP9Xu2IsJlhkw +dkI5vONnZ+zSb14tFZSzMKUn50HUnPjrrqxSygxTy55hAgZ6u07t3DZ0RrJp3rz8Q8u VKzVqT3VdrRraYfNHA1FxSvdoTzqhd2JC2EumbBjzzKo1Jd4fomD9oZrPyNPRMrZgoMh RAZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HMPODTE4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a17090a4d4600b00200e221e9a0si7384570pjh.149.2022.12.01.07.38.04; Thu, 01 Dec 2022 07:38:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HMPODTE4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232093AbiLAPhg (ORCPT + 99 others); Thu, 1 Dec 2022 10:37:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232215AbiLAPhK (ORCPT ); Thu, 1 Dec 2022 10:37:10 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2043.outbound.protection.outlook.com [40.107.243.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A46BAAD33A; Thu, 1 Dec 2022 07:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MLVcNHJBEWbd8Ykguqn8+WTInqtGeIO2QCqHmfYu0a3SayBoJvmrPwzpKq3fY2zzPiTUyeBb14rXnavIONycpgMVYRFgBLSdsFWn2KO7KSpQ1Ky5PgPKHcdNG3LRTBgZ9DYTDMRYdNvHTUz99UlWY8JiqOHUjHDntI1w8jhlw6stBcrA36nQzbZ5YHEaWmXU9teLTvuOdqoV+5M1yMeU12rm8Bo8QYBIE9v/ia4m+8B0uKeZdzIfpYlBYrDqIny7UPLWMtaSvrTlz5nBQfB+U9nk6g/TNJO/3z72ABo/+zKBpFuOY1SCSeKntiw8sg0gcSTNJRKRFzVt3o9siT5kXA== 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=vSPaLBPKryxvsIaZH6p9iqxAa87bzU1121Sb7imypRc=; b=nT/wI/oiMsnxeUDBX8K83dwguKEVgubhtk1LDBjD9CRT6YJYCj4AOTTVAcQyKY5wxFWB43yFzlO4Lvlf+/CfkBKfJFjNEN40HOIYr6I+YNCUg6QGLsALyrj2AvrY9hHaT8/y+xxDZhbmL/KURFQ+/knZNjnTKwA7SDGCDfcQsx+a1H8j6B0NLMOEXmnxFEd8buPXa8jCDOUEBN6p8L1rTNGoHdpAPq7txXf3biWoUI4lfQtW4JTRGRqZbXWr9OJ8ksoENt5TSQKvIDJK2GGsvu/urRJo4476ukh+1YMFAiIG+V3M4z1BZreeYZG1nmdW6Wln3oXkiqEpDMBfmWvaaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vSPaLBPKryxvsIaZH6p9iqxAa87bzU1121Sb7imypRc=; b=HMPODTE4rX1djMJZBr2eJr/6/cqVYHu1jYG/TJo/HE1GIaIF7WxRYCdi683J8BJXZiA248lKMR2T7FpEpth5eU9Zf8mRVeXaDQ1wa2oa93rOJ7V+k05q9QLPIXoK5I1lb06W1E9BjpkFdzn3Lsdfc4QSBYAWy+qtLJe3r23lysU= Received: from MW4PR03CA0128.namprd03.prod.outlook.com (2603:10b6:303:8c::13) by PH7PR12MB5595.namprd12.prod.outlook.com (2603:10b6:510:135::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:37:07 +0000 Received: from CO1NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8c:cafe::66) by MW4PR03CA0128.outlook.office365.com (2603:10b6:303:8c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:07 +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 CO1NAM11FT086.mail.protection.outlook.com (10.13.175.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:06 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:37:03 -0600 Subject: [PATCH v9 09/13] x86/resctrl: Add sysfs interface to read mbm_local_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:37:03 -0600 Message-ID: <166990902305.17806.9650262646704189221.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT086:EE_|PH7PR12MB5595:EE_ X-MS-Office365-Filtering-Correlation-Id: 22b6a6fc-6583-4775-b801-08dad3b1e76d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O+RMWiRyPI/z+ApWlB10AviGXU5NlO47iiW2GMKj2AC2ikqODVLv7HCv91fC0CY9cS+6JQ4Z7NbUFgj6vYyWw8TLCCSzKIC3arFCpPgCq3P2HIbQkHdh1Su9CzMT0RzKaQilKGAP/sbOBjOKLEwwfv46hYleYLg7PpnnAla9pEIOkvvXaIzCpN7e4MjZqT8Qg1TtFwFBOeTBqMTMNJKHMCP6blmrjFyOtVvPAxfM3y2/GeP643tv27IcHxACadtmf6Z51Qfy8oEJMWom2c4tKEiGlp/aS2Fi7hsQwqq0r7yrDhbe8Yf+xa/k2vlt8hfsZUazXOJT/F+ppphrPDB2A+uj66Ok5yCyVIuzdmcnq27JakSuWENcK93gU9qdp5y2an/zaNVi+5NejSixCbqvNA+S819o6K3MVm48syM2olEiUZbNdiYs8YwxWwGGps+1UNN5TC9N34SULTFDJ7AI0Wd0YUta7swZGDfseSc+yY5iZ9gmJBvF9VbLT12Gv3k4v2jXJRt5yC3gmrBkJDZsj6Kzyx0ROT7jNp+p1g+MvfbUEh8BAgErujXX6s9usbc0+s1Cx6/au1WV7izTqyIHy7eMsfsMGUKDhSJZLq0lUBpJCRlj6Mqb7zAdybKwMbcztyIqF6GiwSdTSxhUJreKqXeJn8TKh2Bguo53gcS8hB1qMY4PkMBo8VQ8rM5UpVTjVasR12ocPkZL9qQkxwoTP+JT9nd2axaWJ3pvWxfqdAkKkl5b0X1pkl885EbZtFfjD3nUGQN2G/itVMsLXuCq0Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(376002)(136003)(396003)(39860400002)(346002)(451199015)(36840700001)(40470700004)(46966006)(41300700001)(5660300002)(82740400003)(426003)(16526019)(40460700003)(40480700001)(16576012)(54906003)(110136005)(356005)(316002)(47076005)(81166007)(70206006)(336012)(70586007)(86362001)(4326008)(478600001)(82310400005)(33716001)(103116003)(9686003)(83380400001)(26005)(186003)(8676002)(7406005)(44832011)(2906002)(7416002)(8936002)(36860700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:37:06.9246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22b6a6fc-6583-4775-b801-08dad3b1e76d 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: CO1NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5595 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026604067630288?= X-GMAIL-MSGID: =?utf-8?q?1751026604067630288?= The current event configuration can be viewed by the user by reading the configuration file /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config. The event configuration settings are domain specific and will affect all the CPUs in the domain. Following are the types of events supported: ==== =========================================================== Bits Description ==== =========================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== =========================================================== By default, the mbm_local_bytes_config is set to 0x15 to count all the local event types. For example: $cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config 0=0x15;1=0x15;2=0x15;3=0x15 In this case, the event mbm_local_bytes is currently configured with 0x15 on domains 0 to 3. Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/monitor.c | 4 +++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 2afddebc8636..7c8a3a745041 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -788,8 +788,10 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) mbm_total_event.configurable = true; mbm_config_rftype_init("mbm_total_bytes_config"); } - if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) { mbm_local_event.configurable = true; + mbm_config_rftype_init("mbm_local_bytes_config"); + } } l3_mon_evt_init(r); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e93b1c206116..580f3cce19e2 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1507,6 +1507,16 @@ static int mbm_total_bytes_config_show(struct kernfs_open_file *of, return 0; } +static int mbm_local_bytes_config_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + + mbm_config_show(seq, r, QOS_L3_MBM_LOCAL_EVENT_ID); + + return 0; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1611,6 +1621,12 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .seq_show = mbm_total_bytes_config_show, }, + { + .name = "mbm_local_bytes_config", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = mbm_local_bytes_config_show, + }, { .name = "cpus", .mode = 0644, From patchwork Thu Dec 1 15:37:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp330208wrr; Thu, 1 Dec 2022 07:38:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ibGJ0X90qg8eCbPzy6moJygb+ttmZRonJMbWFYvAsiOVT82+sd78G1g/OHMdTaEQBaXUG X-Received: by 2002:a17:90b:3e8b:b0:1fb:825c:af8a with SMTP id rj11-20020a17090b3e8b00b001fb825caf8amr31394074pjb.104.1669909122523; Thu, 01 Dec 2022 07:38:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909122; cv=pass; d=google.com; s=arc-20160816; b=XN/WCikBVb6OKLoO04PseKc6J6lc7r6pc4luAV9/DSWtklSNEGu9zbvy+IWWyKXPAd 0EEM6ui3OT3zHZI5FiDqidVjnm1vf4mRBgVK7rOEDVG0RXkQ0BQN8cOm13BwoSHVgQRA Dr4HQwrbrrvVdYCwdDMGfeTFGNzWAGtiIQzaTzeA4ubckNEWTbOa4LUyb7m+92//V0v1 KHldnGZ0/N8xK59hDJLqiWip7dGPoBBneVNQCem5UmYActkdzN7EXv+gkOpL+5ifJJUA w2i/6wKPrqRexAc3+TQoIG4ckmD+bk3arIxQgjR57xWT2A3IwwSlCetdBWkmBESCbp6H GCbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=+uzowYfQobwSEZJ6ftLgb5iSVQSyJuZ59EqCdWfiPf4=; b=p2d8rAVX34ocjoA3hQpQJ+8L2xBcnyLbBVaavQhBSmJNhexKQCYYowqCoTsRu9xhFd fuxYUVSyObLbimfh0b/VVq3+AGt1f1Z/zLzKr3Xj+WeMKoVGxFQWv//RJUsBHiUeL+Lj J6hXXc8dtZ8xdEZw8iS83dSjk0OsNgfNco+3W5Ux0ZLv+LQ5MWEE2kP0azeOL6zL610a pbuK9LzWtGuTdQ4lIgsXP0ZykIcPCNgQRryTUzkIRaPqjyCMCa5rglCwFgEzMjHX9GK2 K5ogxGB/hEX4nnJTDNkOOnnF3OVxWShaTIyIyVbfI8NRm+yjqu/q84l2nnHfqjb8FMrl VHHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=eH36igBJ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a634546000000b00470693437b8si4845432pgk.550.2022.12.01.07.38.29; Thu, 01 Dec 2022 07:38:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=eH36igBJ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232020AbiLAPhr (ORCPT + 99 others); Thu, 1 Dec 2022 10:37:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232005AbiLAPhY (ORCPT ); Thu, 1 Dec 2022 10:37:24 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBBC98D649; Thu, 1 Dec 2022 07:37:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sq3oCYo1/V8pNXGb9WTQC3r4mwyr+JjE6iV8RFYXEEi+Gb7cv19ytnyftI9uwvz6izpPWLkPLV8nn1J3nI8P3QPAoDnoEyEjb/D/EUuNP3XlmhPkR6XGwXmA6KyxGIAQkeJbgNjJP7xFz4tHJzdcKNmXHAyNRI5JNMqaFC7o+YRc7+traT7CAlbxo/yV1epfQLAwFiRAeBIcWZcNX9atu9zVG70r96YKhdw0s41fT5uqXt4LDjTHF7NQr292jAPxL+bwIYMqsPlcq1uoRFTz/YP2IwoAds7W5MgUf5ljT1pIVpOto1iQXNchLdk6PiX4ljnOsNNWIaln5AyxGlhgHA== 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=+uzowYfQobwSEZJ6ftLgb5iSVQSyJuZ59EqCdWfiPf4=; b=HkXC1YqasvEeLrlxAgdjBsCg/UOqhMYgYSiNCd8k8e1c2Qx8RrzkV/ZOQEfq3tYVDzECLIFzMjhG0GVs75tm0CrAtKbWo5PmMv/TFU1JgFJs8sqajp2NKKTkZ4eje+n0Hgl062kCEFcEm1Y0qVKKF65V16dbiAcs8fjbSpBq44ZoBG7UnJCwtyC3FSkb8hOSvK96rVuvxpTt+ot1Pavzxc2gwpyUAqpz7iOoA9wb/tBu7NYx4UQ2nuBmyPKVql3Cnu7vpui9hYag9LLG/d5juZFiQ6uzJSRpRnAyEveVuAAeHYY22nCb333wJsZIv9HONbKKDyMJMTL4aI9uLGEKFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+uzowYfQobwSEZJ6ftLgb5iSVQSyJuZ59EqCdWfiPf4=; b=eH36igBJfDm8lYZIbKG/Gp1jLhhOJA9wXi0tcAVLMmtsFRbBmuf3XzH8asAmn6KG0fn0+oUZMbjEw5hbtt2ZyQUwQyq5gVwFBXn/swM7VgX55k2gxZa/OHUWFJKWN31zZai1hzcjiugUck/eXTQyhaYtdu22lBItp4T7XHdkuew= Received: from MW4PR03CA0107.namprd03.prod.outlook.com (2603:10b6:303:b7::22) by DS0PR12MB7677.namprd12.prod.outlook.com (2603:10b6:8:136::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:37:20 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::d7) by MW4PR03CA0107.outlook.office365.com (2603:10b6:303:b7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:20 +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 CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:19 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:37:15 -0600 Subject: [PATCH v9 10/13] x86/resctrl: Add sysfs interface to write mbm_total_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:37:10 -0600 Message-ID: <166990903030.17806.5106229901730558377.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT009:EE_|DS0PR12MB7677:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fea3cfc-724e-483c-192a-08dad3b1ef22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lzb603UZF5EcBkYVBnp2ADGjTZn+TRdB+TDYW2HkOU7CIAv3HGoBHAzXqcXhLYUQ1neQ59f8UIbta4RKhL6xqK8MNFF0kCAuh85hMhD37f0YOvVN42F634eBSUteC9WQJbu8tyx3iYTShfT5P0GgMi1nE8MFW2Sft+Ya1VfcGs8ZsyVvd8vIvEqveBn/W0Y0rntU0H/Atrs/TUP+JUwcDyJqS4fEiu+xDr8Em4H8d235ZsIhvTb9y9PFXgxc3pUbm76XEY/xxlHncedNS30ydByEmEvu/GeVa60UuTRrhjKSEwzICGZGugHNpVk0kqJNasPH/E6GAGrdlABt3fCjlsqamC16Xkt25i6k15uSzSfIm5sRJim0rdmAU1acfUOHGqkvEltUC18ePFixlH3gOZPr1GtWwseXCyUg4hXften9QuDTQndwjgxSC7JOY+z3m1vXJCgseBv0rurviTfAZ6OB41dQyyM2Zj5nJDrRHYHS3RmM6+97SotBSWV7pYHb4DqtxeJS72+QM0I1kTA5WaGlR0Ak8F/LuHhI6QAAyDBc787cQ3MKhTL/ayq5E5atoTgxMgcR86RKqHQZpn+VbUwL6oGKxNUoPezqiac7sGBwUdFi9qNwwPfDz8hzRfCgGlFfT3fb32uc5fzID1jmTjjX4j5AQFc8nBT1PPV2Ho+veNrWrrcd9XE9wzNVZvd18kXzUKM7dADjVDWVy1RYdZGnTmAVLTdGJXH7ZCxbdyzyAOpyZpXqri2gj+4HBtX57BPDri0LYtYLSf3cyzbq2g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(136003)(396003)(376002)(346002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(41300700001)(5660300002)(86362001)(7406005)(81166007)(110136005)(7416002)(26005)(8936002)(16576012)(54906003)(316002)(40460700003)(426003)(336012)(47076005)(103116003)(186003)(83380400001)(40480700001)(82310400005)(4326008)(8676002)(33716001)(70586007)(70206006)(44832011)(36860700001)(478600001)(16526019)(9686003)(82740400003)(6666004)(356005)(2906002)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:37:19.9445 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fea3cfc-724e-483c-192a-08dad3b1ef22 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7677 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026628057914050?= X-GMAIL-MSGID: =?utf-8?q?1751026628057914050?= The current event configuration for mbm_total_bytes can be changed by the user by writing to the file /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config. The event configuration settings are domain specific and will affect all the CPUs in the domain. Following are the types of events supported: ==== =========================================================== Bits Description ==== =========================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== =========================================================== For example: To change the mbm_total_bytes to count only reads on domain 0, the bits 0, 1, 4 and 5 needs to be set, which is 110011b (in hex 0x33). Run the command. $echo 0=0x33 > /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config To change the mbm_total_bytes to count all the slow memory reads on domain 1, the bits 4 and 5 needs to be set which is 110000b (in hex 0x30). Run the command. $echo 1=0x30 > /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/monitor.c | 13 +++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 127 ++++++++++++++++++++++++++++++++ include/linux/resctrl.h | 10 +++ 3 files changed, 149 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 7c8a3a745041..b265856835de 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -176,6 +176,19 @@ void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_domain *d, memset(am, 0, sizeof(*am)); } +void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_domain *d) +{ + struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); + + if (is_mbm_total_enabled()) + memset(hw_dom->arch_mbm_total, 0, + sizeof(*hw_dom->arch_mbm_total) * r->num_rmid); + + if (is_mbm_local_enabled()) + memset(hw_dom->arch_mbm_local, 0, + sizeof(*hw_dom->arch_mbm_local) * r->num_rmid); +} + static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr, unsigned int width) { u64 shift = 64 - width, chunks; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 580f3cce19e2..8a22a652a6e8 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1517,6 +1517,130 @@ static int mbm_local_bytes_config_show(struct kernfs_open_file *of, return 0; } +static void mon_event_config_write(void *info) +{ + struct mon_config_info *mon_info = info; + u32 index; + + index = mon_event_config_index_get(mon_info->evtid); + if (index == INVALID_CONFIG_INDEX) { + pr_warn_once("Invalid event id %d\n", mon_info->evtid); + return; + } + wrmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, 0); +} + +static int mbm_config_write_domain(struct rdt_resource *r, + struct rdt_domain *d, u32 evtid, u32 val) +{ + struct mon_config_info mon_info = {0}; + int ret = 0; + + /* mon_config cannot be more than the supported set of events */ + if (val > MAX_EVT_CONFIG_BITS) { + rdt_last_cmd_puts("Invalid event configuration\n"); + return -EINVAL; + } + + /* + * Read the current config value first. If both are the same then + * no need to write it again. + */ + mon_info.evtid = evtid; + mondata_config_read(d, &mon_info); + if (mon_info.mon_config == val) + goto out; + + mon_info.mon_config = val; + + /* + * Update MSR_IA32_EVT_CFG_BASE MSRs on all the CPUs in the + * domain. The MSRs offset from MSR MSR_IA32_EVT_CFG_BASE + * are scoped at the domain level. Writing any of these MSRs + * on one CPU is supposed to be observed by all CPUs in the + * domain. However, the hardware team recommends to update + * these MSRs on all the CPUs in the domain. + */ + on_each_cpu_mask(&d->cpu_mask, mon_event_config_write, &mon_info, 1); + + /* + * When an Event Configuration is changed, the bandwidth counters + * for all RMIDs and Events will be cleared by the hardware. The + * hardware also sets MSR_IA32_QM_CTR.Unavailable (bit 62) for + * every RMID on the next read to any event for every RMID. + * Subsequent reads will have MSR_IA32_QM_CTR.Unavailable (bit 62) + * cleared while it is tracked by the hardware. Clear the + * mbm_local and mbm_total counts for all the RMIDs. + */ + resctrl_arch_reset_rmid_all(r, d); + +out: + return ret; +} + +static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid) +{ + char *dom_str = NULL, *id_str; + unsigned long dom_id, val; + struct rdt_domain *d; + int ret = 0; + +next: + if (!tok || tok[0] == '\0') + return 0; + + /* Start processing the strings for each domain */ + dom_str = strim(strsep(&tok, ";")); + id_str = strsep(&dom_str, "="); + + if (!id_str || kstrtoul(id_str, 10, &dom_id)) { + rdt_last_cmd_puts("Missing '=' or non-numeric domain id\n"); + return -EINVAL; + } + + if (!dom_str || kstrtoul(dom_str, 16, &val)) { + rdt_last_cmd_puts("Non-numeric event configuration value\n"); + return -EINVAL; + } + + list_for_each_entry(d, &r->domains, list) { + if (d->id == dom_id) { + ret = mbm_config_write_domain(r, d, evtid, val); + if (ret) + return -EINVAL; + goto next; + } + } + + return -EINVAL; +} + +static ssize_t mbm_total_bytes_config_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, + loff_t off) +{ + struct rdt_resource *r = of->kn->parent->priv; + int ret; + + /* Valid input requires a trailing newline */ + if (nbytes == 0 || buf[nbytes - 1] != '\n') + return -EINVAL; + + cpus_read_lock(); + mutex_lock(&rdtgroup_mutex); + + rdt_last_cmd_clear(); + + buf[nbytes - 1] = '\0'; + + ret = mon_config_write(r, buf, QOS_L3_MBM_TOTAL_EVENT_ID); + + mutex_unlock(&rdtgroup_mutex); + cpus_read_unlock(); + + return ret ?: nbytes; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1617,9 +1741,10 @@ static struct rftype res_common_files[] = { }, { .name = "mbm_total_bytes_config", - .mode = 0444, + .mode = 0644, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = mbm_total_bytes_config_show, + .write = mbm_total_bytes_config_write, }, { .name = "mbm_local_bytes_config", diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 0cee154abc9f..e4dc65892446 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -250,6 +250,16 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d, void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_domain *d, u32 rmid, enum resctrl_event_id eventid); +/** + * resctrl_arch_reset_rmid_all() - Reset any private state associated with + * all the rmids. + * @r: The domain's resource. + * @d: The rmid's domain. + * + * This can be called from any CPU. + */ +void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_domain *d); + extern unsigned int resctrl_rmid_realloc_threshold; extern unsigned int resctrl_rmid_realloc_limit; From patchwork Thu Dec 1 15:37:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp330206wrr; Thu, 1 Dec 2022 07:38:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5GrH6xSXRZQZUyCSuC5AAORe+nPh+9UkFyq4ZY6hUSwlfTdnGc4f5hRtUuNaB6u6HZaJtD X-Received: by 2002:a17:902:bd83:b0:180:87d7:9be8 with SMTP id q3-20020a170902bd8300b0018087d79be8mr60976081pls.85.1669909122456; Thu, 01 Dec 2022 07:38:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909122; cv=pass; d=google.com; s=arc-20160816; b=x7tT0YR8apIeeu3VZ4Adq02H9yPwISRtcCzTlq1/0DUAuD7a/NQGI22dhS+8aQFnVT QuCpLf0aLdvEU6SMgI64mHESvm4MlJaBww3RWPrK7IZIimq2EiMfMnkbdVZfyGYH4VQE LVFOHoG2nWBGN6YoWwbuKFtyxARKUn6S9wH9kbG4rZL537ZrRydP3ZDG00EW1DRu3+kH F6gZ3vMs6viYYDnEZX7txkLizqud9JSZhRMArHmGGW+iFv8+KBWnpKk61dgWGyccxB2W kQjTultSQ2pUtLKTUxPeXN5GNeedfFhPYBptNqS/8aoFEFnlxlw+/VlUZC8LFkF2z7Iy g3lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=tRZQAhGhSeJG4LxiSpy+gvcPr1skm6d2SwSKC8AJ1LA=; b=HuiwWrYtO5/Y+ETDb++6Tc26Xn4HAVt/ouCDjBRlijlVJjAu6/PtNYn5Dq/HEr2zbF X1xkMThA4+h5Qb6rNSAgPSiLp+MMNvAsoIPC4mlJJ+ICCudzQeRT2xCNbC2xGxxiWoCK nvxChTw32BG5MtJLk+G4B0ce783nlAD2oixabCDvg1sYl5X/5pf/Md70d65casfEXVAy a3Y2gCA5wmkeahX3ZLC8QlN3iPRQCQyiHx38spgAHiBVTXuaxLkJHxDYv2RWseJnDOU4 gaQllJRTQ7e+m00eFT+eilRj2jOHYicpHJI1HGKFyEcbwJ0HRV+EY1AdF1rriIWrBLeR N0Ew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FfDDZHle; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a63df02000000b0047767ddcdcesi4690356pgg.566.2022.12.01.07.38.29; Thu, 01 Dec 2022 07:38:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FfDDZHle; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbiLAPiE (ORCPT + 99 others); Thu, 1 Dec 2022 10:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232134AbiLAPhh (ORCPT ); Thu, 1 Dec 2022 10:37:37 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2066.outbound.protection.outlook.com [40.107.237.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E348B3919; Thu, 1 Dec 2022 07:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SPbCAvCzFyedqyM0wxoC2J5yOXDtyCSHJT75d5d4WPRCvqIjC3ueoz5GBma2GXQUpLi5NCmX7I7XgQfiaLBvVpoMLshlnCOTltz0rl/Ki3AXHf/NV8+XHM/gXgQ80gmsUIq8F7eU76Aff6fSIFqOJTzXnb5GOgc8QdEURPGqvKlrxZzZPdmyErkh1IlmNvI+ydZ3YoU0G6zqp95eQw2/4qsihWsWwmIytzR/Sw4GszBf/ChhM0F+KoDNW98gv24fjSQjyamWBgaXfQ8VgSSUAsYgD8vGxfA9+gTdrRYHBZ+xhAGiJFi/eGzjNy5JyMTuq5BSFSiybmiwIGDj2R4mtg== 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=tRZQAhGhSeJG4LxiSpy+gvcPr1skm6d2SwSKC8AJ1LA=; b=V99IZ8sgvTKPrD5KhI0QLR/fjmUBb04ASml21SeSGC1kRy27ytgixxj6f9li+X/s2lOF/veFg7RtvGJ4ldxmMXZDOsSTjN+JAzRe6QwW0rFClfmVv+064okSFp5kNrh0IBg0y0xDfFCGqpCibPCDN+GAefv8gYg+UfdiyLDbArqF4HwijWoSf7mK1++9AWjOOp4OKnR1OlEHbNA5UlU5OzjghlH2lGDhrFXyYxtOWsMXaQAabs/RVw8GKBxu+LfzgD/7HtA2a9HEqwpFpLz+/beIA2Run0sRrmsPdLkxtDljwXGMCjhDWJMAv0kQl7ugfa2msonqJT+k6+UF94/k1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tRZQAhGhSeJG4LxiSpy+gvcPr1skm6d2SwSKC8AJ1LA=; b=FfDDZHler078NpUSCa4yMvG0u1zDpNIaJzqjUruZAn07MNlVnJF61WN3KbRdDMXSVyk1OcbaXNtnhPnnp+ckTC0tuWa2Uw3zKIyUw7ugo48YIRd9qbpwFx1juGmbGIFGBGUCFj/gmKkkgaJYHIg1gxmsh+MRjj2RlDbx9blq7aI= Received: from MW3PR06CA0011.namprd06.prod.outlook.com (2603:10b6:303:2a::16) by MW3PR12MB4507.namprd12.prod.outlook.com (2603:10b6:303:2c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Thu, 1 Dec 2022 15:37:26 +0000 Received: from CO1NAM11FT093.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::7b) by MW3PR06CA0011.outlook.office365.com (2603:10b6:303:2a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:26 +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 CO1NAM11FT093.mail.protection.outlook.com (10.13.175.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5857.22 via Frontend Transport; Thu, 1 Dec 2022 15:37:25 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:37:23 -0600 Subject: [PATCH v9 11/13] x86/resctrl: Add sysfs interface to write mbm_local_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:37:22 -0600 Message-ID: <166990904243.17806.8875872967137007418.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT093:EE_|MW3PR12MB4507:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d8f576c-ccd0-4981-3eb3-08dad3b1f290 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RoHQGWxVPIMUfmNJZmFMSl3zxv//gDO/YUw22Doa5BHIbF0/oauNi6wHR1XUL4IteaiFLaqXxpBRjl9Roy/pBnBiqdWnyXQGGPWhJt88cZhjFdB3mTh1dTesTQWV552pb/WlTR9S3revbTnQ/wyYxKL/AEKE4iwnU1s0jWhaWEEjEV10hDNTbYepUxqjvPrXuOxRvR2+jiyaByLWGNnf9aBxsJYBZ7lGilHn6+dUhui4Jf7VPWDt5O2sD6jclyCodRY9/sFjTczls+gMwXFoewO7MJwyfE/QparHNCUohmuUcwgFcoXNna5hnMn6CDgRZtNQ6h72d3hvE/sb39rvbsz3EI73ADNa7/Bv//c/Wo87MMxhRexz5F2vX1F49KEObM1L2bOnZRrpYqkkKUqt/5bzD6PqO8DWcfPsLF/IzUNheXsrAZmuMWulHbGavCmGCT1f6+WdMMelfXV8gdn19wf4NOBXr2M0+PSK/64mEcr3FgfKkQ4hH1ynHnTZt/A+9Mez5dHkwCy3VYs30+/KTel9dd411y/f7LHezzPsOt0eU6itw2w+I7v0VaaCJvXdySNLQqj694J/V2d5/0eOvEbaZbjqV6/a82eYzTG9LUVQERU0G/45biIqNE6ZtXqCA/gSTD6RjQRijVOnnZ5Kb/hBb/0L9ipZ2Soz05z0clLyregySYGviEj6zBDunZQX7eyoJbCN4jHROh/62oDI3bCzDdlT+8pwGZ40WDGKWkArliGsxKS6pdKK/mXbj2qlHLzL258Zzj9hIcLPa6YSvA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(136003)(396003)(376002)(346002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(81166007)(40480700001)(86362001)(356005)(103116003)(54906003)(40460700003)(110136005)(316002)(16576012)(5660300002)(33716001)(7406005)(44832011)(70586007)(8676002)(70206006)(7416002)(4326008)(478600001)(41300700001)(8936002)(36860700001)(83380400001)(82740400003)(9686003)(47076005)(2906002)(26005)(186003)(82310400005)(426003)(16526019)(336012)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:37:25.6995 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d8f576c-ccd0-4981-3eb3-08dad3b1f290 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: CO1NAM11FT093.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4507 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751026627707083687?= X-GMAIL-MSGID: =?utf-8?q?1751026627707083687?= The current event configuration for mbm_local_bytes can be changed by the user by writing to the configuration file /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config. The event configuration settings are domain specific and will affect all the CPUs in the domain. Following are the types of events supported: ==== =========================================================== Bits Description ==== =========================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== =========================================================== For example: To change the mbm_local_bytes_config to count all the non-temporal writes on domain 0, the bits 2 and 3 needs to be set which is 1100b (in hex 0xc). Run the command. $echo 0=0xc > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config To change the mbm_local_bytes to count only reads to local NUMA domain 1, the bit 0 needs to be set which 1b (in hex 0x1). Run the command. $echo 1=0x1 > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 8a22a652a6e8..6897c480ae55 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1641,6 +1641,32 @@ static ssize_t mbm_total_bytes_config_write(struct kernfs_open_file *of, return ret ?: nbytes; } +static ssize_t mbm_local_bytes_config_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, + loff_t off) +{ + struct rdt_resource *r = of->kn->parent->priv; + int ret; + + /* Valid input requires a trailing newline */ + if (nbytes == 0 || buf[nbytes - 1] != '\n') + return -EINVAL; + + cpus_read_lock(); + mutex_lock(&rdtgroup_mutex); + + rdt_last_cmd_clear(); + + buf[nbytes - 1] = '\0'; + + ret = mon_config_write(r, buf, QOS_L3_MBM_LOCAL_EVENT_ID); + + mutex_unlock(&rdtgroup_mutex); + cpus_read_unlock(); + + return ret ?: nbytes; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1748,9 +1774,10 @@ static struct rftype res_common_files[] = { }, { .name = "mbm_local_bytes_config", - .mode = 0444, + .mode = 0644, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = mbm_local_bytes_config_show, + .write = mbm_local_bytes_config_write, }, { .name = "cpus", From patchwork Thu Dec 1 15:37:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp334737wrr; Thu, 1 Dec 2022 07:48:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf46OpBNy1vNXCjCAAKKS866xLLSjs0nJoppRtszAFTD0pZ/oTNMf1tZJpU5lEp6gGd0KUBg X-Received: by 2002:aa7:cf03:0:b0:46b:35dc:cf4d with SMTP id a3-20020aa7cf03000000b0046b35dccf4dmr17331990edy.423.1669909721108; Thu, 01 Dec 2022 07:48:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669909721; cv=pass; d=google.com; s=arc-20160816; b=HR4YEyD8JrTY51j1U2NncKWgi2klRgTxRqNmqq9c7urBJwgXAbPOVYpI09oPv7B4+D HRLdMXeklwkA/tePYA/7F+Rn/U+8mD/KCyJYm7Aoi6jrM+eY5Cr66bhznFTdcbxKVdPw 0YfV1mZEwcamY7KrDL6w2x/GV1pVYgQ0GqxsGIBJbaZcV9wc3a0EpTWTynvdDaFFt721 0YWL9eR/DxyjkpdIlAQv185fJIV77DMrhTkyv5tSd/Wa/xu1IDblJOj8LtZFaOyETtcp 1bAOvq2G1wVO5b/xoan/7y0+OA6KaGCI1E56xBLIvah2C0gcFlkQyhbmd7mOQvQ46VZ7 rtdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=jTpIL32GJ01HUKHGeylEy8GDHtTnvjCumguab5h/8Eo=; b=JZms67p9BXUzT7N/ABPVAQTXsjLxCt06vWJquFqHZRccoV0HwfpG3qW3EJ0dID8jCR YnK6UGKr+I1N6PT+A5/SQRGseetmtcGn02EOdJp+najq6xY/JkD3PyChMa8MFQLrGhS6 YPXWf7YRvSLg/ZRMxRALM1gje7EmbCaKj3bl6AVfLxbvWfupRJmGzG6zDO3fEtnr/gaY XKSYuX3vlJExcUc3HFnUR/hAMssUCBPmJXEGwe45STAmPtksaGaI6keROapzOf/15rMj Yr+Aygd+p6QEiGG06DEnmriS2Au2/EBP2q+AddaMD/jOKeZ5GV4guQ33RCkAdQxPWUu+ 8RFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ASZZZeKd; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020aa7d2c3000000b004602a1b7da9si3695370edr.133.2022.12.01.07.48.13; Thu, 01 Dec 2022 07:48:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ASZZZeKd; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232065AbiLAPiT (ORCPT + 99 others); Thu, 1 Dec 2022 10:38:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232050AbiLAPhz (ORCPT ); Thu, 1 Dec 2022 10:37:55 -0500 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2053.outbound.protection.outlook.com [40.107.212.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2DB963E3; Thu, 1 Dec 2022 07:37:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e7OH1MZaoWJfQWQuyTiwKfMBGbr6kzCCON3GF5bzwySqM5j6j7jslJmVeIdK/ZNIwdFiG9Gk7jrGJD+SweuP+vCSziQxawCsBUsmkhzz6Zz7YMCnZsT1ZzeCfQ9398M0LAonauTh79VVCGcaDmHnlL1hgd3MQqYrlkA4rqsjIwR+YnLdDozjomhlvDmDxg8LlASYlFjhyDW5NIl3FSCIRag5GpNDs5bAxaybz+KdLmXVO9Oql+f3F53tBC5pd94tquXqfLis8N/nRjh2eKHAZDCCD94ntMBimmXMbrSf2IhliWlXQcGyVcO0yKKbWss2TZcuSY086Y/xooNu9SPK2Q== 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=jTpIL32GJ01HUKHGeylEy8GDHtTnvjCumguab5h/8Eo=; b=PlURp6EmIm+JXIjiFiwQ1+1J3byB4J/iLLtrouKk0iqIOE4jqulz8xFGSsepRtnHrmSz/vrCbXd+0DjrYFskAdXGCX1bcL9OCrDe5WNdGN7yH+mTmjX/h8VM/KQEfvPVBcvOpBgYl8RwFOOEb/6VHHqsLKZZ+fCx33VDEAWZQ7wP2U30yz8CZ5z067dxXYGYmA5mtxjQwFajExMDfcHnmrivNwHDnPQ7F/X8Xyc30/pbcRu98/RCAS0K2FH7lxMqEJQ2lp71ypvxBaR9UjHzubdszEF3xtqkmqCYlFNpAiVBtPU4NxM/+ZF6b0/EWxpwzP5IDfhFSM2otHOZE3cdGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jTpIL32GJ01HUKHGeylEy8GDHtTnvjCumguab5h/8Eo=; b=ASZZZeKdYtN181P9NK8QjkhtGHYkgf+BfS2lBqn43IsgoYGdPNm4svQ2U2XQHOnaTkU4Kn4FjjzoCyreG9991RvSETzma3XVkOGpZ1o0TiNdhqMnPZUbWKe2VAuvBQGyVfgXeSifGVJIYyHhVQU1XIHL5AkaLeSCUsRawj+IJzk= Received: from MW4PR04CA0049.namprd04.prod.outlook.com (2603:10b6:303:6a::24) by DS0PR12MB6607.namprd12.prod.outlook.com (2603:10b6:8:d1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 15:37:33 +0000 Received: from CO1NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6a:cafe::4a) by MW4PR04CA0049.outlook.office365.com (2603:10b6:303:6a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:33 +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 CO1NAM11FT084.mail.protection.outlook.com (10.13.174.194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:32 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:37:30 -0600 Subject: [PATCH v9 12/13] x86/resctrl: Replace smp_call_function_many() with on_each_cpu_mask() From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:37:29 -0600 Message-ID: <166990904972.17806.4220672882391241296.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT084:EE_|DS0PR12MB6607:EE_ X-MS-Office365-Filtering-Correlation-Id: cef50bf5-ee6c-4fd3-4a7c-08dad3b1f6c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ybv5jYUgb+FhuLjFgbOwA96dtwFTOgzBPKitzPVcv6U84zU3t3plS8zkLzG9CP2yELN9o7wZJLXn/5qtSwcj9rgY/4k4QSGPBMHdwf0duWJRPs5dyg/YFgLOHAl2r8zH7VK6SJbg0efORI0VxKdDxzuVBOyfEzK/aJuzO/QfiRfHMC16qrXjdDmjYPb2qnR1T3HPo5JyouYeuGcYQBb6roNaGovJh4pytvHYlPcNf2otz4WW1ARV/uu6RZNLJB81V8mEtQItaBjbBfUmZv76JDBfLlo3eaELBFtfZTsGra5hWxErb5zcPWGZNoORULS1hmC6T4k7prtNAP/VANPjol6Ava3IY0xL23ZB6jPpmqqEGjMfMDNDVwGIlqmcrqdSLS6wrIiADFW5McyUsmEs2ZOrRjg3rU1/rzgvhCs+3JSkLp0j3EGlUl4DAh5Ot49vht+v0ljzR/op31wg48RaJ8ETWJmO9XNwqCn1ZsyqGLmt4xrtILFWCeaV1VQhy5SwNUDC/3ALV7DnKDOB+9zIW9IjaAEOCW9CddzC8isPoVyFjkVl0Pq9HV+ajElqya9Pfnck3WsLMTMW1aqUHcAccQiXCWl/E6L9RlI8yHa6sGYISApsYoqunl+VaModBUc2hsptx6SFmHkdeuRM2NcR5g2UEIc8qoK9DvxWhEZGdG38U2o2UC6EracFTf4X/QseThFEDpJh/vLR0teWuVKmTYf8GDtM4M5S9Mk+ZNsjH5aTR650uG5stiagF1CNxvynfdbnL7/4OK9MHQXPSiAtgA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(7916004)(4636009)(396003)(39860400002)(376002)(136003)(346002)(451199015)(46966006)(36840700001)(40470700004)(83380400001)(86362001)(36860700001)(478600001)(103116003)(16576012)(9686003)(41300700001)(40460700003)(8936002)(336012)(110136005)(47076005)(26005)(7406005)(7416002)(82740400003)(5660300002)(426003)(44832011)(40480700001)(33716001)(81166007)(356005)(2906002)(316002)(186003)(54906003)(4326008)(8676002)(70586007)(70206006)(16526019)(82310400005)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:37:32.7253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cef50bf5-ee6c-4fd3-4a7c-08dad3b1f6c0 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: CO1NAM11FT084.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6607 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751027255774017341?= X-GMAIL-MSGID: =?utf-8?q?1751027255774017341?= The call on_each_cpu_mask() runs the function on each CPU specified by cpumask, which may include the local processor. So, replace the call smp_call_function_many() with on_each_cpu_mask() to simplify the code. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 6897c480ae55..68e14831a638 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -325,12 +325,7 @@ static void update_cpu_closid_rmid(void *info) static void update_closid_rmid(const struct cpumask *cpu_mask, struct rdtgroup *r) { - int cpu = get_cpu(); - - if (cpumask_test_cpu(cpu, cpu_mask)) - update_cpu_closid_rmid(r); - smp_call_function_many(cpu_mask, update_cpu_closid_rmid, r, 1); - put_cpu(); + on_each_cpu_mask(cpu_mask, update_cpu_closid_rmid, r, 1); } static int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, @@ -2135,13 +2130,9 @@ static int set_cache_qos_cfg(int level, bool enable) /* Pick one CPU from each domain instance to update MSR */ cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask); } - cpu = get_cpu(); - /* Update QOS_CFG MSR on this cpu if it's in cpu_mask. */ - if (cpumask_test_cpu(cpu, cpu_mask)) - update(&enable); - /* Update QOS_CFG MSR on all other cpus in cpu_mask. */ - smp_call_function_many(cpu_mask, update, &enable, 1); - put_cpu(); + + /* Update QOS_CFG MSR on all the CPUs in cpu_mask */ + on_each_cpu_mask(cpu_mask, update, &enable, 1); free_cpumask_var(cpu_mask); @@ -2618,7 +2609,7 @@ static int reset_all_ctrls(struct rdt_resource *r) struct msr_param msr_param; cpumask_var_t cpu_mask; struct rdt_domain *d; - int i, cpu; + int i; if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) return -ENOMEM; @@ -2639,13 +2630,9 @@ static int reset_all_ctrls(struct rdt_resource *r) for (i = 0; i < hw_res->num_closid; i++) hw_dom->ctrl_val[i] = r->default_ctrl; } - cpu = get_cpu(); - /* Update CBM on this cpu if it's in cpu_mask. */ - if (cpumask_test_cpu(cpu, cpu_mask)) - rdt_ctrl_update(&msr_param); - /* Update CBM on all other cpus in cpu_mask. */ - smp_call_function_many(cpu_mask, rdt_ctrl_update, &msr_param, 1); - put_cpu(); + + /* Update CBM on all the CPUs in cpu_mask */ + on_each_cpu_mask(cpu_mask, rdt_ctrl_update, &msr_param, 1); free_cpumask_var(cpu_mask); From patchwork Thu Dec 1 15:37:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 28441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp338561wrr; Thu, 1 Dec 2022 07:58:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf6aNrpSCLzWs+EpFWKxRiT9C4bIJyw/Xf+nbdt0gZl0cju/Igfuillp/6s0KmT7/R3lK1yt X-Received: by 2002:a63:ea17:0:b0:477:9a46:f57b with SMTP id c23-20020a63ea17000000b004779a46f57bmr41899417pgi.319.1669910294707; Thu, 01 Dec 2022 07:58:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669910294; cv=pass; d=google.com; s=arc-20160816; b=kpz73u/zh6xkMzPyZY/0XE7dBOwI1HOOXyUZEaFdtzu96vhRMCdlTvUk9TrixYJiIo bnrx0UcbOeUuBa/OUIQrp8YOMmNZasl4ezmKSHWMxAdk+19nkcetQMw9TzpsWfpEus6v FZk38KTqdjpMoKmzOCCaCa/z4jo/MltlBmiq5UADuiWgVVAIWzjflFbGiiAzuFIJv/+L fzzMl95EupmnT5qPXDtRL6bgx8fccvhLysLiFvNZSLvVNl+LaaRJ8/JxUkJzRhy6jjy4 u4v+0koZZcjffXbtzmcTndQvuvJwj0hqfYckGpcKsfYUlYAKmWhMVQbHEWjiWZc4JRzr HFcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=mzKlud3bsUwIY4ugncGjqWJsmEy3IPiYuI+nDgn9TSk=; b=KGh/qJekFMLjoHBX9Np5swPOv7j+8x+JrcyRYCGfng42M2QP12iyPz7CvEjAYE4ok0 nrJlGiJuM3DEapXwDX0Tgyt3MCjrvN6q7n7MjxFPCWKtE8JuSmbxsXLjYAWZum4atNO5 7Ii2ymu2bStkeUHvSPTB817Q6wKgQrVTK+FJqZBP1BcneYXXjb0hBhNgSh2SjFDHPSRx JEg9ZvP4OiQWuLZ09ocu9W7mr7d2rYDHrhWJoaKSOicDE0qvRUdbQfUTVtN1rmTqwiTH NZu1YD78gbRowumZewHAKN1GlOOf/M8gqAKRYQ5Y7kcBWR3SrzLjFPbldL0c1N5oWtip vSDw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0QmLHVwg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a63fb47000000b0047867fd492fsi3756473pgj.230.2022.12.01.07.58.01; Thu, 01 Dec 2022 07:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0QmLHVwg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbiLAPiu (ORCPT + 99 others); Thu, 1 Dec 2022 10:38:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232063AbiLAPiT (ORCPT ); Thu, 1 Dec 2022 10:38:19 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2067.outbound.protection.outlook.com [40.107.244.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12E0578C9; Thu, 1 Dec 2022 07:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jZBf+xyCtW7vwtvbyaMNbMr1tnpyUqT1GgpSef27kANEUE6qXEUnN2l/mbAHdPesaFnkPybZj/fEDbitApfjG9rACxk4as7KFLvQpcb7BNZb1S2Wy2FA4kM2EyM5KycunfNzQGIcPX/xvhZY7k2wmT+HoNssIaSxfw9UNt2A44V61WXdEpprfJ6K8i9pRZzJAeZ7n6k5RRhJK5qChRMpY3O8sXVskZ4IXWLXhNe1N4tyntzKdMlyJEPtqVT2OpD3s4s3OpxuepXmy/o4DwmyafaCihJhmiFxcc7XDS+1aDh3ijasCSsYBujn385RCPy6gB2m/fuaNLEHItw2F8KzYQ== 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=mzKlud3bsUwIY4ugncGjqWJsmEy3IPiYuI+nDgn9TSk=; b=HHv6Am1re6hT1isUdzawbIbYFpxK2npKDnr4Lv8LB76b8edfoj6G5a3OPH1weVyoYs4euFFJUwi54LW90EuwRLmCOxTdEZfNewQHPIzLaWew07I51rpG7W9SWyIQKvrq5nIdCent10UUf5X0w7LvNqLdv3+Y1BZakd+ej8k8VOK3kKghD7B9SXqhjaWCsdVouwzFd5qJjAGYKphm+zZLeKnN/+Glm4l3IqjfDP4wZDPCqgIGJCWN8qxRjI4Oe1Lz3hQGvTMSw+J7LYvqVx6BAcuswMnUs+FcBwB6OB0te3AM2QfzzeuWkv4fzjz7t1SEAKO0Pu3/CDV0ekxbVgdSXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mzKlud3bsUwIY4ugncGjqWJsmEy3IPiYuI+nDgn9TSk=; b=0QmLHVwgZFwsdyuDWeWQ+JHWThMSQLwApvD0DPH5HPM5Jof8zyEcyj3I1QaZm0xKjlI4N9R+Yp4CotJxgF7JEIFypyK7XhVazjVK+VwRIYYHFWuXCHY3i/kIFwp6TIjWOe9mAerSs5FQZ49HhwR/SFULtq3WuJyo8ZhxD/PDGVQ= Received: from MW2PR2101CA0002.namprd21.prod.outlook.com (2603:10b6:302:1::15) by MW3PR12MB4507.namprd12.prod.outlook.com (2603:10b6:303:2c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Thu, 1 Dec 2022 15:37:43 +0000 Received: from CO1NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::a4) by MW2PR2101CA0002.outlook.office365.com (2603:10b6:302:1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5901.8 via Frontend Transport; Thu, 1 Dec 2022 15:37: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 CO1NAM11FT041.mail.protection.outlook.com (10.13.174.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.8 via Frontend Transport; Thu, 1 Dec 2022 15:37:42 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Dec 2022 09:37:37 -0600 Subject: [PATCH v9 13/13] Documentation/x86: Update resctrl.rst for new features From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Dec 2022 09:37:36 -0600 Message-ID: <166990905693.17806.6942517971262471285.stgit@bmoger-ubuntu> In-Reply-To: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> References: <166990882621.17806.16780480657453071426.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT041:EE_|MW3PR12MB4507:EE_ X-MS-Office365-Filtering-Correlation-Id: a5582ca0-ef3f-4c4d-38f7-08dad3b1fcb0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VdF77W0x5g51NYZJm9cNuo2ohKUrNUYINQmIydRM2VOz6N0cDav+snFW6QLyTGAFaM2a+UazUkAMF7vkf2BbThtM2iAPDDilC8zkyWtW6HqBJATv8X0BXzJhpTIFH5n46ASky9DJ/SE1agnLV/YYQu+mlxWXc+2rIibTiRALQHfJt6WOky75VzPJ3RCnZ+rYknsaj9YdtOeWCfBm08MCrknEn7evzzUI70CIwI6Ec5MpLZva+SW0h+QjwI3Y/eg569D1ErqW/2zRNkqvHrwXhc5uzkVoK1dMPe+1o8YDzehZNd9nFdqJUX6v/wp45zSVu1aTmD94ZdHNjGdHjc2oxKoqvHTRwStS1UVXg6SpV8JUUmUASWdjQMvBMVqWfVe/zK1ofkzTWAaauHu3f8wmCNyiSr+7fDXpPb2FHws0TyBVGEhQHp6sxrDE4kCB3yV0sgR6UB3jlB8YjHp4GkWcp8P7KCUpCZ4Fn7aZ+CA6iUaABrzHZp2QqqKYb2rHcINc3Ci4bkZmLSqpsk1R2x5pv3Iwz8NucH+NBOkwmVT3bhRo46vR59cY5aHyZ5kMM3cVQUzELNaIa1Lk3To3Xl+CRnUeZ03lhrNuUbJ/T4tiO868zbPp3rLCrSwtFZS2uCmva8yS7B9SOXRhCvSSUQqljP0TtZteI+efSdkgBWhdlBJQZfpHSs9xMDrjkkH3E1gjMhOJRSqOvvv7Y47E2E7zlG863C+Iv/59WRE9y5h90TLr4oBq1QkyWLIDvusFZpIq X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(136003)(396003)(376002)(346002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(81166007)(40480700001)(86362001)(356005)(103116003)(54906003)(40460700003)(110136005)(316002)(16576012)(5660300002)(33716001)(15650500001)(7406005)(44832011)(70586007)(8676002)(70206006)(7416002)(4326008)(478600001)(41300700001)(8936002)(36860700001)(83380400001)(82740400003)(9686003)(47076005)(2906002)(26005)(186003)(82310400005)(426003)(16526019)(336012)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 15:37:42.6863 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5582ca0-ef3f-4c4d-38f7-08dad3b1fcb0 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: CO1NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4507 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751027857525337161?= X-GMAIL-MSGID: =?utf-8?q?1751027857525337161?= Update the documentation for the new features: 1. Slow Memory Bandwidth allocation (SMBA). With this feature, the QOS enforcement policies can be applied to the external slow memory connected to the host. QOS enforcement is accomplished by assigning a Class Of Service (COS) to a processor and specifying allocations or limits for that COS for each resource to be allocated. 2. Bandwidth Monitoring Event Configuration (BMEC). The bandwidth monitoring events mbm_total_bytes and mbm_local_bytes are set to count all the total and local reads/writes respectively. With the introduction of slow memory, the two counters are not enough to count all the different types of memory events. With the feature BMEC, the users have the option to configure mbm_total_bytes and mbm_local_bytes to count the specific type of events. Also add configuration instructions with examples. Signed-off-by: Babu Moger Reviewed-by: Bagas Sanjaya --- Documentation/x86/resctrl.rst | 138 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 2 deletions(-) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 71a531061e4e..60761a6f9087 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -17,14 +17,16 @@ AMD refers to this feature as AMD Platform Quality of Service(AMD QoS). This feature is enabled by the CONFIG_X86_CPU_RESCTRL and the x86 /proc/cpuinfo flag bits: -============================================= ================================ +=============================================== ================================ RDT (Resource Director Technology) Allocation "rdt_a" CAT (Cache Allocation Technology) "cat_l3", "cat_l2" CDP (Code and Data Prioritization) "cdp_l3", "cdp_l2" CQM (Cache QoS Monitoring) "cqm_llc", "cqm_occup_llc" MBM (Memory Bandwidth Monitoring) "cqm_mbm_total", "cqm_mbm_local" MBA (Memory Bandwidth Allocation) "mba" -============================================= ================================ +SMBA (Slow Memory Bandwidth Allocation) "smba" +BMEC (Bandwidth Monitoring Event Configuration) "bmec" +=============================================== ================================ To use the feature mount the file system:: @@ -161,6 +163,79 @@ with the following files: "mon_features": Lists the monitoring events if monitoring is enabled for the resource. + Example:: + + # cat /sys/fs/resctrl/info/L3_MON/mon_features + llc_occupancy + mbm_total_bytes + mbm_local_bytes + + If the system supports Bandwidth Monitoring Event + Configuration (BMEC), then the bandwidth events will + be configurable. The output will be:: + + # cat /sys/fs/resctrl/info/L3_MON/mon_features + llc_occupancy + mbm_total_bytes + mbm_total_bytes_config + mbm_local_bytes + mbm_local_bytes_config + +"mbm_total_bytes_config", "mbm_local_bytes_config": + These files contain the current event configuration for the events + mbm_total_bytes and mbm_local_bytes, respectively, when the + Bandwidth Monitoring Event Configuration (BMEC) feature is supported. + The event configuration settings are domain specific and will affect + all the CPUs in the domain. + + Following are the types of events supported: + + ==== ======================================================== + Bits Description + ==== ======================================================== + 6 Dirty Victims from the QOS domain to all types of memory + 5 Reads to slow memory in the non-local NUMA domain + 4 Reads to slow memory in the local NUMA domain + 3 Non-temporal writes to non-local NUMA domain + 2 Non-temporal writes to local NUMA domain + 1 Reads to memory in the non-local NUMA domain + 0 Reads to memory in the local NUMA domain + ==== ======================================================== + + By default, the mbm_total_bytes configuration is set to 0x7f to count + all the event types and the mbm_local_bytes configuration is set to + 0x15 to count all the local memory events. + + Examples: + + * To view the current configuration:: + :: + + # cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config + 0=0x7f;1=0x7f;2=0x7f;3=0x7f + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + 0=0x15;1=0x15;3=0x15;4=0x15 + + * To change the mbm_total_bytes to count only reads on domain 0, + the bits 0, 1, 4 and 5 needs to be set, which is 110011b in binary + (in hexadecimal 0x33): + :: + + # echo "0=0x33" > /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config + 0=0x33;1=0x7f;2=0x7f;3=0x7f + + * To change the mbm_local_bytes to count all the slow memory reads on + domain 0 and 1, the bits 4 and 5 needs to be set, which is 110000b + in binary (in hexadecimal 0x30): + :: + + # echo "0=0x30;1=0x30" > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + 0=0x30;1=0x30;3=0x15;4=0x15 "max_threshold_occupancy": Read/write file provides the largest value (in @@ -464,6 +539,25 @@ Memory bandwidth domain is L3 cache. MB:=bw_MBps0;=bw_MBps1;... +Slow Memory Bandwidth Allocation (SMBA) +--------------------------------------- +AMD hardware supports Slow Memory Bandwidth Allocation (SMBA). +CXL.memory is the only supported "slow" memory device. With the +support of SMBA, the hardware enables bandwidth allocation on +the slow memory devices. If there are multiple such devices in +the system, the throttling logic groups all the slow sources +together and applies the limit on them as a whole. + +The presence of SMBA (with CXL.memory) is independent of slow memory +devices presence. If there are no such devices on the system, then +configuring SMBA will have no impact on the performance of the system. + +The bandwidth domain for slow memory is L3 cache. Its schemata file +is formatted as: +:: + + SMBA:=bandwidth0;=bandwidth1;... + Reading/writing the schemata file --------------------------------- Reading the schemata file will show the state of all resources @@ -479,6 +573,46 @@ which you wish to change. E.g. L3DATA:0=fffff;1=fffff;2=3c0;3=fffff L3CODE:0=fffff;1=fffff;2=fffff;3=fffff +Reading/writing the schemata file (on AMD systems) +-------------------------------------------------- +Reading the schemata file will show the current bandwidth limit on all +domains. The allocated resources are in multiples of one eighth GB/s. +When writing to the file, you need to specify what cache id you wish to +configure the bandwidth limit. + +For example, to allocate 2GB/s limit on the first cache id: + +:: + + # cat schemata + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + + # echo "MB:1=16" > schemata + # cat schemata + MB:0=2048;1= 16;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + +Reading/writing the schemata file (on AMD systems) with SMBA feature +-------------------------------------------------------------------- +Reading and writing the schemata file is the same as without SMBA in +above section. + +For example, to allocate 8GB/s limit on the first cache id: + +:: + + # cat schemata + SMBA:0=2048;1=2048;2=2048;3=2048 + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + + # echo "SMBA:1=64" > schemata + # cat schemata + SMBA:0=2048;1= 64;2=2048;3=2048 + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + Cache Pseudo-Locking ==================== CAT enables a user to specify the amount of cache space that an