From patchwork Fri Nov 4 19:59:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609217wru; Fri, 4 Nov 2022 13:01:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oQ+dyBif/eTk29ZPFe4duDPh1Tv1OU9NNVOFZRYyZM6qEIpfmeX+dLBUVl3++Sk7a9S2x X-Received: by 2002:aa7:810d:0:b0:563:1fa6:fecc with SMTP id b13-20020aa7810d000000b005631fa6feccmr37340821pfi.24.1667592101340; Fri, 04 Nov 2022 13:01:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592101; cv=pass; d=google.com; s=arc-20160816; b=0z12CnK4D1/7X0hZGNZuRtj6TXRLkx2l0/wHp3wkvDFAbdvDH/3dJHROxRbrPWIEwh DOa6jJ/vY9oYoG0W7ZUaVcnRnjU18dm6UqLC3flCt8iK5m0oHX5lLO77ZP/XWH45XnR2 im9mIdi4bHjWX/tMEuQ+GsF4I3QuNHfaIPvj+4BDx3QhtrO4wSfciM2EYqW+czjjgXZq +5JVyC2pVgBgHWd9WoaUek6deDN5nyVIhYmz9N9Mlwrzw3wuoVHumLsJRua8eRXhYFVD SOSnMRTSTBN0QJbTepWGYXJ/Kq9uAQYq0KziLah82u9S5z0ryMjYiutpvlV+vwOmyI/2 bquQ== 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=qa/qyGGo0Kk/XV44RHn4fj4LicOA+VtADzzKtonlvlU=; b=ppSJtH1l0ZeQsW4oXTCM8kcSLBR1PHiuJQLB9Dj+QNWiXomCymCbI+c7nwNUqPE0UP DMdj41B738/1bkh2/+epx/me2NZ1YNQF+Ng7zw/BolnB7QRMo+UQ98SYAtho+ZHVi+QR L0pWg9E7RRyMC5xyBTG4binpqW+vxEsCS955fL3sxFSqmMPDp5ikSHmp1cfPgOpnLN81 QYY47o1nijF4oNhgBldcBVtZ3bzurz7dJBMEcP36dTuQ5Zz3gGR3PRRacDxtP+dh8235 05hPfnqXep7YWFzWWBQXCV+m/oxbPCh3pyiaNeyUJTHKeQ7/eGwm1RkqcXkqZSAKe8Gp LZQg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GlaO3c1N; 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 t12-20020a170902bc4c00b0017a0c17e47bsi451256plz.78.2022.11.04.13.01.24; Fri, 04 Nov 2022 13:01:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GlaO3c1N; 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 S229764AbiKDUAG (ORCPT + 99 others); Fri, 4 Nov 2022 16:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbiKDUAC (ORCPT ); Fri, 4 Nov 2022 16:00:02 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2074.outbound.protection.outlook.com [40.107.244.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C454385F; Fri, 4 Nov 2022 13:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RKAQudwL0wYlWUj4Xvo+Jk9IFFa5BQ26d3hMpZ/8viugMFHApwumC7ejzKo0VVtmzCrBVJC+7V9k/6O7oBcR1q8FyMDeN4xT3udnAI0jDfD2OMzMQ9Kqc68Y3WwS+S2OpCtK4LhQRD1J3DHevuuLQJsfZucE2KYn3QiCqbVWv4X8LPNFeDi9HItE8lUMgQ4Ioz1rA7a9SIJpLYbluUS5vhGugAhTYjk1jCWmwrPIQ3hjfMIBQRdm7NCP+nG+Z1T8vj2xCqNHxPjnE5ObXIJWbA1tBn9oA4+0Ei4IN0am1sEq/iq/52G4SQ1mbcwuBkEnuP/9p8WQ255aw+UOZd4VBg== 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=qa/qyGGo0Kk/XV44RHn4fj4LicOA+VtADzzKtonlvlU=; b=KE6kPYEAZwmwsK6V0jN0w7TdA40iWWf5i28RBRL3KY3PP3OF30yx2EolWbLgzCEI9Mkmr4swUI4+FiY29eKhVuDwLSA1SfFH9IrSVQdAtxnuKsyJcipCXSuzq9OGjE9aJjD/0DD9LmJI8Ea7r9Zc82y3bqJWqh1bN2tcbOicv/HrwP4MLZohvohXcGTky0zXZA0QPGn91u9p8twqatvfGlG05AZ5a4yTYNYh1HpPJ9gSVsscoPue4JOlpWcHH001kkuy3yOoDAlE6Ctobe1BSSGKnZE4PM6tQvDWjpL9GhaPTlnaTUv7XvYs7nWdw07jFrrdMvWwkkV+k2i3X/eU6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qa/qyGGo0Kk/XV44RHn4fj4LicOA+VtADzzKtonlvlU=; b=GlaO3c1NIwy1h5P4bUz7GLNGuTpqF9NKDdbsSnJvHUtZ5ma8BGKZOLI472zSXw0rttGbdwO1X9sZfGRvituOa/Wj06JUHx9fe6ossugoizV8MylS9c/z8SUIC6BIvXFgaS5di2ZQ/nxMGoK6dQZpIYLzkwoVktDtwYnfHvENzFo= Received: from DS7PR03CA0068.namprd03.prod.outlook.com (2603:10b6:5:3bb::13) by DS7PR12MB5720.namprd12.prod.outlook.com (2603:10b6:8:73::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Fri, 4 Nov 2022 19:59:59 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::65) by DS7PR03CA0068.outlook.office365.com (2603:10b6:5:3bb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 19:59:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 19:59:58 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 14:59:56 -0500 Subject: [PATCH v8 01/13] x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 14:59:56 -0500 Message-ID: <166759199632.3281208.5709918293488898752.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT050:EE_|DS7PR12MB5720:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c8905ac-a3e7-4dda-1911-08dabe9f26e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rekPEjDHKKeLUg8NEGMS31WGnT3fxhD96c/4zvgQi1bF2NJaA4eQi2VG+HIUbj46z80QX85LI3ScRpxixcBpTOSr2XQWZfgBeQn9R5+lmPd9erVOuMnBkeqINuSAYottWz8877b7KcouFDi1Fb8P2/WfYUhSLiopNuE3acKzXx2r4B8lVy3L9Kkev2QNq8Uk+RyHLEX9ZAQrrTzG0vgma8ABZ0FSgHieluNqhAF9o4dsFM64zXHYric7z0raq9wxeEXbz+5oWXwc8p1fssZF1VCcNgClOWb2MG6aFxSNh3DpodmYxMw7ObHgBMUgpA4lGklXiR56hvgCISt9rZUXdesUsQ8RgmKEumBPPeDQta+cWJGA0o4kmepn8FiSf+h9mCqCkxgwQPZS1SMKRuYDFYNfhwwk0QWJv++PJ1M2XFWiKas0PmunhpjjUwXB6p3DYrvaSRMyOtdprP2uiH5GVYPYk7W9NTlLKyFtNYgAgj6fnigqOZUIM7sydLuoWIe2zNrk9OUpHKdiCzAjG/9iKQZpTxTYC5/DbU/WjgMuWu5naU5hY7PdOQ4xbg/qOplXekLju/+6yxZOudHesfku1Nvm10Gorc+7avEF4wcvEqJo6wAUyMRYWeDYcux9pljW8lIBY11bPPma8HujnJfSKL+JMN3FL7eXvIBjOI7xW2Y3UeDFFSRr1bUnSolJbugwINtr9U20c4k0Uob5k/4ZxTa0RI+7bVwx76Co7F/5rkNFiInwH+RF1gM8uzxEDwbFHmgg7KQ4WWwt7R7AbxCa60x0V8H1VMPuH2r0Y2C3nRPODoqx+gyUaChfcheEFkRYcq6ITJ+8h10KwOmbqcMTbkOn3BigAV6zOeQyUIZ6J0krVtmU4d7+8Drgb11oVPY6Jn4chiySWlUwibH4/Xgxng== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(7916004)(4636009)(346002)(376002)(396003)(39860400002)(136003)(451199015)(40470700004)(46966006)(36840700001)(103116003)(81166007)(86362001)(2906002)(356005)(82740400003)(36860700001)(83380400001)(44832011)(40480700001)(186003)(316002)(9686003)(47076005)(16526019)(478600001)(336012)(40460700003)(33716001)(966005)(26005)(8676002)(5660300002)(54906003)(110136005)(70206006)(82310400005)(41300700001)(7416002)(4326008)(8936002)(70586007)(426003)(16576012)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 19:59:58.7387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c8905ac-a3e7-4dda-1911-08dabe9f26e8 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: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5720 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?1748597055126292066?= X-GMAIL-MSGID: =?utf-8?q?1748597055126292066?= 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 Currently, 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 --- 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 aefd0816a333..d68b4c9c181d 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -305,6 +305,7 @@ #define X86_FEATURE_USE_IBPB_FW (11*32+16) /* "" Use IBPB during runtime firmware calls */ #define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17) /* "" Fill RSB on VM exit when EIBRS is enabled */ #define X86_FEATURE_CALL_DEPTH (11*32+18) /* "" Call depth tracking for RSB stuffing */ +#define X86_FEATURE_SMBA (11*32+19) /* 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 fc01f81f6e2a..5a5f17ed69a2 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -44,6 +44,7 @@ static const struct cpuid_bit cpuid_bits[] = { { 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 Fri Nov 4 20:00: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: 15767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609220wru; Fri, 4 Nov 2022 13:01:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Qh2trU4HQXrp7KBxlP8LnHZtJnaq3sSoZbHFEl9DechyVQJpInN1WwsoefRhRQzRfxAOJ X-Received: by 2002:a05:6a00:80d:b0:56d:93d8:f42f with SMTP id m13-20020a056a00080d00b0056d93d8f42fmr25321001pfk.14.1667592101657; Fri, 04 Nov 2022 13:01:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592101; cv=pass; d=google.com; s=arc-20160816; b=CQvoihAR+tLOVWr6QDmjVhy8wWRSskTjgRWt5WJbDZU2bZz7HgzYcjqxifq9PHX8Lp Ofn+yyYRtlnwcCjsJRYJH/Hz9JZgDA4kKLGEGuvnOWSAfSsipDYbDtgj6G5B5SsRGwyH JM1grOMg91LCr0EltP0opvo7LYqNWOpTiHZaUXHh+RYOjtArBLMfba/CznLNpCbBmMVW VhrvN+/zPjpHXqGdtUueDr6t6J9ePMHwbwCvImQ1swFKLeF5DXRFEldoTeyiNBM0mZu3 ST/D/5N9PSXWsZeAYVORVAtQRndCjcJWRZbP2CMYpFqZEko7Y3tJWgnGzcONTXeWgPfV BP+Q== 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=HjDnqO29sOEgSFMiVrU5p1hyybZIQ5Vf8NR6Gv9ZDXk=; b=OwBJmN4UJb/INEPoLc/b/Dsy88Yf9YEFnXWMtqFD8Q/0/f0NI/bXlVn4epH5fJjxbH ibiXdaPOfiyEAIhyYsynnUyndEDgHvKsZCiVOUfRWIzPCSuJfPLDvhFUMGbUyvrDrZP7 E9lQTlhyX2n4BZbi73pL2SZZbx2dl1Xb+v69BBM9yqADSqlg5/APEwmTr/Ay9VvWb6qV Za9AZFDZCUwRPH7l+e5oo1vrOO/YAUpNfKwHkpxsqBVih5tpXdwIFyQzxxFbmK4ee1oX pUZqGIT4UQPjEt/PWl1ujkq3FiA6BuTv1RjeUOY+0s5SwRDyR4eXE3Pc9oau1sL6yFNb 7Lqw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CXyRNXtJ; 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 m11-20020a17090a858b00b002135e1f5a7bsi4080822pjn.155.2022.11.04.13.01.28; Fri, 04 Nov 2022 13:01:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CXyRNXtJ; 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 S229792AbiKDUAV (ORCPT + 99 others); Fri, 4 Nov 2022 16:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbiKDUAR (ORCPT ); Fri, 4 Nov 2022 16:00:17 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31CAF45A20; Fri, 4 Nov 2022 13:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lepj2GiQifyEKbt3sHT3oSpY2x0lvvXzDgk6NWyBtZrwye/wZF5MayBRUIR7CN8hanGrMuiKW/JaVSLzIX0Pf3w0kJu4dTUsXyM0B9Hx1VfM2bYkGytq8hFoGzYfuIOjR00RsmBzUJpd1HhAeghyi5ZCdooYtGss+zazZDA6Vwuk/wvZFKfRSo2vB8H+aqAzLIURvpq4/2VUflsuvntELw5xhKLlUHdA5vxIuSH1IAyY/WXxwTvDZzPhfDRB0RMWgjJY8Izc2Qsu4k+v8tqR/mM7HSxI7m9E8A9vpAcWIFCEdCLlYvj9plgIy0Hc2S7WX0fYY8ykw/nxyftCxMhuQA== 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=HjDnqO29sOEgSFMiVrU5p1hyybZIQ5Vf8NR6Gv9ZDXk=; b=Q7osxiZHFvV6E4AsEtlkLsgZnuxGOjvnhiaB04O1YysYRAmI/y7gQnzrxwwxsQF0F14nY1yYT9FkAldnJYZDrT43WL7zcRceKVsd71uvpB1V9BRIey6BanIZwMii3s/a5im7WraY5e4wzpxQNsDhgqcewzUvkUfW4O+Z+t3AbrNKNZKtjdeGpNIMKmY8v9zlTVB8Dp7eB0TSgZ9x7NIuU7UPNH/39I4Oqii78nA05TxAJT7ZlKU3JG5LZ9Q7nZhbCqTwSLIOreLFpP0s1ny2ug7q3YBpvFNWMSF7+pX0w6wmeNK3UbRIF5ymZoTTu1dQDBiYkL3TyGiJkIav/HW96Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HjDnqO29sOEgSFMiVrU5p1hyybZIQ5Vf8NR6Gv9ZDXk=; b=CXyRNXtJoQSrdWNcQ6BtYEN5vaGHvSAm5ddiIiqrQNdXCyXrxbUs3XfQcKlsACtYxzP2iAU0yswjsDqps306Er4soQfd3LabtORBHyVBCwd0aqOKI9EdVcVZx+/UMmrebHGkZfLXzPO4N7UF7aBGF8F1qq/bQqWuewzkBYyfwJ4= Received: from DM6PR05CA0063.namprd05.prod.outlook.com (2603:10b6:5:335::32) by PH7PR12MB6634.namprd12.prod.outlook.com (2603:10b6:510:211::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:00:06 +0000 Received: from DM6NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::7e) by DM6PR05CA0063.outlook.office365.com (2603:10b6:5:335::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.8 via Frontend Transport; Fri, 4 Nov 2022 20:00:06 +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 DM6NAM11FT010.mail.protection.outlook.com (10.13.172.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:05 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:00:03 -0500 Subject: [PATCH v8 02/13] x86/resctrl: Add a new resource type RDT_RESOURCE_SMBA From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:03 -0500 Message-ID: <166759200326.3281208.5387897092180999498.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT010:EE_|PH7PR12MB6634:EE_ X-MS-Office365-Filtering-Correlation-Id: 831d8c16-8701-4405-2141-08dabe9f2b15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tGfMb3MdCHsaTi0EBbnmVFVPO6gjp93qEYIgW6NnijDg/qMEoJjsExGmzrdbmtlSJrmjSn9XPYCFxnIihDdPKdT7VIxNX1EfYe9utgK7NjlltQZt+MtQLuyB8ovMp7sQcePDqV93cQVbod0n4n9bjBbSjT7JJkCSwOrt6yjZVWHTdq1Zy9sn79lzfhMFuxGdyR9Syoe91ScVYgQtYcDQC0y0zn0gYEuUgw/UI/AnbeNrd2rxWFNnxfhnAMCNzK2KeB0dDBzNjUq9KNOY5qM7VDjCZ9vpwH7K5EMnd9tYvDDojGo9sQ+vfTqfSLwK5zKIUP7Wm4QVPoQUTOBLg6uaRPXAt+625C0d48d575yXUlxPrwH19buG1Dqh8LN8u+Ik12ZxRVKf/nptXI4/ZKQGSLhd+tyvhmtBNz48AuUgvXPGlAyzfgEUBML0Sc2Wv2pgtsNIVSaBF4W8dsj39LSRtPJPkS+nH5qW8LbhGJ6QTIninU4aXsNst18TsmTtVfy/iGnNrIrRTw98KXxG0yx42+V3jnhu3wGqVEhYEzDKzZRgInAfC+/9mgcfDCej1N2yxX7xeP+yK2rn1nZdPzlbXsfsRTS8swfLSjCEBXwCcQy9iD27LJjrVYoTQTaqxQ9rhHpZAO+hR19/8JGwFArBdwlnZ9xmQzH6c4R8vcqJ2jp4A4kmtXXNXBxjWVt73uu6uH3Frqzn1gW0YkstX4dNaFHrp1k28mhcy+uv6pMNBB1yuOyo+s3KzlCqFmLGVNMRZRC1SxbEzSv+u49fPcTy7dUud3k5xC6rMVRbSsRJsQS+AC3ci0vfows3fmXfOClIsUJ/kek16cbDn49ZplOwHQ== 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)(346002)(39860400002)(376002)(136003)(451199015)(36840700001)(40470700004)(46966006)(478600001)(86362001)(356005)(7416002)(82740400003)(2906002)(5660300002)(36860700001)(426003)(40480700001)(103116003)(336012)(47076005)(40460700003)(186003)(110136005)(16526019)(26005)(16576012)(9686003)(54906003)(44832011)(316002)(81166007)(70586007)(41300700001)(8676002)(8936002)(4326008)(70206006)(33716001)(82310400005)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:05.7447 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 831d8c16-8701-4405-2141-08dabe9f2b15 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: DM6NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6634 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?1748597055473976163?= X-GMAIL-MSGID: =?utf-8?q?1748597055473976163?= 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: Ingo Molnar --- 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 03cfbf0fe000..4b970e7192e8 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 5f7128686cfd..43d9f6f5a931 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -419,6 +419,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 Fri Nov 4 20:00: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: 15769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609229wru; Fri, 4 Nov 2022 13:01:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Xq8ltrZn+ksJcd3JHppGRCulNc4Bh2xW2NXYHVIdFKDMT7F+BA/CpkCxDx4cfQspYTf0L X-Received: by 2002:a17:902:b581:b0:186:fb90:1151 with SMTP id a1-20020a170902b58100b00186fb901151mr36945713pls.43.1667592102822; Fri, 04 Nov 2022 13:01:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592102; cv=pass; d=google.com; s=arc-20160816; b=Tdwl87evrpFojAOkT3e0++93z+KiMRPi5DUMKYGS87afYeXDbF9PddwBSha+YeiE2j 78eHMsM90XIDY+c7trNQuUCoCKnvJuzZgEvGiOrM8JXwIjwvXSvxHSHUQDrNoTfpfA7T Roevgs1izu2jy+E4Fn29faMAeS81HHNG77Uooh+HbFvpLGSM2p+IxivAAUCI2YkPlW8V BBPIAlQgo5AJC/4/RMhNY9kmQczBRVJbQfyuG0r1yDTxhBe2ZmyspSnuw9RQmHUH1QVX F0SxTpnfeLCauqFp2E+CTpX6u+CUk4wFhhjQaFfMXuFTTC5RMH2e8t7oOhkdeXHuoot2 n2Yw== 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=aS1lU0zXNAUhuu9mwovoNExV1tBWYnCwFelGPZ1pfQA=; b=0PH07/8Qe3opN9PZ1oW+CxUFUZ96RVaIPTg5rkf/YuFL12hnJaOXhS4BA+KnPI/ixO Jrybm4qHP2HABMbUZwNCJeyB3rbNdLYWGAOftHd9vREIm92qUaXY8MM+tZnfTtRTT5Xu sgL3P2kF4YS86t6HmLKHEMXY6Onobki+sWhI7iXmoUqWi6hQ/EP21Z5ffRywasNoExeK LjvT1iBOv4XPGuDYoC5hHiS7z07msqyqE784QsC1qx44igYqzKtGkNYyaNHOWPeNaOpc IHJNJ4g2H2Fi8TK8olN2Zku3f2y7kL0s7Qlw6GXQg++QdDeuc5KKjX/H6NQpiWZrmomN tX7w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=MSd+BvIW; 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 e13-20020a63500d000000b0046ea4ef43ffsi495728pgb.375.2022.11.04.13.01.28; Fri, 04 Nov 2022 13:01:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=MSd+BvIW; 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 S229499AbiKDUA2 (ORCPT + 99 others); Fri, 4 Nov 2022 16:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbiKDUAV (ORCPT ); Fri, 4 Nov 2022 16:00:21 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2086.outbound.protection.outlook.com [40.107.244.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A08845A20; Fri, 4 Nov 2022 13:00:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XGhD+r/2hWWiGNh2fS9yHRtd+IvQVum6Nq3qShs9UcbXhs8hZ6kU7D/6WoyUJJgfNyL+LKUyNTtygERfBu7iv5EUs96Ng0MpYowtl1dupaE9ujgQHoXFEzYevi9oRY93agALx5X6Kzij7LyLBXr9uWZ+n46aS4KN/Bq8p6L7AVm1Z7WlrLA2hJsoK8GmQeX6hF2xLX/8ndy8mJdpsa9iCEbxvlB1xNM+FbXgtlzhzCBDvaGgBVwoE9IzKOhljwoedPrLpLh0vfJQABSeaDEkqmYqk4VC4Fep57qN9L9K9cCifD9UIKP8fqg6DDXNnNauLl+ED4EqMX9nWOjJfJRyyw== 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=aS1lU0zXNAUhuu9mwovoNExV1tBWYnCwFelGPZ1pfQA=; b=SwLGWW1vmvV3e0Qksur7yVTvR041ada0K34dRAZ+N9YEOruXi9oaHB92jokjs0KoJ4/rayzcBs4VTOWspA1Kx4zIKFYy2hVIFtgKKamXds0Ab9EsSK7dFzLu7bnjmplRVoOU+t/o3xbfLo/UoBCvAgKktgKsJ4EUQp90gtLSNjMGXYZWZuV47T+wpxGqloYp3Uo/SpAdMGzKkxTlhZ6jtRYdkg/neG57tsqzG9433dgSMBFTZT5pBiln2oljRnrGlj5aAiqlU7kzvyNaMvaK4lplnSHrBuH64EPG7BWeG40tQsbnSLjf9N2iNnMopSoibMh6IUFkccRysRbeJSmMZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aS1lU0zXNAUhuu9mwovoNExV1tBWYnCwFelGPZ1pfQA=; b=MSd+BvIWBGBRUd1+ecmmR3OvKnKWkgOLRIL0wtW+lxkCjYPpQswSiPfsgYFWKFfQO0t448IafUD8BFTNc0D2rkg+BMww5FbEByyaqOCQ/sz3B2gTNwYTpb5Z+TeGofjQnSPWsr9x7G7h2W7iRK3zmClkHUlSTnaEWROoJQ/Gstg= Received: from DM6PR02CA0146.namprd02.prod.outlook.com (2603:10b6:5:332::13) by PH0PR12MB8125.namprd12.prod.outlook.com (2603:10b6:510:293::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 20:00:17 +0000 Received: from DM6NAM11FT082.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::65) by DM6PR02CA0146.outlook.office365.com (2603:10b6:5:332::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:00:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT082.mail.protection.outlook.com (10.13.173.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:17 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:00:15 -0500 Subject: [PATCH v8 03/13] x86/cpufeatures: Add Bandwidth Monitoring Event Configuration feature flag From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:10 -0500 Message-ID: <166759201032.3281208.8545863740733338256.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT082:EE_|PH0PR12MB8125:EE_ X-MS-Office365-Filtering-Correlation-Id: dbbb9ac0-38db-47af-e94b-08dabe9f3222 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vGNb2lrg4jquiirc3zSnhBvmJxNY7oZx600M6+fF9EknOHVosZbcBzhf+jEuTRcYuV7IX0X/Xe9y64b2LAheZEkf6qTvZbWwJxLGf4996N6V4++LjBssge55iF+ZQo+tw+g1Y1s0TcJGujjaDORmDFmUbW3LJhraZKieorSxcoCQ3Gbz0Q5oPRO1ySIZsJZbiiKepHea5sjlUOTqr0yXJNo8lil9RgQE4uQtp5I2l9pzXvaffXzE6K8vk41N3McONCXSWaGJS5NOSRcG/rEqDEhNkIeZrbR8PIPHKLvDevtLLd57hc1tJdj18io8SwWatcwba8gxl7OlcSYcJ8SyQTRaZshuJIL5gqk67DPt4wRLpf+xhqbxVnKkYZQJXe34pTWnKd/tmORsKrlCyEWoUP93m1gu6DamxTCAbV+YWl5qRyqGs7ojGXs8MNEuV7QhziFI9vDWJlXf92Fyfgfez/GNsf7u5SHA9I1lhZSKpygxsmf+RhSBZgu//+cW4bX7Cj+dCGFqP1mZOI9nLo1Hk2D7rbLzm2oGGKUxY7g92GQUHJAGBRm5id5xBO/HGnVLpEVrVekfebsR3IWEPKlCWPGW8AcOf/qyC92Bfep622FsGOFdmSb1sqy1ltsd6og+rmiv0jJ39q/vfDCTJBQ6VUebIkB5JLnpNJwt31M4U3B7WQpFamOODmxs9uXi8kd8XSSTnSfrDDAHbzr5MnJi9sXSR5dKvAqpE1RQnFGI7Uvb3DIlkmje/hBcgd+58/0XATr/qiA1Soyy3lt7/kJc24tl4fyXUtcYaWLi1fQqBn8djd7K9gBERAIPm+qJi/fxR8tInCB14e9wG06YZhdnSetZa6imNhLF0/wXWuQZNETZo6VaHAOTFXGgM8Xdziig7jmB3t7zmbkgfBEV293zWg== 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)(376002)(396003)(346002)(451199015)(46966006)(36840700001)(40470700004)(103116003)(8936002)(966005)(82310400005)(7416002)(2906002)(36860700001)(9686003)(26005)(356005)(81166007)(33716001)(40480700001)(186003)(16526019)(47076005)(5660300002)(86362001)(336012)(82740400003)(40460700003)(478600001)(83380400001)(44832011)(426003)(41300700001)(70206006)(16576012)(4326008)(70586007)(8676002)(316002)(54906003)(6666004)(110136005)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:17.5635 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbbb9ac0-38db-47af-e94b-08dabe9f3222 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: DM6NAM11FT082.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8125 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?1748597056703722993?= X-GMAIL-MSGID: =?utf-8?q?1748597056703722993?= 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, QOS_EVT_CFG (0xc000_0400h + EventID) 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 --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/cpuid-deps.c | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index d68b4c9c181d..6732ca0117be 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -306,6 +306,7 @@ #define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17) /* "" Fill RSB on VM exit when EIBRS is enabled */ #define X86_FEATURE_CALL_DEPTH (11*32+18) /* "" Call depth tracking for RSB stuffing */ #define X86_FEATURE_SMBA (11*32+19) /* Slow Memory Bandwidth Allocation */ +#define X86_FEATURE_BMEC (11*32+20) /* AMD Bandwidth Monitoring Event Configuration (BMEC) */ /* 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 c881bcafba7d..4555f9596ccf 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -68,6 +68,7 @@ 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_LLC }, { 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 5a5f17ed69a2..67c4d24e06ef 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_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 Fri Nov 4 20:00: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: 15771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609392wru; Fri, 4 Nov 2022 13:02:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5EvNLwN6QKPrNMb4FxMBefoP5nPKDORaGu5iYJyzhx6NkmetHWxMtfMuCGrTmMRvXwvZR6 X-Received: by 2002:a05:6a00:15cd:b0:56d:1e00:f057 with SMTP id o13-20020a056a0015cd00b0056d1e00f057mr34007923pfu.30.1667592120656; Fri, 04 Nov 2022 13:02:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592120; cv=pass; d=google.com; s=arc-20160816; b=s8WygKvqecsgd95Xzfn3emuLzN5y0u/scRvNyhwp/RGLvCYJEhA8XgGrKnwix9XkJ2 qKyQ0tpa9YfuR+bD7YUlPXQaRu8+JObtzg5yeVvTsVcR/TdZHeHmBrSkyziEWrHNdL0k B4HIWWFKD5rrCLUuE0ECZd7sarT5HOF+GxiKRaSUYXiE2yxYgZI1zjbwF0IXgu/rCpsm enDqaAxpg/Cr5Ls40s0kW+nEPGAS+5p62N6dlMHhVRqgwOM2iCfg0Kqcn6dX0BIxgoUX dAEyWRVWuS/OCYysr+fQJH2vXllG68TGr+O8deDFq2jy6UUiSAOYuOyyKJ+spDo/oXuY CY3A== 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=jd3w3P/weTCZO0Nq/NnxPBowTYaTCyeGACzKZuq6P0M=; b=cr8bjbOox9quj0vn85fX2sY70hgHcMd6Namlb3VnDPsn9ZiGkxkoHqDLkPW0vOR0Xc A+rtPRuxmzbJb62alu/8o9jn2on0ATtOyPM+uSm5LmZNl4O7MPcJFeAcYxWZobQVAG1J 20ohtU8voN1pp3g1y3g684QwjARQi8aOD4Hu/oEB8Sx8nrRafFjmrdg1BaYeFIATaIVi SVNNfSGRrdwQyRDijsCigW3bnk8rhi3/nhx3fbMzsbum3G2gYiVSozPSlYff+ZfdaTVz smbbJwgpOMa3dSQ7+3/BY/l53LK/hbINuC151oRrSOpLwuidIqMdSKvl94i6O2vdv+Zm 4BDQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="m1/oLmN2"; 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 h7-20020a056a00000700b00545c63d5387si168817pfk.21.2022.11.04.13.01.47; Fri, 04 Nov 2022 13:02:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="m1/oLmN2"; 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 S229489AbiKDUAo (ORCPT + 99 others); Fri, 4 Nov 2022 16:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbiKDUAc (ORCPT ); Fri, 4 Nov 2022 16:00:32 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33B445EC2; Fri, 4 Nov 2022 13:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HOKE3+EoIxzVYgzxZTcS/Y7AWQ209B3DaNry+7ALxVulPmoIWBDYumbDzcm1kDdeqi0D8V6dp5iK8R3vV6gpNNoqnxKYw14+aozADUZbspuZsp1pCXBaI8UMcaF3pHrTLdVih68RYTjsIre0W3bJzVUR8VsIZDoICHrvH7gi/v+lassmB3f4kzZGA23A1xyEC8RAGnRcWsQ8JXdcYweKBAZbVya/KuH7EtzTCWPpv8cNV02gwlXxIBH5VV8wtWehPEXc3ZIdR8lWKIA65HqEhZC+dsU2xp5ShXL8cIKJWSISxl97fqfQVTzWjXPlzpJmX589kCvXSltKDQPjsiR3PA== 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=jd3w3P/weTCZO0Nq/NnxPBowTYaTCyeGACzKZuq6P0M=; b=B9gyrUEjkwDqBg0lOTA1ili5bmOeil10bQQy9WNybz4aCiuE8YOOXAtrRAkNXdIyz1TMbxFBwPPcVoDKl+ASrf42XnSXXlBcs9HgstKR5o8U+LRCYJJy1s5o5FuLaTBN+i84am+uUT8o7S5VucKpPPj0qh8i5X95wpBvz947FnBQaHtA9IBpGh8NJskN+zU9k1uIHG1Z9rZqibASpQGSFfd8Ig8GOvTfI0QGLgNxsIh4O3R/L63rbHx4jxZHfP56C9nyB54okMTlMcyuNTt73KzwTSh0nWQz9LOa/hA69SdgSOib9Qb4Wq5tzhMHtdD8jEqfUeb8gqz+waFjmlR5dQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jd3w3P/weTCZO0Nq/NnxPBowTYaTCyeGACzKZuq6P0M=; b=m1/oLmN2U3vYKvaS8olw9EebQE7H9a4/hx9DViAoTMYA27KLc8B9WuiXzMdcLL/ERG4y8eJ/ITcL5Bb5LNPdOfo85XguCeqK8+CPd4LOiOCroN6B8RakQDR1rzGIRLEMR0Wgb/2ioal8BkdUarSZYqQnfQw+rMtXZfMDkvVWDpY= Received: from DM6PR06CA0032.namprd06.prod.outlook.com (2603:10b6:5:120::45) by BN9PR12MB5050.namprd12.prod.outlook.com (2603:10b6:408:133::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:00:25 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::d4) by DM6PR06CA0032.outlook.office365.com (2603:10b6:5:120::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:00:24 +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 DM6NAM11FT033.mail.protection.outlook.com (10.13.172.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:24 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:00:22 -0500 Subject: [PATCH v8 04/13] x86/resctrl: Include new features in command line options From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:22 -0500 Message-ID: <166759202231.3281208.4695877999050945787.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT033:EE_|BN9PR12MB5050:EE_ X-MS-Office365-Filtering-Correlation-Id: d2c68264-7e31-49d0-556b-08dabe9f365e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mOX11GZGFUMNYm8M9MW6Zw1W72meylsxWnw3gLehvoNTwB7bNazbFY6oZyiLkLFIE9Uvfmp/FasOVRYRlMzz+oENdTBvqtwc9PBVmPR88w6WUsdUIg7IdyMOKttpt5EDaL6tingsszPe+wXd9stOQKt6Rx29WyLHtBngw6BZ8gBVuJefDOG7DOsTAC/2EjSheAnnOu63lZI1d22sgMx2jAo0mNX/TVSmzBJaWq8W/+hV695skHbw8i8CslzH0a+tc9YUeUHpXAgQEywLEVGXZHNbg9VD0s0KGsHlITCXNmmCCJLJ9pwIA2t079wbPlzQEUtJHLKL79Zemjjmjh7IC27BEVaOTQ9ymhJYcaGVz7uVWOciEjJGsVtzuT7gZqO3R19nR8oEsLr4IVLFZNA8V5YFDKZERx29uGgaT0jH6+klok4vVkwSXRrf3GVmQBgdE5otJl7QcTYUOh7a9lw51DvVE6Gb5uAL6XGF8MMV581g1gdwijwopcQEF3ppZE96Bd/6JRssbcOQDi4HE1bN1uTdxdOK7ZKrKvu9opH3eYr2Yk1peHkgwzIdJnEFavQ6TVwLiOBmGs+rUgTbN/B4oFRAOr8Iv8OqomAGW6piWSS1DeTQY/DTET3C4rRs2JVmkOk1quWjms8Rb/mhqhnQvW9GV3Gg2AmdlgLGbEa3cN34QUbNMIwinvGxs8tBdzBxgpFyP19gVXEvD1Gux+XPjshvBXGpr3IzNhw7lauMPPfA7+DDiVkn4IQykrz1mUJGgsAk04e0KpHSqLEMxfNXlttS73GyP0FgMLWVMH4II7qBWddm1HBO7KpOXEUEz4SF6LAO1sqXGNKIu9zGorOTqQ== 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)(396003)(346002)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(54906003)(336012)(426003)(83380400001)(8936002)(478600001)(70586007)(70206006)(4326008)(7416002)(8676002)(110136005)(40460700003)(40480700001)(2906002)(33716001)(86362001)(44832011)(41300700001)(16526019)(26005)(9686003)(186003)(36860700001)(103116003)(47076005)(356005)(81166007)(82740400003)(5660300002)(82310400005)(316002)(16576012)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:24.6950 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d2c68264-7e31-49d0-556b-08dabe9f365e 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: DM6NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5050 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?1748597075379171659?= X-GMAIL-MSGID: =?utf-8?q?1748597075379171659?= Add the command line options to disable the new features. smba : Slow Memory Bandwidth Allocation bmec : Bandwidth Monitor Event Configuration. Signed-off-by: Babu Moger --- 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 a465d5242774..f3f0870144fb 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 4b970e7192e8..e31c98e2fafc 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 Fri Nov 4 20:00: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: 15770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609304wru; Fri, 4 Nov 2022 13:01:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YqcqTQhT+dqIwGTNaz/OKZmLe3s5Wiw7U8Zu2b6Vnfe1Oih5KRpasy2FkAkmapBzo5W7N X-Received: by 2002:a17:90b:4b8c:b0:213:6a84:b4b0 with SMTP id lr12-20020a17090b4b8c00b002136a84b4b0mr48880702pjb.207.1667592111234; Fri, 04 Nov 2022 13:01:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592111; cv=pass; d=google.com; s=arc-20160816; b=bSf8ufRihZdqva93kyN0N4d90r3+60tbXvItg242uXKVlAMsOlwxNyrH66LkZAYlQc wz//vipcujxKmr2K8XasQyVCrEE7zz7i9gvrlhXG4CNKsNgZbQ2ihHiFJVEYB01PZnSl yfI+EzlUCL4wGoiq+DM/XJ79XxkiMm94FaTrcblRNzo44eiVQx7iM8zURRpR5NAE1hFR aPAR6KhjWkNq+vwnwMOP1AT6cEBeQNrVWDjClCZJnZ9bfp5FpChSBNzHYuVzJZctq2uj LxYxLUEHKcnH6OY5OwlN6WEG4LoWWzlP7fDC5AykCT2/RfgqDN2Sn8JrOiI9QprPPY6e +0yw== 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=VCKm/SDQ0q4pCk0+0bzeM5Il0UmQw+4Ee6tUR4g01cs=; b=yCvVLo/zySafvcHBpyD0jqc3C1pIcJPjwYc6MY1jacFMKA5lRd7YR+7dQ02OJQ5+UX G5cVT0cgNMpQVk2toiB4DKRwRXZTZaZ1GGLrn3wQDjk3OIxUsL5QZiDjRYlNCYF6wAHH j4Cx+95fg6qENxC953/AfHFS+j3qXm3Ib/3s4FvhSz0u927C+WJnLGCD4tKxUueIyoCh 5GOJ3cESuROhZ1ZOsr4KGgkcWi0CYidsiM94rxaC+bcIlmHB4+OBv6eJrjrqSmxX/Buz NGNos1VIjtUDBQ3Vj5bX6/cU17UiSs6xKta9V1e6IPUnC4nsThDG9W92UsN4qZ8yHw85 bhXA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3soBWCHs; 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 s22-20020a63ff56000000b0046f3dfb9282si501269pgk.52.2022.11.04.13.01.37; Fri, 04 Nov 2022 13:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3soBWCHs; 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 S229579AbiKDUAy (ORCPT + 99 others); Fri, 4 Nov 2022 16:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbiKDUAl (ORCPT ); Fri, 4 Nov 2022 16:00:41 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2051.outbound.protection.outlook.com [40.107.223.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ABBE49B68; Fri, 4 Nov 2022 13:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xg/KE5vWXwd4nJkMm6CIEe7MTi71MfyAC5YIQRIyMiXdlNORlHDjh5qSWXF04Zh7PEKyPS9lgCSIJuwBuce14IILwMvsf7/ZZwM1txWJEwmixpGBT8XEnIjm/bKnlCJKhroHxlXEPAXpf2gXiqkveOZUu1BLz0vhbVvD4EB372UlzxzOOKbQRxa7c/qFPz3+B71fIim0uvaZzLNodYzd+3Qt2xL6dDQvsm8XT7CyS0ZppPB06b7mWbdroqtwYHddMy8IBj/fvRjExeZas7w5bVRLq5ouRKPths1SPcG4WOpzkGbrmVCHFXXivOgIeYU5oRzqdAd2a7mesCiYycw/2w== 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=VCKm/SDQ0q4pCk0+0bzeM5Il0UmQw+4Ee6tUR4g01cs=; b=mE0Cl9BTlIOYWhtuRblGV7gg3OMSwodZaROKW8wy0xedkkIta+g8ZgjBR/Zl/xWXl1nk3YoF5lvRH5lpD1fOouD9vxtO+PH7bw7goZL5ztfREUXdfkPprmA3x/fgY3yLabO27Dsi7jff/KqU7RwsxR/yV36bH3imaKOyEhxnyoth7wn/PNTtnRPTckc0EX0GyzoGYM2w+oqXUibaV57qAzJ3v1IN8tixxaLPQ19mnRvy/Ut5/ZeU1zleJQH0q2FE10sFNpmfKf67XwDHnhwC9JA0PQwKTtPJQr5eVLcfq143QLVyijdKPQkk3/nLB02bjEwmBCBEXkRV3OhWO9KljA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VCKm/SDQ0q4pCk0+0bzeM5Il0UmQw+4Ee6tUR4g01cs=; b=3soBWCHsMJjtRO2NylqsK41acKQbudf3C3qJAWm5c/9af1vywONy+ZkbrjDxdJZKVL/dEUXi3cC2VSewYwgCugSrSogDBFLmB7xiq5r+oIAKoDweHZbxnIGYLSoyhu3HpvAtUWpvaBQccfIKRcRUgE32KMfw0+haPAnmmhZSWck= Received: from DM6PR11CA0017.namprd11.prod.outlook.com (2603:10b6:5:190::30) by DM4PR12MB6010.namprd12.prod.outlook.com (2603:10b6:8:6a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Fri, 4 Nov 2022 20:00:31 +0000 Received: from DM6NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::7f) by DM6PR11CA0017.outlook.office365.com (2603:10b6:5:190::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:00:31 +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 DM6NAM11FT046.mail.protection.outlook.com (10.13.172.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:31 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:00:29 -0500 Subject: [PATCH v8 05/13] x86/resctrl: Detect and configure Slow Memory Bandwidth Allocation From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:29 -0500 Message-ID: <166759202922.3281208.6231300030834095574.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT046:EE_|DM4PR12MB6010:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d634fd3-4c49-4906-5333-08dabe9f3a8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QisL0pUCQsE3L1+wSbZ+it6KeZsn8/NLlFSVSkfJfwDL7K3BvaBLz0/qVxzCyGVRM9eCw8nFTLevXln8wpeXf1X5y/MK7cVdBfIbP/uOL3kfptUT8VzEuz3A15tlZOjAI2LdGWiPpckp+is9roX1+7uwecYESK8Bwshp6me2HgzIjs0kDLN3azznAubvDXejbxrkzrvxCnCCWlLcm4001dcTnzGAMx/uubpkztpi1Ty9XzOrMihtxIo+j03NEUfHn4HuQEGjPiusB5CwQnAQEdb+CvtQ+XS1pOrPrc8HufA/SpaxiHy35EpTFtu6FT8LDEI5l5jdx9dMPr7TwFGkQH7oS5zSjKUZtXeiwZGSY5OAvfDoygp+IPqWXH9+HxgL1525lebrZZiz9puHgv8L3nIQ7nlsXVZsrRfV8NzwYPyTOiS9j5b0hYMjdT2fIBHicNFrRpef+YXjY9fI0OIWfcNMNYcWGB3NZdlK9GihzAsvshhhkFstvR1bzUG5QYCwp1G8ePqlz7jbC90yz/WDn6bGWpZvtkddBBFIHVUA9yv376JpV96vRrW5CgIch7VHWS/3SYBaHjhT+H1njmVmv+NSw0xglbFDvl8SLGO3UY1zaGHfJNSgmTQj9YBnnGF3rJfJDkN2VHel7kBw/thIntlVfUmtpTpmZ/24nyuSE9wPRTOYasvDHbyfyjIm9BhED0P7jIlW3ytMEpJefY7qIGIGWSSbibEl1aSxc9h1fyH/EGV8t20UAXoYHkp/RG+IJ7N1Dj5teYN2SLRABcbzfvR1rGuKNPu8WPrl9cim77NpwjcciqEzVJF39YoibKMOaH+0/Oja1NGUVv3G/OjPUA== 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)(346002)(136003)(451199015)(40470700004)(36840700001)(46966006)(478600001)(110136005)(426003)(9686003)(33716001)(186003)(26005)(54906003)(16526019)(40480700001)(336012)(40460700003)(36860700001)(83380400001)(44832011)(47076005)(2906002)(7416002)(16576012)(70586007)(8936002)(8676002)(70206006)(4326008)(5660300002)(316002)(41300700001)(82310400005)(86362001)(103116003)(356005)(82740400003)(81166007)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:31.6852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d634fd3-4c49-4906-5333-08dabe9f3a8b 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: DM6NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6010 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?1748597065651658900?= X-GMAIL-MSGID: =?utf-8?q?1748597065651658900?= The QoS slow memory configuration details are available via CPUID_Fn80000020_EDX_x02. Detect the available details and initialize the rest to defaults. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 36 +++++++++++++++++++++++++++-- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 2 +- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 8 ++++-- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index e31c98e2fafc..6571d08e2b0d 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 again. + */ + 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/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 43d9f6f5a931..16e3c6e03c79 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -14,6 +14,7 @@ #define MSR_IA32_L2_CBM_BASE 0xd10 #define MSR_IA32_MBA_THRTL_BASE 0xd50 #define MSR_IA32_MBA_BW_BASE 0xc0000200 +#define MSR_IA32_SMBA_BW_BASE 0xc0000280 #define MSR_IA32_QM_CTR 0x0c8e #define MSR_IA32_QM_EVTSEL 0x0c8d diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/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 Fri Nov 4 20:00: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: 15776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610053wru; Fri, 4 Nov 2022 13:03:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7csBVOxM1aPYH8nX4yCEYSHnry8r87gTp+n1Xa4W+7tL90dDvT7WnVxIrzUQoSCDNUGtHz X-Received: by 2002:a17:90a:1690:b0:212:f865:4f0e with SMTP id o16-20020a17090a169000b00212f8654f0emr56684240pja.197.1667592186405; Fri, 04 Nov 2022 13:03:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592186; cv=pass; d=google.com; s=arc-20160816; b=zch8qwf4bd7CUYQB5gSmlhZxVXkqFPIMJKTf7m1GQ7IxKyXNBgQApTPEPns/R2wTVb i/ry39Sv/AhT28isjApVAaz2mDbvfeuokORtOotXZiZl1yNMDeyI8wTez/9KjrRSW4CL xYH2XSTNA/acDEuk5/W3aMw7QJri0VrF9/j+1gZCSdCI7tqkOhsEr+41H43yeUOgBLbC prWhb0Kwk3/bKwZM5hE37lnIu0UZJIUYPds/+zrBTDyJewamrfThzkd8u59M/Cg7w3FI GoAknIdcrORPvPGklomFbZ8tlO9ksMzCQhGe31QmsGuu6bLCPCSmctyiqvYVwjszSThG uHgw== 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=qUNml/GcRC1L5UbtzmycKFoVbdM/W6e2kLFg/9v8EUQ=; b=zrQCwJgCwvRB/sDAcOJWAn8y9yPSTKUxlyjTAk59IFWEbc1c+E49lgUNLN+bbV2jK0 UZ5xUe9B9lmFWEQ001ne80yvQT+p6C2gPWWpkgGcqRmbTc7PPmUkOwny151ItYwvD4uP aUkvENKdH5VWeJJ/4eEbOhtTSmnbNq8rjMwmzgGn40JJmSVOl3d4IX0JM6NhrSX4vwRD f2TleSLItGvPQkilJBZDU4bf31AmdrWiq3o+YJwfDHiKglWqbFKzQWSgsyUGdvRopfSv 04sa6xnArsOyLtiyfwL6lc/07AhVnc6yovXdpLXKKyPibaXm5UHQz/neLoyv5QmHXnaL Dndw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SBNr7Na3; 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 h11-20020a056a001a4b00b0056be3109462si109804pfv.163.2022.11.04.13.02.51; Fri, 04 Nov 2022 13:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SBNr7Na3; 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 S229553AbiKDUA4 (ORCPT + 99 others); Fri, 4 Nov 2022 16:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiKDUAn (ORCPT ); Fri, 4 Nov 2022 16:00:43 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2073.outbound.protection.outlook.com [40.107.237.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DEED45A27; Fri, 4 Nov 2022 13:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DUF15wbMHz57uMBdB4UM76cmLoCrjgAhEjxpkKeFCxTZaiWKlyBTd5vAzhxl0Odn6UDJPH3wRIboA22DL529Ofsz0D/sst3489G82nYgopL09dN9vMnLq3exdrLDIRht8/cPZSx4PcKqBs1I6ilEsJe/UcGAjOaOTbVoVnbCBiaefP5ZsdP6cbO+l/Jk9l2yzZcgQ+En2uZt4d37mWLw+z7niJI+EbYTCYHMZXjLPY4VlcX2q5cKYVbQvTp6oL+5aQpPYuZh8utZwSBD9J/tITEGrXreg2TAPsIgd7ZEyKml96gfrKPtRpqJMNEt3B37HRk8gZEaePdB4Hk+mKCY9g== 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=qUNml/GcRC1L5UbtzmycKFoVbdM/W6e2kLFg/9v8EUQ=; b=DwnMmyKMcKLFpqtHgezYjAXweBfk6QzloWuCQESlXyHS+FG1EWYPIs43Oj7/xHXfjRvp1Ig3YmNenduorXlXS9er8WQf9q/H+kRHqZMFU66CaGIppFVMnai5E16NLeJwDsyV8dpMlH7U4eId1LIJi+nWbfRtB20OXidWmsmo1PcNBw/GCbtMbJMplgwhHPlocZalYk9I2g8HbwYNvJUy9Pl9m0BQc++uBdr5yux/+wKS4VwM5OHSCHB3eDNDOiptXyuSQUckqcaStlcH2Cr29ZqKn0A+tXx3qVu50+8riajH+V67N9XBNUGzR+T0/HhbcgYcHZ4ZphPcYgMP3Msp2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qUNml/GcRC1L5UbtzmycKFoVbdM/W6e2kLFg/9v8EUQ=; b=SBNr7Na3r74zjNGDPy8uSeUkrB+ykuCJuctecj6ZbVCDfflFBmuEEKw7sy16edc9MaSkVuPY/c6fXh6jv/CqibQXIrsEWzoZRWHWjBcKAmd3EYtBK5pXSUC4AOWx6zHdIXRq95k4fQe7Q4fNey5O3omKarpU+hMaHBj2vfdOhyI= Received: from DM6PR10CA0026.namprd10.prod.outlook.com (2603:10b6:5:60::39) by CH3PR12MB7644.namprd12.prod.outlook.com (2603:10b6:610:14f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:00:39 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:5:60:cafe::bc) by DM6PR10CA0026.outlook.office365.com (2603:10b6:5:60::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:00:39 +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 DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:38 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:00:36 -0500 Subject: [PATCH v8 06/13] x86/resctrl: Remove the init attribute for rdt_cpu_has() From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:36 -0500 Message-ID: <166759203614.3281208.12929995949176975687.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT031:EE_|CH3PR12MB7644:EE_ X-MS-Office365-Filtering-Correlation-Id: bd087f91-cbd0-413d-a2ef-08dabe9f3ee4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HC7mWgj+EayOjw949XOVElJrgd/eLdAUzGDbFzbTOt76KfcpDgCW8yFwzMauYiyCtE0UwXeG15CtW0+oXTlCh5xW7ffEowDk2wL2L+W9NuqTTGus2apRJbfAMNWbeYZfoYJwS1ja+b7SIurw2YbMZ43fYWz9gaH/Swo4S/Ikpctrpbit2+EtsdKQMYGIUSUdq0h7T3mod5ylPdWLcRpFIQYznMpva6fCaSff6Rs0zIw31iJ2YK/EiRVeleuqGdPzCeQNLBikmk7p+lXA4gIttwaMS+Bqir23mNRQXHvjBOsjCYACa7P/OXEeCmU+jEZqdQrTc9LtGjJ/p90jGeSOA9yfI75nmPu+68+RF1Vu0wdiIJVwnaSzREnyxgqz8MXnOTT2nJSyyVRqeP4q9EXUYgtz1pLSu16S16zpWaWpgYc8QOV5aN8xEXzL9GuhMlnIsRUCK6J5W1TYnM/Xr6qEYx5gkpnOeOM3K54MNNB9+8Q7PUZgRD3LLczYNJ6GcQQ6osx/YBuN39jUiAo85SaHZ3X+xrP+CWuhGtI0b+jYuyrgWKO1IK8ely087vcCEpRgh/b42zWoOGWUMkFhps8RFRmj3dUkj5/zvacPOOf5r6vJtrLbAmKRrwOiIkM0kVjij7mbbxuUbHn7DdvIhY1WFl5ck1Me/dPJOElwaT4d6ZSbZfk0FsTDtV00Cns7F/1kSggMzAR7lkadPHk1Hor9zQ5Y3/EHiLzcPAOhqyhfVXxTXXFJrlQ+k2HFw+PBdX0IhcHPFasIzFjAxeGuW5gPvgTpCjWwRJrQkGJkEUcGf50CQ/mXfhOIvirg2k88tuIBhyxHMnmF5eEcCxKm+esMeA== 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)(39860400002)(346002)(396003)(136003)(451199015)(40470700004)(46966006)(36840700001)(16526019)(426003)(9686003)(186003)(83380400001)(336012)(26005)(47076005)(2906002)(82310400005)(40460700003)(70206006)(4326008)(7416002)(70586007)(478600001)(82740400003)(8676002)(36860700001)(81166007)(44832011)(103116003)(40480700001)(8936002)(41300700001)(5660300002)(316002)(86362001)(356005)(54906003)(110136005)(16576012)(33716001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:38.9970 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd087f91-cbd0-413d-a2ef-08dabe9f3ee4 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: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7644 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?1748597144462622465?= X-GMAIL-MSGID: =?utf-8?q?1748597144462622465?= The monitor code in resctrl/monitor.c needs to call rdt_cpu_has() to detect the monitor related features. It has the init attribute and cannot be called in non-init routines. Remove the init attribute and make it available for all the resctrl files. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 4 ++-- arch/x86/kernel/cpu/resctrl/internal.h | 1 + 2 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 6571d08e2b0d..b33a541f5c80 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -688,7 +688,7 @@ struct rdt_options { bool force_off, force_on; }; -static struct rdt_options rdt_options[] __initdata = { +static struct rdt_options rdt_options[] = { RDT_OPT(RDT_FLAG_CMT, "cmt", X86_FEATURE_CQM_OCCUP_LLC), RDT_OPT(RDT_FLAG_MBM_TOTAL, "mbmtotal", X86_FEATURE_CQM_MBM_TOTAL), RDT_OPT(RDT_FLAG_MBM_LOCAL, "mbmlocal", X86_FEATURE_CQM_MBM_LOCAL), @@ -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 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 16e3c6e03c79..e30e8b23f6b5 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -499,6 +499,7 @@ int rdtgroup_kn_mode_restore(struct rdtgroup *r, const char *name, umode_t mask); struct rdt_domain *rdt_find_domain(struct rdt_resource *r, int id, struct list_head **pos); +bool rdt_cpu_has(int flag); ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off); int rdtgroup_schemata_show(struct kernfs_open_file *of, From patchwork Fri Nov 4 20:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610273wru; Fri, 4 Nov 2022 13:03:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cWqgBoSILaf5afFnleetPpTfaZZP+4N65Fn27H8tcK3UOc/CfMnGHAyYvGWBH1W4KN5Ec X-Received: by 2002:aa7:9ece:0:b0:56c:5afe:67f7 with SMTP id r14-20020aa79ece000000b0056c5afe67f7mr37290447pfq.55.1667592206178; Fri, 04 Nov 2022 13:03:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592206; cv=pass; d=google.com; s=arc-20160816; b=QsbhCbwfc7rhJ2VZ+elD31QkLZOA0PeND/h2DrkjfOoHdPGktKJpZaRYeDP33xd4o7 unL5wKFEInsD4mCsx7ElUT0QCfrywFFBFfXN0ikSLfkndee2Q8hsE8sQXjj9CZfTG+m5 4y7Lc456zT6H+BXBQ5F9Di1prRo22sFD2kCMUsxXGkbUXHqgGCfAIulrfHznMjJav2jv TDJMsA4r/R5zZl1EjDbji1oUQq4q8hk+23KECxFnMNH1rSZYf4iwHdMSDVeAc/Yd/nwZ Q0nI8HifTI0X8Qv7Z2zUqCf7oWT+WSrfESLOJ2Vb0ki0HcwtjdE3M4i/p4HRIjAU6CCV lW0A== 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=sKb9tDfP1LbvSJvk9qh0dWDguSRtNWle59XvPJKlnR8=; b=RUEs1CJ8n4Cu8ndovtHysJhBe9Io2kfHNPj1ojFl/0kSKJCDgKf6sesrL6rA4g7n0G Y0omRPyJFhlzXNtMXI8rpYXZoDdAa4MIHmRhkBjMDiHOQwVxRg12avOHVzDh1QFf7VJy 224VTaVExTgyhAnHCV5zoMqS4cuinmGS+11KPB684adpfDFRz6NkPmcgL/x6692CV0JO 5BU7JT0vTJHQZqkZ9ofzRY/qqdNo9an/8oi2ZyJggR7qoRD8olWHGZWmhGdg7MIUBdq2 h7dgvvklqJFYluthDbTG53Pjfm5qUyjQI9dHTagk/VatRs7Nud1Y3wWAJKMaLpZmx2va 02MQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Qq+6dIuv; 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 k15-20020aa788cf000000b0052c56cea553si33385pff.352.2022.11.04.13.03.13; Fri, 04 Nov 2022 13:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Qq+6dIuv; 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 S229694AbiKDUBR (ORCPT + 99 others); Fri, 4 Nov 2022 16:01:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbiKDUAz (ORCPT ); Fri, 4 Nov 2022 16:00:55 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2088.outbound.protection.outlook.com [40.107.92.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C72D4AF28; Fri, 4 Nov 2022 13:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CFNmaKNojYHCrrMbMVr8Y6C4gGPgxIfYlTQSFHzuOb2TN9dpSRGWwMBz8NlQl1GFSH5X13M9jJggXxF48am98qcDAQn8vE6cIMoDS+cYcgp54kIKs6fzC8LSgEUo7LwwyRYaBmItIfyInlJOUdylLyl+tPZXhgIonQUJLpNDoMBQ+NwishB33l3V/BPJ/L9bvLl64ZPbc7901dmYD0Xmz3nLHbdwnkO/KP2gx8OCTaYYdvS4iSjHlfkVxdzDeelSPnMII4iYUcSAHzz5m9veG4c5803X8XbMIhAEaWXqx54o+FY9z49TinA+ONpixG/wO//0vsDpf/99wXojUq79Gg== 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=sKb9tDfP1LbvSJvk9qh0dWDguSRtNWle59XvPJKlnR8=; b=GKYqXVp1iShoWGG2gFJ7zcC7UNno7IYqokmJFsKLxBTRGcU2z8yGAA0YR0ApY1d8NTKAPiQECTgsLXWxqO1q8CC5KSD/CRB6fwgvcw8rfY89mRHsQ6Ce8NSZpu6wm4AoIdOTSOPfe45SkT57wNPXV2LwO4yQ3YCGxgYagJOF3URAsAaFG8btlE672HaKCpcchc9drI2SQmuYclu/NHwILai6g+maNx6lFOCIgvKygkdHKPeXBkeaoIGiY/2pARut817Ow1OYCoU0tclsDC/RKc4OLID7MlvHAF1JadM9VJieAuwiXJMuRoi4ARZlUIRWcKwz1kKsaxy2aoUW2sX6WQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sKb9tDfP1LbvSJvk9qh0dWDguSRtNWle59XvPJKlnR8=; b=Qq+6dIuvMRWDF5pXrGCxAPpyIDITipJTUb3zZxhCJNu3R6MV416N0kxNa8qXY/8XkRtVGqEcxwwzM5CWAbphikoexhtET0A42b3J34y/Iav3h6kpMm+zpnDQkdDkhK621bFMzp+gVQET7Wa9sfYaPOs2IlxXcKCtQ+5nvkQ92eo= Received: from DS7PR03CA0043.namprd03.prod.outlook.com (2603:10b6:5:3b5::18) by SA1PR12MB7126.namprd12.prod.outlook.com (2603:10b6:806:2b0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.16; Fri, 4 Nov 2022 20:00:50 +0000 Received: from DM6NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b5:cafe::ae) by DS7PR03CA0043.outlook.office365.com (2603:10b6:5:3b5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.18 via Frontend Transport; Fri, 4 Nov 2022 20:00:50 +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 DM6NAM11FT066.mail.protection.outlook.com (10.13.173.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:50 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:00:48 -0500 Subject: [PATCH v8 07/13] x86/resctrl: Introduce data structure to support monitor configuration From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:43 -0500 Message-ID: <166759204323.3281208.9744810874584175730.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT066:EE_|SA1PR12MB7126:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fc93470-ef2d-410e-8565-08dabe9f45d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wpDlkeVRmiKXFkSd9vU/Xo8qxiBVjXfl/a6bUI7P3gilK+/5oSuVi3XEUBbXXLjL8rzewLWgKiSz5rwTDd2UMvbKxAeMtItj2ZN0KQuOE96hsHjRLiE6Qfl6yrrKyNGgp5M8Mj2RMT6To7OkaBLROKXzit4I9ggznfamktyItiO8034FnWM+xkB7QQ1c92k9uKuDsuIZO6x/wPOafEeKrWmQoWAFTUzWmbXw8Cu+TXDlHH0XVloxCuQQr8XH09GYxkRVBFIJCMA6KMmBHfN/fVWTx1zyhnS2+sC5fwiI7xdw1WwiorykTsOtB1ODKr3eB+//HTw+GfQOUDTAp2zezlW7sP2TrcS6X/WcqZL8mS6QndmsJUCmVnjyUbq10vtNkYzqxupqm623KSemNl5ccPWZSAp+ufXym2OktcCFx4V3cu+Xa8hIFIXYzBSCEGbYfjIwUtyF9NvJNXK2AFiCpvyPxPNfVzieCCO1Tz+r+K8IHnkCWWTjb0VHVAgU66UvPem58UoipfQZVBFnYf6Sjn4UWerq0rBQJnSw0M4Simq5YS1y+J1V6AJ559tXUv3LgknD/rEoPhsKgyh7NfJNKzWLql7T+oiNApyKJirh/wH3J8mQEIzB35IwxJG3JoRNjEV592vBr63JFw2qM64xjNeKLY9Ptev8Am0TbmMV4/W4aPE7Vs23UflOyYFQozXDkHZhyBW1cDGZos2bkxPHyai2JH/G1BUgw8dtalOF+9GLJ7M552BMDH5u40ra7+xTxxJqqBcHhEucqdgMUCH9NQymE8xwm8w2GhkH4rPTNQciJhDZyHbg7wERyRXTK9J4EwD33txr3/IY40L9QhtqTQ== 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)(39860400002)(396003)(136003)(346002)(451199015)(40470700004)(36840700001)(46966006)(82310400005)(186003)(5660300002)(33716001)(44832011)(16526019)(81166007)(40460700003)(336012)(426003)(2906002)(47076005)(356005)(86362001)(83380400001)(7416002)(36860700001)(82740400003)(316002)(103116003)(4326008)(41300700001)(54906003)(70586007)(478600001)(70206006)(9686003)(16576012)(8676002)(110136005)(26005)(8936002)(6666004)(40480700001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:50.6264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6fc93470-ef2d-410e-8565-08dabe9f45d5 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: DM6NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7126 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?1748597165275141591?= X-GMAIL-MSGID: =?utf-8?q?1748597165275141591?= Add a new field in mon_evt to support Bandwidth Monitoring Event Configuration(BMEC) and also update the "mon_features" display. The sysfs file "mon_features" will display the monitor configuration if 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 --- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index e30e8b23f6b5..5459b5022760 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -63,11 +63,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 efe0c30d3a12..06c2dc980855 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -750,6 +750,7 @@ int 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); + bool mon_configurable = rdt_cpu_has(X86_FEATURE_BMEC); unsigned int threshold; int ret; @@ -783,6 +784,11 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) if (ret) return ret; + if (mon_configurable) { + mbm_total_event.configurable = true; + 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 Fri Nov 4 20:00: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: 15772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609595wru; Fri, 4 Nov 2022 13:02:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Wj28xI4x+LBS0BUVogsCz1A6V0xs6fN5olHDaxzlsajznX+pShztoa2qYYrX24mZfq9jH X-Received: by 2002:a17:90a:7d0a:b0:213:ee54:a707 with SMTP id g10-20020a17090a7d0a00b00213ee54a707mr27484535pjl.206.1667592142038; Fri, 04 Nov 2022 13:02:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592142; cv=pass; d=google.com; s=arc-20160816; b=XNagNuDRDhX7mKU/Qv3vNk4g1K67ZLnZVg+8zaG7S4p1pPwsL2lDbM/+GG+nQ6IW19 bgs3+zGxdh7EIP8N8kFwOUu1KdfrPOeveUkSb7iKbOd8nz588/2aXjWui6VOnoSdG/vU RNRDNMJRG3PV2Oiu11Ebp1pqtMw92EG+SaESkJurKwN0lU6cadBiYuOIGJO9VCYp0Vtb +sVLcYTJr1yxscFK2+FWEwRyZKqetlRqhkHVbp0HClBbji5nVR1yyVGOhSVPtcdT2tp9 UXtForQBNWKIC7k9GBbXrsqtyzcHJP5XeiHR3wNF97j4drKT+Zl5ISn+xWO9emvJAnkp jXTg== 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=4bdApC+C+Pz47I6PY3IaepkhrLN/PquXbV0FTP+h2+o=; b=QaoZ3kiWbhqwpM3Z3vqTYShRsnFhDsL0TkYprNvugtVK8YbxwuiEB/1POLOIWG5q+q ixG06kmcugQPO5Avm88UvIbAJbtYvWx3Q8sCFMsR8ieefgxiRylsijHSGq5lkUU/LJSN zV6VxhCEikgvlYm5z18ppThdrynV3eCFxlOqB1iwgKppP5rtpm4p0/CJV6q1S8iNUduZ O8+j3WkwY16C+zXAQuiNb8Ck5XZ55KCSWNd+UsbPIwuf0CePV126i0F5GKrq0rZKvEBt qvKJYBPSqiPi8c4rMh7iHhetmtGii3qnBRpYkEFrmX3iNUVvnu5flMDEI6QIHQ3CN8oA eL1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=bBAj2uQ5; 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 nn1-20020a17090b38c100b002131bb4043asi5281458pjb.177.2022.11.04.13.02.08; Fri, 04 Nov 2022 13:02:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=bBAj2uQ5; 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 S229713AbiKDUBZ (ORCPT + 99 others); Fri, 4 Nov 2022 16:01:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiKDUBD (ORCPT ); Fri, 4 Nov 2022 16:01:03 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2055.outbound.protection.outlook.com [40.107.96.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A144B996; Fri, 4 Nov 2022 13:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FiTT/roqYHQyIZrQkloAOQjG2/c22CxzyVfeJlHHJx31jfETehR1bZts8O7P5M1h+zXM8ec9xQANFKH9ZsvC4z1UZhqyQTynK6v86U3pDV452/v97CJcuPqZOCL3+mzwJzsiuucKUO7qUbeaVWEeTV/4rwiNaMpPxKGbtgMNU1mmhRQAdM19Zde07nnSfQ2ROB1tNoYOIKV9fPvXPTjSaWjfKhH5N++/D+YzKEXc4HhxzG7Mwx0uc9b3a9VtC7v3B17lZJdXV5SK8L+KR29s++awfB3qBqFYOqT1BR72yeVVW40nXcz2f40/1Pp1I3Q2kRnYNdWoVvtwKyJeoB9+5w== 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=4bdApC+C+Pz47I6PY3IaepkhrLN/PquXbV0FTP+h2+o=; b=XaqW4DSwEBFiwPsRY+YwtD5RlR9A3GKbWJpn5nHxgPKEPxCoT2Vj+e3V0u7PM8kGn+BOB6of3Shy6oEv+JoUfIAfmAwREHr8KxKJYRSX7UwChS+CaQYKZ9NCwnp0x4PxXREV0ZkhjGbBzvYPpYqgkKOcAjphcik7ZXMylv9VWgNwR970GMGnW/FnNQaII1vQJ0BtUgqGedbKsSY0NJt2rHfqJ5R7TllOvcoqmMtwapjXJAso3Njup/ZV9zzF/mDslnrT4p2pTccpI+uDZVBrnNwxrrMk2PfyK5/unDegA6XyENw20rtjJlZSKc2xi6QsllEbVMYSeD8g6N5DxuMr7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4bdApC+C+Pz47I6PY3IaepkhrLN/PquXbV0FTP+h2+o=; b=bBAj2uQ5+KwErJ8xF5JcoE4dAZ4puYqx6josSkKbqAwW7/50YE1SyW+zDAONMUf74KegReAOEUVc4cU2flqVrykAr8PI0WV1sewpNaCdiGcQdZjHR7jqTBI2DXVjY2agHMl+tTSI3hgx+tm/n/XtDjdqcL+xTrSHn83I4Tsb1fg= Received: from DS7PR03CA0286.namprd03.prod.outlook.com (2603:10b6:5:3ad::21) by MW3PR12MB4489.namprd12.prod.outlook.com (2603:10b6:303:5e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:00:57 +0000 Received: from DM6NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::17) by DS7PR03CA0286.outlook.office365.com (2603:10b6:5:3ad::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:00:57 +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 DM6NAM11FT073.mail.protection.outlook.com (10.13.173.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:00:57 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:00:55 -0500 Subject: [PATCH v8 08/13] x86/resctrl: Add sysfs interface to read mbm_total_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:00:55 -0500 Message-ID: <166759205510.3281208.11437041392524040365.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT073:EE_|MW3PR12MB4489:EE_ X-MS-Office365-Filtering-Correlation-Id: 9873935e-cdbf-4177-d730-08dabe9f49ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EvffVthzzfomMIfThegbj92TAu/I+9VCLNuBLp09H3y5/Vym4rfmGYD+OfEKJaxQ6iX73GyVAb8zwC5JNbSY9zj/LKeoaqnEl2qJ1oGaQBF4A1jPu+j4aFAwhyia8VQkGXqxWlMENuDKK10O6VRLqagMHMMCD2IiL4D9TRDFqZB49XR055jA8mtGH5Kv3Pu/HXhUzHvw8kz25mONLDQMeIoUNzkxLtHjGob190q3wkhXeNyb8Xvs1csH8n50201833UKQeoxJ70I20OkAhUsX7I4UfHjhzGIwWiTPbGnxZypb0Jifgep6meLYj8czu/6cvbuFRrkhQrVR5+aps5trhtOYlRufJZOdOzXH/yOSgtFpIgPJAu+JpXL6uvfeF+e/6pZjwX/utD2HeePgUzthvwY3XjG/DcweSnwu0adaW0kg5I9c8FeRQriPRKmDZ1lFqVVq6yHHjafZ99jgICkrPru4ib/mD+i5V6SdJtOLi4WcCr13e0mswyKtk5CogdSBZrTjh0dAzdgYiTQzlmhH9wtZ98WkexkGXxswk4HPStkX7yd4tOVKNveOlRgDUigcoDhjx74miq+YxqjgzbzbAQcp42bGsCMaWu9W74Eun5R8JgCuqJKS1s/DYEcMt/zzNl7qk/077DQWfcNxyQmYt/qBwMbdZ6/L7h1TnwExzQTQjzJyWFD5yzJgxghOS0x6XHGOQTcgiBlP3DeE2gnd/i+cxYceEaVl72u94jQjmqn1sdVuk6cCiVT0aUawX5gVGcmfP1Y7OoAywqyWTWtySin4ZYUA2FCRvn7pCbLdh+c7iYWsc5BgjDvl/etnhhGXOt4pnV8WBE098VWX3JEXg== 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)(376002)(136003)(346002)(451199015)(36840700001)(46966006)(40470700004)(8676002)(47076005)(426003)(2906002)(70586007)(70206006)(4326008)(40480700001)(86362001)(82310400005)(316002)(16576012)(110136005)(83380400001)(82740400003)(36860700001)(356005)(103116003)(81166007)(33716001)(40460700003)(54906003)(5660300002)(7416002)(8936002)(478600001)(41300700001)(9686003)(26005)(16526019)(44832011)(186003)(336012)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:00:57.4941 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9873935e-cdbf-4177-d730-08dabe9f49ef 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: DM6NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4489 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?1748597098051363303?= X-GMAIL-MSGID: =?utf-8?q?1748597098051363303?= 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/kernel/cpu/resctrl/internal.h | 28 ++++++++++ arch/x86/kernel/cpu/resctrl/monitor.c | 1 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 87 ++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 5459b5022760..c74285fd0f6e 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -15,6 +15,7 @@ #define MSR_IA32_MBA_THRTL_BASE 0xd50 #define MSR_IA32_MBA_BW_BASE 0xc0000200 #define MSR_IA32_SMBA_BW_BASE 0xc0000280 +#define MSR_IA32_EVT_CFG_BASE 0xc0000400 #define MSR_IA32_QM_CTR 0x0c8e #define MSR_IA32_QM_EVTSEL 0x0c8d @@ -41,6 +42,32 @@ */ #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) + +/* Max configurable events */ +#define MAX_CONFIG_EVENTS 2 struct rdt_fs_context { struct kernfs_fs_context kfc; @@ -542,5 +569,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 mbm_config_rftype_init(void); #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 06c2dc980855..a188dacab6c8 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -787,6 +787,7 @@ int rdt_get_mon_l3_config(struct rdt_resource *r) if (mon_configurable) { mbm_total_event.configurable = true; mbm_local_event.configurable = true; + mbm_config_rftype_init(); } l3_mon_evt_init(r); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 8342feb54a7f..dea58b6b4aa4 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1423,6 +1423,78 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, return ret; } +struct mon_config_info { + u32 evtid; + u32 mon_config; +}; + +/** + * 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 + * > 1 otherwise + */ +static inline unsigned int mon_event_config_index_get(u32 evtid) +{ + return evtid - QOS_L3_MBM_TOTAL_EVENT_ID; +} + +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 >= MAX_CONFIG_EVENTS) { + pr_warn_once("Invalid event id %d\n", mon_info->evtid); + return; + } + rdmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, h); +} + +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%02lx", dom->id, + mon_info.mon_config & MAX_EVT_CONFIG_BITS); + 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 +1593,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 +1705,15 @@ void __init thread_throttle_mode_init(void) rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; } +void mbm_config_rftype_init(void) +{ + struct rftype *rft; + + rft = rdtgroup_get_rftype_by_name("mbm_total_bytes_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 Fri Nov 4 20:01:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15774 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609961wru; Fri, 4 Nov 2022 13:02:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YZVgx270eFXnmVxmURy/cbggEmE6d2Hk5dMM0E0VSJoi8lHN+xxmR19+WlUqvaCWwMFw7 X-Received: by 2002:a17:903:444:b0:187:428:1317 with SMTP id iw4-20020a170903044400b0018704281317mr36998696plb.151.1667592177680; Fri, 04 Nov 2022 13:02:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592177; cv=pass; d=google.com; s=arc-20160816; b=ZPGwD+k78mjp785GgCkbrmOv4yQaPwxp+OuB+G8x/9cYu+MMErs3Z3QhDdf8eMChJh xbATyavi/QlMWVc0L+ajXtSYuejN5pTy+fqWhVhdjDKc98CUw7nyMUP5MujV/Z9uaRGf tuBLqfgz/ZuVddUTTiNkPBoP1VN3acJZtsGuYC2jGq7SupQ27T9+2/ZWOUfUgXfeG7Y+ gqqd6nWyxdp6nTcts0zLJ0jQDgYIYaVA0hVbo/vMole1cxENxy7WPozbcLP0WSMmrwNX FiNGQaci2/sTGAX6BO41YK4r+NKJCxufkLlxELPpUzqmaeH+w7MYutliPtlPSOGqieFB W2zg== 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=ufPDQv/9dsvkv3ag0LNeCo92Tiz85xefszd+/x9G4ss=; b=SZ5jriXugcnOSPCcgY0XW8PGCkbAcDm3HBh01mbwKc/G3kP7siwvR6JhWVxhpset6Z S3CxMksjd7ITyqO8K1IPtZ006iZ/IxcnX/O5PzJZM+gQ6R31f6qbA6sou0Q/p1ZfWv0n qn6IZrTSY767Fo2I5fZ/H30yvNQSfsDE7nwm25KSDs4MKhdUpfi17HEIvAS/zm2/B/Zj 6jOf573ZeCuAceqwcqReAp43yWHk21E1WUrao1PLSEb2Z67gHYWqqw31K8zfYrJ0uBLu Q8a1+EzUPD8EpLlm5LQae7ZJ0wCJIr45P3bu0SSf3ZrMXIiSbmyi1cy6iSpbwdIl5DPk QSeQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UNpJsccR; 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 m137-20020a633f8f000000b00439f026cf5dsi398304pga.612.2022.11.04.13.02.41; Fri, 04 Nov 2022 13:02:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UNpJsccR; 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 S229819AbiKDUBe (ORCPT + 99 others); Fri, 4 Nov 2022 16:01:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiKDUBL (ORCPT ); Fri, 4 Nov 2022 16:01:11 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2041.outbound.protection.outlook.com [40.107.93.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 203434D5C5; Fri, 4 Nov 2022 13:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d2+gUvkMPkOSwnEfp7uUzxs4Wh8mFhhkdV+zE2vWjRNjcSgWmx/ouwh5uQXKffMz/WT+CZSE3yTmCtglhqkcrxakfmMV/Nuj3FTlulAlzaG30CPp0RncY8yopSqW095wuowThp9PU7dBjRFqOKqkahExW19CIte84+nZZQP4NHzi88QjUUPUweD4RXocY+tXOTodD93IVMyS5VOvKRITnYrW113etm3sGxAlA0dMRxKXCUON4E8lyvSyvbvag3KBCTOOiUUMvh5MTpck5R3Aa6tlnkjcLMy3XCyU1KYa581bwhwb4JaSbvIw1i/qg9heXEJrDCkES0XH91HyP0qlqQ== 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=ufPDQv/9dsvkv3ag0LNeCo92Tiz85xefszd+/x9G4ss=; b=S8L/v+CFRtuRp1zNx/67HXtxNWTyCpVffA0Q58Grn9uMx+rn72G48VeUAhqPf2vynipMh2P8HMR9PrvtM3BA03g8uzZ5pCWwQNoJpS130NTc0cF/stm/kE2mkBxkPUWR6zb6OK5d+IxiSKlKp6zoiq3EQgWM9nEAf/AYoKECiuyiVAuqEfSPa4tJLZwa5ck9Lz4eUNVOMaf4scIS6X9VGheW2uZbzKj8wXZNoBHTrAzjYUDK9y2UY9CcRYcmalibNaSC/hzi9THs6B+6/BiVdc09K+JCPSNxWu3/ZeSnQ3/q5DDDW4V0Il9i2vLho8bioa7RWSFdEukl75wLAXEeKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ufPDQv/9dsvkv3ag0LNeCo92Tiz85xefszd+/x9G4ss=; b=UNpJsccRia6DUrZbyluUetDhzmy+SeHE/KHQn+gYTfnLbfu3/xd4RfMsORqjRTYZDSM5Uk8QEuLbgFpSnEXKWYjO4kWopLYB4Pe+B1fPqoGw/DKE+0SfT7EKS65i4p+eH4o77OZFg1QrkdXBWOgAOM4FE4yxR1RTaT8lSQreMVg= Received: from DM6PR03CA0002.namprd03.prod.outlook.com (2603:10b6:5:40::15) by PH7PR12MB6633.namprd12.prod.outlook.com (2603:10b6:510:1ff::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:01:04 +0000 Received: from DM6NAM11FT108.eop-nam11.prod.protection.outlook.com (2603:10b6:5:40:cafe::da) by DM6PR03CA0002.outlook.office365.com (2603:10b6:5:40::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:01: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 DM6NAM11FT108.mail.protection.outlook.com (10.13.172.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:01: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.31; Fri, 4 Nov 2022 15:01:02 -0500 Subject: [PATCH v8 09/13] x86/resctrl: Add sysfs interface to read mbm_local_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:01:02 -0500 Message-ID: <166759206202.3281208.14680469884299384074.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT108:EE_|PH7PR12MB6633:EE_ X-MS-Office365-Filtering-Correlation-Id: a8965902-4534-4d01-66fe-08dabe9f4e02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2b5nc0bERNA0inMcy8LHlEHggUIJIe1rMs6Yu1+hQR6HeTaRasu1DorRwS63O3fxZLKyoOEyPvYNrXSRYVjXaJ073N1wln/H+nDsL0L0IbJXzYu8m75GQl4fTWdCcOtUoErFTLXUW2Axcrh0zfB2AoeSdkDfq62Gq9QYOQxZJMf1jzoJ22bUd5lobePnABxbLkL3/Z5r7em2aL61EFu9SIx4W0eeZ4uAVt5NQ71LOnlv+GNUHHt3G6eLYy2vFfDFmCz3kz/C0ECCKwAdVY1+f42A5qlU994Zm+VNYxCUF/PLIndMAChJh8ey/zNjUc+RZKV+mm9wLuY8Ik+4j5a5fRvZ5GKbsmG/ntGVKzLTnyTk0STWxOdY+VqEug+6mAjQ2YzMrrX1jAVJr0Tiy2yxfEVJvG5/NBgP3RgnMDgcJdVOAQzXiWaXiHqqnNovg2ztXahbG5GTJ+Ml0qt9YFIxsOoSo9ybGMqjc/BYzjogs8YCAeDwlnsqr6ju1RjxnY2QK4AzChpSTTumhzaCdbN9nqCdOqMNRKzR2Xp+E15I8JcMN2pLb+26FMBgx9FxqhRLJ+HOaJ2iEaJnkyRBps79iPmrYayHQXkf3HKiTEJXPDA+rl+RuRiiY9amRfrcl81WlbPjcHfTyhnQtuyfRt6M6DbHB3sRRhIYz12Q7FodfU4aW25R7ODkLApk5eAVU1LO9lnHYh8ljKOQqzppzmMaEIuDE7rZa68WAj6A1P/4CaltLjTYzrIEf9lDquULzarpqkF51quweIN9NwmXSe4Q/MpOs9/S54xufkhW6dibrmpUyzdBE66ZawpfBX1c7RyfWNeGCsU3ZRB5E3O51xT4eQ== 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)(396003)(136003)(376002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(44832011)(2906002)(186003)(426003)(47076005)(336012)(16526019)(478600001)(4326008)(70206006)(8676002)(36860700001)(5660300002)(7416002)(70586007)(86362001)(82740400003)(8936002)(9686003)(316002)(82310400005)(54906003)(16576012)(110136005)(40460700003)(40480700001)(41300700001)(103116003)(81166007)(356005)(33716001)(26005)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:01:04.3266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8965902-4534-4d01-66fe-08dabe9f4e02 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: DM6NAM11FT108.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6633 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?1748597135342228305?= X-GMAIL-MSGID: =?utf-8?q?1748597135342228305?= 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 --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index dea58b6b4aa4..18f9588a41cf 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1495,6 +1495,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[] = { { @@ -1599,6 +1609,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, @@ -1712,6 +1728,10 @@ void mbm_config_rftype_init(void) rft = rdtgroup_get_rftype_by_name("mbm_total_bytes_config"); if (rft) rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; + + rft = rdtgroup_get_rftype_by_name("mbm_local_bytes_config"); + if (rft) + rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; } /** From patchwork Fri Nov 4 20:01:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609946wru; Fri, 4 Nov 2022 13:02:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CAHSe6Wp69Jye38Zjttro9+qgQv+wfqNT6uwD5NSyrq0EBbdxbcLQDV+ZpH5jl0wqaojT X-Received: by 2002:a63:69c2:0:b0:46a:eeb1:e784 with SMTP id e185-20020a6369c2000000b0046aeeb1e784mr31476605pgc.589.1667592175823; Fri, 04 Nov 2022 13:02:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592175; cv=pass; d=google.com; s=arc-20160816; b=Hmyurnny39obW/W+hgVcAhC4kUSXjZdOaNVg8xxgVNAiC/m2zJ6Vtw+8Bl0hkFI4yi 48z6w9K4TLp0UK3RL7nhLZ4pAJMe97PtNZlQqMJRlz5LgpU2DCChqHxJRIV/YWZIJ7kg OWtMkOC6xpMIcKq/aR9fJD72SQyvPsK6nh2pQ4llzb/X2on370AQXgeqDIuHjWXB3Jxa g2qcQiosSqjPvFZWxaTN3FYdhRjRFBASnWAw27BVLJgfXxmgsRpXTC0XUqrhdaF4uyJR v7a1gGyuMKS+uh5/1rrLYZmQKkscoplnEVn/KHnUTz4srF5FGk5ViyPppfFTJ8wfqFRD 7Dow== 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=EhPsXuc7Ix2Dzi+ZlbtEA0mEhLgjscPZHWQv6Fb9h2g=; b=oQXeCBC6Z1Plm3pG2TpXIRAXhNF06RihfNK6Z7QFujHbQp3rovrOetXCUvV/tJMxx/ RS4nuEj3SlY6ymR4adrj4VwR0rJ3SMXhv52pgqeTsNq6gKjNq/bbGNPMPxq0w0DyHFpr ieYyKiEXRwJspEkgSz+jGyVEfaFftV2WpIRhvUznzIqLLQgPJiPpNd01B1uBl7zTTi1J RcIkMkUeXSGewEUKVkMOprOqgqk7P8yh8CNrm28wH9s8K63w924hPc8uAUjx4WX5UNI8 of6pktAQjcEYXpbMHO30lVos2IE/NBP/utZCXtYLY+hZAPdwXxDZOn5BeguMZcjWa7gq 6FrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="H2wC0/cB"; 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 m11-20020a17090a858b00b002135e1f5a7bsi4080822pjn.155.2022.11.04.13.02.34; Fri, 04 Nov 2022 13:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="H2wC0/cB"; 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 S229961AbiKDUB6 (ORCPT + 99 others); Fri, 4 Nov 2022 16:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbiKDUBV (ORCPT ); Fri, 4 Nov 2022 16:01:21 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2050.outbound.protection.outlook.com [40.107.100.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE2C45A37; Fri, 4 Nov 2022 13:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T17cwrFzi0/pI0U4J3jC62qPpKJE/EaxOyEITknh1IJ7OGu9x44gUx28MS8eofnOTny3dEkROI43AzfQeR04qfOFOkFNH03toAlVUeMX1OiGHWuDCgKgDYfnoyRl2v5esJraBz9lGftw+tib2T9zXUZhg8T2j8admMMZM9KST4sZHEy18rAcSEd1u/PvW0xP3xEQ+y1PjbZh/7oe4GNOiX7XG7R7h2xqCu+hYgjEJd1kFz78dxcBBWRuHLO1hd+bftTFyY8qT91v3m5HqPzo9zNwK3e/3w1lM6hhU76sB/mY4CfWdfuMXPy9uuYpRvU4CfR3ouZ18ZglLK5j3UkYDw== 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=EhPsXuc7Ix2Dzi+ZlbtEA0mEhLgjscPZHWQv6Fb9h2g=; b=ngynHBVA4AzA/Zo7QlN9TfHPCitGyDF7xyG4Grt4eE53ix+bKb7KTDLgFN7Dqnci03Ryn1eSrhk4VR+CUXTnBkvMpj1CyUIU/46Q/FOuzwFXHLOoGfZo15ISdmCdcBWUVgR9599mctlnOMe+ia/tIj9BgmL8xYP+GlOGSQTLZE0Qyiws1uv+J5H75EhPuoP6eeERBB144dIs1DochFJDcnPsDKEktEJVE5PG77mU8VUYWENiwKkb9haHEpCWJRraZ3GFboc673C35NQ8l6eqUBjIPAUmYmjJ/6feiiyN4SZBRRVCMgc7L4bWcx8H0Ko3k3S0WtDFnhi8rOUJAdygbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EhPsXuc7Ix2Dzi+ZlbtEA0mEhLgjscPZHWQv6Fb9h2g=; b=H2wC0/cBIahPQjilhd+6Qy+JhPqxmHEmqnL9z9ENOHK2LxHoZeR7PlwiYXIdcXuv+DCfId69ax+291lkONczQX0mWq3albrLb7Frrt/Li7hmubh1huw/pihsU4b4/yLuvONNc0x6IKvrl8E+pHP1YUWUtbeMx0IpHDbYkGHA5k0= Received: from DS7PR05CA0035.namprd05.prod.outlook.com (2603:10b6:8:2f::18) by DM6PR12MB5007.namprd12.prod.outlook.com (2603:10b6:5:20d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:01:12 +0000 Received: from DM6NAM11FT100.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2f:cafe::60) by DS7PR05CA0035.outlook.office365.com (2603:10b6:8:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.8 via Frontend Transport; Fri, 4 Nov 2022 20:01:12 +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 DM6NAM11FT100.mail.protection.outlook.com (10.13.172.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:01:12 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:01:09 -0500 Subject: [PATCH v8 10/13] x86/resctrl: Add sysfs interface to write mbm_total_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:01:09 -0500 Message-ID: <166759206900.3281208.11975514088019160962.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT100:EE_|DM6PR12MB5007:EE_ X-MS-Office365-Filtering-Correlation-Id: d1ee638a-3275-480d-26df-08dabe9f52ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hG9n9cAnSqeTnoVfSyZ4ZqXfNvZ7C3UCGLGEyeZUaJtDIYSGb8c0jEc/KmDh392cfyVhuIqf86ufCG+kTfVimswHTczsj+GbZGUerEmv46633lb67/0Q6lF90quRw8u2jYvWa59y8g3rrSqQv3q9+sty302zTkSQCsP2LNmVxtV1THl7HGOvhJQ0pQxuWPlFo47Mcx1SzEfi432BuGuTLMH4QkRTg0+7+zqtwkggCckVHqZYEQZOL9bwTy/mX58mGHic5UIIjEg6EQRjSxuQjuHODeWfp//JNdq8DD6jpsAr/+ypiRCa4/QnxKD7Q1FPqSuxYM4oiYdE65D5nYevtmAkGt1cGRcYVTGOXVzmpEWbtY4aHWeivyk8zvI1dz+mnoUzAjrPfAbbvP85QakQbjPyQlw+4u5Cwd1aNqcELG+Z7UP6D5sm8lrH8UUFiEwd9FSJrM8fKNr+U7QVN9r+hhOzaQLsA3+DdY8bNHIK6KBK4E5iCd6Ga+KY5IqvNT2UoG20QwSnbLinufEGNvik1o13v5NO8FY+Iv68nDOwbrFd1fkYZXcNiGvYL9O4r2xgEqbhSt2OWPCnIWBjkqWKk1ppok9HKoEa+K325Wu3rJh7ZUpM8yDOwZzWLtbFOwp6yDFoYYAKOoJjDmNt0xKf7mwQlXNcUHmTwvoU48L2s6C9LCsI+tcC8GIQiUKJ/urM4YunhiOOHKFyHYKTu3P4+C4sqGJfCGXhN1CpHz4TmlWDUKSVv3DtL3PCvJARVmA93+kqgLve+fuEOvkh4g2ivV7xlBpDyDqO1uaeSBMx8j87gF9cWP5gDlrD5DHpO2vysXHrBYm5F5SUVmbC22XtoA== 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)(376002)(396003)(346002)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(83380400001)(70586007)(8676002)(4326008)(70206006)(356005)(47076005)(86362001)(426003)(40480700001)(316002)(103116003)(33716001)(16576012)(40460700003)(54906003)(2906002)(81166007)(82310400005)(36860700001)(82740400003)(110136005)(8936002)(41300700001)(478600001)(9686003)(26005)(7416002)(5660300002)(16526019)(186003)(44832011)(336012)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:01:12.3778 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1ee638a-3275-480d-26df-08dabe9f52ca 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: DM6NAM11FT100.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5007 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?1748597133675062377?= X-GMAIL-MSGID: =?utf-8?q?1748597133675062377?= 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/rdtgroup.c | 130 ++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 18f9588a41cf..0cdccb69386e 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1505,6 +1505,133 @@ 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 >= MAX_CONFIG_EVENTS) { + 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(struct rdt_resource *r, struct rdt_domain *d, + u32 evtid, u32 val) +{ + struct mon_config_info mon_info = {0}; + int ret = 0; + + rdt_last_cmd_clear(); + + /* 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 same then + * we don't need to write it again. + */ + mon_info.evtid = evtid; + mondata_config_read(d, &mon_info); + if (mon_info.mon_config == val) + goto write_exit; + + 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. + */ + memset(d->mbm_local, 0, sizeof(struct mbm_state) * r->num_rmid); + memset(d->mbm_total, 0, sizeof(struct mbm_state) * r->num_rmid); + +write_exit: + return ret; +} + +static int mon_config_parse(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 (!dom_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("Missing '=' or 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(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_parse(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[] = { { @@ -1605,9 +1732,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", From patchwork Fri Nov 4 20:01:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610049wru; Fri, 4 Nov 2022 13:03:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qXQV2E5jYyrii9T7HBT5IPYuRuWl0zf43oTxfVj/bnmA4/wgwaAyWIPnsBZlG8IfhEWRQ X-Received: by 2002:a05:6a00:acc:b0:530:e79e:fc27 with SMTP id c12-20020a056a000acc00b00530e79efc27mr37356377pfl.61.1667592186191; Fri, 04 Nov 2022 13:03:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592186; cv=pass; d=google.com; s=arc-20160816; b=Pt47kwo4Z8gMPlmjT/2/hgRi6ReZx2OBJDyr7V4KSam0lxS5WVW1LFX1dzYsUmwo6s 3EreKVzWT1dndMV3gVP0rHAsGCmpdptc+vL2pO6S4nLvaO6hTPfOIQNvCIVWwwNc50B8 VrcntDu24ywZo4gDlHXjARzOB1eDw41L5sojeAJsXGoKSpnVf3CMkzmzt259aQqxxlcm 3xmU+TN2wf0+WAJxVDO9CCW4v+pJrIObZW3dWcUuFNaJhHM9cWaeYJx54hcEuWIWJMo3 x2e18RiIOh0844Y8F8imlyXYWLVxEaxzOU++L4sTQOcuo7LMpHnS/MJB9Z91E/RNTA81 ubVQ== 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=zwWna5ohYvk6/hKT2RmHI9Xdzj9jtWfTFAzrIAfz3hI=; b=yoMhBqVGgjZAxeVDsDMHQUn0kwsVidmTart2RHbDGy7S8n0AJTYhcLKINUkmkx5VNi DTmfypBfGVEsoYImt51cZeuqc0tyzQJym5F/AoWTiTJrn+aXgPNSIqoDslYUSJYlK/0i yo25RniSJS6A76hofZVCSphc9I7SjKhlos8rosdCXqe9eAZaTW3svIXb1xHo30jhFQkk PGUmO/UuYG3pyfAJhP8hSKp0vswYfhiGqmGY5Ov698NG99zbzCduslgVW2U8BltzHhs/ wyUgGFxKDX/9dGtjdYG7QRjtlauOLVYYBaee11+9Q22IKFbS0u6iigA/M4iBjMqCIAfh 1zLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HBVrw3oc; 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 t10-20020a63444a000000b0043ce223c86dsi391820pgk.843.2022.11.04.13.02.50; Fri, 04 Nov 2022 13:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HBVrw3oc; 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 S229894AbiKDUCG (ORCPT + 99 others); Fri, 4 Nov 2022 16:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbiKDUB3 (ORCPT ); Fri, 4 Nov 2022 16:01:29 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4251B4B996; Fri, 4 Nov 2022 13:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UbAbuQoaYIYvbAVKw0sNu1IezEX2udmPokc8D0FVgK8eaz4J2e4Py3BFyzA0joQx+5arxwvuhWRubIuRe2CxL4tG6PMKNMSXbH6oIZSFIIOMWZY/mrHwGS5CmR8JlsKikIFiM9HV8kTsiHX8tMMj9fU0Lw21qR8vIfgmBJmIoOS43MsBFr7MgPidCziuCqI18b6o8NqPvADi2/ZzMzVD9n6rQiucN8H5njbXKO3eG2VJ0xovPQXzlDIqda6CAyEMHs93+XWhI5uk8HuWpKMJHBCF8lyUaCkpEFwFGFfDdX/RAzLnIFhyyYyMTt0TcUBQW6ILc6PO+MkGK67T9nzoyA== 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=zwWna5ohYvk6/hKT2RmHI9Xdzj9jtWfTFAzrIAfz3hI=; b=fr3iARF92gRpitQFYSaeev0BqD1prDK2V/KD30YhqB/6i75fguVeVkbQ5KHhWNK75EAvSnyhUoxn7cVKf30Fj+G/g0xpqEmVMxrPFEQTNZPI6kKjoluN3fYENRjQZjcdd3pOQ5mj3uMNyWdFTgX4uN3+8ieL+3Jww9jsP+q/xV2fvHqIG4JSj4Vec77iqp4xpfoCZWvrvJAoGYQKQJIWUoQcFOktKrW7t6s7SdWlUuc+Xqoh1ts5/DFvtL9FQZaxMgL4nbh5f/mf2w+SsGTsXjCn08lfaOqFup/noOnbvS6rJpfb3sFzxNeSEJdRMX+EsqYKMQ3LSG78G8Qq/Yjmhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zwWna5ohYvk6/hKT2RmHI9Xdzj9jtWfTFAzrIAfz3hI=; b=HBVrw3oc6lbK8U9OgSRhuQPKI4UwasYNTQK4RTWqb5PPzpUvo0pSfO7H5rlC3QXXAsxZiIxasKbuCJFTowDd8QltrjDi6CztKsoHHpJ/84/a6ph1xfciRStCZLQT69fk7KqWfn7GW0Y3cYOwUksYYHeQdqFf+Epy8nY/tFOhtiQ= Received: from DM6PR02CA0136.namprd02.prod.outlook.com (2603:10b6:5:1b4::38) by CH2PR12MB4197.namprd12.prod.outlook.com (2603:10b6:610:ab::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:01:19 +0000 Received: from DM6NAM11FT083.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::33) by DM6PR02CA0136.outlook.office365.com (2603:10b6:5:1b4::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.23 via Frontend Transport; Fri, 4 Nov 2022 20:01:18 +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 DM6NAM11FT083.mail.protection.outlook.com (10.13.173.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:01:18 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:01:16 -0500 Subject: [PATCH v8 11/13] x86/resctrl: Add sysfs interface to write mbm_local_bytes_config From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:01:16 -0500 Message-ID: <166759207601.3281208.770005576930282516.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT083:EE_|CH2PR12MB4197:EE_ X-MS-Office365-Filtering-Correlation-Id: 39dac42e-b12f-4585-e63c-08dabe9f5663 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uYb+W8AtB4KF0Y40ugVd3+JteoOjYSfgrzVJVmi2G96Ul5xV5brCzembHHppZ523hBZcuxu/1JQcMwM6bI4kNK0ArOWONI4ZhHYDL37Pyj/ldeW9xJT1c0Q7IZHQdrCj79JxVAKxl3puwfEEp8V8FpMF9Nj/fuIAuzdBpHwEfCSoOG/lISDmxf7zYantRHzORNIOlSBcX2XemJT0qCJiTNKwuaOQrTlid26bsATkiz2Q+9ogTvx2AobpC1CTTvd1eVEdZaOmn3Q4IEu7MgVL6Vuemi9Z555BeIJUcr0I57t+2eTmq3zDlJj1ELigv+D3n45L0gt1u1Z1Kj3ssaVC+Ji4UCY8CfkARcnmC4Dyu7PE4J65TlY7UO8noPSg2oLdV0ys9WcIZC9w0u7HUMmx9a/TEhUafCNySuF3rPecfq5veIX7o5rPcYoW4y0tWZvidAHbKxVPQRqTocbbXW7pp3gAlS6duz1EtwbLcP3W2psL0nV+UNC8tTYa4smCPV+5jvkpco/6SvwilSaC0gxMAy9Bho0mWz7yQ+xlY4PVN238g865Yp3bR8vdMq+1qfbzbXZ7RWolG9bYVja9f+dN2GsEQRfE922cC2ixIOUKXVAbh2ku/CE5ZpRDsQx5Q60rdbT9Zd7EknqvvR4rZj/xRM4j9eHDrjWb6iRZKiWf7R1gZQRnKhsOInmqcsPbVc2792T53FDxdIK4X4ptkNr+7LLGlsTyXlSBOzthTYAD4UbOYQPvL59zWM+49KUwiUkIHn50FDRFGtUgIBWNZI+VPuqsTCIkNjmzVjt1wmvrC7Oub2Dtdu08jlkt2yo8syPq06WirKNNy2igf6zo9J4veQ== 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)(136003)(346002)(376002)(451199015)(36840700001)(40470700004)(46966006)(44832011)(82740400003)(36860700001)(7416002)(2906002)(86362001)(356005)(47076005)(83380400001)(426003)(5660300002)(103116003)(81166007)(40460700003)(40480700001)(316002)(110136005)(478600001)(9686003)(16576012)(336012)(16526019)(186003)(54906003)(8936002)(41300700001)(4326008)(70586007)(8676002)(70206006)(82310400005)(26005)(33716001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:01:18.4030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39dac42e-b12f-4585-e63c-08dabe9f5663 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: DM6NAM11FT083.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4197 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?1748597144135983459?= X-GMAIL-MSGID: =?utf-8?q?1748597144135983459?= 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 --- 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 0cdccb69386e..f37ecc16b34b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1632,6 +1632,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_parse(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[] = { { @@ -1739,9 +1765,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 Fri Nov 4 20:01: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: 15777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610206wru; Fri, 4 Nov 2022 13:03:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47869viQGMd3tIbbz81wbPJQHU0hShbOfHYymV8XZ0c5WeC4sQlXXC6G5paLKN9g4asUbi X-Received: by 2002:a63:591c:0:b0:464:bb3b:d1ad with SMTP id n28-20020a63591c000000b00464bb3bd1admr31837367pgb.146.1667592199683; Fri, 04 Nov 2022 13:03:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592199; cv=pass; d=google.com; s=arc-20160816; b=Ot2BaQiUE4rqwSUuhdcSK0mf41rJZy1cIMn0vnf79HVj+Z3ZxZpr+4dBZJL1w9n1uW CXvEz6h4FS16FxynWSihpyZvPDndTlmN1sxhI6o8fCMf/b0CIheqtusIbglryP6WdbJw O7C1RBt/i/rf5s69dA9vuw2GXZsrMUrNfkE2tdMBQjqT3ONiuZiPR3rtgXxqymbyElQf Ftiuwhggce4599gQU2WknABWYqDY7ctMx31zm2f6gXxr9n3wZCfX4lVMdI2+9E7StES8 d98jm2fmv2s+AEpzRI3LsAgM95f8Dk0OQqtMAyE/6jkGb6q5qv6YortPKmaEiwno0rP2 m/RQ== 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=4Zet5DKiEM4lCLt7BH9iSf59T7ygIwURNyOBh4jTAdo=; b=wEvp6jKNFenR+OktahRGqPBfCYJQ8Xbp9EeWA84DylZuCOXwpNinq9nkTmdA/jFkPe 3zOe/+eJvOCR7cgj+NU1O1NB7qspqJPx7NiaU/l9XS0Zjr0I/Gq6dP+sker8X7hXcb/K TSCVxXnVFM4qA9LAlikPyU1LWagGn8IW2qnrg7uMY0AMlUK0VQ8Vx1++Q2BD2cew9b9i ULVhFI/olXR+Y6s7fNASV6mR1N9ao/ZGah9JNHc5pobebeHAcprAx0N52kniInvGO/EH EUp26tMwEiKV4G8Zk4EzjHvC+Ad9pJpwXKQAY+KuU0ln0i29WktHWK9egy+1CAOHbjfV 2tnA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=P89rJWN9; 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 c7-20020a056a00248700b0056bc44616b1si147721pfv.135.2022.11.04.13.03.06; Fri, 04 Nov 2022 13:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=P89rJWN9; 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 S229994AbiKDUC3 (ORCPT + 99 others); Fri, 4 Nov 2022 16:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbiKDUBt (ORCPT ); Fri, 4 Nov 2022 16:01:49 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2077.outbound.protection.outlook.com [40.107.102.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65EED4D5C3; Fri, 4 Nov 2022 13:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fJ2m/+BEZY5+vQF+kIpddnbkR8WDjpN+S3i0mDkXwLt0kOxvTIurNNVjhnNZvwegajhm2R9bhxwhVH1Tr0eMbiaNaHJczWVJR0sMnjdfOEb/KWS6dCgYyGBHBhxPZZDkjyICIF9juYKoC0T5KgGM81uJ4Y2Oef6/8pTDWJ21+zH/1y0u63v9sfzU6D1a7y2N5hDJLxhQ5+oq4xEKI3fZltIvvy/7RkpgLC2ibE7wJBL9oKjvuqDCXS+ta6cWPM4JFTqUam1tsgePgF5UBCvo39Dfe0bQ/cikbyB2n+HmaT71Oc/c7huF0M6Oif+CHcOrDXpby5jbVD62MYAW6KZ50Q== 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=4Zet5DKiEM4lCLt7BH9iSf59T7ygIwURNyOBh4jTAdo=; b=Gl81TEqDGP4CFDY1RiXgFWTX3DYnr2Lu1NF5kKWL9MUpesbPSyLFKp5oU9FVnCJE2xRJeflchqDrSBUmyH3qV80QGpmkuKnBEjouDYOD6nbePhoXCaTAWGwgep+tvYV3MKB/nwJUuxe7T5hhPKTYQ59Ost1hTv87pNfEmcNUSXSoBW4skHTtsvTanb8/ZzIDRsUNLxFJMu2mLAKtRxleejCE5ZdWGEsPYmZvk7EW1kW9ne9gqizpfvNDUoa7YA6BovY41jnbbDJAxo1P6/6YbcqT1JKRWa6U3/KFcHD7QL7NDRXlujvB2GClfx6U/2XjjAzo2bX11uPDTGNHj0a3YA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4Zet5DKiEM4lCLt7BH9iSf59T7ygIwURNyOBh4jTAdo=; b=P89rJWN9Vkm5ucEQT0JXCxLInNaWv9FKUvFvd/0iADKKFBW2tse9vtkM9ROC9CXGSBWgmQ0vIp7stp7UpQA+eqBap6brf7JFiUEBT9mcn++hU2MRbLPUDn1YJOIM+KRfwKvjb+le2G2ZLQa7L7IRZXCYo2jxZewZiXea3Pucl8g= Received: from DM6PR21CA0014.namprd21.prod.outlook.com (2603:10b6:5:174::24) by DS7PR12MB6264.namprd12.prod.outlook.com (2603:10b6:8:94::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 20:01:25 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:5:174:cafe::99) by DM6PR21CA0014.outlook.office365.com (2603:10b6:5:174::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.8 via Frontend Transport; Fri, 4 Nov 2022 20:01:25 +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 DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:01: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.31; Fri, 4 Nov 2022 15:01:23 -0500 Subject: [PATCH v8 12/13] x86/resctrl: Replace smp_call_function_many() with on_each_cpu_mask() From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:01:22 -0500 Message-ID: <166759208296.3281208.13284924391643463358.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT018:EE_|DS7PR12MB6264:EE_ X-MS-Office365-Filtering-Correlation-Id: 012c4d51-8086-4bd5-130c-08dabe9f5a85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K9WQqLMErbsClgKaCRwSxSdDJKHwRGhBOEJSbC9ATEuv+LaZiN0eS1vlUpPFeRksEkE9IpTA2YgKvPEtxkj0ONw/yt+jxvxvUgZiHWrfH95unz6SuKFlN1mHOLzokyv9Sm9XRVetCsRNPA5H2l5wav9vDkX5nnD0lOxYqdWFpc05/g97Ltu73eKGC7CkICCh+2hqUVLgcHAu0VmkAr+BXJOVfDgt8uhqKpr2uyWqzkMVm4SOL2iOEui7anjRZTT59JHznrC5UhggSS5EVFbvXVKlXmJotiVjRQDBFUsw4Pp24vT6alqvZ7iJekSDzb2id1HiioZ8n5nYSyAa4gpRs5bxSU00bUbo3PlGs3HXgRYT6ag0M9N8Yr8C2Ggsp3KfKPAJK+ee37LJbBpfcixEGfsenF+y3yLuCo5fx+FCuMQlOLpdq5CcHenazc3GjXGFx7AuruN8VmdfUuh5umtfsSGsuJ2Jo+ArXuapbymypi7cBUGuyu0lvUR4hrwJjQifjC4XooFzd6hVqNsvJO56QIrNDAtFbpcnu5WRvxuf4o3D/QI6S/k2RgQPhqtVaE+9WmnTYUhBNdqfiKWtKkrpZ4+V2ZrD1CC7m/pK1mi6z9pZvXam4AxWW7OiTHZhzeVMhfzogcZpXzMHU7BapFP+KXTDORvc/yZT7LARFjeakUZDGalt+t0ZOuowIG1V+sa1111Tq7R5ZHPVtegfhZCrXmuHBt7Kgt45I0BPERfNDkVQ0eOmNf3ipjqwop2akOtGXleDA/xE3eWjuVOXQ/AmF2qcWDGMux7CC7nWnJPeD5ce9+hb1Dh8rGWW1k36JATxncLkCWH8rG4ii+NJ+9w3cw== 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)(346002)(39860400002)(376002)(451199015)(36840700001)(40470700004)(46966006)(41300700001)(83380400001)(26005)(8936002)(5660300002)(2906002)(44832011)(186003)(9686003)(336012)(426003)(16526019)(7416002)(40460700003)(47076005)(82740400003)(86362001)(103116003)(82310400005)(33716001)(36860700001)(81166007)(356005)(40480700001)(54906003)(316002)(16576012)(4326008)(478600001)(110136005)(70586007)(8676002)(70206006)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:01:25.3313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 012c4d51-8086-4bd5-130c-08dabe9f5a85 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: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6264 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?1748597157990872850?= X-GMAIL-MSGID: =?utf-8?q?1748597157990872850?= The call on_each_cpu_mask() can run 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 f37ecc16b34b..6b222f8e58ae 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, @@ -2130,13 +2125,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); @@ -2613,7 +2604,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; @@ -2634,13 +2625,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 Fri Nov 4 20:01:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 15779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610329wru; Fri, 4 Nov 2022 13:03:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F4/4ULsQwFZovA8BUZHQeU5Hq+TzHCnqbzbVA/TXLDyKJSUK3pC4mIN+1OmMmlg7PCAw1 X-Received: by 2002:a17:902:d58f:b0:186:fd58:c6fc with SMTP id k15-20020a170902d58f00b00186fd58c6fcmr36731881plh.125.1667592211194; Fri, 04 Nov 2022 13:03:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592211; cv=pass; d=google.com; s=arc-20160816; b=WUi9GvHmjfs458IK8p3x2lxtyvlr9idVS+ZElXyEoKxfegHWcKiFOk3Lwz49Jydy3p HHBcDFe9Ws0fbOXk8J9ijJiH9OV+gDIbRBfrzGRe+coqwit4LgF83acQzBm9hrGYBerY rQtGFJI69I0fPn4WSZcRBUfT7e3J/RpjPg/oqbD1SwaDP09IlZZ+/jm6Nq3Sf5jfGKdL azXZQYhOdt7WOM/g/HSQ1RhiUJ5rjHjoKMFWxZkf1QlJCm3zax1KXZU7PQKtQH3W8RKE v7FYH2yt5VV48oK0s12y5WMRkx9o78y1KrJDooT5vF2qXwJK5/vZppw7CXfczBR7Sg75 mlUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=+s4l4zkGjAI//GM6I9DveLbzsB6+BhZ4ms4R4KpxxNE=; b=B3HFw6HQRbS9CM+RRsprTIrFZUHeoTFXXVNB3AebefqK/HkICxa90d3cW9gwsmkXEj 7r9a5o71PtBwgc69s3PNyBB0O+C3PAPdvKBE8NRNOJD7io0lqGOK/Jx43paALQ8vwHpu Gns/xb9Uwvv41Ow7NyhieMnSiaRru15VR8pdC9Hx0ijbf66tQ15TREtvHHzhbHxWPNRL P/cKbHYqnslG6t7D90w7Z/De6h9y+NsPTD0im1XXg7Rsg+bLq5HKMTv26GdHejZQIFJk hFFQNlGjkxwWkH6OQB52OWJvW8kD7UgwMgfNbroIhIAZ68syWAd76IJpJOS+I4KJ6k8d ARVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wLnjMCtK; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a63f241000000b0046ef23ae9a6si362045pgk.848.2022.11.04.13.03.17; Fri, 04 Nov 2022 13:03:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wLnjMCtK; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbiKDUCi (ORCPT + 99 others); Fri, 4 Nov 2022 16:02:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbiKDUBy (ORCPT ); Fri, 4 Nov 2022 16:01:54 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2043.outbound.protection.outlook.com [40.107.94.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1D34AF3F; Fri, 4 Nov 2022 13:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GOscMAck0Sx2lzrEBhfUpbA1hTxmqP/64ZRPqMc/6dFOMEM4RhEIc6MLBbtZNO8rUkghhIycqWWmCFgi619hblSzSsQJyShoevrzVJPIfjekybelytWzbgXCcrpThs7YCfXOS4002Rd9SwcgL8tbOyNfFHO152jQyZlg3cTAoLA2BQ3cT4VOTnBWvKaDVIeKPjh537JPzODolh17hF7oBZse3Q+jenSODhQCRPrY49l4VPDtC+jW1CmbP2g09qKjiaY+iqddPsB8mo4eDWlIzTjM35yeHg7oHRisb7o21QZtHsYCHKYtkG+JbV9sfQ8LiVV3hEp2I/7g9v5HfbV5UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+s4l4zkGjAI//GM6I9DveLbzsB6+BhZ4ms4R4KpxxNE=; b=VeR9OM+t9grn9NuXePRb/jat9m2hFJHGzWVDln05bJ/gLKIs3I+fDw7CKXt1rK6xaB0v1uFbw7HSV4U6TFm5LMay3NJ0PJDToID0SpoA/hozcMoufn1hv5Pe7D4cJS6Cy18NEYj8qiJlOCDFp9QqrZ1OOigk6z6xaDV+1S/NrsQG/i2bKtN4UcylRAqIn/RFuQVukpLAT8hxtJspnUw957DukWy8hsIId85v29/q0QE5/q0dPFN3kaaEb1HFuVlbXgndjNT66lW7bNRwgPxQFCTUb4nBdogQxp4Rd72hH0R403SBltFZkm7Dp7xO3mqd0P33DVdUTv4wI1a/SEG4zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+s4l4zkGjAI//GM6I9DveLbzsB6+BhZ4ms4R4KpxxNE=; b=wLnjMCtKLLY6nUdtj1QcMAqQj9s/LBWfdj5tWbBTIjR1Dwy6zxb/2wsmENN5P3mMrassz8hqjlhJNIZ8zR2ahwyhWBuvYwxyeE55+lmKPxfV1aEmEuT9Js8b0gcFCmAdire8bHEXaUFoArHasGVjtrhAgupV6i7WZGfpmDB2s1U= Received: from DM6PR11CA0059.namprd11.prod.outlook.com (2603:10b6:5:14c::36) by SJ0PR12MB6880.namprd12.prod.outlook.com (2603:10b6:a03:485::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:01:32 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::db) by DM6PR11CA0059.outlook.office365.com (2603:10b6:5:14c::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 20:01:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:01:32 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:01:30 -0500 Subject: [PATCH v8 13/13] Documentation/x86: Update resctrl.rst for new features From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Fri, 4 Nov 2022 15:01:29 -0500 Message-ID: <166759208987.3281208.3199784740546752454.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT065:EE_|SJ0PR12MB6880:EE_ X-MS-Office365-Filtering-Correlation-Id: c256ef78-ce43-4667-f48a-08dabe9f5ea7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9NLPLuCUHvmPR8lPctqdDaVPWas8HS79j1dFqQ0cjh6xfz5qSsz3aDW9DngRxYX1vxi4WIf0jIY/vq6XChnjKhsdwfU3RZ+P1adUbFfHh+loL0HVreHUKy/s4eULmtUHL9voJCZjT7nsXhB9cl//FjrtY9UzCcCgY5mEVhYhvXUZOG8TSHBKAmyvRYf0FE+MSgoAdpZEvOBiR2Y7ALqM9VUbi94sWx6G/QJ5W7ZMv/5J8U3lSdMVJFE+dcHM70qqsJq7AMqDu5RkQznBIyLA/KPhaUozwqVTNXSBhLpp9VflPJ7fKjqe3hEm3i+Pke0fNp+7KEwb2DNyoPThrcigkSpXD3WCxtTwTUkiqbH6cwkR6B4Fs5rrpIDoySCvfw/XrQq8mJioM3Ycmy68YokmPf4O3bk54q6fVAgwhPvLkZW4KEKiKJGh1czx2eH5LihYx7xijH4ToGkpEIpY3rcxa4RUlbDsMIGDxsWy33ZjZdgbgy7+W6p3dhkbADXgeP86Hfl2KmGMF/TFi3XmKNWzZveM/ybv2CeWEz/OM04ai1VnvnY9EL914KR0uWHk+RbD4oGWlun6/Aui3eIWR2DKs2jE1x+hI92Vz3/hHyN4YVy5V5AcYUA5U9nOBkPpsSA++08BPoitxqBV8uCn1ksyTUzxfdUXK9jjxYuTzfpblKwW0a33AaL4fERVTJwjIuzoy1DloaEZb2W7dAGGsVhghpLu3rbAjnStZrLvi7Cd2VYhXwSBJuXrNCv2KdH9heguyshLmL0gB8XnkDJB97+lcCPD8dwo/v3mptKMB8Tb+ofT+MH1UO8PatvhWoE5C9C5 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(39860400002)(346002)(136003)(376002)(396003)(451199015)(36840700001)(46966006)(40470700004)(2906002)(33716001)(110136005)(26005)(86362001)(82310400005)(356005)(81166007)(103116003)(40480700001)(7416002)(36860700001)(41300700001)(9686003)(8676002)(4326008)(70586007)(70206006)(186003)(44832011)(336012)(8936002)(16526019)(478600001)(5660300002)(54906003)(15650500001)(40460700003)(316002)(16576012)(82740400003)(83380400001)(47076005)(426003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:01:32.2708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c256ef78-ce43-4667-f48a-08dabe9f5ea7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6880 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748597170309813019?= X-GMAIL-MSGID: =?utf-8?q?1748597170309813019?= Update the documentation for the new features: 1. Slow Memory Bandwidth allocation (SMBA). With this feature, the QOS enforcement policies can be applied to the external slow memory connected to the host. QOS enforcement is accomplished by assigning a Class Of Service (COS) to a processor and specifying allocations or limits for that COS for each resource to be allocated. 2. Bandwidth Monitoring Event Configuration (BMEC). The bandwidth monitoring events mbm_total_bytes and mbm_local_bytes are set to count all the total and local reads/writes respectively. With the introduction of slow memory, the two counters are not enough to count all the different types of memory events. With the feature BMEC, the users have the option to configure mbm_total_bytes and mbm_local_bytes to count the specific type of events. Also add configuration instructions with examples. Signed-off-by: Babu Moger Reviewed-by: Bagas Sanjaya --- Documentation/x86/resctrl.rst | 139 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 2 deletions(-) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 71a531061e4e..12adba98afc5 100644 --- a/Documentation/x86/resctrl.rst +++ b/Documentation/x86/resctrl.rst @@ -17,14 +17,16 @@ AMD refers to this feature as AMD Platform Quality of Service(AMD QoS). This feature is enabled by the CONFIG_X86_CPU_RESCTRL and the x86 /proc/cpuinfo flag bits: -============================================= ================================ +=============================================== ================================ RDT (Resource Director Technology) Allocation "rdt_a" CAT (Cache Allocation Technology) "cat_l3", "cat_l2" CDP (Code and Data Prioritization) "cdp_l3", "cdp_l2" CQM (Cache QoS Monitoring) "cqm_llc", "cqm_occup_llc" MBM (Memory Bandwidth Monitoring) "cqm_mbm_total", "cqm_mbm_local" MBA (Memory Bandwidth Allocation) "mba" -============================================= ================================ +SMBA (Slow Memory Bandwidth Allocation) "smba" +BMEC (Bandwidth Monitoring Event Configuration) "bmec" +=============================================== ================================ To use the feature mount the file system:: @@ -161,6 +163,79 @@ with the following files: "mon_features": Lists the monitoring events if monitoring is enabled for the resource. + Example:: + + # cat /sys/fs/resctrl/info/L3_MON/mon_features + llc_occupancy + mbm_total_bytes + mbm_local_bytes + + If the system supports Bandwidth Monitoring Event + Configuration (BMEC), then the bandwidth events will + be configurable. The output will be:: + + # cat /sys/fs/resctrl/info/L3_MON/mon_features + llc_occupancy + mbm_total_bytes + mbm_total_bytes_config + mbm_local_bytes + mbm_local_bytes_config + +"mbm_total_bytes_config", "mbm_local_bytes_config": + These files contain the current event configuration for the events + mbm_total_bytes and mbm_local_bytes, respectively, when the + Bandwidth Monitoring Event Configuration (BMEC) feature is supported. + The event configuration settings are domain specific and will affect + all the CPUs in the domain. + + Following are the types of events supported: + + ==== ======================================================== + Bits Description + ==== ======================================================== + 6 Dirty Victims from the QOS domain to all types of memory + 5 Reads to slow memory in the non-local NUMA domain + 4 Reads to slow memory in the local NUMA domain + 3 Non-temporal writes to non-local NUMA domain + 2 Non-temporal writes to local NUMA domain + 1 Reads to memory in the non-local NUMA domain + 0 Reads to memory in the local NUMA domain + ==== ======================================================== + + By default, the mbm_total_bytes configuration is set to 0x7f to count + all the event types and the mbm_local_bytes configuration is set to + 0x15 to count all the local memory events. + + Examples: + + * To view the current configuration:: + :: + + # cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config + 0=0x7f;1=0x7f;2=0x7f;3=0x7f + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + 0=0x15;1=0x15;3=0x15;4=0x15 + + * To change the mbm_total_bytes to count only reads on domain 0, + the bits 0, 1, 4 and 5 needs to be set, which is 110011b in binary + (in hexadecimal 0x33): + :: + + # echo "0=0x33" > /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config + 0=0x33;1=0x7f;2=0x7f;3=0x7f + + * To change the mbm_local_bytes to count all the slow memory reads on + domain 0 and 1, the bits 4 and 5 needs to be set, which is 110000b + in binary (in hexadecimal 0x30): + :: + + # echo "0=0x30;1=0x30" > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + + # cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config + 0=0x30;1=0x30;3=0x15;4=0x15 "max_threshold_occupancy": Read/write file provides the largest value (in @@ -464,6 +539,26 @@ Memory bandwidth domain is L3 cache. MB:=bw_MBps0;=bw_MBps1;... +Slow Memory Bandwidth Allocation (SMBA) +--------------------------------------- +AMD hardware support Slow Memory Bandwidth Allocation (SMBA) feature. +Currently, CXL.memory is the only supported "slow" memory device. +With the support of SMBA, the hardware enables bandwidth allocation +on the slow memory devices. If there are multiple such devices in the +system, the throttling logic groups all the slow sources together +and applies the limit on them as a whole. + +The presence of SMBA (with CXL.memory) is independent of slow memory +devices presence. If there is no such devices on the system, then +setting the configuring SMBA will have no impact on the performance +of the system. + +The bandwidth domain for slow memory is L3 cache. Its schemata file +is formatted as: +:: + + SMBA:=bandwidth0;=bandwidth1;... + Reading/writing the schemata file --------------------------------- Reading the schemata file will show the state of all resources @@ -479,6 +574,46 @@ which you wish to change. E.g. L3DATA:0=fffff;1=fffff;2=3c0;3=fffff L3CODE:0=fffff;1=fffff;2=fffff;3=fffff +Reading/writing the schemata file (on AMD systems) +-------------------------------------------------- +Reading the schemata file will show the current bandwidth limit on all +domains. The allocated resources are in multiples of one eighth GB/s. +When writing to the file, you need to specify what cache id you wish to +configure the bandwidth limit. + +For example, to allocate 2GB/s limit on the first cache id: + +:: + + # cat schemata + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + + # echo "MB:1=16" > schemata + # cat schemata + MB:0=2048;1= 16;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + +Reading/writing the schemata file (on AMD systems) with SMBA feature +-------------------------------------------------------------------- +Reading and writing the schemata file is the same as without SMBA in +above section. + +For example, to allocate 8GB/s limit on the first cache id: + +:: + + # cat schemata + SMBA:0=2048;1=2048;2=2048;3=2048 + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + + # echo "SMBA:1=64" > schemata + # cat schemata + SMBA:0=2048;1= 64;2=2048;3=2048 + MB:0=2048;1=2048;2=2048;3=2048 + L3:0=ffff;1=ffff;2=ffff;3=ffff + Cache Pseudo-Locking ==================== CAT enables a user to specify the amount of cache space that an