Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3567811pxb; Mon, 1 Mar 2021 13:36:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwGlcd3T6xI0mXirGt2S4HPEqmv611XDF+s1+9MDm/6CIhWVns0/CbsWx/RsKmX9O5PffgU X-Received: by 2002:a05:6402:84b:: with SMTP id b11mr9169801edz.56.1614634591463; Mon, 01 Mar 2021 13:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614634591; cv=none; d=google.com; s=arc-20160816; b=Q6IIQgeEc68wetUs+RhTC5NqVCCxh9NcsoLb8pdlhsth6HOj26graE3J3nCfK5rmbQ ceBZos5s/ZLDbWKo87Pn7uqF9zhq9zqXcsLhQ4y94z7DyKt46LLFzNh2M+OUYSQHz5c8 gE+CJSxpK5YkbrIBLHVqTMbup6Z9Qzm3xskWu+IlNL7v1P1HtSgUxsoysYDl88DolqcM 503QtLyIBYtkzADZca1Wwp0ySqVXZMTUcR9piga+aTkobZRquxQNU3WQgQPqNHM5Kawc 4XK4huC+DuYwEeN9Kh1O/H9M8SzuxF0S8wrGhzD6Tv78ewSaljoVrxqCtN3X+daz4Lnc ibgg== ARC-Message-Signature: i=1; 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:subject:cc:to :from:dkim-signature; bh=3fYzuneNoj93qKHsBOoC2tPFng3F6dq7RARmXPEbD8s=; b=aSowS5F6lF5aSnjS0JyfOXB/MDwOWk1dAqQlHvTL6Dr2AvFv5j4eUaF/NcYD4/ZmNm V82BCm/9UdP+DkRhdFyYs71x5SbMidUil10DMOcCXFkpH4ORcTDX88hS4JZ6E+IITr0h SjrxUuAQOV0oVb5aX78IQLuPTPzAtJee71MlxYT9DIVjitA9axjHGetHexj87NcaRvyo PrDOP2cRRU7sLKJA5ZhHQ7J9PFIpQ/LwX4mMNvH9o/HbcxCvMvPr8sxvVmEwnuHEk/ey VrdKgFwneR/ifA7b9acKlaLLuam/X4ik6NvdX4A6ZoTBAAB9NZULOdxomv87uCLtOShu i72g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0xVbKnal; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u8si11687456edv.94.2021.03.01.13.36.08; Mon, 01 Mar 2021 13:36:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0xVbKnal; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244331AbhCAVdd (ORCPT + 99 others); Mon, 1 Mar 2021 16:33:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:37365 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236768AbhCARSx (ORCPT ); Mon, 1 Mar 2021 12:18:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A051065054; Mon, 1 Mar 2021 16:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617245; bh=tkdfp6IB7m+q6PeaUkHQqLe3S9J4yE5WveKPf4/Z0FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0xVbKnalpUOidvcH/eN3JZGLc7SIVOPvQSWqjVs8xc8h/clFSjtaspxlC6jqazf8s AJ6mpbyzBDG81Emt2Aj4K9sJ9x8ZzDTYuuKNWftaielgQcc4EztzgkhVAbSjYDJUPn hEj40A5TxrbFmPDl2JGnx4CZY9E5xuLPFFhVT7g4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wendy Wang , Chen Yu , "Rafael J. Wysocki" Subject: [PATCH 4.19 228/247] cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available Date: Mon, 1 Mar 2021 17:14:08 +0100 Message-Id: <20210301161042.850935117@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Yu commit 6f67e060083a84a4cc364eab6ae40c717165fb0c upstream. Currently, when turbo is disabled (either by BIOS or by the user), the intel_pstate driver reads the max non-turbo frequency from the package-wide MSR_PLATFORM_INFO(0xce) register. However, on asymmetric platforms it is possible in theory that small and big core with HWP enabled might have different max non-turbo CPU frequency, because MSR_HWP_CAPABILITIES is per-CPU scope according to Intel Software Developer Manual. The turbo max freq is already per-CPU in current code, so make similar change to the max non-turbo frequency as well. Reported-by: Wendy Wang Signed-off-by: Chen Yu [ rjw: Subject and changelog edits ] Cc: 4.18+ # 4.18+: a45ee4d4e13b: cpufreq: intel_pstate: Change intel_pstate_get_hwp_max() argument Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/intel_pstate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1420,11 +1420,9 @@ static void intel_pstate_max_within_limi static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) { cpu->pstate.min_pstate = pstate_funcs.get_min(); - cpu->pstate.max_pstate = pstate_funcs.get_max(); cpu->pstate.max_pstate_physical = pstate_funcs.get_max_physical(); cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(); cpu->pstate.scaling = pstate_funcs.get_scaling(); - cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling; if (hwp_active && !hwp_mode_bdw) { unsigned int phy_max, current_max; @@ -1432,9 +1430,12 @@ static void intel_pstate_get_cpu_pstates intel_pstate_get_hwp_max(cpu->cpu, &phy_max, ¤t_max); cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling; cpu->pstate.turbo_pstate = phy_max; + cpu->pstate.max_pstate = HWP_GUARANTEED_PERF(READ_ONCE(cpu->hwp_cap_cached)); } else { cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling; + cpu->pstate.max_pstate = pstate_funcs.get_max(); } + cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling; if (pstate_funcs.get_aperf_mperf_shift) cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift();