From patchwork Mon Jan 9 16:43:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2258990wrt; Mon, 9 Jan 2023 08:46:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+159A8vEbHMU8fFPrMu9ImuYFRSW3LipYjHSs5Ptyp7qFypQMWOiL9xlMjRZy4BSfemvW X-Received: by 2002:a05:6a21:33a2:b0:b5:d242:d4de with SMTP id yy34-20020a056a2133a200b000b5d242d4demr6194583pzb.58.1673282795112; Mon, 09 Jan 2023 08:46:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282795; cv=pass; d=google.com; s=arc-20160816; b=ydDOCzhD8sFdm1ccVP38WAvbcFhonDPHNh1PhGDCXvZ6l7Dhymo8B8uHcT0hQriF9B c9mAPE6INEZbLw9ihGdr2ARFCXKl+hF+3eEzKMPg/wxz71+/Wi4+5mojByyYbPzEVCOW o9eOuhEbbxabwdu3hkgnH0Ex4ZiSHeKdTyVUhW7As3s1e/UkYu3ms5U4Qgrxo0vmpoYv 7g+n+1uPOPIh0YiHSRc5sr0NkMd+Un2AtkBBadim37va2gJFgKNORE6EwWNK6pod0UGd 16MCmzPhFh9haoD8oyXkBBdQCdlh/mkea0DZVKiSj//y3/aBQ8HcginJ7CbbT46O+LLR 8uMQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fgVeecox9aCJooi/qcyiRrJ1TSTmj4nKFh4IAaq/f3g=; b=Rq3vXD2Dl1JJPxaqoMSFwmCd6HbVO2vWWb8LcsNf7NUzdm/UGKsFz2CAcM8mOjvgHh F5D4+DxCUgvb5gKAm5lL8E31t/2uScQEZJQ8zFppuhV3ctDVGj4O7ILhsVHG7VlQYoZl p2Iimw6yrvP5/TRbuC6N6Wiwfkgh5g+pxAkR1cN92iL0dUakgQGgDSQkmcw4/zz/6lqf d5KnbWqb4ScnEQSdlEsct17JtnKpm+scl2Gg91X9JjRW2Gs5kli8rmZ0oJ4oKKfLjKLi HaD551HyxOR+tWWOzBXC0QUuhvT9U7mqlpwJxXDz/plqRQN3IHhpw8qiDQ5+yFfT9S/h L5zA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3dVjJ5vO; 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 h21-20020a63c015000000b00476d1591b76si9063635pgg.119.2023.01.09.08.46.22; Mon, 09 Jan 2023 08:46:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3dVjJ5vO; 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 S236558AbjAIQo6 (ORCPT + 99 others); Mon, 9 Jan 2023 11:44:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234229AbjAIQoS (ORCPT ); Mon, 9 Jan 2023 11:44:18 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2044.outbound.protection.outlook.com [40.107.237.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5412E5F43; Mon, 9 Jan 2023 08:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bLqZlaYUgv7rch+8lqIa3hINX3TutW+jFvqXqe4NcXlZ8z5AZv1lgxB6Q+DUXz1udvngf1TSWgi8nvCwih+OxkcugdB+EJPv79v7uEF480AMpXIGtVuAR4Msj105+AgoyxWTH89is954UMFasg/CzvHvBt6bP/8XaBWTSTDptiD6BpCMT88WBxFpMRE/vvCvv123kswpERh1bLZ5QZ2LkI1MRwbfFpzjqXgALtNc6mHOOOZyipNQxyhlU7xKfPKlzE8jpADi1rw2eQbE5dmihEYXxsM3CEDFs81DukLXZ7cOjQIzzWqy//fuyshDWLBLTYV88txUtOhIieAFohKG/g== 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=fgVeecox9aCJooi/qcyiRrJ1TSTmj4nKFh4IAaq/f3g=; b=f0gJotOHTl8bIhXfbRuJOdKZAjx+iUISPQN1O/im3hMf/5sjA8HwOPuz1VyRd3THvN9QUKzD0t+pCaCkI7lgMObgOVNci5MJVLy/6YN0fPRtwsAviFH2ChD+l525tZqFk0qNRjSR5N6JODgX/iPzoel+64L+J/6UI339S1q3rde7E8JF927HP4QOfEWzveNFRTyVQQHjgpUQkkA1v3tVb8NQuVVHLDhNICR2DX8W4p+QAflp7vf0cRi0ZW5onKKA5Lc+9xlLKzQc+HB14xHXyBE04W05wrGPxGxsryqmdT+WYz/iARuMy+EbKi0HvFUADt4VtZjou1VHfD+W+229zQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=fgVeecox9aCJooi/qcyiRrJ1TSTmj4nKFh4IAaq/f3g=; b=3dVjJ5vOan3xQhVGWScU0GP8Hz0eKfSzW5cpZ7Nd0pJzGLaOjihSw0vNvy5hUG4eEsLsXD2Mw7IftSp6XEdlo/MFa6W5X7Z9gvFF8azNVP9a9dalLPP3XJuv3a7HcuO1dpgeTEuf0B2HsUuzY4DOMxCa/k4fY30oVTdL17n5vYE= Received: from DM6PR12CA0035.namprd12.prod.outlook.com (2603:10b6:5:1c0::48) by DS0PR12MB6485.namprd12.prod.outlook.com (2603:10b6:8:c6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:14 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1c0:cafe::67) by DM6PR12CA0035.outlook.office365.com (2603:10b6:5:1c0::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:14 +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 DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:14 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:12 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 01/13] x86/resctrl: Replace smp_call_function_many() with on_each_cpu_mask() Date: Mon, 9 Jan 2023 10:43:53 -0600 Message-ID: <20230109164405.569714-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT014:EE_|DS0PR12MB6485:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e788f38-2767-443e-4dde-08daf260be39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EvgQHjSDaGALReu6DxmxF/BcARTwxnQQibeHXgNPWnuY2kZ7y7+VXxtkz0qivNRK+EVPsBv7NpfZ7eG3Ov6zoFIOqSnEAtYpbdcetNIBhmNlRKpjZMw2zSgFE8bVDsCFF9JIZ85rPjaevqU9SWB4QOfIFLrzQuqymTyCrcH6dQ7ZydIZjYZc/1fFxjIqBfVKtexx+BdjyIyqpyLhWQCyYuCDhgDacA5GQhYzdyFlBTkt2+gNvgP2WN86VgLWFIipP0khxauSgNCWmKCfDRlduhuTGbhHT4eQ1Cv05luLoLyINQiLPf3DDxNYqgEp21gu6/aakxfMW0MR4fHIPnpjFl1NdBOeIbJ9LOOjvsExpU0xqZ1WJ4Vd0Sa8plzxjnLgIvtzL0xlJqgbtNPD5XmGnw/gViTLt9W/XObP0QjmheSp10PkB9oHMN1C5GbNmlcfc/2PnyR2Fiwop56hv163qOykF5+EzqYawUuCMjvCheQCL5MFL9gk4u4E3gtRYVFcsC62BkVKuJm/rz0RB8Y+YZ1AC5WhmNCG1CimEKiyK84k/yU114RswFchnTG0W6/JWXGMUPJ+KyakN2uIL+pjrDvkSa47py+pGMFRuOrza3F/XmO5moLKdAGtolYiMz8JhuxfKm1b3I0zbaCnD51u8VPALEm96+lAu+vJYSmfZSSbhxOllZqStwyhUX5griT7g59RA2T5cSCGFdxSzd+94lamQXk2JsoKeVNN6wZwSLM= 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)(39860400002)(396003)(136003)(346002)(376002)(451199015)(36840700001)(40470700004)(46966006)(478600001)(426003)(47076005)(36756003)(86362001)(110136005)(82740400003)(54906003)(40460700003)(7416002)(5660300002)(4326008)(70586007)(70206006)(8676002)(7406005)(41300700001)(8936002)(356005)(81166007)(26005)(316002)(7696005)(83380400001)(36860700001)(2906002)(44832011)(186003)(16526019)(1076003)(2616005)(336012)(6666004)(40480700001)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:14.7774 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e788f38-2767-443e-4dde-08daf260be39 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: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6485 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?1754564180462206315?= X-GMAIL-MSGID: =?utf-8?q?1754564180462206315?= on_each_cpu_mask() runs the function on each CPU specified by cpumask, which may include the local processor. Replace smp_call_function_many() with on_each_cpu_mask() to simplify the code. Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 11 +++------ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 29 +++++++---------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index 1df0e3262bca..7eece3d2d0c3 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -310,7 +310,6 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) enum resctrl_conf_type t; cpumask_var_t cpu_mask; struct rdt_domain *d; - int cpu; u32 idx; if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) @@ -341,13 +340,9 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) if (cpumask_empty(cpu_mask)) goto done; - cpu = get_cpu(); - /* Update resource control msr on this CPU if it's in cpu_mask. */ - if (cpumask_test_cpu(cpu, cpu_mask)) - rdt_ctrl_update(&msr_param); - /* Update resource control msr on other CPUs. */ - smp_call_function_many(cpu_mask, rdt_ctrl_update, &msr_param, 1); - put_cpu(); + + /* Update resource control msr on all the CPUs. */ + on_each_cpu_mask(cpu_mask, rdt_ctrl_update, &msr_param, 1); done: free_cpumask_var(cpu_mask); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e5a48f05e787..e4e6cdc1ee62 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, @@ -1864,13 +1859,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); @@ -2347,7 +2338,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; @@ -2368,13 +2359,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 Mon Jan 9 16:43:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2258881wrt; Mon, 9 Jan 2023 08:46:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXs7C8R42KmiKvgap2i57XrcOLx6h1xTKE03FUCP4LZDp0DPJU1B9CiZvyVVfrjumwrEYObZ X-Received: by 2002:a05:6a20:3d1a:b0:a4:b2e4:c561 with SMTP id y26-20020a056a203d1a00b000a4b2e4c561mr96769289pzi.51.1673282780906; Mon, 09 Jan 2023 08:46:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282780; cv=pass; d=google.com; s=arc-20160816; b=nSed9t2UeigGFU6cfKDmbMoGseWpT0ta8QkQNFMNwQ7Qkzhvu2/1JamXr9x4KqWl3o n8u2/EjzjIA8PidmiJgDscbKLevJLEMYTNH3MicUefpmlFsvVyz+LLhlmvNmHt32V3zg WTNl98Lvpoxere7zlN5L1NnUASs9kemgiplft9iAN0/FDrcn768hCi6/QItCh3okzT1G y9nHXYPHTi9of16QrkDcpio0pYHxFdDGSjeA+0oKv7aOC+UCvf9wIeHbqtXytij7dFMK mMu8JkSD7eqA/PWcAwokYKjoyG5ZNfJGFPhFhuMiEylkQebZcYTkXGAv1JTV2EAr7uuZ NjNQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6Bfz7NaQgOToWbH9FokuddOZoIT4xJvg949sQG3VCK0=; b=027NaCg2QQMJjpvxOjnR0mgXVVdiwFSiSctMriBxlhr7Fl8RJXcNmaecFscTMwt9GU GH11MUgKjb0Dv00TyHawUZlYaJUqE47JHqYzII8UKj6nHlSkq3NPQpmH1RwMNxsqZLwK Lifnd9CsyGsslHYCOqWCNH2TshDHuKutxHAxlrDGGsOfRW4Nhf+XB2uqTKGizmJ/CI/t 35JoRde1WcaBdwctsYV5HfTgaG3ZLiwoJWKyVMpu1GKQYie40SNshqRVMej3kXYGBtvX MTRG7IvQu1kP2me6WfFL/5vplCNFmUagiY9Nd/r1NsqCaZp6/z1nNwcn5qpCBYPjcIL/ NS+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Y2n5ohuc; 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 20-20020a630a14000000b004ad26aaad36si7947999pgk.223.2023.01.09.08.46.08; Mon, 09 Jan 2023 08:46:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Y2n5ohuc; 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 S235387AbjAIQot (ORCPT + 99 others); Mon, 9 Jan 2023 11:44:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234251AbjAIQoT (ORCPT ); Mon, 9 Jan 2023 11:44:19 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E32E95F43; Mon, 9 Jan 2023 08:44:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nFjIMtNgFfFG1IhsGJL5vSxotpsI2JNq4/vnAw1NB6Lr1mmKc/KJ0jxIHG6VsxpI003NdX0KXz3/NfgJPaBFouhJqeuYaE/xMsjnOoKnfnBzD6jBtJTlTAesW5W8ptStX4nMg8TFgljC2jyHp0cFGgZ8NrAXL02oErGjxuPu4PS1JtASsbxOz/9jaD5BiJX50pKhBXkNHTsHt576cEbcz9zU8RrqRRCPJsa2vwSGgb6ILaSB65YuDEajNb+6pckAz8znv/CGSutiEqWBYUt+KS/QlR9nybenFtNFYpUnF+GP3smW/rKAveuo1TZRgh/LYl9cqFwoMqTaS1aM0tZ30w== 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=6Bfz7NaQgOToWbH9FokuddOZoIT4xJvg949sQG3VCK0=; b=Pk+dYxEvBVyw7W9kyMkiz+NLubpN6yDM6HNY88Slv0k6i9cxup0XuxKIYqd+fnKFJEIVc4JUixEpmlq6md4b7PhekfieR3H0d2Dwtbua3uUAfmqVM91qfgrMt9gxw7zVPybXPhs07iBqMmfvwMpEjjET4Z998qDtoYWHAxMWGbm5TFu8cVM2DKn5ZwTuwfCt1bR+ynOLLAAR3U5M5Yv6Ar4fAGwmAgWppXIltkTnV8EfQwA8ZJih+W9SbaQCnFvqg+MQMOY7ZlqRx8gOY7U+Z9dCRD/IO1yvQ8IjB1lTKlONLrytxeTM60xxgeOpUNVRAYXzTSh55+OCHGdfpXioYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=6Bfz7NaQgOToWbH9FokuddOZoIT4xJvg949sQG3VCK0=; b=Y2n5ohuc6OyiAQQm9+UtmE7mp9plql1aa1ER446jQwiK5UHaCOAcxe2LDw8LktoAE6+ODUFvRA59oM+4XSqgL3+K2kV4BPBwuwXheY3yFiI25sxNnFWAngqE6uvSSjxRLcBmdXvKAf6Ysh04MezkRm8LhOlu6fuwckm7dTB+SEs= Received: from DM6PR14CA0054.namprd14.prod.outlook.com (2603:10b6:5:18f::31) by PH7PR12MB6835.namprd12.prod.outlook.com (2603:10b6:510:1b5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:16 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:5:18f:cafe::be) by DM6PR14CA0054.outlook.office365.com (2603:10b6:5:18f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:16 +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 DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:16 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:14 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 02/13] x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag Date: Mon, 9 Jan 2023 10:43:54 -0600 Message-ID: <20230109164405.569714-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT004:EE_|PH7PR12MB6835:EE_ X-MS-Office365-Filtering-Correlation-Id: 91a82631-b720-4838-c75e-08daf260bf2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Krm7jUKpXyFA8w3BmmWLWMO0j9rju+eNYy03FIEWZ2vmUJyJn25W/jDsuCyJ7youfv3WLztkJIsQC5yCRSrWXqtXYbOSwdLWimqnKKVpKoC0DsseBtdm6+3lMOofpV5fwy0BdfptK+KhO3c7QyZV4uXAUH0H9RRpKjNX1YVRGJUrL+p+57pTUq1CYqAw3bkggDYEtKOvBiNJN2Kn0iHhMyLmDyKK44fJyJTyuzM7FKYVIb+K7s8C+HcxGgpxHWnUiCQ5ngh0X95f/rU6TCy3bAAFJ3iMwTzLLKP7GCmKr9ZayFF8vI5mhe5Hn2QMgaP97z/thgqO2bVnfiIk8su8TUkLkw3aM6lnErnYiyu2tcrSmUuakerVPgMdpfIh87EJIm8HlaV9NlGsm9AnyR2j8RyvQQxAzILsK+EC6PvR6pzSJoIPHZj2SWpVsohtKSH9U3NKk46BBP+JKhmVaw/UvK6ooqA71IKoE2GjT+XNGyN2FhonoSNZQUlHj3MnHrcwLt43h4zkTjHrSCOoeBJePOagnq55UyJuWs7Dz0EM8suZjfWWJASwEBnE+R1QcgcOLEQmGDJ5ftji29UAtJgT8ZYPRF8coVC1NFQcAbzgaP2VFELWAFmIeieeEcll5U/XO516iel1FVIoCF28T/AGFim319fjKplmPVbCQtNn0X/rqNecqK39vaMWIRKgUJMM24XDOprd6cb+UvPZJFvVHAdmKv2aqgklHrzbuZM2IpowWUMm6RQ6/Qrn/CLjlBQC+6GWymUC8HKzISP2m7812CZAledkLqAlxJNZE1caWel2Mz1WYjf3Wwzu45fijZot 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)(376002)(346002)(136003)(396003)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(2906002)(44832011)(83380400001)(82310400005)(47076005)(336012)(36860700001)(426003)(54906003)(110136005)(16526019)(81166007)(1076003)(2616005)(7416002)(7406005)(5660300002)(7696005)(40480700001)(6666004)(26005)(186003)(36756003)(8936002)(478600001)(70586007)(70206006)(8676002)(41300700001)(86362001)(356005)(966005)(4326008)(40460700003)(316002)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:16.3926 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91a82631-b720-4838-c75e-08daf260bf2f 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: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6835 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?1754564165262037380?= X-GMAIL-MSGID: =?utf-8?q?1754564165262037380?= Add the new AMD feature X86_FEATURE_SMBA. With this feature, the QOS enforcement policies can be applied to external slow memory connected to the host. QOS enforcement is accomplished by assigning a Class Of Service (COS) to a processor and specifying allocations or limits for that COS for each resource to be allocated. This feature is identified by the CPUID Function 8000_0020_EBX_x0. CPUID Fn8000_0020_EBX_x0 AMD Bandwidth Enforcement Feature Identifiers (ECX=0) Bits Field Name Description 2 L3SBE L3 external slow memory bandwidth enforcement CXL.memory is the only supported "slow" memory device. With the support of SMBA feature, the hardware enables bandwidth allocation on the slow memory devices. If there are multiple slow memory devices in the system, then the throttling logic groups all the slow sources together and applies the limit on them as a whole. The presence of the SMBA feature(with CXL.memory) is independent of whether slow memory device is actually present in the system. If there is no slow memory in the system, then setting a SMBA limit will have no impact on the performance of the system. Presence of CXL memory can be identified by numactl command. $numactl -H available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 node 0 size: 63678 MB node 0 free: 59542 MB node 1 cpus: node 1 size: 16122 MB node 1 free: 15627 MB node distances: node 0 1 0: 10 50 1: 50 10 CPU list for CXL memory will be empty. The cpu-cxl node distance is greater than cpu-to-cpu distances. Node 1 has the CXL memory in this case. CXL memory can also be identified using ACPI SRAT table and memory maps. Feature description is available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication # 56375 Revision: 1.03 Issue Date: February 2022". Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Link: https://www.amd.com/en/support/tech-docs/amd64-technology-platform-quality-service-extensions --- 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 61012476d66e..00045123f418 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -307,6 +307,7 @@ #define X86_FEATURE_SGX_EDECCSSA (11*32+18) /* "" SGX EDECCSSA user leaf function */ #define X86_FEATURE_CALL_DEPTH (11*32+19) /* "" Call depth tracking for RSB stuffing */ #define X86_FEATURE_MSR_TSX_CTRL (11*32+20) /* "" MSR IA32_TSX_CTRL (Intel) implemented */ +#define X86_FEATURE_SMBA (11*32+21) /* Slow Memory Bandwidth Allocation */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */ diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index f53944fb8f7f..d925753084fb 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -45,6 +45,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, + { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { 0, 0, 0, 0, 0 } From patchwork Mon Jan 9 16:43:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2258985wrt; Mon, 9 Jan 2023 08:46:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXvr9qsG1biiJRgPz59zKFiiQnFkabOjqN2KR4LTeXruRKS30u4zOMeV7xBIPNJ8xRNQxP6I X-Received: by 2002:a17:902:e54b:b0:191:24d1:8af6 with SMTP id n11-20020a170902e54b00b0019124d18af6mr98123102plf.42.1673282794781; Mon, 09 Jan 2023 08:46:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282794; cv=pass; d=google.com; s=arc-20160816; b=v2i4CnTzg7w8MUmqx76YWkkJPIrunbKO2RT3Kv217VAey9xVyL5wf3+1/trThNlCnh AKVpSvXHwHEq/An6/9n0DbmkHEsQXsqkmbub6y14XQJaOxB9XQ8bnUR5bXVFNnv7/HZ/ S0+Pup9UgsFAKisrz44NuE5Z2mIO0EbIS8dmQb9gfGTd183m4Norhq1dJKhuRp6UXkDz GBvKWRGGHQx3qT3VOIuIJE9uwdDMDHO1ZizQP1n6H+Jm4yB+hdgod/Iz64t1PaG6uvGp Twy5lwbJzCtwWy5qS5exBTn3m4p9ET/r5SwWWi8kpmAPEzP9cgYHHSwTpU8np+IKrhZo glGQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1F1GLlMLfSr5l7CElB+d0nCVkbg0nKh2QbK6amZ2zIc=; b=Y0x0WDcm1ZGPHfyV7tzA6X8g1rkCc9qx7guqbj0eySGNx+srAhwFd+xz/FbnrSSViH EDI1KGuBTn0XtHPHy89g+v7OnOxq0fGKufhJSbTokYE06XCZIkap5WV2fi8/hTkU84OQ /3PpcSnJd/+k2acZ0ck7e8qRexOmFIgQA113XjieM0RgBbi4rG+3i9UwBqUdEdLytncF sZ6Ehn4xFjpf94M3xwY7ObdbE7tptJsGFwEyB7OQ1BIWsObAiYi25GZlWHoHR0J9oDDX 0PT8TnNcgfS4P6GBsNnL8XV/er+O8AIA6oLNxQCyi346aFsoZh55Xb2zr9mlOUm3tS1l 8VUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="w/2UbkR4"; 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 f5-20020a170902ce8500b00188c9c17571si9841155plg.391.2023.01.09.08.46.22; Mon, 09 Jan 2023 08:46:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="w/2UbkR4"; 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 S236677AbjAIQpB (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234410AbjAIQoX (ORCPT ); Mon, 9 Jan 2023 11:44:23 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5AD12634; Mon, 9 Jan 2023 08:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UW+pzvyOAHxIVbKl4Hq8Ot7Ve9Jo50YwQuXULq/K856imnZTSvSoB1to8jYnJwAfTd9navvzVR7+iB03XIjtTXZtV3h8wbP9u9czXR5ojaJXhqLeP0PQufIDwHX9i9DGSNvHBmCrTUs7h89zH7tkqp84Q4kElnmHQt6/eENr7tH9R6H6jBZKWK8jK3Pb2VdCdhMjLA2aIHFf9jKi39Natc8gvbAe7asCrQ/YeQlGObCwseHdseiBgYxy7koXRo4qXFPqrX8VMVB9YImiomSI5m2floAOMD8M3yYBgm0BcxU4HNbOGdnals0pMMrYVyf9wyU0qPbbNr0PweiCgqv0MQ== 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=1F1GLlMLfSr5l7CElB+d0nCVkbg0nKh2QbK6amZ2zIc=; b=jzFytgFnM2nfEipn/p6iI5mDp1HdLH0b3jIVxTyOoafp6q45LviTn3Dy0r3tOmA/QOy9a2jPrJEXj3fq+MbV2goV/5pXTgWJVP+5QSOR48f9M7IT31gTIUX1UCOq1mTneSzkPiPk1VMbcR1NHCiS3gxVeXCxPPHgwqT3GjWmcb8EDZMlJhkl2lxPx1hm2j5VaLlNNiVnPCY5zZwLRUpzTzNDa4I/mimxATjTidF8xeVBzGFpGFUmEd5jNVf7DoTzxJEc9bfjGbMKtcNJD4L/zbuHravnQv442rXgWVZKbiAw/p5OsPL2fcgtnPXyiWkmCYwJTWdWB/mheRxc0bJxuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=1F1GLlMLfSr5l7CElB+d0nCVkbg0nKh2QbK6amZ2zIc=; b=w/2UbkR4duGFBbebpzmQATr1NFj3SQsqNnrMaUea3tTyb3Uz1+wU2SLXRtt34ehjwpNRNwVDGaRT4eEwrvFBTU4LLCuUAwwgSkD3BuRp0zMRSlPxYOimcAi7+z/Sffvffdo8f26tNaarX9TT0A3kndXQsWnqRxWPrZtD5kKBSZM= Received: from DM6PR04CA0007.namprd04.prod.outlook.com (2603:10b6:5:334::12) by MW4PR12MB5628.namprd12.prod.outlook.com (2603:10b6:303:185::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:18 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::1b) by DM6PR04CA0007.outlook.office365.com (2603:10b6:5:334::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44: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 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.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:18 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:16 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 03/13] x86/resctrl: Add a new resource type RDT_RESOURCE_SMBA Date: Mon, 9 Jan 2023 10:43:55 -0600 Message-ID: <20230109164405.569714-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT033:EE_|MW4PR12MB5628:EE_ X-MS-Office365-Filtering-Correlation-Id: ab5d3b52-6ceb-4b98-ead2-08daf260c04f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kCsXxt8dbTNvnPFKS40KR0EW1OHaNhs8Hh356nClUbc1crqmIe5XKfF0HmtlFQTtCByM3+ER+YP0fRDCD+mG12M2lUK24I2rS2hcocMwGYj1VkBvSP/go9Ec1gqG7I5hCy08Z9VCiS8ff27S8hTEXyP5JGOuE2QVgngdHqH5MrOXQ0lK4DFGKOsh8/MuHGhDANVMdEEV1tmYPglj0K2nsXn/lJFNYPe8VrvnVCcaJXTUcfPNveCwl4X/sly6yaTVCRBnBbuVinPKWiKUaS+v15Un7owXOr4aluLimyk7EVMuI35XD2NwiTdjqDIM5fvWGwjLcFOfha3KixDS8liXfBq64EOgbhZjZJFBvJdtntYlCiR7SH4uR2S1Wi39tixDmObRLdOsB/KBhvcYQwbMaaJ5nXEsC1uIutoaCeoMo28HEwvihGNG+vrn641Z4b/sSA5Zaf81kuC6Z7WLh5oXVYl4MlwgtJbh2Vrxb8ZCSgY55UCWrWey4NcLBpoJN1oO2V4mtixc/LgUlr+SdnDzLs7MWE0fW8dNPSMyQswT3e0uQbbnbNxxJP4uE3KKtsvqMEonYqMwzOkjFQtqEKShmN3JyoMtDPNdSmHwAWCr6srFNlXZplVTQbLqcqeya8pPHlqRiq2MsWsLDhDAWJwIPJ3ew2kNKJ4XZUoLdxMqN4rMh1mLftjtcC5XLOyklWufbHuwlU5VKArI7/MR5kcv1eoiZF8bvaEtOMoSe/vX+L0= 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)(346002)(39860400002)(376002)(136003)(396003)(451199015)(46966006)(40470700004)(36840700001)(82310400005)(8936002)(40460700003)(2906002)(7406005)(5660300002)(426003)(47076005)(41300700001)(81166007)(7416002)(7696005)(70206006)(4326008)(70586007)(8676002)(316002)(356005)(44832011)(110136005)(54906003)(186003)(16526019)(82740400003)(26005)(40480700001)(1076003)(2616005)(336012)(86362001)(36860700001)(36756003)(478600001)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:18.2966 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab5d3b52-6ceb-4b98-ead2-08daf260c04f 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: MW4PR12MB5628 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?1754564180007951610?= X-GMAIL-MSGID: =?utf-8?q?1754564180007951610?= Add a new resource type RDT_RESOURCE_SMBA to handle the QoS enforcement policies on the external slow memory. Mostly initialization of the essentials. Setting fflags to RFTYPE_RES_MB configures the SMBA resource to have the same resctrl files as the existing MBA resource. The SMBA resource has identical properties to the existing MBA resource. These properties will be enumerated in an upcoming change and exposed via resctrl because of this flag. Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 12 ++++++++++++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + 2 files changed, 13 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index c98e52ff5f20..f6af3ac1ef20 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -100,6 +100,18 @@ struct rdt_hw_resource rdt_resources_all[] = { .fflags = RFTYPE_RES_MB, }, }, + [RDT_RESOURCE_SMBA] = + { + .r_resctrl = { + .rid = RDT_RESOURCE_SMBA, + .name = "SMBA", + .cache_level = 3, + .domains = domain_init(RDT_RESOURCE_SMBA), + .parse_ctrlval = parse_bw, + .format_str = "%d=%*u", + .fflags = RFTYPE_RES_MB, + }, + }, }; /* diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 5ebd28e6aa0c..fdbbf66312ec 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -409,6 +409,7 @@ enum resctrl_res_level { RDT_RESOURCE_L3, RDT_RESOURCE_L2, RDT_RESOURCE_MBA, + RDT_RESOURCE_SMBA, /* Must be the last */ RDT_NUM_RESOURCES, From patchwork Mon Jan 9 16:43:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40965 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2258726wrt; Mon, 9 Jan 2023 08:46:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXsFunFQLipKMnTgGoUcxteq5a3EhA/jZeJ9jMk/MVECaZYEoHt/xcpNPEx09mhbKh0M9zvn X-Received: by 2002:a17:903:26c4:b0:192:f6d0:602e with SMTP id jg4-20020a17090326c400b00192f6d0602emr17024334plb.22.1673282761115; Mon, 09 Jan 2023 08:46:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282761; cv=pass; d=google.com; s=arc-20160816; b=m0M1bvC8yeZ7ioUmPcFExOD87x1r8gK6/gTt/N+cIoj0MFgvClGkTFMy3Odzmeu/3p z0vB8N7qUxvSZ9oXg9OLq+C/u6wF+jE609NssO4ObIe02pJtAieHzkbFW5OiahWedYIb usb0hLTDTsZlbjhISYp+9DFDJCnbPzsDR0ML3DtcX/7C8dVLJB1+5Nwm8B4GHvISRiDA Wi3oUhH9pEk6XJWO1JyOmgXyWHReC0acGufWm2/Ig668mY14iuOGsGEROq02HnXiSoCV pBhADX3YgtcgtCZHh8KAESjnCHpzD7ops9oR5SzQSvFc3sc3s61t8Yks9L0WSRo8ZOdC SaQg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9Twd7ddBJxwhZGfyhY4WBCZBaAd4nlAK3kbxKuE11Hk=; b=SnqtZFyYi1sgAu71wyhH3LKzVa3GwW8DqQLW2xEYQhYUKU+tRVFe1KSR14ZB+N/98W +pTgVv72igPOPl9Jae52ueJr8b2c/hSJtfphzyLwGLpvQ6zvWvS+rOhRH+9GJ4Oz6o0a eArATEZb4EikKR7QXlfo6vfwuJexPHaBvmztarwLTbk+Hy8O1zG6f5pEyafbFZVcB8d+ s6n1WqqPR/Gtd0yV9HEQeoGQhA9HFdXaPJFhBi6Rxs36rTtppBPgsiXuXknvz8TLp5sI yF3+6o8TiZDtQhnK03tbpDaLxeMlnXt5lVJsaTQXUUxYMbpthWO/lQ+/NmNuQLYZtnSu p/dg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZOGFTcPU; 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 x21-20020a17090300d500b001895608367csi8383117plc.535.2023.01.09.08.45.43; Mon, 09 Jan 2023 08:46:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZOGFTcPU; 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 S235007AbjAIQok (ORCPT + 99 others); Mon, 9 Jan 2023 11:44:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234470AbjAIQoZ (ORCPT ); Mon, 9 Jan 2023 11:44:25 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2075.outbound.protection.outlook.com [40.107.220.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6739DE0DC; Mon, 9 Jan 2023 08:44:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=InOwn97BQ4ngNty9EiI7miKhVX1SesP6sTb1bBwjw1WKjUVXCoIZVuBPG3xqpkmEZN1kxsL6MyHTphB8XsNigQTy5lC54IuoqXFjRQbIJiX5MVZIb2ofI3XqMOUnO6qm9fkX0TJjZnpbcrGOluuva0CtCXuoDpaETwP0521X+MNKgYthQWJkUYLbUWr+6q2h7+mRv9iM1396LTbHVYOMwn9qsWIGGDZGhA4rhGeNS+gVRA5bU+FeVqzz1FADiUJPF9i4uKwsG9GycLU/0R8HFlrl+8gRAHAlwQzfj9ZvF5imEO/YKjJpAP21x3JDsrqtZpfaXUIDw7/tt5h+LNpNJQ== 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=9Twd7ddBJxwhZGfyhY4WBCZBaAd4nlAK3kbxKuE11Hk=; b=ZYqLEVhvmkoci6ISIVDBN6WEx0Hurv+W9/oX5qY93fsEh2Quix/Z2lTlSTDKVmFXp1SQaYrbmvdWAW8J5nEOOZsysiDre8d/Wj2ArLhVaUd0+3C/YmbsMKN0ZAhivkZbw5KUbaUaPfdjkKSeUbQMP323oaDW55sP9+1r8wGUQwFTAhkscgyy13IG8i/21G9OX6vCEZHTX7MfASsrkBRyi0zPo3rara5PxrfC/I3A7rPzk5Tsv/VU56H6j+uRjLp6/+sfMXe/RnJZ0va09twTIHEJ+NGLNrS4UyhYdDT8Ov43gMRKIlOSt9/VK8ruyG4gKb5zfmBFqbxstvDzNMBBXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=9Twd7ddBJxwhZGfyhY4WBCZBaAd4nlAK3kbxKuE11Hk=; b=ZOGFTcPUANtHWtUyoV2/kn58gotm+tGi/8xqJa8QNkCt/LvPDAkUOo07MqxHzL8xhvPAm2Fb/tUE4jegO/IEp20W/Qz4nMXSbYuwTcdW0c6VtNYFjwTOEJcDUONmVUXIra8PewMt9saaoFibhZ8iSjwFndprM5NCsfLCBBHiAfQ= Received: from DM6PR04CA0011.namprd04.prod.outlook.com (2603:10b6:5:334::16) by DS0PR12MB7948.namprd12.prod.outlook.com (2603:10b6:8:152::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:20 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::70) by DM6PR04CA0011.outlook.office365.com (2603:10b6:5:334::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by 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.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:20 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:17 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 04/13] x86/cpufeatures: Add Bandwidth Monitoring Event Configuration feature flag Date: Mon, 9 Jan 2023 10:43:56 -0600 Message-ID: <20230109164405.569714-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT033:EE_|DS0PR12MB7948:EE_ X-MS-Office365-Filtering-Correlation-Id: 0310f62d-9f64-4044-d258-08daf260c1c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F0hhhGVqMfNMoIzHrE0bVU4qCr5xLOtIE+/bzZq0wlh7pTSeuE942X7ALxwZuMHcd4f4PnAU7GzwpbU4ZWLct4/2b17yxf7pTIirr9Sdp0c6T/tkI0wC3uZLJvcplqbrB15/VG4Ww2037DResvFhUKvy4r9eYP+N1mDfAVESXcAit4aLHCNJPC/uZz/86viQPpecuxYn5cSJAsZgRcxawJmSdOodhY5dQHrGzzTiyDqkn0FRT82YEleMw4UTXlWOtrphxUa9tcfFbrDh8uJJl2O6S1zKHSAoX9LqZvMX+ZiKdEuLdlfE1EL8HIy5M9Y+HajEXvtmKnpYJip5S8ShK+cfVJ1RudqBiC8GAQvAoE7/I1EHQ5vXYBxksFPLkD5O690bogO3uFqKyNOhtVAJnhrco+YZUgxuFeZCDwJAliiHowAG66dMCE9LGSc2qnKB/BEOSqm39Ce/SckZumtFUJXOVSwdDlsbiOTDVdQgG/MPzwEsNGuWhaJTdxw8wBWvSi7hl2YD7Al+mzq1ajHfPCC4PNqW+WHzxEokw9pfBM3rCmdU5CiN5eJbL3K6JbFtq8RYEpGYywtcZ0Wd7jTn7ebwtvMIl2de6l8NS9P4VVzL3FAFxZBFh94WLqFqIu5OJtNp5A7Wr4YhIeHoF1LTkQiNXWhT30s/f84EwmxCz2SQFjnG/eEFr0lfaMCfAsQh21gvEI0jEGuEC0GOxh3wQj77SEhS1NH/bhtzUNj+tPfzN/oyJP6ihSRvQQkXPVaLrv/jVV2PDQ6JYwKUVec2GCaZ1EKBIYjem6N/00xgoYDCzigWhxkvudViIOJ17Qfr 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)(136003)(346002)(376002)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(41300700001)(40460700003)(426003)(47076005)(54906003)(110136005)(316002)(2616005)(4326008)(8676002)(70206006)(36756003)(70586007)(336012)(1076003)(86362001)(82310400005)(36860700001)(81166007)(356005)(40480700001)(82740400003)(8936002)(44832011)(7406005)(7416002)(83380400001)(5660300002)(2906002)(966005)(186003)(6666004)(26005)(16526019)(7696005)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:20.7183 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0310f62d-9f64-4044-d258-08daf260c1c3 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: DS0PR12MB7948 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?1754564144401474407?= X-GMAIL-MSGID: =?utf-8?q?1754564144401474407?= 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) The bandwidth monitoring events mbm_total_bytes and mbm_local_bytes are set to count all the total and local reads/writes respectively. With the introduction of slow memory, the two counters are not enough to count all the different types of memory events. With the feature BMEC, the users have the option to configure mbm_total_bytes and mbm_local_bytes to count the specific type of events. Each BMEC event has a configuration MSR, which contains one field for each bandwidth type that can be used to configure the bandwidth event to track any combination of supported bandwidth types. The event will count requests from every bandwidth type bit that is set in the corresponding configuration register. Following are the types of events supported: ==== ======================================================== Bits Description ==== ======================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== ======================================================== By default, the mbm_total_bytes configuration is set to 0x7F to count all the event types and the mbm_local_bytes configuration is set to 0x15 to count all the local memory events. Feature description is available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication". Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Link: https://www.amd.com/en/support/tech-docs/amd64-technology-platform-quality-service-extensions --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/cpuid-deps.c | 2 ++ arch/x86/kernel/cpu/scattered.c | 1 + 3 files changed, 4 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 00045123f418..db5287c06b65 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -308,6 +308,7 @@ #define X86_FEATURE_CALL_DEPTH (11*32+19) /* "" Call depth tracking for RSB stuffing */ #define X86_FEATURE_MSR_TSX_CTRL (11*32+20) /* "" MSR IA32_TSX_CTRL (Intel) implemented */ #define X86_FEATURE_SMBA (11*32+21) /* Slow Memory Bandwidth Allocation */ +#define X86_FEATURE_BMEC (11*32+22) /* Bandwidth Monitoring Event Configuration */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */ diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c index d95221117129..f6748c8bd647 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -68,6 +68,8 @@ static const struct cpuid_dep cpuid_deps[] = { { X86_FEATURE_CQM_OCCUP_LLC, X86_FEATURE_CQM_LLC }, { X86_FEATURE_CQM_MBM_TOTAL, X86_FEATURE_CQM_LLC }, { X86_FEATURE_CQM_MBM_LOCAL, X86_FEATURE_CQM_LLC }, + { X86_FEATURE_BMEC, X86_FEATURE_CQM_MBM_TOTAL }, + { X86_FEATURE_BMEC, X86_FEATURE_CQM_MBM_LOCAL }, { X86_FEATURE_AVX512_BF16, X86_FEATURE_AVX512VL }, { X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW }, { X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES }, diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index d925753084fb..0dad49a09b7a 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -46,6 +46,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, + { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { 0, 0, 0, 0, 0 } From patchwork Mon Jan 9 16:43:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2258956wrt; Mon, 9 Jan 2023 08:46:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXsId9NBlAPa85bDqQ/S8gzDznfFAs5L09vhCceDJaO5ZWjhAJDS/lC64pV5oYQdxI3mKZj/ X-Received: by 2002:a62:b619:0:b0:574:3cde:385a with SMTP id j25-20020a62b619000000b005743cde385amr57956596pff.32.1673282790442; Mon, 09 Jan 2023 08:46:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282790; cv=pass; d=google.com; s=arc-20160816; b=bkXC91AMLqjy3Qn+5RmCMEVbD3A+mYwtBWpen8HJUEyfvUBgBF9F068LmDJJoJMi5e q8ZFp8DuQUVWmTlJvk6/HBqCsjSB7aeBn0WtMIZgA8xwownvneyNv1kOjwof/bwFBsYc CfyEtCm1Q7o0xUjoUtdvYeP5Y88RmfXC2lQm8nYHv3w9pQczuION6V5B1RqLJi9LTEiW marQDL6B50tqrNVcGbF3TlVADXKGFfvx0v3teL2CC1V8/YyEql8TO/wtK4N+trhnTop+ ZjRYT+CdrUELStz96QwrH6RaQz/uw25enhDbChfVNK8QDLqAQ8FxBqvezxMBSba6wWLz +Skg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BZ0txemEripltiNGTXy/Z+dsa5is9tRbljc7gm5f0gg=; b=yjiA+QLR5ruI+PFqS7WCi1JLw+MziqNRTjSKgJpYiPpI1dBPlmCVVNIOZTZz27LUVz PxpEM2S4ENOOZ/xRltK3POE2zBpic+QEYRBsNQ3SuN4UQQaT029DY1ELhH638roQXGD/ shhmAsfjLer2ZeqEvDKugK++I9uZZFS5EfvUPtlRCHFRxldrGc5Kx/tfbkLBrlhg9sTi QupGkmODeNaby/6QTYifuvVs1sGgHt7IDPOA5lTujTQGZ9e3uRDJEuC/BJpd3kKWHVs8 tC6p80aw5ELaxtcfapmCjYBvltcdH8QhA3XwOEOsDY9MoFxYh/gBk46AVXFr1NOBiLDk 7jyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=sac0a4j9; 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 g20-20020a056a001a1400b0057a74250665si10029531pfv.310.2023.01.09.08.46.18; Mon, 09 Jan 2023 08:46:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=sac0a4j9; 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 S236351AbjAIQoz (ORCPT + 99 others); Mon, 9 Jan 2023 11:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234463AbjAIQoY (ORCPT ); Mon, 9 Jan 2023 11:44:24 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2086.outbound.protection.outlook.com [40.107.220.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B2CA5F43; Mon, 9 Jan 2023 08:44:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jD/1T7I98Y10YbiJc0IEARg7oSS5YLy6j2paMZW91eGqPpqv8aDMXfKSfLNnhhK7+Ij1VZyL7BD5VDgqUkB3VmHwX3KNhTb17dx0sU4OKykM9bBcgRw4X0cArp0h8q8iZjqbVN9CKbRoGi+XE5wdMByFjpkSqRp4gv+YYehGx61prLFd4zM+oiEg/DxVbahmqd6/nIBeTo3MEqDJZ/hicxACv/x9BJPmAM8Ehgk3y3CZcKgoMVR2BDClodc6W6owU1WUA66UK5NMZ4+7rFX/KkRmSWc+ixLJ0lh5vBnEYwsGQ8icNMAQ4btBo1souhAunwf2ZTCuFtoZLkW/v7x/og== 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=BZ0txemEripltiNGTXy/Z+dsa5is9tRbljc7gm5f0gg=; b=U10ex7FDYHn7QlE2kLdWsbW0bx7KBJ+VoE/C9DF8do+49h48E0XHiz/7Jq42v6iluAw/SJHxyaky+WseRDb9kh1Sy+lxP3wC/AtOcRfuHEUPG3kVxTQJUYPEy/gRX8kuFQsbPhspBhhlIHwvcZr6w72Wf/xdPNh9NXX1SDcEBE6fOhbes+4+zfJPE71ZrBvGKQpObT26Ef8zZxYiMCbGaYyI/wj0lKbv0bdSkfu+5NhpxzqwDaEgU/ioMN1wG6/d3Ddb5rc0M4gQg28A9klp0DcisKzRYbQebvlrLTsPy+4ra2/ejSd38RQPFVqYkLPPvPGJvnlIxwdd3euTfvvrLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=BZ0txemEripltiNGTXy/Z+dsa5is9tRbljc7gm5f0gg=; b=sac0a4j90zGl1ZQRONW7O96eOA4PYRT7BqgtmzeQQVOe14L7+XtFwEwgfDzjKBcNY2hCUzqDc6NMKFe8cv2ZCntlno0ln1adYquSzGNI42DQLGHbGNiGd7+Nh170/boeA7/RCHLehagENG21LFs8xho2znMhtx7lRj753GR9fOM= Received: from DM6PR04CA0023.namprd04.prod.outlook.com (2603:10b6:5:334::28) by CY8PR12MB7538.namprd12.prod.outlook.com (2603:10b6:930:95::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:21 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::e) by DM6PR04CA0023.outlook.office365.com (2603:10b6:5:334::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:21 +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.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:21 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:19 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 05/13] x86/resctrl: Include new features in command line options Date: Mon, 9 Jan 2023 10:43:57 -0600 Message-ID: <20230109164405.569714-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT033:EE_|CY8PR12MB7538:EE_ X-MS-Office365-Filtering-Correlation-Id: 90e37580-85b4-4dc6-15fb-08daf260c26d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: esEGJ18LZBF0k27/EUVKT2nZUNnppDa5wGqZGbxGEUHNNNvTZdcchhJVx4y8dxUdxyoX4o62tSI9ulw6PjgOaXCMJTJiBJdd9wRvjCcFxu05VfesxXzBJJf2GjiwbwgJ3k2u8TSAgEM2poblHYNiYJue3mRjXCniR290OJesJBXeCuh8JdpGe7z1U+tRNVyQ7PKsptEMeEtQ5QbHMQAY4fRuo6Sg5OctNKLFznx+jaL6c9la7peoMami96D/54QEgZsHfKlNb0Df5/hHp1D9Z344FjsF1QwdT/ibXIFyLDJu8Qd+PnzWN4qCnFtfWJVCRbjaHLy5efqcN/6RE6k4vga0V+2hVR9fkOeCske7kqe4ofTdoq0aCGI6S+uBbPEKUAihGaUVzyqaYx+XEaR28mvDHA7T5H7sa7RbhYv2GdkWhzoXXku4SreMiHXNAia5SzdxyYkeOY0Ned/Ncd8PSusH5aEfx1UQrEqfShk5SLO9RmmjDoGm3ETKkjwwDTj3Cot2dd4faddrMXuF7MMLQXb07UqOpvCICfCaHtAO1w2tlvzo04QePiBlmXc6/ZO88BlOhpgKHYn18SIsoUcMix/KSs6fZ4PX5Ez1htf7JCrdDNQFGa5ex3DynRtcCs5+E0soSUD1QojZxccrOm60/GYw/+gGDV4D2WIZTbOMuhqMpeK9pXL43pqOVFqAL643/Xqw1NBp/rEEQbdQyLpr40fkN1+qBUC8AFBbGXVXSaI= 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)(376002)(346002)(136003)(396003)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(2906002)(44832011)(83380400001)(82310400005)(47076005)(336012)(36860700001)(426003)(54906003)(110136005)(16526019)(81166007)(1076003)(2616005)(7416002)(7406005)(5660300002)(7696005)(40480700001)(6666004)(26005)(186003)(36756003)(8936002)(478600001)(70586007)(70206006)(8676002)(41300700001)(86362001)(356005)(4326008)(40460700003)(316002)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:21.8276 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90e37580-85b4-4dc6-15fb-08daf260c26d 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: CY8PR12MB7538 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?1754564175633064714?= X-GMAIL-MSGID: =?utf-8?q?1754564175633064714?= Add the command line options to enable or disable the new resctrl features. smba : Slow Memory Bandwidth Allocation bmec : Bandwidth Monitor Event Configuration. Reviewed-by: Reinette Chatre 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 6cfa6e3996cf..0ee891133d76 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5221,7 +5221,7 @@ rdt= [HW,X86,RDT] Turn on/off individual RDT features. List is: cmt, mbmtotal, mbmlocal, l3cat, l3cdp, l2cat, l2cdp, - mba. + mba, smba, bmec. E.g. to turn on cmt and turn off mba use: rdt=cmt,!mba diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index f6af3ac1ef20..10a8c9d96f32 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -659,6 +659,8 @@ enum { RDT_FLAG_L2_CAT, RDT_FLAG_L2_CDP, RDT_FLAG_MBA, + RDT_FLAG_SMBA, + RDT_FLAG_BMEC, }; #define RDT_OPT(idx, n, f) \ @@ -682,6 +684,8 @@ static struct rdt_options rdt_options[] __initdata = { RDT_OPT(RDT_FLAG_L2_CAT, "l2cat", X86_FEATURE_CAT_L2), RDT_OPT(RDT_FLAG_L2_CDP, "l2cdp", X86_FEATURE_CDP_L2), RDT_OPT(RDT_FLAG_MBA, "mba", X86_FEATURE_MBA), + RDT_OPT(RDT_FLAG_SMBA, "smba", X86_FEATURE_SMBA), + RDT_OPT(RDT_FLAG_BMEC, "bmec", X86_FEATURE_BMEC), }; #define NUM_RDT_OPTIONS ARRAY_SIZE(rdt_options) From patchwork Mon Jan 9 16:43:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259268wrt; Mon, 9 Jan 2023 08:47:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXugfq80IDlV4hL2Nk99WMVq2ZE5BFDphZvP0slLzpac1aiXdDmQq76CgErYfkjIRB7RASuU X-Received: by 2002:a17:90a:ad04:b0:226:f8dc:b236 with SMTP id r4-20020a17090aad0400b00226f8dcb236mr7997585pjq.43.1673282829418; Mon, 09 Jan 2023 08:47:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282829; cv=pass; d=google.com; s=arc-20160816; b=qpCeEndyzjUGiFq1KmdpTb28x8hWS32c0gkVFGJDBaiLKOYLvqljb1YhFvDAKrkLkG Xzr/Kc7Tqu50QpPlUcGfmIDhJ+Qjht2XVNyrwYxK4kAKY/boUawZocxuYk0buXdHmNDR Wrr49EV+t4VpmLIyJ3wv6EoA9XlFI2sCVmc7NVToMzcd+zkB4FSo48IrS0xKsT2tKyev ZklBASK+WSYyZPNsQbeQ4ksU6R04N29adob6Dfh4DfMqZRq+jE4ICkh+GSJVyK+/oE4s 0EdnAuxiEG660hwfdM3DPzwXHRrvPCTL3VceLnMAn6FMa1BsQW0xP1hqO+Ito4STeBNC nTsg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mEeciAaZNIcX84dQ2+o7NGFqkLIscB9krD01am5HSJ4=; b=mlVmIqMN10RPAyMaKjqX57w36azz/z1DHbagbah7xNMak9Cg4gfwl7lycEhG8DHScW T94S/DSCChMj/eU8On4l3JUHDNZpAJqF9QVCy/7n2jYEAtzSoCYS4KIVuiw87q67iuB+ rQ3TfFkfOtSbMme9OBNMWrsLv/Efwh10/MArLtGO+mxQvc31C3eJb4TnXYhXInw221Kf iPIKsh9uzIjAlry4LMH1XV4550bWZZZrjNmnkZO2NHIWYb+VIafJcw+T9d9p/wBpBn/N WP2ZKR+pnDjX6ohkYQBLUeXacaS+ti/8VO0ab0nkxLRZ3MplA4reu+xklsfp4EdEqvfM bAEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wuRdGIP2; 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 lx11-20020a17090b4b0b00b00227213d4563si1495429pjb.144.2023.01.09.08.46.57; Mon, 09 Jan 2023 08:47:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wuRdGIP2; 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 S234955AbjAIQpQ (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234889AbjAIQo2 (ORCPT ); Mon, 9 Jan 2023 11:44:28 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2048.outbound.protection.outlook.com [40.107.92.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18BBC5F43; Mon, 9 Jan 2023 08:44:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BO66cnmEe3396n36Y2+RRdIbszE3s/sPUvPi5LUQOcg5uGymLbHbPDOtPG7b9YsBIVDQZJW7+EOhNU60T9GFLIqfGF8oNPwr2pIktFd8l798ysBATGSyAQh+Kopt4se25O9c9x1QmFOkWjK0jUeDz2DaOUfA/IRmjmXe9QVNL7PeV7J6D6UqeFo4XaQ/04uXCh3r+S+DGnmPtmddq86mV2fDF4OkKDZfmQtj7UAUFSsi1e5MfRTK59VGtzEEwuCAG1z6/bgmMtN97soyzEKQVOnjH7IOLFQTxwyactSdEGO02DxIUL4GiS3ScRx+HsEPxv9dtxYrxHweVnV8zUhlBQ== 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=mEeciAaZNIcX84dQ2+o7NGFqkLIscB9krD01am5HSJ4=; b=az/NyDdyWJmlc4mxzlCDMAo8mlvV+QWm5i7HHpx869MsY1U8EE4FgA3gm0NuT9XEh9RoneleXvvkDHnT3pCBWVP4kM9wIQOzGcym5c3pCcBM6LB/TzNyo1kss5fe2KCIXJ3Jaan02LJ8XwOdPJ5uuwrdcsVyyFVBKfOPPzeQAIh1VZ4ASxLGMAwtjPqTX1+LJ91msl28HAPMM2QfA+nLhdP0uJc/pr4jo1f9+JzC7+hVZVO17ZKDAnzncCYrmjvEljl5N1jUGsFLbS3jhKA116wJdgnMvTJUtSAQ/z/tAp3ftx9dRoEtSBPEvWyauaQOasjCPwJoHudYOGmAjRvtqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=mEeciAaZNIcX84dQ2+o7NGFqkLIscB9krD01am5HSJ4=; b=wuRdGIP2ivi77xlDEqNHsIZrpFSaFIBNkTiuzs6AAEtkAwDwywqZvq3igE9qBPB7Lfh3gVrw2YDZ9aZv5rH9OtEU4f+uPbSDzNGSJGgSB3CuXM4/M0eacp7z/Y71nHECCXpuq0hrAeCO8n3pAUZI6xxX4bMtnMypKZ4iWSsaiDE= Received: from DS7PR05CA0092.namprd05.prod.outlook.com (2603:10b6:8:56::10) by IA1PR12MB8334.namprd12.prod.outlook.com (2603:10b6:208:3ff::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:23 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::a9) by DS7PR05CA0092.outlook.office365.com (2603:10b6:8:56::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.11 via Frontend Transport; Mon, 9 Jan 2023 16:44:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:23 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:21 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 06/13] x86/resctrl: Detect and configure Slow Memory Bandwidth Allocation Date: Mon, 9 Jan 2023 10:43:58 -0600 Message-ID: <20230109164405.569714-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT052:EE_|IA1PR12MB8334:EE_ X-MS-Office365-Filtering-Correlation-Id: d22b1dda-8fa8-49a2-38e4-08daf260c36a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FVTkeOX+jK8Q+uecXvpUwTuVudWz56tgLQY7Thizv9NhybejAYPKfIqo65eBoBLKRghIKHtEJoHzAACcZ0W4CHi5Ub3rOiyqi+ygZZdiCFXUEZGkUtl97uusQAuxyHUmtXh5QjYe/r5BSdXpyyY9W4J9ZPzkLenla2dZMfc02iecF4d3WmFzwqjjtYNX8Nm+B74wiiEf24KHZufIukRmuE+6Z/OoN8gW4pB/fvQAT15map4SFKWiiGyY3SI1YPFWYTq6GbeskC9yQCWC8jenVYn6JSvrn5zNtREsCTFmsdk7wC075auyaxQSYnjTVlAYHPrBvOZdiaT5F6WVNxV4fhMTiZ8ENanbmYVHOk4CghieIDqPwTIoxk+1zBRHR2bNJ8jko5Mr39HbC08OSXwUmIheMquH/4MIEo7EgqmGsMi+UJFI00ZZAgTJdmC9xB/f7p/c+cqtnb8Ngy3x4GZnRPEBpLI392cvdmoe0fUPlfxBrh96+WJHRU4mpUxDtKgG3F/Ct9C+qq8JD9rU1d4rgz7zPkfuVwWEGGVztcfL6lJF/1NfccLTROx39J96i9JiCqGMFlGbtjI1Hk/B35yxcacohiFdooN5AFqVsLVH7VsVmnChWMtVN27bl0e1mxAcNHFBYNF21V04vrnx1HS9eV+2ssUw/LbP6dNwjhheG8folzlnoV57s28vTcopYSd/Hl/BNDlSWLzF8Y5r8/Hoe8DtUA/mY0oOPPqigJci5F4= 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)(396003)(136003)(346002)(39860400002)(376002)(451199015)(46966006)(40470700004)(36840700001)(82740400003)(356005)(81166007)(36860700001)(83380400001)(86362001)(70206006)(8676002)(4326008)(41300700001)(70586007)(54906003)(40460700003)(110136005)(426003)(316002)(40480700001)(44832011)(7406005)(7416002)(5660300002)(2906002)(8936002)(47076005)(1076003)(336012)(16526019)(82310400005)(2616005)(26005)(186003)(478600001)(7696005)(6666004)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:23.4866 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d22b1dda-8fa8-49a2-38e4-08daf260c36a 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: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8334 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?1754564216473696732?= X-GMAIL-MSGID: =?utf-8?q?1754564216473696732?= The QoS slow memory configuration details are available via CPUID_Fn80000020_EDX_x02. Detect the available details and initialize the rest to defaults. Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/include/asm/msr-index.h | 1 + arch/x86/kernel/cpu/resctrl/core.c | 36 +++++++++++++++++++++-- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 2 +- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 8 +++-- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 37ff47552bcb..e0a40027aa62 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -1061,6 +1061,7 @@ /* - AMD: */ #define MSR_IA32_MBA_BW_BASE 0xc0000200 +#define MSR_IA32_SMBA_BW_BASE 0xc0000280 /* MSR_IA32_VMX_MISC bits */ #define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 10a8c9d96f32..b4fc851f6489 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -162,6 +162,13 @@ bool is_mba_sc(struct rdt_resource *r) if (!r) return rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl.membw.mba_sc; + /* + * The software controller support is only applicable to MBA resource. + * Make sure to check for resource type. + */ + if (r->rid != RDT_RESOURCE_MBA) + return false; + return r->membw.mba_sc; } @@ -225,9 +232,15 @@ static bool __rdt_get_mem_config_amd(struct rdt_resource *r) struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); union cpuid_0x10_3_eax eax; union cpuid_0x10_x_edx edx; - u32 ebx, ecx; + u32 ebx, ecx, subleaf; - cpuid_count(0x80000020, 1, &eax.full, &ebx, &ecx, &edx.full); + /* + * Query CPUID_Fn80000020_EDX_x01 for MBA and + * CPUID_Fn80000020_EDX_x02 for SMBA + */ + subleaf = (r->rid == RDT_RESOURCE_SMBA) ? 2 : 1; + + cpuid_count(0x80000020, subleaf, &eax.full, &ebx, &ecx, &edx.full); hw_res->num_closid = edx.split.cos_max + 1; r->default_ctrl = MAX_MBA_BW_AMD; @@ -750,6 +763,19 @@ static __init bool get_mem_config(void) return false; } +static __init bool get_slow_mem_config(void) +{ + struct rdt_hw_resource *hw_res = &rdt_resources_all[RDT_RESOURCE_SMBA]; + + if (!rdt_cpu_has(X86_FEATURE_SMBA)) + return false; + + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) + return __rdt_get_mem_config_amd(&hw_res->r_resctrl); + + return false; +} + static __init bool get_rdt_alloc_resources(void) { struct rdt_resource *r; @@ -780,6 +806,9 @@ static __init bool get_rdt_alloc_resources(void) if (get_mem_config()) ret = true; + if (get_slow_mem_config()) + ret = true; + return ret; } @@ -869,6 +898,9 @@ static __init void rdt_init_res_defs_amd(void) } else if (r->rid == RDT_RESOURCE_MBA) { hw_res->msr_base = MSR_IA32_MBA_BW_BASE; hw_res->msr_update = mba_wrmsr_amd; + } else if (r->rid == RDT_RESOURCE_SMBA) { + hw_res->msr_base = MSR_IA32_SMBA_BW_BASE; + hw_res->msr_update = mba_wrmsr_amd; } } } diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index 7eece3d2d0c3..eb07d4435391 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -209,7 +209,7 @@ static int parse_line(char *line, struct resctrl_schema *s, unsigned long dom_id; if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP && - r->rid == RDT_RESOURCE_MBA) { + (r->rid == RDT_RESOURCE_MBA || r->rid == RDT_RESOURCE_SMBA)) { rdt_last_cmd_puts("Cannot pseudo-lock MBA resource\n"); return -EINVAL; } diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e4e6cdc1ee62..aa469d708991 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1208,7 +1208,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) { @@ -1397,7 +1397,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); @@ -2832,7 +2833,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 Mon Jan 9 16:43:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259154wrt; Mon, 9 Jan 2023 08:46:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXv8rWJcJuMungoAHxwzbOMxRZRounPB2MvJUnITn6velihOpeqU29HLUl+VnzTUtKjdHlJk X-Received: by 2002:a62:32c7:0:b0:582:a212:d92c with SMTP id y190-20020a6232c7000000b00582a212d92cmr23554101pfy.10.1673282811843; Mon, 09 Jan 2023 08:46:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282811; cv=pass; d=google.com; s=arc-20160816; b=MPfVrTZdcM+EOrWYzou66bAj0677aTMAwGkAzrGOJD7IZy2mFFsJbX7z/nUrqr6M3b 3Uat9NeaykphxmxiBnKUFNGTSD4Dyq74ZrLqnx7AvQ4D+mHR2rz4uSxdtEHjxvx6cK7M VNiNqBioCgrp6IKfWA9T86wZTtZIGWkSyiADQ4v5iiuMZF5uqQzwzLJIBq5kUlnJiMKR nTmSUq5xLrKAZqPHk61uvyZC2CBig9dtDW4K6DK7lvQUZ3kcBakLKyaHjkJ7l+tdopp+ 0Mf96XXQg3uamC+GLAZxDZqxKMX089CiU7cdgZKqCzdv3v0X7dkJNw2erpReiO/MGbnV StCA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5jkUFf1gvYK/SZx7CijuTqt+imvr4lxr+zPkVdz7ka8=; b=L0f1P8caPONau4RIGeCYugmdaITmny3Ex/qj7tiLmjLdV/y3yqK7EpRm3MCbrtH8kv 6F86JQK2qtEQ0BEMFc2A5bPQvq+gQc511v/zlXehgnyQa+OBgsz6ZocOh7GYXC6qjgFK q9OzaqHKvIHIeFNocfKniZbt6qxF01dj4bFrF8MQNrk3Leo3r1UFY2H1OFAA3afrLGnQ bm/nFCEzeChsnEx5DPkq1lJXBO26qPla2v9E4Wdu2n98szX/U9IrGxCx/pI2C/8Fv8lM EAfS5pWu+3xW15FKSombCdN4kNu5v5WLgmzBHPZ+OP9AU05fPXCXna6YBpre52Z0NAL4 TnmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=D+u3Ol31; 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 p68-20020a622947000000b0057b3321ca84si9126537pfp.99.2023.01.09.08.46.39; Mon, 09 Jan 2023 08:46:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=D+u3Ol31; 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 S236755AbjAIQpE (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234756AbjAIQo2 (ORCPT ); Mon, 9 Jan 2023 11:44:28 -0500 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2084.outbound.protection.outlook.com [40.107.96.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C77E0DC; Mon, 9 Jan 2023 08:44:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L9d3k2olytywZemSz5F9RbpbcPGdA7wdZ5Fvnb4KYBvq1MI6IcT6mpAwU5rTn22lX2YRleieilZAHyOoM7AdvGT4oQLEMzc1VCTbM+cPorhvlrgWUaKXUuQCXgxP2+eV0zTGgyuIOCqz4PT6aoOUfXDdH87DL1UeI4A3GxhcQwVn7UIQiqeT2oSmHU1mX7ELwOMOA3kKfcJyyx3iTh4uw2DJpZpYcaLhr/7/G+C30bVXnKnPlc5t/bIVkHWClSd49PVl4O8wfLav673RCx2hqf+k2ACKwcS5/MQxnixH4wRbF2bO0lC30eeUWYnyXCwA649npuNwJ5ETYL/r4rqgKA== 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=5jkUFf1gvYK/SZx7CijuTqt+imvr4lxr+zPkVdz7ka8=; b=Ehe/R0ylIyWQ8dJpidP3FM5mGPZG8MZ36WwiOFpOoRQlZiyUND52c9AfZ+kkHoubF2CNILLG1ShfbzV3rwyj7pAJRwFiIEyXz5mcZOz/meq2i/0yk3sczfo64k7aOjBT788aCayUVMwJbkYj5XNJUiLJQNOV3Ror1iBAUE04o+XlXtjWreb4ttVfxPFAv3SMjKna5tebCVaVfNywxk2St3iAzUsPtpgJjQCYxHoviMlsSUPeGvW27dlN4EorCL8Gk2Ch6NXvbAIgmccbFyp5Z1asV9ZyRKM9GRy6tUT3UfeXXUynlKCmhTtI2lWsTYQTvHs+8vmuwoLLMdI5msto1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=5jkUFf1gvYK/SZx7CijuTqt+imvr4lxr+zPkVdz7ka8=; b=D+u3Ol31HYJrtH7aqODGkB5WqWYUvmO7VI7etaZO4U6LVGUOKe4ohuyguBuMxao3xjYzaYcTjD6wplfg8lpX4CozLWfW7lb8zsJkSKFv3iP/9oz3P1GzZe41kDbVRMwIKrtdYnIxGS+qR6nJyu0ABmCSBvfCjwhn2XtKlEVKu3g= Received: from DS7PR05CA0087.namprd05.prod.outlook.com (2603:10b6:8:56::9) by SJ0PR12MB8168.namprd12.prod.outlook.com (2603:10b6:a03:4e7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:24 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::cf) by DS7PR05CA0087.outlook.office365.com (2603:10b6:8:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.11 via Frontend Transport; Mon, 9 Jan 2023 16:44: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 DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:24 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:22 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 07/13] x86/resctrl: Add __init attribute to rdt_get_mon_l3_config() Date: Mon, 9 Jan 2023 10:43:59 -0600 Message-ID: <20230109164405.569714-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT052:EE_|SJ0PR12MB8168:EE_ X-MS-Office365-Filtering-Correlation-Id: a5b76698-7489-4792-f12c-08daf260c428 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OkKCb/hikZKpYJ+OMHkFGI5c8BMwf0JYOjGSRel75aehfgT/ACM8RxDTDa90EmwJzyIcv02kz/aqaLs1XcDJAS0l/Hp4WUaZERtgzZFwx3JY1vtGq9L4sVHWZMeiBHnIuHDB8wDnfJNUmg0ACsnbJ5rkgX1SqSPRcBEq05MmEhDPZmc4mlCdZ4s+aa9mVgaF/ylILYi54cLyJx2xtj0jWWevtga8Ic1UVxv38evxJpJe9RnXKcMW2Kct1PmF3XxIXfZO8iBCyFs3Qog8zUXDjJSKjgIsfq9e13pxSEc85FxIxOKASYD9YTfLsjWGQ+dDmn0nt1xOM25LIBd57ExRAqIFmiRaGG96e8BKsS6G/Yxf859hD0p39NxeTo5Vi+DcoVNvpAym/z0Yz1kDPPIdwdRx/e7u1GvfdpD4Asfcbp4eFHeg34aeBjwGO+o3D6XudKsUw+xqg77MciYgS7IeY8m4MmfqBAEKzvXPBNCtYglsWvCoo5JAd0urpXuHO42FiMYHaA1SNJ89hit9oxo6fKpRibRxNAV4bvjcMWmfUzi/V1M6lDH1o3yRgtRODMTz1otjLCWYpE0AM4nWDaJ0B2M7hn/9hs6MyU7uatc1RvdmeHR/lGEczMq4aUK2mYcJ/TNLk4KwMicnLq5xKgYj5lI7ppCn8VvDnQF/O5pKNiCE8NNNiP1GPdHx/zLOzJvUgrFrQ0N36y8z8Pw0LUJfKr9VCOzV8BAUx1lKirWiYBY= 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)(346002)(39860400002)(376002)(136003)(396003)(451199015)(46966006)(40470700004)(36840700001)(82310400005)(8936002)(40460700003)(2906002)(7406005)(5660300002)(426003)(47076005)(41300700001)(81166007)(7416002)(7696005)(70206006)(4326008)(70586007)(8676002)(316002)(356005)(44832011)(110136005)(54906003)(186003)(16526019)(82740400003)(26005)(40480700001)(1076003)(2616005)(336012)(86362001)(83380400001)(36860700001)(36756003)(478600001)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:24.7365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5b76698-7489-4792-f12c-08daf260c428 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: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8168 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?1754564197704408560?= X-GMAIL-MSGID: =?utf-8?q?1754564197704408560?= In an upcoming change rdt_get_mon_l3_config() needs to call rdt_cpu_has() to query the monitor related features. It cannot be called right now because rdt_cpu_has() has the __init attribute but rdt_get_mon_l3_config() doesn't. Add the __init attribute to rdt_get_mon_l3_config() that is only called by get_rdt_mon_resources() that already has the __init attribute. Also make rdt_cpu_has() available to by rdt_get_mon_l3_config() via the internal header file. Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 2 +- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index b4fc851f6489..030d3b409768 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -728,7 +728,7 @@ static int __init set_rdt_options(char *str) } __setup("rdt", set_rdt_options); -static bool __init rdt_cpu_has(int flag) +bool __init rdt_cpu_has(int flag) { bool ret = boot_cpu_has(flag); struct rdt_options *o; diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index fdbbf66312ec..f16b8bc5448c 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -512,6 +512,7 @@ void closid_free(int closid); int alloc_rmid(void); void free_rmid(u32 rmid); int rdt_get_mon_l3_config(struct rdt_resource *r); +bool __init rdt_cpu_has(int flag); void mon_event_count(void *info); int rdtgroup_mondata_show(struct seq_file *m, void *arg); void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index efe0c30d3a12..e33e8d8bd796 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -746,7 +746,7 @@ static void l3_mon_evt_init(struct rdt_resource *r) list_add_tail(&mbm_local_event.list, &r->evt_list); } -int rdt_get_mon_l3_config(struct rdt_resource *r) +int __init rdt_get_mon_l3_config(struct rdt_resource *r) { unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset; struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); From patchwork Mon Jan 9 16:44:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259742wrt; Mon, 9 Jan 2023 08:48:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXvzW70Ox6pnHjhGaFlyTF6711p1BpPwh4A/DupHHrQND/aU20L0OhPQHg7tvRdqr7rVT7oV X-Received: by 2002:a17:90a:de92:b0:219:396c:9e30 with SMTP id n18-20020a17090ade9200b00219396c9e30mr70974898pjv.20.1673282882912; Mon, 09 Jan 2023 08:48:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282882; cv=pass; d=google.com; s=arc-20160816; b=YNVA7Tctj5J0v60eW2+pUQ3xhKkNx4O7S9KIbFfhSegKPEIRfXXeOnqIWKt9dJ/LyC 0M4kegbYzgzF5nxvjqLt77c9DBfFbMirT4d4w+Gesd7V5/mxizw107+8KsPF8kArlNIe fIDPbGSiqe4HReB0k+rclszLl2cNXWDok1srCyZRCVfW42KH81gIVNTFEQt6yNrYytvm tSVaqds0lX72/CLTFZLEVlyvm2AwWm3149YEuRp0jGljZ8z5P0ftWvSfqOrUoMZsVNPL F83xOg3Qpw6EP4Vxm6EnyrnC559BqRn4xZaYQ63V7cGS+id0/55FjB2kkChRvybq9YST c/Fg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=h0bR2q0emfUDh7SYHWelwMKwpBqpUM7KkxYqPZ2X+e8=; b=xlwEgA/p6EFx1FfcMhLkvfwywi+b7EVY30xE5Dn4Jm/fEc3ECCh+mGodwLTbLFlcFx 2Bf4b9uI4tUoSXgxjfE4zbOgw4SaLtzP7+a98WMlpqeRCo5dlJlqoTt90eEFflX3MXFI AHF5q5D572i0IN2gVE0pNyGeZ/CWgFYVgNXuU12WT+DXTI6ZzqaKdNldQ7bWqXHmG0yC JhdacKsp81LpYVwKGpAsFtNrm3NJ3KdTwMnZno7fCTyHuIYqmz2YQc8WZtKxfgq1al25 UKvfZemkXpArORIpwbgcRfQ0DnYc882at7A0//JLeCBlWsajGwVdFkIkKK8AdtmkUJsn LxYA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=esnj17hb; 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 lb12-20020a17090b4a4c00b002194ca43255si10664807pjb.50.2023.01.09.08.47.50; Mon, 09 Jan 2023 08:48:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=esnj17hb; 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 S231418AbjAIQpa (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234922AbjAIQoa (ORCPT ); Mon, 9 Jan 2023 11:44:30 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 339285F43; Mon, 9 Jan 2023 08:44:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K7wFe6iZU3KUWloP9l+Kp//CI6Sr3cu/vkzD4s8duY7Mn0uYRSNo5y67R4ccWtGnLkK0wz/VpiYWIIglBV3/S6JCgqNp9QUD9pvyl2kXC+YqoxbZFNWfCdb/3Xc/wUDMtscpYWBUNtY44x/4AHsb7/3qF5D/egg1w4WLFhMscBpl58VSTge850LsEUMA/R8l4ML/ICLalRDu6wILAnJLQvPYGIkXmvpsMaI7THZE6PoEODtkH1nj94hZ4qgqel/f+ar7RMByKP/EeJwhGGqGkPQdAeT0UnDWrBvXWxJyKU9mzvgkFP/8AbBpdspbn2AFGXzowU8tkqFq1ohrjE5ySg== 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=h0bR2q0emfUDh7SYHWelwMKwpBqpUM7KkxYqPZ2X+e8=; b=V34tt7tARkA4RXG4qtTxo1BuL+gw/aIJuICTjA8FAIx1rokJzBI6dwpPZPxQXRmsfKlkXGonw5+CQRM5fbXmz7sZCElYj896vOC0z2p+kmcvgiMb1+nkcdm4O8CqhkaoqA3bJs4K3J9AzUzHcSqJhVCHk3QxCA2n/VbPPxhWH/O1n7mRY0Rh701AD4EbiHaVKSRdf+ONVQBb2CvFOMibzHW322WLKLFGiJFnWBso7tToWwduHm/mK8KZnGHpsKpoIV92m9gXWfjIrQqqPKCYDBcnXMui87dza2UVIi38jlaWoAyE+SsfCYR0PAC0HIveYhtvYjHuKtLFCi85ThfkoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=h0bR2q0emfUDh7SYHWelwMKwpBqpUM7KkxYqPZ2X+e8=; b=esnj17hb5xgLjcXjq+EVdFxHpqwkrCRKQE3r065MJODd2Jfi4zk4J6HIoJ0yz6FVbD4Z8vPOIQf7GAGSLNIz6gMl3o0/R1sOSuoNNBChRLF0Fq82oTFhDu40auyqP5f5BZitXCl5JIn06MiW8ve7bNEw2VvyRKwOMdd3PK2D3Q8= Received: from DM6PR04CA0015.namprd04.prod.outlook.com (2603:10b6:5:334::20) by IA0PR12MB8373.namprd12.prod.outlook.com (2603:10b6:208:40d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:26 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::c3) by DM6PR04CA0015.outlook.office365.com (2603:10b6:5:334::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by 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.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:26 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:24 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 08/13] x86/resctrl: Support monitor configuration Date: Mon, 9 Jan 2023 10:44:00 -0600 Message-ID: <20230109164405.569714-9-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT033:EE_|IA0PR12MB8373:EE_ X-MS-Office365-Filtering-Correlation-Id: 97c1f9ae-12b6-4d4b-f978-08daf260c548 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1LyFlG/bNjcVZdHfeYcanrkvtp+d8ISsWSbU5CKeZbEH4jTurKI5Y2oev1TOlSzL8vuLu74bqIWPFNAZNKt2Pl+im4a1W47nfpE3vgISNhdZeL3PpECFTLUUbgGRvdDjr0RS+pV8p6eX34+mk7eHP2SO2XZzOyFpAAkhi8pSA4QN1ipGEd8T/lKJGedjnSAZFc3Y0XP+IfynQJx4bFqTuQ7TeHAlTJbl4b/KEG9ZDY+DAYLOqQtdBfmzKYGcilp+LhEsgZnTIw9bS2Ds9/beM0gdKtoGU2NJrXsrzhlKF8ZU6fW/0c8oQ9ZFV2KSZe1DKdJ4LfLQAalrJq8XyPg7ZMFb2bxuRyNgG0N0OZdYgJ6Fb7M1KN5hbkQZ9lh20v3estimRtoRIegEnkhvmPnknQbf7Gu3yL42oahTpeLYoyw7kCyy7e7S1yr5Rp9lsjrgrp6fHRdEdJlNQvGvyXhiLMwK1twqjnFXeacqNArLZzVhA7jFhxDHsdS/yAfqjjTkWcqrbBea6tbeysGU/vWQZ6iLVTLlJDf78n20f7iR1pEpm/8y0owVfZbDkrzV3PDAwG9QmkrX5F0pBBjAO/m3XcHGmmcr6vPDdlMm0oWn+jcXOLrIVFZ2smLMwOukCRXBDOsEvsmHVZ7CN6a4JM+p78ayasrQczBDt+r4VTyQIFgBgCbi9H7dPEDlZ/MEWd9lyEnOmpHI+BpINImvnhBy+asWSJ1/f4KudiG5E0gxNmk= 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)(396003)(346002)(39860400002)(136003)(376002)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(82740400003)(6666004)(81166007)(356005)(2906002)(478600001)(44832011)(2616005)(7406005)(186003)(1076003)(7696005)(16526019)(26005)(316002)(5660300002)(40480700001)(7416002)(82310400005)(83380400001)(8936002)(36756003)(86362001)(426003)(41300700001)(47076005)(40460700003)(336012)(8676002)(70586007)(70206006)(110136005)(54906003)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:26.6241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97c1f9ae-12b6-4d4b-f978-08daf260c548 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: IA0PR12MB8373 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?1754564272330986845?= X-GMAIL-MSGID: =?utf-8?q?1754564272330986845?= Add a new field in struct mon_evt to support Bandwidth Monitoring Event Configuration(BMEC) and also update the "mon_features" display. The resctrl file "mon_features" will display the supported events and files that can be used to configure those events if monitor configuration is supported. Before the change. $cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes After the change when BMEC is supported. $cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_total_bytes_config mbm_local_bytes mbm_local_bytes_config Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/monitor.c | 7 +++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index f16b8bc5448c..0605b04f1b7a 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -52,11 +52,13 @@ DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key); * struct mon_evt - Entry in the event list of a resource * @evtid: event id * @name: name of the event + * @configurable: true if the event is configurable * @list: entry in &rdt_resource->evt_list */ struct mon_evt { enum resctrl_event_id evtid; char *name; + bool configurable; struct list_head list; }; diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index e33e8d8bd796..b39e0eca1879 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -783,6 +783,13 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) if (ret) return ret; + if (rdt_cpu_has(X86_FEATURE_BMEC)) { + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) + mbm_total_event.configurable = true; + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) + mbm_local_event.configurable = true; + } + l3_mon_evt_init(r); r->mon_capable = true; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index aa469d708991..f34c70c7a791 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -996,8 +996,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 Mon Jan 9 16:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40975 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259623wrt; Mon, 9 Jan 2023 08:47:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXseyDv2twrw/2q5iCAF2DcTqMlfonsg9xsaVGf622sMQ36ulvDL67n0d+fGEBpmi+3yCAoo X-Received: by 2002:a17:902:74c5:b0:193:17bf:597b with SMTP id f5-20020a17090274c500b0019317bf597bmr11586787plt.12.1673282870842; Mon, 09 Jan 2023 08:47:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282870; cv=pass; d=google.com; s=arc-20160816; b=pSUwTAjhtET1BxALqTHYpNFnNA/J55rhi6UyGq1w9FUhpJz7wBrNF1msy5lOohHNSG AN0Eo6TBj7N+kWGsOBPhcG9CrXbtPxD+WTwo7BazcfSJK8lWvEGZj68olF2WU7SyUzMW IqMmafNTjgscEnWo3JRW8MZ2SUGYKBZoZ45GmpIHrsP3PnDZI2bMRAMLkn2BQw/L1L/o 0u+TalEU4eklvV0AfGVCaPNipaTO+w1tNGSEbFGKWf2QnqlLdrDBPasupJFfvJaD2CLx ScPs9y24WMuZOrazb+B/TQFkKHCi/mM3FFawtN9gZ2bd18qlzFMWJeIdJKQKGl2fNaO3 B/mw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u5qSfmt/4x6sqre59VT3Cght4ETaTpvKxvi19PY27ro=; b=SVF7RSfuHbdfzqnUaQoipamJEw0ZUPChJvzVNmEC6x6AQE9B9HtW2gE1jIVZ3KcE1F 4k0WhWiWaEH1G5BGDjFLXfTkgVhhsnHhiHolDvcxiYjdOhZVSa2FxkDwyAwoVJVzmJzN bj04lnTV/NQN/bia7yJBc4tKnzIGCWac42b1fGMz4nrE6ShZ15dvjGOA505fAvRIagra x49W6FCBhLWMFl4CJZfQcSHscKEa99q+U/m2eryqdEhRjMDv/wh7sdU9GSaAplnKw9Ix 8TgLGmRrQ0xCjsG1dQFz8Lt/YcQFzO9PMO3yIyIVXz81agZiUR+6hEkWU6bC8Tf6RNWp tgrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EEBCGlMY; 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 c18-20020a170902d49200b00187085e0aacsi10030331plg.549.2023.01.09.08.47.38; Mon, 09 Jan 2023 08:47:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EEBCGlMY; 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 S236909AbjAIQpK (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234955AbjAIQod (ORCPT ); Mon, 9 Jan 2023 11:44:33 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2056.outbound.protection.outlook.com [40.107.223.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0CA45F43; Mon, 9 Jan 2023 08:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d3613rWvBufUnlEm/i8m0PHaawXiplogb7OHSh85/pVBPXqijxFgfBFAYYkNhE1tNt8BkkdhrnfgGTO9yIuWNd4IOel7Ar1hYSzQAt0JOPTIhegk4t4ruR8/YzC3NUOO8AWTumglGX/I49LlmocQakEGMH4utZZI/mCbbuiTd5f/O8ysxIOrw5+VyRebiYJuVonPnPvuYROWPPt59SH/dziwvWvhnMpu8MBQomTf3jjt75gMBWXtbX27d6Y2AhHmzBL6+E1jDov8n3Wd0t++hNfPrG1Tr58QqOLJZw8Pck6ED8lM0P7/X5Om8ZOxWUAU8MmwtiFbTTI6mj2XjUkeoQ== 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=u5qSfmt/4x6sqre59VT3Cght4ETaTpvKxvi19PY27ro=; b=oWSUV2lbVs227DLWebA053XP6ypwMdrwsspZD4k5PqznzR1cillstBVcwLmN4jwYBrj1mlJjPIpQ50eOJNRchoitos1JiOAIivuwc5pdtpjO+860KQpDVNwNeohmuSMI1VvLBC7JhYLvDyffgykaL/rDJj6tI1MekMEEFxFRoMu18gxEslmhKqbneDNvnFLxi8sBblQWeaq8QkkbThwhk2AZPHymNsP+YgHynorl+Nj+jRGTwEwbMnm66S+ycZ9FFzZBU/AVhLH2IVp31/K8+Ms6fQ0HtZCzrR7HHjr4oIWKuwE8iXY+sgZNnAc95VPDezEVEItOQYSXJBCa7sn2qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=u5qSfmt/4x6sqre59VT3Cght4ETaTpvKxvi19PY27ro=; b=EEBCGlMYIA1VY3Rox9eYQ70KBxefcfn9ibuCzx+Mo3ZeI75fQ7K9qy99PhXSlFXF2eujGOFygFqWaTjelPHqwYJf5oQ9TDvZgb6RiZnpiVe1+4YTB+BV66kSCfs/hcicupxAvD2aLM8chrEGee24a73M92ehwTmyUhlu3pbTUOc= Received: from DM6PR17CA0033.namprd17.prod.outlook.com (2603:10b6:5:1b3::46) by BL1PR12MB5801.namprd12.prod.outlook.com (2603:10b6:208:391::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:28 +0000 Received: from DM6NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b3:cafe::12) by DM6PR17CA0033.outlook.office365.com (2603:10b6:5:1b3::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:28 +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 DM6NAM11FT078.mail.protection.outlook.com (10.13.173.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Mon, 9 Jan 2023 16:44:28 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:26 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 09/13] x86/resctrl: Add interface to read mbm_total_bytes_config Date: Mon, 9 Jan 2023 10:44:01 -0600 Message-ID: <20230109164405.569714-10-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT078:EE_|BL1PR12MB5801:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b468180-7028-411a-b456-08daf260c653 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7gidmvX8FeRKfMheP9lKuRL/ol7d1U/K2WyUQ9wxo8Pa+5oj4sSvyf8K9/V/XdgsQjtxPcz3orYTH3sjDpdulskXAoDejv218U9zHPWhTXVVQeVrdcKm1Tq567ury+XT1NNcKZxBdlW1tvZz3aL+G/rpRPhK+N6eNsZlFNPVgJyynFsYug9+Bsyuac8aoAb5hukHkGtgFVzY2gYAmH3q8aWTEowjuDqy/NNxH4s/1gNrr3YYCqzLK9jNYlVKB40n+myxYPrd5Zz5xPvWwXTRTYJIyR6W7bq3W6NmZFqjMUt5vOhVe99CvcqTt2rFveF2vr+KlvT/tPJwuxTFODMK6dL1gmSp8EVpK4vfZjNMYgauJkdp6tQ6Ze2ahCVk6NRUp4WmqDWJr7Kh09b66I1NBhmC+MB/OecQGeLECN9XlKmmgJiGpWsFvqXUv5LY2UmL+aZndmueGphbrpuSE7MtqNmqv6+Eekc5c43q4rhZ0tiujZqsiDTw0FrKI5tVuyv5pGm3GBRaMbWgk+eJBgC1G8iLoqy3kUR+CbJth0cN5UDv2vawdL9FXBl+QDk7o+Ib5nEDsZR7kP6u2xtlAwyFv64BrmM6xfI1SYHyvCEKvkAI7zL2JxARzdBKzK9aYno2lgAP83xXkn3YQ9dkJZ5VgXsAKXT834qNNHUKyOkSQL/MVfm9tggVVKLq2EE7tHIEfmHQwXT1NE0DTWJP0DmW2ogxiGKyu8U2wMXRhFM3uyw= 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)(39860400002)(396003)(136003)(346002)(376002)(451199015)(36840700001)(40470700004)(46966006)(478600001)(426003)(47076005)(36756003)(86362001)(110136005)(82740400003)(54906003)(40460700003)(7416002)(5660300002)(4326008)(70586007)(70206006)(8676002)(7406005)(41300700001)(8936002)(356005)(81166007)(26005)(316002)(7696005)(83380400001)(36860700001)(2906002)(44832011)(186003)(16526019)(1076003)(2616005)(336012)(6666004)(40480700001)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:28.3721 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b468180-7028-411a-b456-08daf260c653 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: DM6NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5801 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?1754564259580702274?= X-GMAIL-MSGID: =?utf-8?q?1754564259580702274?= The 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 configured with 0x7f on domains 0 to 3. Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/include/asm/msr-index.h | 1 + arch/x86/kernel/cpu/resctrl/internal.h | 24 ++++++ arch/x86/kernel/cpu/resctrl/monitor.c | 4 +- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 102 +++++++++++++++++++++++++ 4 files changed, 130 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index e0a40027aa62..2e5f57c93605 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -1062,6 +1062,7 @@ /* - AMD: */ #define MSR_IA32_MBA_BW_BASE 0xc0000200 #define MSR_IA32_SMBA_BW_BASE 0xc0000280 +#define MSR_IA32_EVT_CFG_BASE 0xc0000400 /* MSR_IA32_VMX_MISC bits */ #define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 0605b04f1b7a..8edecc5763d8 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -30,6 +30,29 @@ */ #define MBM_CNTR_WIDTH_OFFSET_MAX (62 - MBM_CNTR_WIDTH_BASE) +/* Reads to Local DRAM Memory */ +#define READS_TO_LOCAL_MEM BIT(0) + +/* Reads to Remote DRAM Memory */ +#define READS_TO_REMOTE_MEM BIT(1) + +/* Non-Temporal Writes to Local Memory */ +#define NON_TEMP_WRITE_TO_LOCAL_MEM BIT(2) + +/* Non-Temporal Writes to Remote Memory */ +#define NON_TEMP_WRITE_TO_REMOTE_MEM BIT(3) + +/* Reads to Local Memory the system identifies as "Slow Memory" */ +#define READS_TO_LOCAL_S_MEM BIT(4) + +/* Reads to Remote Memory the system identifies as "Slow Memory" */ +#define READS_TO_REMOTE_S_MEM BIT(5) + +/* Dirty Victims to All Types of Memory */ +#define DIRTY_VICTIMS_TO_ALL_MEM BIT(6) + +/* Max event bits supported */ +#define MAX_EVT_CONFIG_BITS GENMASK(6, 0) struct rdt_fs_context { struct kernfs_fs_context kfc; @@ -531,5 +554,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d); void __check_limbo(struct rdt_domain *d, bool force_free); void rdt_domain_reconfigure_cdp(struct rdt_resource *r); void __init thread_throttle_mode_init(void); +void __init mbm_config_rftype_init(const char *config); #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index b39e0eca1879..2afddebc8636 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -784,8 +784,10 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) return ret; if (rdt_cpu_has(X86_FEATURE_BMEC)) { - if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) { mbm_total_event.configurable = true; + mbm_config_rftype_init("mbm_total_bytes_config"); + } if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) mbm_local_event.configurable = true; } diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index f34c70c7a791..d47c675a856f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1418,6 +1418,93 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, return ret; } +struct mon_config_info { + u32 evtid; + u32 mon_config; +}; + +#define INVALID_CONFIG_INDEX UINT_MAX + +/** + * mon_event_config_index_get - get the hardware index for the + * configurable event + * @evtid: event id. + * + * Return: 0 for evtid == QOS_L3_MBM_TOTAL_EVENT_ID + * 1 for evtid == QOS_L3_MBM_LOCAL_EVENT_ID + * INVALID_CONFIG_INDEX for invalid evtid + */ +static inline unsigned int mon_event_config_index_get(u32 evtid) +{ + switch (evtid) { + case QOS_L3_MBM_TOTAL_EVENT_ID: + return 0; + case QOS_L3_MBM_LOCAL_EVENT_ID: + return 1; + default: + /* Should never reach here */ + return INVALID_CONFIG_INDEX; + } +} + +static void mon_event_config_read(void *info) +{ + struct mon_config_info *mon_info = info; + unsigned int index; + u32 h; + + index = mon_event_config_index_get(mon_info->evtid); + if (index == INVALID_CONFIG_INDEX) { + pr_warn_once("Invalid event id %d\n", mon_info->evtid); + return; + } + rdmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, h); + + /* Report only the valid event configuration bits */ + mon_info->mon_config &= MAX_EVT_CONFIG_BITS; +} + +static void mondata_config_read(struct rdt_domain *d, struct mon_config_info *mon_info) +{ + smp_call_function_any(&d->cpu_mask, mon_event_config_read, mon_info, 1); +} + +static int mbm_config_show(struct seq_file *s, struct rdt_resource *r, u32 evtid) +{ + struct mon_config_info mon_info = {0}; + struct rdt_domain *dom; + bool sep = false; + + mutex_lock(&rdtgroup_mutex); + + list_for_each_entry(dom, &r->domains, list) { + if (sep) + seq_puts(s, ";"); + + memset(&mon_info, 0, sizeof(struct mon_config_info)); + mon_info.evtid = evtid; + mondata_config_read(dom, &mon_info); + + seq_printf(s, "%d=0x%02x", dom->id, mon_info.mon_config); + sep = true; + } + seq_puts(s, "\n"); + + mutex_unlock(&rdtgroup_mutex); + + return 0; +} + +static int mbm_total_bytes_config_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + + mbm_config_show(seq, r, QOS_L3_MBM_TOTAL_EVENT_ID); + + return 0; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1516,6 +1603,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, @@ -1622,6 +1715,15 @@ void __init thread_throttle_mode_init(void) rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; } +void __init mbm_config_rftype_init(const char *config) +{ + struct rftype *rft; + + rft = rdtgroup_get_rftype_by_name(config); + if (rft) + rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; +} + /** * rdtgroup_kn_mode_restrict - Restrict user access to named resctrl file * @r: The resource group with which the file is associated. From patchwork Mon Jan 9 16:44:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259001wrt; Mon, 9 Jan 2023 08:46:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXvjxuCOsUM5lIrbTR5tFcQQB9b1buSXpQgoUG+8cAJxbrqp4VCH0d8oiPj+4ajjm1BpaxAY X-Received: by 2002:a17:902:9b8f:b0:192:6d68:158 with SMTP id y15-20020a1709029b8f00b001926d680158mr60148307plp.15.1673282796011; Mon, 09 Jan 2023 08:46:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282795; cv=pass; d=google.com; s=arc-20160816; b=aBwlN7PPp8+g1YbhqlCAnWPqcKogYDwmLQcIh/YiWGjty47MNXClo320R9YLsH+4hK nUVlFgOp5r2fv1qKhPRnQUioodBCQeawvOGQzRxcamPiscfAcMwsZpDI2aGssoKAmTm6 L7vmlkbOs4M2Hr+GgadOUHwCA3LQiGom5p04GSQif0DW4CN597BTDxVdPNfDHN/OQ8MO FslGNZW3KN7/veRctFF5YrtDvUpOTuEzETl5Y2HcUYR9nltPB2LfgXXqjig3B3ol4nMV pyM9oSRFO/PWoT6JA+V43KHZmE4P47MkX6S3sTV/4CCgkK0m07qDFckjjH/EnAQjjdQD PEgA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W2uEUxX41ZlmL8yO5lveogj9xZ7JYR+w1/cxisLotAI=; b=umREP3AsrLfe/0F41khkwT70hGnft9b8iVilHqvUaKbe7hQZ5+ZJwwcHIh/SUXTdYd G/R5yWpOoSqZzVrdvIof65b4DJZlbKt9TTkgEDYg1xw+lG0CAxjtHdMMbYTzzqoQSF+d mF7Py011+UiWUaGurmqMB/txGf/nDIiDqbIQ4Iih+KovtTKjiUtOerj2RXJ3SirYqysd TgKNnWygPAgn8s1Z6HAAQ4swJnlkv/KyPjKLhwPJJv7ud49Y12z6S3fOsz3dIC0omhaj qUFSZT03SJOSvzq2PAKyFPG48P3YclMDD8f1C2ryFjwDUgBG4oB91+fvSkcpunyXl2RS DsIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=T3MGwFaB; 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 b18-20020a170902d51200b0018951533e11si9458213plg.278.2023.01.09.08.46.24; Mon, 09 Jan 2023 08:46:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=T3MGwFaB; 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 S235914AbjAIQox (ORCPT + 99 others); Mon, 9 Jan 2023 11:44:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234961AbjAIQod (ORCPT ); Mon, 9 Jan 2023 11:44:33 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2043.outbound.protection.outlook.com [40.107.95.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B652DE0DC; Mon, 9 Jan 2023 08:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gAfiWBN1MLi5jTID6+VICULCBzf7ZZKeF5yc2RTDNy5uNuMKWObFUxUA3hAUF1+JNPxcFvmA/M0UsWVbPH9pg4MuPeS115lF+Yr3fCVjedM9RFCSDzVUmFLTC17g7xhxGhZKQOtqSKZEnE64T2QzO2XlvKAZ0v956s0Q+MmTv7g8tvEWBeCIyoRuaK8ninbeAK8XxnCodeA7y8OVYXoehxfSBrudp+TkDkhqo1Lb0Mk/Zm675qGMwc6Ma86G25HC8sngbA9zrpxD1G4OltvkYil5fBFUyzTtDTGkEVpYpt1+EUam9RjtmTfpO+JaXZv2Qd8UQrf/jpOvZdZHhkKUWw== 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=W2uEUxX41ZlmL8yO5lveogj9xZ7JYR+w1/cxisLotAI=; b=JK6Pe0QeOHKpqlC56KjzdqoiyUC4lFQCZ6BbzapNsDcEBzw/tUjE3vSeAZCBPRA6uVCOUEFL4YPuVe4a4gAqhpsnfDV4oKuQwak2iAYeenZbwkNdrRkaZTxlYnmgw63NQhWgQoPs/2Vd1DC7mxhVWjtKDjhDbmv8CykyTK0xJJmUf+pJnh80fHH/6KiO/l9wGttcnbsjEJ3B9c+Qwq4LWD1SOR9N5V1yVv658xpx85LOkf8GOfdxQfa8PAknUV+/Q0i9jBFMe+mzgQVVxdKT8SF/k/egs+VfRb88mbsXDv7dxxfGZXzv3U5PrEfzDdP6e2tCTEzcxNFn4Ht8SAt3sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=W2uEUxX41ZlmL8yO5lveogj9xZ7JYR+w1/cxisLotAI=; b=T3MGwFaBDu0JA+SbWtIUCK+6QzH0oKQPVLV7PlAV5cVudST7g+Gb9PI8ZHPClw2Ve4MAo9ZV85GZ6tpZoKE2r19rFf3ufuOWzgdTqBl0OwzVpXeuETa4HLqTEZP5/couHapK2hRaFi3D1vHK+M1KNpZV0na+wbms5P0zisX+xBY= Received: from DM6PR02CA0068.namprd02.prod.outlook.com (2603:10b6:5:177::45) by PH8PR12MB6697.namprd12.prod.outlook.com (2603:10b6:510:1cc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:30 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::75) by DM6PR02CA0068.outlook.office365.com (2603:10b6:5:177::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:29 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:27 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 10/13] x86/resctrl: Add interface to read mbm_local_bytes_config Date: Mon, 9 Jan 2023 10:44:02 -0600 Message-ID: <20230109164405.569714-11-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT017:EE_|PH8PR12MB6697:EE_ X-MS-Office365-Filtering-Correlation-Id: 05948bf8-1f51-46fc-241e-08daf260c749 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JPYjEUssdF6k+9UnCCKwP95EeJhVkMnOHEjColgzx6FZsQywkHmgySVyXG0AV6MeK4aogpodNIsn1g9T6QReYi4clJUfqigp5/9kfxnCC9p5kG5wWwZHmu61l1Wt+fgy1YcM+2qVv9P9Jj1WAoBWtgRX4HCgXOTEqcZ3xcjU/9BL+u9GA4f77gfzinbX8BD+h/V5mqs28fpneIBl0svogcZXinJsuoVXhNHGMJKlGK0HP31jrAtWtKUxrKtqAaOI3eyfm932+44o84Ii9/S5YRm4pFtgqx6yG/CR8zNefXgV1TIySj/jGu4QsXAAe5XM2DUIm7TpR+MaJ7NkcHskuKxyf+OlSrU0PP2WHuotu0CcdvHemBH+V1u5sYgMuhNsylY6GgtivBCL9fCWDZzVX5/c+uhG/EYNq9udegt5ozUmYl45qhhbD846gpEzB62lsO5u66enFexD1n2pYJcgGUH8D1q/f+gdH+x8CGBIpY43Cz8QFmOPuFWDc0SbNpfm92+aMqDdneVG8UbhTgsZGnSCWneOSaz0cN/ShSD3K2ebpgzHrdqIB8j75WfxRi48QpgpSkFEw/HbR86yZNGqZpx+7+htWndr9YE30DhZb/H1g1xtacj/umGUjvR/CAuDZjzid9eFYHnytiUZAZirr28FC5QVdPO2VBPaEsr45E3Opl5vZhVv726o303sZFEK8/3ddmoADCiFwC77UqoiqSrmedRIETkXbT93OZ1HsuA= 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)(39860400002)(396003)(136003)(346002)(376002)(451199015)(36840700001)(40470700004)(46966006)(478600001)(426003)(47076005)(36756003)(86362001)(110136005)(82740400003)(54906003)(40460700003)(7416002)(5660300002)(4326008)(70586007)(70206006)(8676002)(7406005)(41300700001)(8936002)(356005)(81166007)(26005)(316002)(7696005)(83380400001)(36860700001)(2906002)(44832011)(186003)(16526019)(1076003)(2616005)(336012)(6666004)(40480700001)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:29.9494 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05948bf8-1f51-46fc-241e-08daf260c749 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: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6697 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?1754564180866475859?= X-GMAIL-MSGID: =?utf-8?q?1754564180866475859?= The 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 configured with 0x15 on domains 0 to 3. Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/monitor.c | 4 +++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 2afddebc8636..7c8a3a745041 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -788,8 +788,10 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r) mbm_total_event.configurable = true; mbm_config_rftype_init("mbm_total_bytes_config"); } - if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) + if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) { mbm_local_event.configurable = true; + mbm_config_rftype_init("mbm_local_bytes_config"); + } } l3_mon_evt_init(r); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index d47c675a856f..43e2a866e8e0 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1505,6 +1505,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[] = { { @@ -1609,6 +1619,12 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .seq_show = mbm_total_bytes_config_show, }, + { + .name = "mbm_local_bytes_config", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = mbm_local_bytes_config_show, + }, { .name = "cpus", .mode = 0644, From patchwork Mon Jan 9 16:44:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259069wrt; Mon, 9 Jan 2023 08:46:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXvzGcSOKXX8MiYJQxsix9pjsqQwqDY6LggcxXlV7BBIU2zQuGM0gTDl9ynMAYXZugMGihxg X-Received: by 2002:a17:902:8e8c:b0:193:2a8c:28bd with SMTP id bg12-20020a1709028e8c00b001932a8c28bdmr5191877plb.22.1673282802879; Mon, 09 Jan 2023 08:46:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282802; cv=pass; d=google.com; s=arc-20160816; b=LVBldIAyoVJ3v6EzcBYmq0hv46XSwiR8S44kjN9DFG4VznDJn2kdvRH7SMJmV3G6HP GkTPS8+TyGtxtvB1+TZe1UdkBxnLYGYr/jmrYAOXSBzAJg6kpEhHQkXW7scN8LoK4yul LFWwCH5z6pvADe6KkhROKWn760B1VEeS9s15w0ITFYWAE5bJR2w4tBlX7wffdWl3O6iw 8HHFE9dHhr7A0LSKi4pt+LHc9J/AmIPWmt1bbEZTSCT8FL7tulPbKhA6IDqUskJWUOrk 6XEy/QkQBQXGg+qiuBB+1Dh2o27VvVxhiuH9c/A7uVzRh0WGmEV+67thdNOKZXdU1MoA 3NgA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RtXYbPQC0+WYlbNB5AV7iBoCSOE0PPHNoDawc9whwaQ=; b=ghMlmDTcuZalLIKEY4z+Ew1FAdHz2wRVKZD1oNZDDWLpmre4kg5CaGZVjciDot4k9q 5j1NOaJrVrXbRL96/Zas+np/0B6dsdarO6wM701qjiuSpFGb4pCjvUYUINiqi94yBVzx TJCL58P/OAWpOC650pqItsjOMOk76203ZExZPT6HVFwCOrcJLI6e0w0V7qSCDWTM00+I K/xxEPv9JjYjpKicXHGvkQd1gVGQqh6Ym29EHnHJBp2l/gRHeJMAporEeOtv5OgFUQh5 cAG0YTMCKcDOMxA+dmFFJhHjQb5H+iBBt8xwqkg+JPGXpdYzeC8kNwIUY/h1MWP0x7br NBzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0WsmewxK; 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 r36-20020a634424000000b00490a1c37b20si9065229pga.615.2023.01.09.08.46.30; Mon, 09 Jan 2023 08:46:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0WsmewxK; 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 S236848AbjAIQpH (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234984AbjAIQog (ORCPT ); Mon, 9 Jan 2023 11:44:36 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F460E0DC; Mon, 9 Jan 2023 08:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FLzQsmTOJHEjshDLjVXy+hC5X4tr+MXpLffPtbAeq6wpxg3R/PTQUBzMruJK49jysAZXfZUtaXHiD10BBQviCCwoLXVdxZioAtl4E/8r39o+DWuJR0h4pxN0souNW/we5XANlUJukdD2r9VLf+8Ds096Fln0n5WMPYHHLKR3dgvTQIy8xp9iyfQBUlxJkKPpLfzKAjq2hRLO25Oi2FT1ieY2xktCeAUlyHWQz0lnxzfgCaQKS+GFHRjKOKGETnLFmfc0YLtbzY1UkaBBbpEDbgxiiiY7tv7BBOrV2DMqg/+bvfpLhm1hh69BsKsV++KVwOB7HmJOa7gwW/f0yjJyIA== 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=RtXYbPQC0+WYlbNB5AV7iBoCSOE0PPHNoDawc9whwaQ=; b=oZC3spDmwjukt9fy0KxwokSlsCpAUYTHUOHc/WvPyaJhUaEtZkZByAVMCaGb9R//XPc86k14q6Vy5cdE4JmpkUm8nI1Es273on3bYdVVn+7qYPNeBRHuxJ/I9xUqDY3xDKSgS3alOzOvkapt/zqazAn5TU18EkCWPt7ikOspihIlvdt69f84lBTte3Dn1ZuM2hgi5xKqbOW1K/dO6kyfscmbUrro6xVyVVQWYcE6JpyWkNHLSMD55yrdL3UQhvLjFHq6bPcJ7KId1+5oz74/EErLu0i96rvOA/++NYTdr/qMw6pgqy2UXN9jxgSr5CxJ9ydKaYl8nugj6W5L4cE9eA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=RtXYbPQC0+WYlbNB5AV7iBoCSOE0PPHNoDawc9whwaQ=; b=0WsmewxKu3ccPxTStSGV/nLrMhNwS+PGewjSshb1Y3S0qpQ/sqrdGP1O3Us+COXQ106eLDYexuR5s4AgEvdOzNEc0mBgyH4zPF/qWMxHmLI0qKavwmPJvGAMSE6GHgG84ZzvEQzkBr9c2W3ighgSdvxDEd/cUaIIo+UIOrsWSfo= Received: from DM6PR06CA0019.namprd06.prod.outlook.com (2603:10b6:5:120::32) by PH8PR12MB6937.namprd12.prod.outlook.com (2603:10b6:510:1bc::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:32 +0000 Received: from DM6NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::f2) by DM6PR06CA0019.outlook.office365.com (2603:10b6:5:120::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44: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 DM6NAM11FT099.mail.protection.outlook.com (10.13.172.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:32 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:29 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 11/13] x86/resctrl: Add interface to write mbm_total_bytes_config Date: Mon, 9 Jan 2023 10:44:03 -0600 Message-ID: <20230109164405.569714-12-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT099:EE_|PH8PR12MB6937:EE_ X-MS-Office365-Filtering-Correlation-Id: 797f044c-ff5b-4b1e-7352-08daf260c891 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: thk8hh+ETzNEsy5wA2Ydo2iSrbaFibE3vDdE6WyUOoAmUjKtfXP8NQpHXWFnWDMOsTQ9K0ReMMkFcMIgILp6EBcYD4mkXv0HZNIPqdQLz9CBVDVXUqlgv85iE7ZrkhV5N2zmJ+NGqPFyNHh54Jhf2hXV8F54UM5Uz2q2LoZnCGYLSISrgsQRSQbGDdT5QDGCK5+opDiBDvDmCWMHJPtxe5fdyAsf/MpIgLPYu2/eb3+t2+EFZy6LpQ/ETk3Wnz1aVDgVqAyZmhn3sxxykdvR2NvbsroTUNGPCTD7X6UqnXYjGPskZaf2E9cpeBHbuTS+Hkc6MWX29RsQSh0kF1RJFGPxtwjhdtotpN2sBY07jWg0yVd0EHqUQI68XkZnczMC+lmE6UAqZg68MVOuQ4phHHotc5fZ5AHa0W1XUrqgo7m7uP8k506M4ZT5BiFeJGXD31v0AG64N9xbxHDoBAQIsddy3cTqkNCyIlqP7ctIKrUGwG6BeySxyfDADo6XNCIeSer61K06HVzWoW4sbErYAmhQNvFaAvxP+dFZNi2OqGfwSCn2d/uujqWiv2vUR51mQjY57aARPLsf3m0ybkrv6B+ZHkussGijjuZUfFLuHjZrkP4JUATFHsyHiLOZgiYag12h+Y4XjRuIyYhPU9/3BY63cHkX0KLrWxQ3JHnGA7LpNxoOytzshDmC9cUIwIn+KX/iYLfp+HmPmIbVfzYr+bE78q16kKeTczqhGGN2Hq0= 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)(396003)(346002)(39860400002)(136003)(376002)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(82740400003)(6666004)(81166007)(356005)(2906002)(478600001)(44832011)(2616005)(7406005)(186003)(1076003)(7696005)(16526019)(26005)(316002)(5660300002)(40480700001)(7416002)(82310400005)(83380400001)(8936002)(36756003)(86362001)(426003)(41300700001)(47076005)(40460700003)(336012)(8676002)(70586007)(70206006)(110136005)(54906003)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:32.1322 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 797f044c-ff5b-4b1e-7352-08daf260c891 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: DM6NAM11FT099.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6937 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?1754564188394226924?= X-GMAIL-MSGID: =?utf-8?q?1754564188394226924?= The 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 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 Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/monitor.c | 17 ++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 124 ++++++++++++++++++++++++- include/linux/resctrl.h | 11 +++ 3 files changed, 151 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 7c8a3a745041..c50c43656bdb 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -176,6 +176,23 @@ void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_domain *d, memset(am, 0, sizeof(*am)); } +/* + * Assumes that hardware counters are also reset and thus that there is + * no need to record initial non-zero counts. + */ +void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_domain *d) +{ + struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); + + if (is_mbm_total_enabled()) + memset(hw_dom->arch_mbm_total, 0, + sizeof(*hw_dom->arch_mbm_total) * r->num_rmid); + + if (is_mbm_local_enabled()) + memset(hw_dom->arch_mbm_local, 0, + sizeof(*hw_dom->arch_mbm_local) * r->num_rmid); +} + static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr, unsigned int width) { u64 shift = 64 - width, chunks; diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 43e2a866e8e0..21fdb4a48a11 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1515,6 +1515,127 @@ 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; + unsigned int index; + + index = mon_event_config_index_get(mon_info->evtid); + if (index == INVALID_CONFIG_INDEX) { + pr_warn_once("Invalid event id %d\n", mon_info->evtid); + return; + } + wrmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, 0); +} + +static int mbm_config_write_domain(struct rdt_resource *r, + struct rdt_domain *d, u32 evtid, u32 val) +{ + struct mon_config_info mon_info = {0}; + int ret = 0; + + /* mon_config cannot be more than the supported set of events */ + if (val > MAX_EVT_CONFIG_BITS) { + rdt_last_cmd_puts("Invalid event configuration\n"); + return -EINVAL; + } + + /* + * Read the current config value first. If both are the same then + * no need to write it again. + */ + mon_info.evtid = evtid; + mondata_config_read(d, &mon_info); + if (mon_info.mon_config == val) + goto out; + + mon_info.mon_config = val; + + /* + * Update MSR_IA32_EVT_CFG_BASE MSR on one of 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 observed by all the CPUs in the domain. + */ + smp_call_function_any(&d->cpu_mask, mon_event_config_write, + &mon_info, 1); + + /* + * When an Event Configuration is changed, the bandwidth counters + * for all RMIDs and Events will be cleared by the hardware. The + * hardware also sets MSR_IA32_QM_CTR.Unavailable (bit 62) for + * every RMID on the next read to any event for every RMID. + * Subsequent reads will have MSR_IA32_QM_CTR.Unavailable (bit 62) + * cleared while it is tracked by the hardware. Clear the + * mbm_local and mbm_total counts for all the RMIDs. + */ + resctrl_arch_reset_rmid_all(r, d); + +out: + return ret; +} + +static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid) +{ + char *dom_str = NULL, *id_str; + unsigned long dom_id, val; + struct rdt_domain *d; + int ret = 0; + +next: + if (!tok || tok[0] == '\0') + return 0; + + /* Start processing the strings for each domain */ + dom_str = strim(strsep(&tok, ";")); + id_str = strsep(&dom_str, "="); + + if (!id_str || kstrtoul(id_str, 10, &dom_id)) { + rdt_last_cmd_puts("Missing '=' or non-numeric domain id\n"); + return -EINVAL; + } + + if (!dom_str || kstrtoul(dom_str, 16, &val)) { + rdt_last_cmd_puts("Non-numeric event configuration value\n"); + return -EINVAL; + } + + list_for_each_entry(d, &r->domains, list) { + if (d->id == dom_id) { + ret = mbm_config_write_domain(r, d, evtid, val); + if (ret) + return -EINVAL; + goto next; + } + } + + return -EINVAL; +} + +static ssize_t mbm_total_bytes_config_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, + loff_t off) +{ + struct rdt_resource *r = of->kn->parent->priv; + int ret; + + /* Valid input requires a trailing newline */ + if (nbytes == 0 || buf[nbytes - 1] != '\n') + return -EINVAL; + + mutex_lock(&rdtgroup_mutex); + + rdt_last_cmd_clear(); + + buf[nbytes - 1] = '\0'; + + ret = mon_config_write(r, buf, QOS_L3_MBM_TOTAL_EVENT_ID); + + mutex_unlock(&rdtgroup_mutex); + + return ret ?: nbytes; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1615,9 +1736,10 @@ static struct rftype res_common_files[] = { }, { .name = "mbm_total_bytes_config", - .mode = 0444, + .mode = 0644, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = mbm_total_bytes_config_show, + .write = mbm_total_bytes_config_write, }, { .name = "mbm_local_bytes_config", diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 0cee154abc9f..8334eeacfec5 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -250,6 +250,17 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d, void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_domain *d, u32 rmid, enum resctrl_event_id eventid); +/** + * resctrl_arch_reset_rmid_all() - Reset all private state associated with + * all rmids and eventids. + * @r: The resctrl resource. + * @d: The domain for which all architectural counter state will + * be cleared. + * + * This can be called from any CPU. + */ +void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_domain *d); + extern unsigned int resctrl_rmid_realloc_threshold; extern unsigned int resctrl_rmid_realloc_limit; From patchwork Mon Jan 9 16:44:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259523wrt; Mon, 9 Jan 2023 08:47:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXuQ7NQ0Cl5DELdMgZtoWQ9Jn70XT8fv1xz/hO87o5s5J/9HhFG4BYtXckk7S/O4e+s5PdDX X-Received: by 2002:a05:6a20:d2c7:b0:ad:a277:e57f with SMTP id ir7-20020a056a20d2c700b000ada277e57fmr80472897pzb.34.1673282858235; Mon, 09 Jan 2023 08:47:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282858; cv=pass; d=google.com; s=arc-20160816; b=iHFuwvgsVsKPoPMl/yusYIdBIIl4Fdwga3FwXITIghPzebZ06KkG4R8o8Ng55EH5Nv 7HtFOAmESj1gwKD1Hvx0+rX9sZ4BvnWan+okPDiIXsdXRdllJ4mg2884gKcAFrda+ZiB iZZMjzedsOvwymTgvgnFRMSNsTyzox0lo+BqwlHTgk8NziASkE0NRvF7YeAbiVFYeRTg 5cmxRLK7I5AbrU3/P9hvDTE7Kt917Tsjbilz9/+tb4eMyFgEVrtfmgDuCdPDOZF5ITKb Vk4DtOw2nvBxMfI27XjPIO+1C0wtksQwbv0y5jpiiLzGJi98Xdw4hWCATf0AurFjKdcK GjLQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kZNIE/KiQlDsnqpWez8nLH+XR/8AdS9CmM6H4W5Pkbw=; b=cHmadOZP1fcc7SxcgAwi+Vvn0dO596r6XPuKDDn740BPuBPtfUPgjzCmhk1Oz1ZEzJ 3jXUIhKbsx4Lqu7j2PvS7H85E+kbb67i0JptEtCqSTCyYBjNZfp7qiiGgVtizZpdgoG4 duTyBbdhwc4wMYkvGnebcyUrfVOPcSRvItezGow3exElhp+dy19Y0PIXLiAsWjuMoVp2 dN43sU60QoS1EFevE4uwgkLvWfkGMrxn5iy7AQVxYn5i32kxdau/1EUjLQGOBU1CuN/U hV3DFE/GKxMRmtMfmyBd49lgezA8P4mfwe2zQuzeOVTi3wkhgEwJXAWkz5L+7u07ZnmH E0cw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=MvWTbNT+; 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 j6-20020a63cf06000000b004b46ce1ccdesi1527728pgg.605.2023.01.09.08.47.25; Mon, 09 Jan 2023 08:47:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=MvWTbNT+; 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 S235216AbjAIQpV (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234981AbjAIQog (ORCPT ); Mon, 9 Jan 2023 11:44:36 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2087.outbound.protection.outlook.com [40.107.243.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 745905F43; Mon, 9 Jan 2023 08:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ogP88M0/epeBVwkaD6yk4DJWTTA5OTcEQUIIGFuZufZhIcZFtlVpoRGihnQ8yfUxiJLQWSgnop2ECCkVLyA26e5jvxGjnvq/pLDU6ui+J3T/QsqEcZy5YykUxM0BA8omqbxx+ZUyJWIyCMQyVjYNr5fvH+WKodt+7FOXQd1ID1/3YZ37Rq9k7cVU++aOKis+f9Ba5EONVsbxMtez0BNaqCmEe0W4x6z0//768rfIi4xuomFBKigBIZvZixRFv//1e3ISH+z0QXbKq7CGS2fLuLzQsiuL9cQm0A3I+uKLpUKhyKWq3BPsu8S8sEmlF8Q+mwlvBYcAfZ3f83UdvZ4cBQ== 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=kZNIE/KiQlDsnqpWez8nLH+XR/8AdS9CmM6H4W5Pkbw=; b=Zg0g17+LElJN2qr5py1HMD7BHaFDFTX8nleIpQ+NswCpMkqx7H3sKb4aIa23gPsI0C/nSYMWZZIe054XXo/M/X8xG3YiuYCZrBKgWucAWkFCg0J95HEaWHZNMF98vLHNdnizbNUnulE2jmeB/mB8i/+IY8K6t8oMRecIp3aSHOQefRpyXTuyaQLFzX6i7PRcayV/eu/fwkZReKdhcXz9+0nsJjtoMQNBJUFKhgea0Dw1nv5F6eUTs4i/7eeqZpfslM91oVIWYNh1jyiaHlu8jWk1/KJITxVuk9ZDOQ8AwV82O7kTtOsMVMIYN+3qYj1zDuurfxFKvy42b2cFOk2GKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=kZNIE/KiQlDsnqpWez8nLH+XR/8AdS9CmM6H4W5Pkbw=; b=MvWTbNT+6r49lv7tJFuK606ZrGzeqnxiiYxFoNtRWZvmwtk76Oecr3OqI1mOGloyPtozAQrNwMhufo62YAuvu+8liQFdxBhQa/FX7ZXWBbKkPrtmEEFkzDFsgx6GnaoTngiGFvaS9SAotOXLi7e5EyKayjOsf8ZHPeMqqeL5g9I= Received: from DM6PR06CA0018.namprd06.prod.outlook.com (2603:10b6:5:120::31) by CY5PR12MB6155.namprd12.prod.outlook.com (2603:10b6:930:25::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:33 +0000 Received: from DM6NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::e6) by DM6PR06CA0018.outlook.office365.com (2603:10b6:5:120::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT099.mail.protection.outlook.com (10.13.172.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:33 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:31 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 12/13] x86/resctrl: Add interface to write mbm_local_bytes_config Date: Mon, 9 Jan 2023 10:44:04 -0600 Message-ID: <20230109164405.569714-13-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT099:EE_|CY5PR12MB6155:EE_ X-MS-Office365-Filtering-Correlation-Id: 6be6ccb4-a575-49ea-2db9-08daf260c931 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mZNaaf60Y7XkqTN3/OeylUz7fXnd2mdFdnAdR+kmrjbJ72/DJUs6y+p+oxWbH4mPc4NqkO6MzMzkLMPYdAxhCPJw1sO1lHFErqGmz2OEsn8OzBp2zHg02z9LJBLEVwl3adYfVaRGw1WSR7XUf3lvMwmmGvrs7M/pQnWDBE66Jg6UA3TSBYfGZeCOXzXZtffTLGpaux4OG3rY3egBT2aluwlMJ9X0rjOpfs/r9zA5nyHPPnFolQbFre9BL5uyb4PI8+pEx5C/tBwEZ2IaJL05kcTz02MbLd8Ndcz4PAVNo0qymwXXjZq4XbO7vkBwX7thbn9hkVxMaVVqav9dKdqdGyYT1/7K9bzX2KdK9xviOQ5P3Kx1/fXFvmDW2WMVBijGA6S5sFq7Kl+RZknhC5ojTMm3RzDK7sUQfHhhMrP9QT7iPnL7cn6hbYeAFGhthH5ah917Vb3Q8zGZnJTd0BcLocF7c2ZDV0gAwNL3RVbbAXVKMc7mqS8p0Vgqd/zSnfm/oCpu/KHZY2wirM3/QF2UpmfDbRltIh+7pdtZPCOeiFckNNHQOjvs8jOX/BFDzzk27y0WcA6/1ldoKheG0lefWDiLImZMhTipeIbuwie+KPUUI3fWf3CH8oe5dRA1OKrHvtJMcMyM2sSpFUaPuc8Z+Za8SCEJw1yifOG1SNXHLxtjOzWPtzBe0tAsMlpL6J6faZ1phuaxJLHNa5kRLKZg/zeY/S2MZ/FGw0akuZW5mug= 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)(136003)(346002)(39860400002)(396003)(376002)(451199015)(40470700004)(36840700001)(46966006)(41300700001)(82310400005)(44832011)(8936002)(36756003)(7406005)(5660300002)(7416002)(2906002)(8676002)(70586007)(70206006)(316002)(7696005)(110136005)(54906003)(16526019)(6666004)(47076005)(40480700001)(478600001)(336012)(4326008)(186003)(26005)(2616005)(1076003)(426003)(40460700003)(86362001)(83380400001)(36860700001)(81166007)(82740400003)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:33.1790 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6be6ccb4-a575-49ea-2db9-08daf260c931 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: DM6NAM11FT099.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6155 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?1754564246222533316?= X-GMAIL-MSGID: =?utf-8?q?1754564246222533316?= The 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 Reviewed-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 21fdb4a48a11..9fb8e32f4d00 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1636,6 +1636,30 @@ 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; + + mutex_lock(&rdtgroup_mutex); + + rdt_last_cmd_clear(); + + buf[nbytes - 1] = '\0'; + + ret = mon_config_write(r, buf, QOS_L3_MBM_LOCAL_EVENT_ID); + + mutex_unlock(&rdtgroup_mutex); + + return ret ?: nbytes; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1743,9 +1767,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 Mon Jan 9 16:44:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 40976 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2259697wrt; Mon, 9 Jan 2023 08:47:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXsgwmUJ1HxlqptzSoYEMINl/wYLJH/7JusWVs5yi1EWbtRI6sXLjDGAwfjHiWODZje9pD6c X-Received: by 2002:a17:902:704a:b0:191:7d3:7fdd with SMTP id h10-20020a170902704a00b0019107d37fddmr81635977plt.60.1673282878610; Mon, 09 Jan 2023 08:47:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673282878; cv=pass; d=google.com; s=arc-20160816; b=aZ1sRQa03FdpU7YqSu0qr1Wa9LxllW5mKTh4ZEn99YXWsAnQnkJtmhrD2NIXs7scMb pP68CRTvfxdoYCi+eYmGJb3+R3ecLAzRHj+TigLqPXE31gkanHIVtiO1qfBD8bQKF6Yp pp67bV0oMOXh2u6pMV5jc3Jf+5dKi8jNFP59OeTdGojc9ptPk2oO6v0E8MbUycxUAXyc 9lPCmpWlycQ6i/+Ay+mbFUbS2JjZkEPjPFdiaFKskzUamjPqKYjHpxoM2GA+tn07dIZS IKksjMZaU4P23CA0dHlhL/3uFoCcClHmNbIJlULUXTVHTW5iVnLVyojRotPVHFoWaYFg YPGA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vIKnkiU2VOmW02KhvidhhyVz/nE+t6wH0/fkqMzLIzg=; b=xHGG0E4hKQwZ3p85X7y5eW0VMhajDQ/kXXvLZl2bJx0b8sJA+/HWHbjj6GArdzecqZ ek7rBPxHHjNzChMFn2quD2yRaa7o/WKNScb2Si06Jmui/ehEHwSB0V18WgU0xDVy9/nR 9jxPzkOivJ85Rqos6JXmtAe/hx6cy4c81kNJ5w1EV0BxcZVhGZNETsCffIXTGvzYii+q vO0pl9h2FkiQkd+7L92Q3b0QbntDsFGZVxOU8lJZRWJBd1EPa2L+Rm3LfL07bJ4VTh1h a78MQkms+4xVem2cOS29VqARzE5X+7IOH4xMyBarrzJ9+KZlA48a2aerVziV0YRuqyxW A4gA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=XkiQxpvz; 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 r36-20020a634424000000b00490a1c37b20si9065229pga.615.2023.01.09.08.47.46; Mon, 09 Jan 2023 08:47:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=XkiQxpvz; 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 S236962AbjAIQph (ORCPT + 99 others); Mon, 9 Jan 2023 11:45:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235012AbjAIQok (ORCPT ); Mon, 9 Jan 2023 11:44:40 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 090BF5F43; Mon, 9 Jan 2023 08:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gAs5rWx9sAJw8BWD7ieEKDWZjVghdaZaHMtSpU1n+FpFCQo1J5oXkazb/BcvNX1fxkMy+ZwP7UTd7JPTpWNz0HEXj9JXLpsH2knMPp7RSc8OKIbmaZ/lxoF2s6cCksptAzP/oyGM+5NFeJ0WjQGT5+sqKOJglz38SrQ3HQ7gouxlgmG9tV/BY6s96YN8spS11rA6Cvs7laYJUn44ZwJqiLKLnaJd9r/1Zq0rf6EJi66uN8B/G7aM50UGSm8etv6pYy+pMp5GXOQWGcgtqs3iMV3Jrt9aGB9u8XZe1dhAxnFHdu26oNPSucdZdSryx9A6EeN8hv3W8pGYBFkOaR57BA== 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=vIKnkiU2VOmW02KhvidhhyVz/nE+t6wH0/fkqMzLIzg=; b=G+UO054fv5WjuwbGWAQg2qlkPVvOCFL/jZ99yIJ0Kwwvte51ajo2h8FYoG1pk/3zZ50NZvqccBOM1LN0BhNUxZgHPvL8V+K2TZ/IGIwpkRwKhSPufRhFGmbRrAuEQJnoLsIdYyDuOH/MBwiE0tyArtD+b/Ma9cFSD6mwPEgcAj7PddF4rf3AVXA3Cu1+cZ7PEgyPhWGGaG9nEK6t+TMdmbbi34VqaAUJ7P5jlPfqlRKcczVhfsUAnJAe4NGnPMZJr/Qe/1/UGsZqHrIu/r3Ang8YarS342mlqlZKLNVYy1sa0wixr0LBWoIZbMeX81mWcKwjZwQnFXyWEodA0uOSTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=vIKnkiU2VOmW02KhvidhhyVz/nE+t6wH0/fkqMzLIzg=; b=XkiQxpvz8aySA+ztb/kSaCiHOK3rbx0IeGWRwTUec8kXFODSVAYT65g+nJsMOHFc5D3/Z5lnMFzbpsukKFiUQ8Cv8yKZx6f2+9UEPKYU2PXnXukOr0Kp30O2CG2nB8NV+BTWHOpCeT5mMEEcZWDl829jKxWVT3V5Q6MrvVhgrPo= Received: from DS7PR05CA0007.namprd05.prod.outlook.com (2603:10b6:5:3b9::12) by DM4PR12MB5866.namprd12.prod.outlook.com (2603:10b6:8:65::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 16:44:35 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::31) by DS7PR05CA0007.outlook.office365.com (2603:10b6:5:3b9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.11 via Frontend Transport; Mon, 9 Jan 2023 16:44:35 +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 DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 16:44:35 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 10:44:32 -0600 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 13/13] Documentation/x86: Update resctrl.rst for new features Date: Mon, 9 Jan 2023 10:44:05 -0600 Message-ID: <20230109164405.569714-14-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109164405.569714-1-babu.moger@amd.com> References: <20230109164405.569714-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT059:EE_|DM4PR12MB5866:EE_ X-MS-Office365-Filtering-Correlation-Id: a6a8513e-81ba-4ce8-9b5e-08daf260ca78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NKxCnwuo7TuZWk6EvooM212NrTDx/UUzRFFHIIFEyp4jLoW92jw0HDpBDJW3G2ZRQscwCifIaggYZ+0waDvglhL2+ZkTQplBJSRC05rRK2eYjsU3opKpPFZWOYjXdqFjeZHFjo2KPF59UUaq6o53wxr1ndedcMLt+jWTxg788dlZozLOXnvRrommomtn/tYNusWkDw9R4OtwNf25L4K+q7d/ixQNe5cO/8lP1+Jm0XMX1HGV8JIr3YCvfjTg93+GhFzdWe/Zdr3dqKtnz43IfNLqxGBhV9v2cYEprKwNqoCc5wOjH4JS+akhP/wZ44WTw19aUs2+xsAh3MupuBL9BmQWxlmkMd0Vy2MvtOw+u6ELpDIRMpgY40/F+2bvajkz9jutYy8Ox+Re4gz/82rA2BbPXI7GBTqwaG6KKwANxJkAqyc/BEf3kha21Mc30iIq/MfeI7yjqSpjZKdMBsiWjzPdk8vixC6KkSmXPDy32Pkqyfhbxcx7XkXsiiwwByPi3oj1RmMa1Zqny9MZLR8bmkLMIFuAuqt8LXd31DmUxaL5kDNnGL9jM/Fd7cfRfjDX5iJS2UiLkGg2ApR/D6JF46JfTnWUbsFG4kW+/tpnxf/OsgGwUOj8KEFWynUiyyhlnWPUHf8/Tx7cQQdUYCeTltotuTuAwb3fgeniaByW7+8tREK6W2iNxxIZAbqhIa2qmuJj2MtCttR4Qx7nvZK4cWzRXKwQnTPRc+z5xNzkiQ+zGEs0p3ULCZ89fqIv6e8QgmB5wJfEnFV+xpYT6WHLIA== 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)(346002)(136003)(396003)(39860400002)(376002)(451199015)(36840700001)(46966006)(40470700004)(40460700003)(47076005)(426003)(41300700001)(110136005)(70206006)(2616005)(316002)(54906003)(8676002)(36756003)(4326008)(1076003)(336012)(70586007)(86362001)(82310400005)(36860700001)(356005)(81166007)(82740400003)(44832011)(40480700001)(8936002)(5660300002)(7406005)(83380400001)(7416002)(2906002)(15650500001)(16526019)(7696005)(186003)(26005)(6666004)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 16:44:35.3405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6a8513e-81ba-4ce8-9b5e-08daf260ca78 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: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5866 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?1754564267711385380?= X-GMAIL-MSGID: =?utf-8?q?1754564267711385380?= 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 --- Documentation/x86/resctrl.rst | 142 +++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 2 deletions(-) diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst index 71a531061e4e..2860856f4463 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,83 @@ 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": + Read/write files containing the configuration for the mbm_total_bytes + and mbm_local_bytes events, respectively, when the Bandwidth + Monitoring Event Configuration (BMEC) feature is supported. + The event configuration settings are domain specific and affect + all the CPUs in the domain. When either event configuration is + changed, the bandwidth counters for all RMIDs of both events + (mbm_total_bytes as well as mbm_local_bytes) are cleared for that + domain. The next read for every RMID will report "Unavailable" + and subsequent reads will report the valid value. + + 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 +543,25 @@ Memory bandwidth domain is L3 cache. MB:=bw_MBps0;=bw_MBps1;... +Slow Memory Bandwidth Allocation (SMBA) +--------------------------------------- +AMD hardware supports Slow Memory Bandwidth Allocation (SMBA). +CXL.memory is the only supported "slow" memory device. With the +support of SMBA, the hardware enables bandwidth allocation on +the slow memory devices. If there are multiple such devices in +the system, the throttling logic groups all the slow sources +together and applies the limit on them as a whole. + +The presence of SMBA (with CXL.memory) is independent of slow memory +devices presence. If there are no such devices on the system, then +configuring SMBA will have no impact on the performance of the system. + +The bandwidth domain for slow memory is L3 cache. Its schemata file +is formatted as: +:: + + SMBA:=bandwidth0;=bandwidth1;... + Reading/writing the schemata file --------------------------------- Reading the schemata file will show the state of all resources @@ -479,6 +577,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