Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1138842ybz; Wed, 22 Apr 2020 14:22:19 -0700 (PDT) X-Google-Smtp-Source: APiQypJ2LlaK5FeQNusVK2iVJOuIjC2D1d6iviQfdVt9hrB05uc1vnykx5CHzbj0e3I77CdxF6DF X-Received: by 2002:a50:b062:: with SMTP id i89mr507036edd.72.1587590539807; Wed, 22 Apr 2020 14:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587590539; cv=none; d=google.com; s=arc-20160816; b=w7CCGlut9GDpruOU0jrCUgadBxv2k7r2wTfSabHgIx7pYreWwNEjbnRpR+Pz0JA5UK 5N/rsYg6l6EF6qlCL3kcw/SC6P7GvEWcZACxjNLjqm6BgrIEjgd86UBRvk3AanxpA+Er XYUmyDIGV6uwAKpD6KipPZQJmKZBp61+YkkLeGNXhdHncx0Mc/ZSKFvXb1TylCK4CqJH sbMLkabynk9J4gBHop1rPjJeW8Zyoj1e2/IHIx14yKydE8h3S4xaAe8kcHK8wn0HuSDI USR5vk+OrBMJIOx0vG0Sm+qlfP6YDZcu2FwPBVhGtLICILkUQ8t5qoPowekAccijQZPB EXyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=0th5PP1ws58z3B7OVRy6V+N8pcMxvBMAucbZXW+CPcY=; b=L+ArgvLp3gsN+fLeLNE+aXRALO8ty+sJPQGsvTZTDpBwNd02mpIzl8rvpPTrg1NBAy pAVLGEPFSU4mk6xPreqgYgp07Pfh02mkinPsCnaaZqiD9HRvDOMbeBcnLtAgJ/Ax+cI9 c1Bz9W1yai/NU8Sop9I4MVpwnUHqTmDf630H6AV1wkW1OLrbUWGMJoUnP8lu+oR9r6X9 u/UaErylC4aZC9/Ab1Kf8WEkCeixPkJGPAvbbu7DNXEGTCq8qewf2D3UnOiMAxv2+q2Y Z23Fv5VkTQdlU/cuFANTYUJ0Y4/beUO9vBb0M+gbYCmTKZd4lLTOsX76Mn7M+jq5q8Tu T5iw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si166334edo.126.2020.04.22.14.21.57; Wed, 22 Apr 2020 14:22:19 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbgDVVU7 (ORCPT + 99 others); Wed, 22 Apr 2020 17:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726534AbgDVVU5 (ORCPT ); Wed, 22 Apr 2020 17:20:57 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75AA4C03C1AA; Wed, 22 Apr 2020 14:20:57 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jRMnZ-0000Oh-DF; Wed, 22 Apr 2020 23:20:49 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 088811C02FC; Wed, 22 Apr 2020 23:20:49 +0200 (CEST) Date: Wed, 22 Apr 2020 21:20:48 -0000 From: "tip-bot2 for Giovanni Gherdovich" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] x86, sched: Account for CPUs with less than 4 cores in freq. invariance Cc: Like Xu , Neil Rickert , Giovanni Gherdovich , "Peter Zijlstra (Intel)" , "Rafael J. Wysocki" , Dave Kleikamp , x86 , LKML In-Reply-To: <20200416054745.740-3-ggherdovich@suse.cz> References: <20200416054745.740-3-ggherdovich@suse.cz> MIME-Version: 1.0 Message-ID: <158759044865.28353.8160614260085686915.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 23ccee22e834eca236b9a20989caf6905bd6954a Gitweb: https://git.kernel.org/tip/23ccee22e834eca236b9a20989caf6905bd6954a Author: Giovanni Gherdovich AuthorDate: Thu, 16 Apr 2020 07:47:43 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 22 Apr 2020 23:10:13 +02:00 x86, sched: Account for CPUs with less than 4 cores in freq. invariance If a CPU has less than 4 physical cores, MSR_TURBO_RATIO_LIMIT will rightfully report that the 4C turbo ratio is zero. In such cases, use the 1C turbo ratio instead for frequency invariance calculations. Fixes: 1567c3e3467c ("x86, sched: Add support for frequency invariance") Reported-by: Like Xu Reported-by: Neil Rickert Signed-off-by: Giovanni Gherdovich Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Tested-by: Dave Kleikamp Link: https://lkml.kernel.org/r/20200416054745.740-3-ggherdovich@suse.cz --- arch/x86/kernel/smpboot.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 3a318ec..5d346b7 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1945,18 +1945,23 @@ static bool skx_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq, int size) static bool core_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq) { + u64 msr; int err; err = rdmsrl_safe(MSR_PLATFORM_INFO, base_freq); if (err) return false; - err = rdmsrl_safe(MSR_TURBO_RATIO_LIMIT, turbo_freq); + err = rdmsrl_safe(MSR_TURBO_RATIO_LIMIT, &msr); if (err) return false; - *base_freq = (*base_freq >> 8) & 0xFF; /* max P state */ - *turbo_freq = (*turbo_freq >> 24) & 0xFF; /* 4C turbo */ + *base_freq = (*base_freq >> 8) & 0xFF; /* max P state */ + *turbo_freq = (msr >> 24) & 0xFF; /* 4C turbo */ + + /* The CPU may have less than 4 cores */ + if (!*turbo_freq) + *turbo_freq = msr & 0xFF; /* 1C turbo */ return true; }