Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3975936pxb; Tue, 2 Mar 2021 03:37:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8v6iiYYTaftnCIJKTfrvBqLI1xGlvkHxCrhUgWNBzUJBkx5Ws0GUF7Vi23iVhZc2bjYwW X-Received: by 2002:a17:906:cc89:: with SMTP id oq9mr9172456ejb.258.1614685057901; Tue, 02 Mar 2021 03:37:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614685057; cv=none; d=google.com; s=arc-20160816; b=KRbeoDY1FTunT0xErfP+m5gX0ywxYChLFQ81JcU7PeStkjy6i2SX3MWM1+R8t8u/AX 1OaYJoQnIfLdMr9+Od5C/QDSOBeqsSWobwDzCOBbwdGrn0c41fOn0C2k1RAe8KST8sCC gnqb/HagdvGAmiTHc1zVj/K7fvp7WZpbCidWCLQKHkKy6mpa9lKSM2FFCsHG5qGTApWH iPLOszpf3s38k8dMC33aL6Iujug0mUYUwYW3hYkubk6UEFeLDXKNcWZZhm3TZl0qpLn9 0YIxlMza3ckRhI0nk7yvo57vRGCGxe9yupl8b7AG/AUWxRke2acKCzGVPbloHEPwY3BO VEuA== 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=YL5AnyHIdpgXGPrDlaZ/l1aU0/XlEtzPbmilsz8u7tY=; b=UnWPf3hAqDP/ibjGJLmBWPxEgkMdYUQ7xOZuuDPwSwZbbz//Txf9etbrBBu/GZA5+F rWYPnispaMK3GE6AXokLEf0FRUb9CBH7ulWrnb2ZihsbSW8XJvvHcGWoDLXWM4hEX0CZ 9WypskrBSoQNJdmPIvndaMmKqbmkZBwuLKAWKE3uVVVIyaYrM43slEZ7T8ZptOFq5QCe VJXPM+vHTKL+Uk5gKGGkBU0Y9vgRzENePMaw4DKj+VJq8ZPVjDWepOgdE0DYEp1Z+YO8 NJao/LBAm3vEK9pWe+IW7rZ3cq24DeEu7o2IOX5d7CvcW5+gLbFs7+Mo7v5rMramRejZ 2hGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R2YbpI6n; 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 cx24si5173509edb.541.2021.03.02.03.37.14; Tue, 02 Mar 2021 03:37:37 -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=R2YbpI6n; 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 S241504AbhCBCIi (ORCPT + 99 others); Mon, 1 Mar 2021 21:08:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:50732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242087AbhCATfJ (ORCPT ); Mon, 1 Mar 2021 14:35:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCF95652A3; Mon, 1 Mar 2021 17:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619990; bh=wgaXRl/06iB34Dd8qvi3yLsKhPmctgt8Zt6Hw5hdfrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2YbpI6nirC0rGtNuDvs/KwZBaIx/0Gl/C0+Vk4HNH/KmrToBVAQvRGUIlqgOs72J eM/1z/qgTVAmyO5++/AMNZQn0edmiXqAXel91uvs+LtBttAWKAXpNG1A5SAicQtkvz jHS77LDV+Ly/QtiKVR6UP1rv4ccF5YuW3gjPN2DA= 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 5.10 624/663] cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available Date: Mon, 1 Mar 2021 17:14:32 +0100 Message-Id: <20210301161212.720847259@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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 @@ -1724,11 +1724,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; @@ -1736,9 +1734,12 @@ static void intel_pstate_get_cpu_pstates intel_pstate_get_hwp_max(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();