Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp565668pxb; Wed, 3 Mar 2021 09:40:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJsZDRyTXuWlPrIJF/yyKasmJudbyhrtvCvi5RKWZ61suyZ70JhHlGh0JtkIBnTvWL5pju X-Received: by 2002:a17:906:2803:: with SMTP id r3mr26754048ejc.50.1614793213611; Wed, 03 Mar 2021 09:40:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614793213; cv=none; d=google.com; s=arc-20160816; b=AmIBVunNQJeW/WIOUB51AXnffwTKZWpVjIL2NWSbObxJksSSlERzob/sekvDr0Mloe hXrQ41ZO+6Ab4H3twGnxjOP13G5SrepnopD9aKZPB/gIchKTDhm2H5DBjSpg89psujQw 4GsLUp4GRmnpOeJ7McpacLtdwO/8Z17WGkdk1HHKnMThQGEFOXL3bk14iHgwIQZB50/7 U3XkEq9DYTvOAJ3XISwdF0pjodHjn2Iyllu00SRa9f1Weq+JKLPwbY/xHeKbLXjHUW+T q1WTtkh2CfklVpX0L6uhOnque6car6VTy+SBAQWZRMhYJJLu6Hg6hTysZsOkaZcq/PB+ MTjg== 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=CQhtQ7BiVi+X8I13pRjMESDLNS0ui+0kU+AtDVKrmH8=; b=X5JLIMRdIscu8swfAoNYKXR1SRXkTir0MZYiPxkLPhfOpeuYVLUmxBZG716DAdncL1 S64/N1HzO4EXBy/gzHVVZxmw92fp2JgBV7eZs+LmFbX7U3WyEM4Uqilq81Qku6mu9eVe /TR7SPNXqCNfimlHdaAEq4ZDSJSi1Hv4y0h0/x1eJvsHcmTJcxjMM+IURWoIP2o302G5 V5ux2/alpaAdMJuxpyyiHHpwGeZAKVjVRlJNtTdZ8MPHAKgJI/TvpNfMVUSGe0MvAgaE 2XbcbtlISCaZmKg3v7ZIH4ldicFBOMDKTNZvJlAbxGTYNAtPAGCpVEVqefTiMjdRFNPK NHEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=awBkTBiv; 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 z9si15359153ejm.194.2021.03.03.09.39.05; Wed, 03 Mar 2021 09:40:13 -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=awBkTBiv; 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 S240191AbhCBA7U (ORCPT + 99 others); Mon, 1 Mar 2021 19:59:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:54406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235191AbhCAStl (ORCPT ); Mon, 1 Mar 2021 13:49:41 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7829650FC; Mon, 1 Mar 2021 17:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618119; bh=9JWjh7AvZXL4VeSi0y6vEWJfCSzqtZD6IaYtAeUvkKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awBkTBivtxZ/PGqoUGp07V2OTX3LP6ly1tW1iO8VAOWrYv752PkOnUVyEnwqlegWi TNoFPU2h/B7s4C+VVaQwrQ6Gv3xxXe3CP3ax2sZHb4/8Oe64zrGfLHq4qm/TjP+FJR nX+xwAyndb74NS9kuEzScWNE3nMbw75wIi+aZV9Y= 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.4 313/340] cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available Date: Mon, 1 Mar 2021 17:14:17 +0100 Message-Id: <20210301161103.691641522@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161048.294656001@linuxfoundation.org> References: <20210301161048.294656001@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 @@ -1566,11 +1566,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; @@ -1578,9 +1576,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();