Message ID | 0409d40c500eeb8d4d84ecb028b73f2eee147822.1706255676.git.perry.yuan@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-39742-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp537705dyb; Fri, 26 Jan 2024 01:16:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNiZrI1kQYUPdR9PV3wSHq8qSGf2frkIv9Pj2UQs/NGl0gP7Wx/Kgz7bqDQwdKHc7EeDVU X-Received: by 2002:a17:902:c94d:b0:1d7:5da2:90a9 with SMTP id i13-20020a170902c94d00b001d75da290a9mr1101127pla.5.1706260598413; Fri, 26 Jan 2024 01:16:38 -0800 (PST) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n12-20020a170902d2cc00b001d556872df5si831191plc.335.2024.01.26.01.16.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 01:16:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39742-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=rmVw5GMi; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-39742-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39742-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 38120B2487A for <ouuuleilei@gmail.com>; Fri, 26 Jan 2024 09:11:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80A21679F6; Fri, 26 Jan 2024 08:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="rmVw5GMi" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2047.outbound.protection.outlook.com [40.107.220.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0921A66B5E; Fri, 26 Jan 2024 08:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706256532; cv=fail; b=kuMr2JAhpyROl16qyPy/09jpHVH1/tiSjZq2ZPiAaPr72PRV3sx3c24IqOKVDueRXFbvXVo4jNOsgG1ZK6WLr/n/fVURCmYcJCNJRkcXLsjhhjBDzEBTFXV+FF1QM5lpAlUmgibS44tJZSqp5rJ1ehJAvvU+DUA5rb26yMWmcVQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706256532; c=relaxed/simple; bh=FQhdeqBABGQevdCOeKTLkYQntoXQSjVMSy2guOjCtEo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tz+q4eu1dSbpYMWqw4xWDmUZiOeVfXKVwJMw9T6Tn6HjeVFdMJI9+fNsYDh/Yz81W2yA2L7n4r77fatf/aaBq/9Vk9QrtuLUa/GyF5c9frFQgWk3cHppBcwy4AJVkLRsvnJ00l3ZpYwVxyqHnWvUtF+Kuu0huiDQ/zvaU3Wr9pM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=rmVw5GMi; arc=fail smtp.client-ip=40.107.220.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dwCCIDE9eh4jt+1YhEahxVaVanfxeUiGZY/WUDbsPT7uyFDyCkmw1NmEIvQxaYItBiJYh3SG5aJo6qj+Uks9RAA+FTEYZ06M/IzuFIJErOc3N55rYm3VuTaSMXrUXL9eRW1z5a6j87AEzyRgK63R4zz18MwN+/MTH0e5eLpgzIi6UTAAJJrD2xgN91BHESELxD0SYM5V1JzJS5IhXO1gkLz2xNsKKNfxrY13Xh9mA0PDl4FepYGYWamTM/tACSL5vCa25BDfrnl+3OzRIMjxxmGDchnooVShMOBEdwYZBme6tKHIh/BkyEpjbgoCXBlzEZDgm6XLuB1fVTgLkv5kKA== 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=SQ4JdInETrt07iGA7sHRatZnkDgbYvAn5F5tTGvZ52Q=; b=fl3uVVT2hWm/udFiRlh1RX3HhzRZlxTtrL2EinEUErGF6PjM4Myvv77webjzlQhdDWSw8ZZZuPh3cjF9I9ZpL+YBoLjG1Ot3vtkc7Xrv1EUnIJseNrwnv23NznDxpFVggRNy9GJr1Ayze9U964POh0Qud/4Zjy30L4dsPoBjKhnIkPJmPmo8ILntl8HUydfF34W8ld/nq0EY11MK1bxvv+AR0E6+1kaxJkWvripbHNcXBEwv6MKrKBby8Vfdajmoyu6QwK7X/KjrwFG6c+8boCziaruC6jBY9Q38MpubAOfJKuj5Ltsmh8bxCN1xtlmRue3Cn9YE6A8l5s4+ntwPVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=SQ4JdInETrt07iGA7sHRatZnkDgbYvAn5F5tTGvZ52Q=; b=rmVw5GMi3nEgbJZIPVKtp0Q/wuq9OxriyMgEoBlCbfK3o5v3nFxLFW8wf9VC7FDTIWsbOWCi1GpKdTqvmt8AqrgUw1HSA9YCwQnPful+E90v9d5VJwNnCt/ybGWtQ0Qdj2xMzU0S/10k385YUe34lvtuVIhBCkHxlxWLgbAiHS4= Received: from BYAPR01CA0026.prod.exchangelabs.com (2603:10b6:a02:80::39) by MW4PR12MB6874.namprd12.prod.outlook.com (2603:10b6:303:20b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.26; Fri, 26 Jan 2024 08:08:49 +0000 Received: from CO1PEPF000044F4.namprd05.prod.outlook.com (2603:10b6:a02:80:cafe::1) by BYAPR01CA0026.outlook.office365.com (2603:10b6:a02:80::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.27 via Frontend Transport; Fri, 26 Jan 2024 08:08:48 +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 CO1PEPF000044F4.mail.protection.outlook.com (10.167.241.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7228.16 via Frontend Transport; Fri, 26 Jan 2024 08:08:48 +0000 Received: from pyuan-Chachani-VN.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.2507.34; Fri, 26 Jan 2024 02:08:45 -0600 From: Perry Yuan <perry.yuan@amd.com> To: <rafael.j.wysocki@intel.com>, <Mario.Limonciello@amd.com>, <viresh.kumar@linaro.org>, <Ray.Huang@amd.com>, <gautham.shenoy@amd.com>, <Borislav.Petkov@amd.com> CC: <Alexander.Deucher@amd.com>, <Xinmei.Huang@amd.com>, <Xiaojian.Du@amd.com>, <Li.Meng@amd.com>, <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH 2/7] cpufreq: amd-pstate: initialize new core precision boost state Date: Fri, 26 Jan 2024 16:08:05 +0800 Message-ID: <0409d40c500eeb8d4d84ecb028b73f2eee147822.1706255676.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <cover.1706255676.git.perry.yuan@amd.com> References: <cover.1706255676.git.perry.yuan@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: CO1PEPF000044F4:EE_|MW4PR12MB6874:EE_ X-MS-Office365-Filtering-Correlation-Id: 8eea2675-04a7-418e-b15b-08dc1e4606a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V5zK1ierk8sOlVnX9vjIQCtDXg8JiKBCFlugzlneldIl0lttngyG5YpNg3oFak1ZkT5kYxohK8izdXOtLMCuqNaZLYUfu5vgmxqip7YjCIWzUndd+Pj7nMGfYBKXqamYqF75mbwENyUtQOJJyOv+iId6FnHmfkRtYfZZT/jnUAqDXSSkebanacrZi1a6qvI/791m7iCaI3Cqeyhl9gFudk5xnSka5OSPkBtqJhdY2IB52O0rr4kgU18SyF3z/rlLmnHNIDxOyeZV0XBafBIRGzzmvPg/DnX65iWHw4f2ehmhSaewbC334ltGi9JIjkGdivjP75osbRzOmrQdNGh8e/0HYJWK1zEvodhpssqd8Wk1EuEgLJIIcBalRXJjB+ZiE1XER4KydUnzkvt71WV6rLjmEk1xiRMpvblNFJPZEmFbq/LV9eQXseEDXT4WJ1HEsz9V72nDsGbvA7a0xtPiEOuwWYYZ1D8haJpsmk/VAtvYSXBa5l3RuGDgMZvXwDrBCyRZpTx/9ZWjd8bGqEHxdyJc7z6j4UyRFM4zBuy2XYQGcfCyREtsBdcv6ft2s7VnRLb9QSG7m+DitygXjokHE6mH5qB/bEoZINhEvWQYYiZOXMhgIE0fEKtyGAbuEflmu2gEG91waVut+JDvnlB5jzkn+3Xj4cezk7tKvJdJHY61GJP3hsA5sHP7jF+/bDAXuNkP0wvLrkCNjnUPpfJEQiRdfcfV1eFsqirL/g7YUeMmmo9xeyK+LARGARwZDt39Qq/90br8UWAkJK58CTzlGMdESPtGpKStsWwUYTMfgPU= 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)(39860400002)(376002)(346002)(396003)(136003)(230922051799003)(82310400011)(64100799003)(451199024)(186009)(1800799012)(40470700004)(46966006)(36840700001)(41300700001)(83380400001)(426003)(4326008)(336012)(26005)(2616005)(7696005)(82740400003)(36860700001)(110136005)(81166007)(44832011)(966005)(8676002)(47076005)(5660300002)(8936002)(16526019)(316002)(2906002)(6666004)(54906003)(6636002)(478600001)(70206006)(70586007)(86362001)(356005)(36756003)(40480700001)(40460700003)(518174003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 08:08:48.6074 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8eea2675-04a7-418e-b15b-08dc1e4606a2 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: CO1PEPF000044F4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6874 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789143913563670946 X-GMAIL-MSGID: 1789143913563670946 |
Series |
AMD Pstate Driver Core Performance Boost
|
|
Commit Message
Yuan, Perry
Jan. 26, 2024, 8:08 a.m. UTC
From: Perry Yuan <Perry.Yuan@amd.com> Add gloal global_params to represent current CPU Performance Boost(cpb) state for cpu frequency scaling, both active and passive modes all can support CPU cores frequency boosting control which is based on the BIOS setting, while BIOS turn on the "Core Performance Boost", it will allow OS control each core highest perf limitation from OS side. If core performance boost is disabled while a core is in a boosted P-state, the core transitions to the highest performance non-boosted P-state, that is the same as the nominal frequency limit. Issue: https://bugzilla.kernel.org/show_bug.cgi?id=217931 Reported-by: Artem S. Tashkinov" <aros@gmx.com> Signed-off-by: Perry Yuan <Perry.Yuan@amd.com> --- drivers/cpufreq/amd-pstate.c | 46 ++++++++++++++++++++++++++++-------- include/linux/amd-pstate.h | 1 - 2 files changed, 36 insertions(+), 11 deletions(-)
Comments
On 1/26/2024 02:08, Perry Yuan wrote: > From: Perry Yuan <Perry.Yuan@amd.com> > > Add gloal global_params to represent current CPU Performance Boost(cpb) > state for cpu frequency scaling, both active and passive modes all can > support CPU cores frequency boosting control which is based on the BIOS > setting, while BIOS turn on the "Core Performance Boost", it will > allow OS control each core highest perf limitation from OS side. > > If core performance boost is disabled while a core is in a boosted P-state, > the core transitions to the highest performance non-boosted P-state, > that is the same as the nominal frequency limit. > > Issue: https://bugzilla.kernel.org/show_bug.cgi?id=217931 Rather than "Issue" this should be "Closes:", and the tag should come right after the Reported-by tag. > Reported-by: Artem S. Tashkinov" <aros@gmx.com> > Signed-off-by: Perry Yuan <Perry.Yuan@amd.com> > --- > drivers/cpufreq/amd-pstate.c | 46 ++++++++++++++++++++++++++++-------- > include/linux/amd-pstate.h | 1 - > 2 files changed, 36 insertions(+), 11 deletions(-) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 8f308f56ade6..0dc9124140d4 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -65,6 +65,19 @@ static struct cpufreq_driver amd_pstate_epp_driver; > static int cppc_state = AMD_PSTATE_UNDEFINED; > static bool cppc_enabled; > > +/** > + * struct global_params - Global parameters, mostly tunable via sysfs. > + * @cpb_boost: Whether or not to use boost CPU P-states. > + * @cpb_supported: Whether or not CPU boost P-states are available > + * based on the MSR_K7_HWCR bit[25] state > + */ > +struct global_params { > + bool cpb_boost; > + bool cpb_supported; > +}; > + > +static struct global_params global; > + > /* > * AMD Energy Preference Performance (EPP) > * The EPP is used in the CCLK DPM controller to drive > @@ -632,18 +645,27 @@ static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) > return lowest_nonlinear_freq * 1000; > } > > -static void amd_pstate_boost_init(struct amd_cpudata *cpudata) > +static int amd_pstate_boost_init(struct amd_cpudata *cpudata) > { > - u32 highest_perf, nominal_perf; > + u64 boost_state, boost_val; > + int ret; > > - highest_perf = READ_ONCE(cpudata->highest_perf); > - nominal_perf = READ_ONCE(cpudata->nominal_perf); > + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_K7_HWCR, &boost_val); > + if (ret) { > + pr_err_once("failed to read initial CPU boost state!\n"); > + return ret; > + } > > - if (highest_perf <= nominal_perf) > - return; > + boost_state = (boost_val >> 25) & 0x1; > + if (!boost_state) { > + global.cpb_supported = true; > + global.cpb_boost = true; > + } else { > + global.cpb_supported = false; > + global.cpb_boost = false; > + } Seems like a lot of lines and an extra variable that could be simplified down to just: global.cpb_supported = (boost_val >> 25) & 0x1; global.cpb_boost = global.cpb_supported; > > - cpudata->boost_supported = true; > - current_pstate_driver->boost_enabled = true; > + return ret; > } > > static void amd_perf_ctl_reset(unsigned int cpu) > @@ -676,6 +698,9 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) > if (ret) > goto free_cpudata1; > > + /* initialize cpu cores boot state */ > + amd_pstate_boost_init(cpudata); > + > min_freq = amd_get_min_freq(cpudata); > max_freq = amd_get_max_freq(cpudata); > nominal_freq = amd_get_nominal_freq(cpudata); > @@ -725,7 +750,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) > > policy->driver_data = cpudata; > > - amd_pstate_boost_init(cpudata); > if (!current_pstate_driver->adjust_perf) > current_pstate_driver->adjust_perf = amd_pstate_adjust_perf; > > @@ -1093,6 +1117,9 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) > if (ret) > goto free_cpudata1; > > + /* initialize cpu cores boot state */ > + amd_pstate_boost_init(cpudata); > + > min_freq = amd_get_min_freq(cpudata); > max_freq = amd_get_max_freq(cpudata); > nominal_freq = amd_get_nominal_freq(cpudata); > @@ -1143,7 +1170,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) > return ret; > WRITE_ONCE(cpudata->cppc_cap1_cached, value); > } > - amd_pstate_boost_init(cpudata); > > return 0; > > diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h > index 446394f84606..66d939a344b1 100644 > --- a/include/linux/amd-pstate.h > +++ b/include/linux/amd-pstate.h > @@ -80,7 +80,6 @@ struct amd_cpudata { > struct amd_aperf_mperf prev; > > u64 freq; > - bool boost_supported; > > /* EPP feature related attributes*/ > s16 epp_policy;
Hi Perry,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/acpi-bus]
[also build test ERROR on v6.8-rc1 next-20240125]
[cannot apply to rafael-pm/linux-next linus/master rafael-pm/devprop]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Perry-Yuan/cpufreq-amd-pstate-remove-set_boost-callback-for-passive-mode/20240126-171412
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git acpi-bus
patch link: https://lore.kernel.org/r/0409d40c500eeb8d4d84ecb028b73f2eee147822.1706255676.git.perry.yuan%40amd.com
patch subject: [PATCH 2/7] cpufreq: amd-pstate: initialize new core precision boost state
config: i386-randconfig-141-20240127 (https://download.01.org/0day-ci/archive/20240128/202401280215.WvGTuIEq-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240128/202401280215.WvGTuIEq-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401280215.WvGTuIEq-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/cpufreq/amd-pstate-ut.c: In function 'amd_pstate_ut_check_freq':
>> drivers/cpufreq/amd-pstate-ut.c:229:28: error: 'struct amd_cpudata' has no member named 'boost_supported'
229 | if (cpudata->boost_supported) {
| ^~
In file included from drivers/cpufreq/amd-pstate-ut.c:29:
include/linux/amd-pstate.h: At top level:
include/linux/amd-pstate.h:104:27: warning: 'amd_pstate_mode_string' defined but not used [-Wunused-const-variable=]
104 | static const char * const amd_pstate_mode_string[] = {
| ^~~~~~~~~~~~~~~~~~~~~~
vim +229 drivers/cpufreq/amd-pstate-ut.c
14eb1c96e3a3fd Meng Li 2022-08-17 193
14eb1c96e3a3fd Meng Li 2022-08-17 194 /*
14eb1c96e3a3fd Meng Li 2022-08-17 195 * Check if frequency values are reasonable.
14eb1c96e3a3fd Meng Li 2022-08-17 196 * max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0
14eb1c96e3a3fd Meng Li 2022-08-17 197 * check max freq when set support boost mode.
14eb1c96e3a3fd Meng Li 2022-08-17 198 */
14eb1c96e3a3fd Meng Li 2022-08-17 199 static void amd_pstate_ut_check_freq(u32 index)
14eb1c96e3a3fd Meng Li 2022-08-17 200 {
14eb1c96e3a3fd Meng Li 2022-08-17 201 int cpu = 0;
14eb1c96e3a3fd Meng Li 2022-08-17 202 struct cpufreq_policy *policy = NULL;
14eb1c96e3a3fd Meng Li 2022-08-17 203 struct amd_cpudata *cpudata = NULL;
14eb1c96e3a3fd Meng Li 2022-08-17 204
14eb1c96e3a3fd Meng Li 2022-08-17 205 for_each_possible_cpu(cpu) {
14eb1c96e3a3fd Meng Li 2022-08-17 206 policy = cpufreq_cpu_get(cpu);
14eb1c96e3a3fd Meng Li 2022-08-17 207 if (!policy)
14eb1c96e3a3fd Meng Li 2022-08-17 208 break;
14eb1c96e3a3fd Meng Li 2022-08-17 209 cpudata = policy->driver_data;
14eb1c96e3a3fd Meng Li 2022-08-17 210
14eb1c96e3a3fd Meng Li 2022-08-17 211 if (!((cpudata->max_freq >= cpudata->nominal_freq) &&
14eb1c96e3a3fd Meng Li 2022-08-17 212 (cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) &&
14eb1c96e3a3fd Meng Li 2022-08-17 213 (cpudata->lowest_nonlinear_freq > cpudata->min_freq) &&
14eb1c96e3a3fd Meng Li 2022-08-17 214 (cpudata->min_freq > 0))) {
14eb1c96e3a3fd Meng Li 2022-08-17 215 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 216 pr_err("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect!\n",
14eb1c96e3a3fd Meng Li 2022-08-17 217 __func__, cpu, cpudata->max_freq, cpudata->nominal_freq,
14eb1c96e3a3fd Meng Li 2022-08-17 218 cpudata->lowest_nonlinear_freq, cpudata->min_freq);
60dd283804479c Swapnil Sapkal 2023-08-18 219 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 220 }
14eb1c96e3a3fd Meng Li 2022-08-17 221
14eb1c96e3a3fd Meng Li 2022-08-17 222 if (cpudata->min_freq != policy->min) {
14eb1c96e3a3fd Meng Li 2022-08-17 223 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 224 pr_err("%s cpu%d cpudata_min_freq=%d policy_min=%d, they should be equal!\n",
14eb1c96e3a3fd Meng Li 2022-08-17 225 __func__, cpu, cpudata->min_freq, policy->min);
60dd283804479c Swapnil Sapkal 2023-08-18 226 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 227 }
14eb1c96e3a3fd Meng Li 2022-08-17 228
14eb1c96e3a3fd Meng Li 2022-08-17 @229 if (cpudata->boost_supported) {
14eb1c96e3a3fd Meng Li 2022-08-17 230 if ((policy->max == cpudata->max_freq) ||
14eb1c96e3a3fd Meng Li 2022-08-17 231 (policy->max == cpudata->nominal_freq))
14eb1c96e3a3fd Meng Li 2022-08-17 232 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
14eb1c96e3a3fd Meng Li 2022-08-17 233 else {
14eb1c96e3a3fd Meng Li 2022-08-17 234 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 235 pr_err("%s cpu%d policy_max=%d should be equal cpu_max=%d or cpu_nominal=%d !\n",
14eb1c96e3a3fd Meng Li 2022-08-17 236 __func__, cpu, policy->max, cpudata->max_freq,
14eb1c96e3a3fd Meng Li 2022-08-17 237 cpudata->nominal_freq);
60dd283804479c Swapnil Sapkal 2023-08-18 238 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 239 }
14eb1c96e3a3fd Meng Li 2022-08-17 240 } else {
14eb1c96e3a3fd Meng Li 2022-08-17 241 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 242 pr_err("%s cpu%d must support boost!\n", __func__, cpu);
60dd283804479c Swapnil Sapkal 2023-08-18 243 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 244 }
60dd283804479c Swapnil Sapkal 2023-08-18 245 cpufreq_cpu_put(policy);
14eb1c96e3a3fd Meng Li 2022-08-17 246 }
14eb1c96e3a3fd Meng Li 2022-08-17 247
14eb1c96e3a3fd Meng Li 2022-08-17 248 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
60dd283804479c Swapnil Sapkal 2023-08-18 249 return;
60dd283804479c Swapnil Sapkal 2023-08-18 250 skip_test:
60dd283804479c Swapnil Sapkal 2023-08-18 251 cpufreq_cpu_put(policy);
14eb1c96e3a3fd Meng Li 2022-08-17 252 }
14eb1c96e3a3fd Meng Li 2022-08-17 253
Hi Perry,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/acpi-bus]
[also build test ERROR on v6.8-rc3]
[cannot apply to rafael-pm/linux-next linus/master rafael-pm/devprop next-20240209]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Perry-Yuan/cpufreq-amd-pstate-remove-set_boost-callback-for-passive-mode/20240126-171412
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git acpi-bus
patch link: https://lore.kernel.org/r/0409d40c500eeb8d4d84ecb028b73f2eee147822.1706255676.git.perry.yuan%40amd.com
patch subject: [PATCH 2/7] cpufreq: amd-pstate: initialize new core precision boost state
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240212/202402120216.mjdQyGCs-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240212/202402120216.mjdQyGCs-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402120216.mjdQyGCs-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/cpufreq/amd-pstate-ut.c:229:16: error: no member named 'boost_supported' in 'struct amd_cpudata'
229 | if (cpudata->boost_supported) {
| ~~~~~~~ ^
1 error generated.
vim +229 drivers/cpufreq/amd-pstate-ut.c
14eb1c96e3a3fd Meng Li 2022-08-17 193
14eb1c96e3a3fd Meng Li 2022-08-17 194 /*
14eb1c96e3a3fd Meng Li 2022-08-17 195 * Check if frequency values are reasonable.
14eb1c96e3a3fd Meng Li 2022-08-17 196 * max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0
14eb1c96e3a3fd Meng Li 2022-08-17 197 * check max freq when set support boost mode.
14eb1c96e3a3fd Meng Li 2022-08-17 198 */
14eb1c96e3a3fd Meng Li 2022-08-17 199 static void amd_pstate_ut_check_freq(u32 index)
14eb1c96e3a3fd Meng Li 2022-08-17 200 {
14eb1c96e3a3fd Meng Li 2022-08-17 201 int cpu = 0;
14eb1c96e3a3fd Meng Li 2022-08-17 202 struct cpufreq_policy *policy = NULL;
14eb1c96e3a3fd Meng Li 2022-08-17 203 struct amd_cpudata *cpudata = NULL;
14eb1c96e3a3fd Meng Li 2022-08-17 204
14eb1c96e3a3fd Meng Li 2022-08-17 205 for_each_possible_cpu(cpu) {
14eb1c96e3a3fd Meng Li 2022-08-17 206 policy = cpufreq_cpu_get(cpu);
14eb1c96e3a3fd Meng Li 2022-08-17 207 if (!policy)
14eb1c96e3a3fd Meng Li 2022-08-17 208 break;
14eb1c96e3a3fd Meng Li 2022-08-17 209 cpudata = policy->driver_data;
14eb1c96e3a3fd Meng Li 2022-08-17 210
14eb1c96e3a3fd Meng Li 2022-08-17 211 if (!((cpudata->max_freq >= cpudata->nominal_freq) &&
14eb1c96e3a3fd Meng Li 2022-08-17 212 (cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) &&
14eb1c96e3a3fd Meng Li 2022-08-17 213 (cpudata->lowest_nonlinear_freq > cpudata->min_freq) &&
14eb1c96e3a3fd Meng Li 2022-08-17 214 (cpudata->min_freq > 0))) {
14eb1c96e3a3fd Meng Li 2022-08-17 215 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 216 pr_err("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect!\n",
14eb1c96e3a3fd Meng Li 2022-08-17 217 __func__, cpu, cpudata->max_freq, cpudata->nominal_freq,
14eb1c96e3a3fd Meng Li 2022-08-17 218 cpudata->lowest_nonlinear_freq, cpudata->min_freq);
60dd283804479c Swapnil Sapkal 2023-08-18 219 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 220 }
14eb1c96e3a3fd Meng Li 2022-08-17 221
14eb1c96e3a3fd Meng Li 2022-08-17 222 if (cpudata->min_freq != policy->min) {
14eb1c96e3a3fd Meng Li 2022-08-17 223 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 224 pr_err("%s cpu%d cpudata_min_freq=%d policy_min=%d, they should be equal!\n",
14eb1c96e3a3fd Meng Li 2022-08-17 225 __func__, cpu, cpudata->min_freq, policy->min);
60dd283804479c Swapnil Sapkal 2023-08-18 226 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 227 }
14eb1c96e3a3fd Meng Li 2022-08-17 228
14eb1c96e3a3fd Meng Li 2022-08-17 @229 if (cpudata->boost_supported) {
14eb1c96e3a3fd Meng Li 2022-08-17 230 if ((policy->max == cpudata->max_freq) ||
14eb1c96e3a3fd Meng Li 2022-08-17 231 (policy->max == cpudata->nominal_freq))
14eb1c96e3a3fd Meng Li 2022-08-17 232 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
14eb1c96e3a3fd Meng Li 2022-08-17 233 else {
14eb1c96e3a3fd Meng Li 2022-08-17 234 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 235 pr_err("%s cpu%d policy_max=%d should be equal cpu_max=%d or cpu_nominal=%d !\n",
14eb1c96e3a3fd Meng Li 2022-08-17 236 __func__, cpu, policy->max, cpudata->max_freq,
14eb1c96e3a3fd Meng Li 2022-08-17 237 cpudata->nominal_freq);
60dd283804479c Swapnil Sapkal 2023-08-18 238 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 239 }
14eb1c96e3a3fd Meng Li 2022-08-17 240 } else {
14eb1c96e3a3fd Meng Li 2022-08-17 241 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
14eb1c96e3a3fd Meng Li 2022-08-17 242 pr_err("%s cpu%d must support boost!\n", __func__, cpu);
60dd283804479c Swapnil Sapkal 2023-08-18 243 goto skip_test;
14eb1c96e3a3fd Meng Li 2022-08-17 244 }
60dd283804479c Swapnil Sapkal 2023-08-18 245 cpufreq_cpu_put(policy);
14eb1c96e3a3fd Meng Li 2022-08-17 246 }
14eb1c96e3a3fd Meng Li 2022-08-17 247
14eb1c96e3a3fd Meng Li 2022-08-17 248 amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
60dd283804479c Swapnil Sapkal 2023-08-18 249 return;
60dd283804479c Swapnil Sapkal 2023-08-18 250 skip_test:
60dd283804479c Swapnil Sapkal 2023-08-18 251 cpufreq_cpu_put(policy);
14eb1c96e3a3fd Meng Li 2022-08-17 252 }
14eb1c96e3a3fd Meng Li 2022-08-17 253
Hello Perry, On Fri, Jan 26, 2024 at 04:08:05PM +0800, Perry Yuan wrote: > From: Perry Yuan <Perry.Yuan@amd.com> [..snip..] > @@ -632,18 +645,27 @@ static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) > return lowest_nonlinear_freq * 1000; > } > > -static void amd_pstate_boost_init(struct amd_cpudata *cpudata) > +static int amd_pstate_boost_init(struct amd_cpudata *cpudata) > { > - u32 highest_perf, nominal_perf; > + u64 boost_state, boost_val; > + int ret; > > - highest_perf = READ_ONCE(cpudata->highest_perf); > - nominal_perf = READ_ONCE(cpudata->nominal_perf); > + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_K7_HWCR, &boost_val); Use hwcr_val instead of boost_val ? > + if (ret) { > + pr_err_once("failed to read initial CPU boost state!\n"); > + return ret; > + } > > - if (highest_perf <= nominal_perf) > - return; > + boost_state = (boost_val >> 25) & 0x1; How about the following ? boost_disabled = (hwcr_val & MSR_K7_HWCR_CPB_DIS); > + if (!boost_state) { if (!boost_disabled) { > + global.cpb_supported = true; > + global.cpb_boost = true; > + } else { > + global.cpb_supported = false; > + global.cpb_boost = false; > + } > > - cpudata->boost_supported = true; > - current_pstate_driver->boost_enabled = true; > + return ret; > } > > static void amd_perf_ctl_reset(unsigned int cpu) > @@ -676,6 +698,9 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) > if (ret) > goto free_cpudata1; > > + /* initialize cpu cores boot state */ > + amd_pstate_boost_init(cpudata); > + > min_freq = amd_get_min_freq(cpudata); > max_freq = amd_get_max_freq(cpudata); > nominal_freq = amd_get_nominal_freq(cpudata); > @@ -725,7 +750,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) > > policy->driver_data = cpudata; > > - amd_pstate_boost_init(cpudata); > if (!current_pstate_driver->adjust_perf) > current_pstate_driver->adjust_perf = amd_pstate_adjust_perf; > > @@ -1093,6 +1117,9 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) > if (ret) > goto free_cpudata1; > > + /* initialize cpu cores boot state */ > + amd_pstate_boost_init(cpudata); > + > min_freq = amd_get_min_freq(cpudata); > max_freq = amd_get_max_freq(cpudata); > nominal_freq = amd_get_nominal_freq(cpudata); > @@ -1143,7 +1170,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) > return ret; > WRITE_ONCE(cpudata->cppc_cap1_cached, value); > } > - amd_pstate_boost_init(cpudata); > > return 0; > > diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h > index 446394f84606..66d939a344b1 100644 > --- a/include/linux/amd-pstate.h > +++ b/include/linux/amd-pstate.h > @@ -80,7 +80,6 @@ struct amd_cpudata { > struct amd_aperf_mperf prev; > > u64 freq; > - bool boost_supported; > > /* EPP feature related attributes*/ > s16 epp_policy; > -- > 2.34.1 > Otherwise looks good to me. -- Thanks and Regards gautham.
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 8f308f56ade6..0dc9124140d4 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -65,6 +65,19 @@ static struct cpufreq_driver amd_pstate_epp_driver; static int cppc_state = AMD_PSTATE_UNDEFINED; static bool cppc_enabled; +/** + * struct global_params - Global parameters, mostly tunable via sysfs. + * @cpb_boost: Whether or not to use boost CPU P-states. + * @cpb_supported: Whether or not CPU boost P-states are available + * based on the MSR_K7_HWCR bit[25] state + */ +struct global_params { + bool cpb_boost; + bool cpb_supported; +}; + +static struct global_params global; + /* * AMD Energy Preference Performance (EPP) * The EPP is used in the CCLK DPM controller to drive @@ -632,18 +645,27 @@ static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) return lowest_nonlinear_freq * 1000; } -static void amd_pstate_boost_init(struct amd_cpudata *cpudata) +static int amd_pstate_boost_init(struct amd_cpudata *cpudata) { - u32 highest_perf, nominal_perf; + u64 boost_state, boost_val; + int ret; - highest_perf = READ_ONCE(cpudata->highest_perf); - nominal_perf = READ_ONCE(cpudata->nominal_perf); + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_K7_HWCR, &boost_val); + if (ret) { + pr_err_once("failed to read initial CPU boost state!\n"); + return ret; + } - if (highest_perf <= nominal_perf) - return; + boost_state = (boost_val >> 25) & 0x1; + if (!boost_state) { + global.cpb_supported = true; + global.cpb_boost = true; + } else { + global.cpb_supported = false; + global.cpb_boost = false; + } - cpudata->boost_supported = true; - current_pstate_driver->boost_enabled = true; + return ret; } static void amd_perf_ctl_reset(unsigned int cpu) @@ -676,6 +698,9 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) if (ret) goto free_cpudata1; + /* initialize cpu cores boot state */ + amd_pstate_boost_init(cpudata); + min_freq = amd_get_min_freq(cpudata); max_freq = amd_get_max_freq(cpudata); nominal_freq = amd_get_nominal_freq(cpudata); @@ -725,7 +750,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) policy->driver_data = cpudata; - amd_pstate_boost_init(cpudata); if (!current_pstate_driver->adjust_perf) current_pstate_driver->adjust_perf = amd_pstate_adjust_perf; @@ -1093,6 +1117,9 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) if (ret) goto free_cpudata1; + /* initialize cpu cores boot state */ + amd_pstate_boost_init(cpudata); + min_freq = amd_get_min_freq(cpudata); max_freq = amd_get_max_freq(cpudata); nominal_freq = amd_get_nominal_freq(cpudata); @@ -1143,7 +1170,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) return ret; WRITE_ONCE(cpudata->cppc_cap1_cached, value); } - amd_pstate_boost_init(cpudata); return 0; diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index 446394f84606..66d939a344b1 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -80,7 +80,6 @@ struct amd_cpudata { struct amd_aperf_mperf prev; u64 freq; - bool boost_supported; /* EPP feature related attributes*/ s16 epp_policy;