Message ID | 170240413801.760665.7930294172146734221.stgit@bmoger-ubuntu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7900327vqy; Tue, 12 Dec 2023 10:02:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQJf+5Hd/53QN9UA0vXJl3ujbiOlqaUPsM4WXTCWeC71fHI5Lz07KmXkYjj+g93tURisiV X-Received: by 2002:a17:902:e74e:b0:1cf:9c44:62e with SMTP id p14-20020a170902e74e00b001cf9c44062emr7785019plf.34.1702404159174; Tue, 12 Dec 2023 10:02:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702404159; cv=pass; d=google.com; s=arc-20160816; b=LEk4KSj14eonzul2LZyTqqKMDQQXjaC/6s9Jv08gfEoLwnkoMGa2vYZohaWps5eIZ3 JComixdfA7W4CTIDsX+YoupkDns3dGVJ/zQexVSik9QB9HTMXEZcP8wbCLnSh08dP/w/ gBctDN6iSb/jwBOkL0iQC1P+A7ZsGC4NrtEDrGmscLEI5i9OJWylxepQzjgTn/vhc5mk 1oKy2kUi5nn6BBVaphFQF+8Wpjm9bi1a6gGmJ8y8QuF3LXBSJFCEdkJkdAySkUrCiNjT pgoEP2W5EuhxJdUEeopsbHn2R/C+Khf8y7KFdfeNbFKHpSQfzGx0UWGtD/xmz6fm7MlM rqZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=iQJkixhoEZv8s2AuoE8peC4+I58i38wBbi/cK6R+DoY=; fh=vF0N9Z0ba3gyWrEQcQJLcn0rHBkZA/Vpru/MVFB3YIY=; b=kqURh2RUJPQwAQFWGtWdKNH+353ZXafXchSYx4fxkHQYpCcbb6Rve9Q/UfYGB3Rdpg fPp3WiJB3yJrBUq1epiUczdp92O/oEbu/In1ewStZnBgctiU/Wjbb+zeZ1nwl1aZuoPY kHopaqe8O/yNLdr6jBr7DBjM32xyhSLi/1xmXEUgFojAdCUHcR3IflUFPxKOoB4g9R2K sRAEOKmTo9edzFP1RREWKzc95JiJH+ReMTwZmT7tJvrkCmbhsYzrVOPS+MP698jb0Bpx 0+p340mi1JnS0RpAUlVjRH2aMrL3YHagfyTDiruQap/kgayVvILNj2aXHiQrCX1mQOzc Q1yA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4u+bTuMk; 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::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id jj6-20020a170903048600b001d0d15b9c6fsi1293032plb.380.2023.12.12.10.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 10:02:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4u+bTuMk; 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::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BB8628048C2D; Tue, 12 Dec 2023 10:02:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377074AbjLLSCV (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 13:02:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377068AbjLLSCU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 13:02:20 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2089.outbound.protection.outlook.com [40.107.93.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF363AB; Tue, 12 Dec 2023 10:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AaLdsVWNRLdjgXB54XMJz1ZcmvFFa3tJL6ZsEL/tpgibp5eMnV0a81Z1KkF3PDn3V7JiJr4/9jk3bt1JEG8jsXNjwY6kLf1zDUf4DSV2hQ+1YkxjBqa4YWRCMV6dgtfL/DZR0tz0EaiRF5sb9dPd/pU7KbM9b7TxCwymce2xP3WIPbdLpWy163BgcSjfNVvdkPLCcX4FyQgLms8VJHiocyLg2iOh94j5n28iJEJDzuT4tHYp2LgiETirpqW3EyOTSmUgP3WGDdJ5QcJ4f1o1un2PY9PvK7zReH994eVYtwB8NjTXvisjTQ0cDVrizF5tNJD0FAn1zOtSrSrF9QEvJQ== 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=iQJkixhoEZv8s2AuoE8peC4+I58i38wBbi/cK6R+DoY=; b=B0xuIqQJ1dx4oP8volJ3F9hKR5DSyyBV0WHLnKmbVYaQeZrS7zaolop3BuRPycBfjHg3fx2MsSdgI8lQ7XywX8CqP4Nz2thB7l45wYF8ww9TbbKhHa8Wgmlw2HzkZScec3MdcJsLbQkW67GYtAm5VyzlHmEvCsKB6csmk958f/gdRPRfzdh4rvVARGP6hbJndjxvp3DHH2yaSnhpDuKpWegvDrJqigdi30BGfXq6XgMx7YbsKJ0RYAWBd2Aatnu5Q1CvdxObzxmcGRg7UoVqRoOuiJC65XllrWLcIR6WvCd6xhRRPR5RkEBXPIZBv9KiDqVU5PtwyGzzw/JV9fmGaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=iQJkixhoEZv8s2AuoE8peC4+I58i38wBbi/cK6R+DoY=; b=4u+bTuMkFYsUePHzlEpDsNmRJzkclYzUDipzsssfs6BNop9t8bjmWh7QzqmBKE+Ag8kyDcbb515j/Ng8s8FqZ7dS9DrTkbXkfNJZidSDWvIuJ9jcWHjnRipPWigX/ugrE8JAap000H3HAguexFAiGrP71MhNnqYH1gnmThV78OQ= Received: from CYZPR05CA0036.namprd05.prod.outlook.com (2603:10b6:930:a3::24) by CH2PR12MB4891.namprd12.prod.outlook.com (2603:10b6:610:36::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Tue, 12 Dec 2023 18:02:21 +0000 Received: from CY4PEPF0000E9D3.namprd03.prod.outlook.com (2603:10b6:930:a3:cafe::3c) by CYZPR05CA0036.outlook.office365.com (2603:10b6:930:a3::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Tue, 12 Dec 2023 18:02: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 CY4PEPF0000E9D3.mail.protection.outlook.com (10.167.241.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Tue, 12 Dec 2023 18:02:20 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 12 Dec 2023 12:02:18 -0600 Subject: [PATCH v2 1/2] x86/resctrl: Remove hard-coded memory bandwidth limit From: Babu Moger <babu.moger@amd.com> To: <corbet@lwn.net>, <fenghua.yu@intel.com>, <reinette.chatre@intel.com>, <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com> CC: <x86@kernel.org>, <hpa@zytor.com>, <paulmck@kernel.org>, <rdunlap@infradead.org>, <tj@kernel.org>, <peterz@infradead.org>, <seanjc@google.com>, <kim.phillips@amd.com>, <babu.moger@amd.com>, <jmattson@google.com>, <ilpo.jarvinen@linux.intel.com>, <jithu.joseph@intel.com>, <kan.liang@linux.intel.com>, <nikunj@amd.com>, <daniel.sneddon@linux.intel.com>, <pbonzini@redhat.com>, <rick.p.edgecombe@intel.com>, <rppt@kernel.org>, <maciej.wieczor-retman@intel.com>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <eranian@google.com>, <peternewman@google.com>, <dhagiani@amd.com>, <babu.moger@amd.com> Date: Tue, 12 Dec 2023 12:02:18 -0600 Message-ID: <170240413801.760665.7930294172146734221.stgit@bmoger-ubuntu> In-Reply-To: <20231201005720.235639-1-babu.moger@amd.com> References: <20231201005720.235639-1-babu.moger@amd.com> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D3:EE_|CH2PR12MB4891:EE_ X-MS-Office365-Filtering-Correlation-Id: 980fff2d-40e2-412d-5bb5-08dbfb3c7c99 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nlnqwDLMTf1ukKC8b1v3UVbQg6zS6v3P+aJkmmhyC+SD/b+iU9E1K0aWMVICJAkNjWfcPK+uKshUmUknMGnc8/jq2P6anuad/bXnMU0RP3AH+BhllOYA+3KeJOPVcQndJNigfsezGYHnOsTb4vmilUcWkhvKeA6Hxu1Jwq9Znqw6MILHcd+Zg3zGoqnsO0t3dsjLKcoj0up6PunUyVD8mCqYxs21aCZmYhZGuSUTSg/BooejJncT0B3N8u492bXz+KsoalG9Ptttl2/w+X3rR9oSVgQkVDw0njV0ak7D6DqeL6Epd4Hkw72G8DyrcGRCaPsr087GCp9eJ3dlD9WVOmPoeSNvR3eivNOMV2XrdaR7oz37m22iUcblZqAo8GKdz82DKzN/MNPmvqDZryPkMk6hZtnrHgzax1Hi3eVf3wzdSM1t1hxhl5kCq7FYUPl3mlH/SDrRy+ypJBa8DpmX562olLqaqDtDNoFwHIkQSAbBS2fa5Ntjly0T5/cbkDqgBxkCKS2W0pb3X929oJi6jiCdZnLEgyIDo6crTfDyuSMxQ5hv1/KQvwr9g03rK/ekR0LDxelTVIqj49Dd4Z4PTLanWAwdrCF8fa3N8BK3uqs7OMm+uconWzoSgoLZnVsD9zIufD8RySVONsSBW2/oGLF10Az5IYlQc302EjEQHYUZbHqOKIZhRml1wxbyfRsCCR34L4TdbJ0dUHJ7mJXDU+Cx31rgAehWp0YtWmj6K3oIUvxLiKeN7jnbdHMTVSEAaahV3BFf7RPasr8PZkULPHzsCZj5CFcA39JF9oMMjqod18qem8Gc9j9lFiK07nxaThpVVTYu161q7nY/V2D7eg== 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:(13230031)(4636009)(7916004)(346002)(39860400002)(376002)(396003)(136003)(230922051799003)(451199024)(82310400011)(186009)(1800799012)(64100799003)(36840700001)(40470700004)(46966006)(16576012)(110136005)(316002)(70206006)(70586007)(54906003)(40460700003)(9686003)(41300700001)(16526019)(81166007)(26005)(336012)(426003)(33716001)(82740400003)(86362001)(356005)(103116003)(83380400001)(36860700001)(47076005)(478600001)(966005)(40480700001)(2906002)(44832011)(7416002)(5660300002)(4326008)(8936002)(8676002)(71626019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2023 18:02:20.8841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 980fff2d-40e2-412d-5bb5-08dbfb3c7c99 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: CY4PEPF0000E9D3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4891 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 10:02:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784039105960185124 X-GMAIL-MSGID: 1785100142408561636 |
Series |
[v2,1/2] x86/resctrl: Remove hard-coded memory bandwidth limit
|
|
Commit Message
Moger, Babu
Dec. 12, 2023, 6:02 p.m. UTC
The QOS Memory Bandwidth Enforcement Limit is reported by
CPUID_Fn80000020_EAX_x01 and CPUID_Fn80000020_EAX_x02.
Bits Description
31:0 BW_LEN: Size of the QOS Memory Bandwidth Enforcement Limit.
Newer processors can support higher bandwidth limit than the current
hard-coded value. Remove the hard-coded value and detect using CPUID
command. Also update the register variables eax and edx to match the
AMD CPUID definition.
The CPUID details are documentation in the PPR listed below [1].
[1] Processor Programming Reference (PPR) Vol 1.1 for AMD Family 19h Model
11h B1 - 55901 Rev 0.25.
Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v2: Earlier Sent as a part of ABMC feature.
https://lore.kernel.org/lkml/20231201005720.235639-1-babu.moger@amd.com/
Sending it separate now. Addressed comments from Reinette about registers
being used from Intel definition. Also updated commit message.
---
arch/x86/kernel/cpu/resctrl/core.c | 10 ++++------
arch/x86/kernel/cpu/resctrl/internal.h | 1 -
2 files changed, 4 insertions(+), 7 deletions(-)
Comments
Hi Babu, On 12/12/2023 10:02 AM, Babu Moger wrote: > The QOS Memory Bandwidth Enforcement Limit is reported by > CPUID_Fn80000020_EAX_x01 and CPUID_Fn80000020_EAX_x02. > Bits Description > 31:0 BW_LEN: Size of the QOS Memory Bandwidth Enforcement Limit. > > Newer processors can support higher bandwidth limit than the current > hard-coded value. Remove the hard-coded value and detect using CPUID > command. Also update the register variables eax and edx to match the > AMD CPUID definition. > > The CPUID details are documentation in the PPR listed below [1]. > [1] Processor Programming Reference (PPR) Vol 1.1 for AMD Family 19h Model > 11h B1 - 55901 Rev 0.25. > > Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature") > Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 > Signed-off-by: Babu Moger <babu.moger@amd.com> > > --- Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reinette
Hi Reinette, On 12/14/23 20:20, Reinette Chatre wrote: > Hi Babu, > > On 12/12/2023 10:02 AM, Babu Moger wrote: >> The QOS Memory Bandwidth Enforcement Limit is reported by >> CPUID_Fn80000020_EAX_x01 and CPUID_Fn80000020_EAX_x02. >> Bits Description >> 31:0 BW_LEN: Size of the QOS Memory Bandwidth Enforcement Limit. >> >> Newer processors can support higher bandwidth limit than the current >> hard-coded value. Remove the hard-coded value and detect using CPUID >> command. Also update the register variables eax and edx to match the >> AMD CPUID definition. >> >> The CPUID details are documentation in the PPR listed below [1]. >> [1] Processor Programming Reference (PPR) Vol 1.1 for AMD Family 19h Model >> 11h B1 - 55901 Rev 0.25. >> >> Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature") >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 >> Signed-off-by: Babu Moger <babu.moger@amd.com> >> >> --- > > Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Thank You Babu Moger
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 19e0681f0435..d04371e851b4 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -231,9 +231,7 @@ static bool __get_mem_config_intel(struct rdt_resource *r) 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, subleaf; + u32 eax, ebx, ecx, edx, subleaf; /* * Query CPUID_Fn80000020_EDX_x01 for MBA and @@ -241,9 +239,9 @@ static bool __rdt_get_mem_config_amd(struct rdt_resource *r) */ 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; + cpuid_count(0x80000020, subleaf, &eax, &ebx, &ecx, &edx); + hw_res->num_closid = edx + 1; + r->default_ctrl = 1 << eax; /* AMD does not use delay */ r->membw.delay_linear = false; diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index a4f1aa15f0a2..d2979748fae4 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -18,7 +18,6 @@ #define MBM_OVERFLOW_INTERVAL 1000 #define MAX_MBA_BW 100u #define MBA_IS_LINEAR 0x4 -#define MAX_MBA_BW_AMD 0x800 #define MBM_CNTR_WIDTH_OFFSET_AMD 20 #define RMID_VAL_ERROR BIT_ULL(63)