Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2565145pxa; Mon, 17 Aug 2020 12:55:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySt6W41WLqks+FcGTm/DFRNuapYRXjwPDoWAFdeT9SHSdhkQwm91xehzq4C7PRaR0Q3Vyz X-Received: by 2002:a17:906:4f8f:: with SMTP id o15mr16403535eju.220.1597694106422; Mon, 17 Aug 2020 12:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597694106; cv=none; d=google.com; s=arc-20160816; b=A7yK6hFtruCDxvQzIsZSB+fiFFTZfsLERJoJYUBB3fXWRbqs5UNzkot/qBT5t3nD1q KLD+tfPgvNFNipX9L+S9chsoh/h/2p5YK7KFymErt04qtNMev8syVfpDCDTa1C3PqLWb yh92R2dbaII9StsMOJb5jiyMj+/GPSJ6H9a+vyNi1qc0t/nRq+HQZpePZGt0a4RahqS0 0LMMRlxIFwfAqkEN2w5Uz56lTpfPIgAZFE7wtwTeIFlXvd5WNcvMOrOKwLD4/RpxJ3EU eQy83XH+kvSs2fG9D1VmXSVXtn/nvvxwzBM4RL6qvDEv2XGxwe1N3BR1vtvEh0T+DSBu FSPw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hsm2SodsDP9T3abq/0VXMr7c/a8LsPzj8cprnZRKQRA=; b=TESZ9VDqJN3CDJWNQQsv5eI7nhOUXlmt0B+wfxu2iit1wiki+5joKpB1Bl62Mw5J+b HwHwuMbsyAHBj+yHGG/UMm47uk3k0XarQfbYzO4MvXoL/arVyohw/igVKgRjnfhRiJlO okc97PKIIJQHHc1b9YYLGaSGJOKcwwQY2haL0BRGKJnefRcIlvIrcWKkgIYKoF3wiiCb ov/6S047xNf8HR2c1d+WWoO7detsUffrkvN/sD8s9UR7ekXI12ASOZRCOY8VmUgZS9ai 1DvxHTi1HqPPKEVl6umzeDcSqMhDZF+v0qJBT+/aiFYVukD+OmGSwb/IzDC+OFX/tio2 WKsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="F7oJ4i/9"; 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=fail (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 r28si11578137edc.150.2020.08.17.12.54.44; Mon, 17 Aug 2020 12:55:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b="F7oJ4i/9"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404463AbgHQTvl (ORCPT + 99 others); Mon, 17 Aug 2020 15:51:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:40060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729118AbgHQPSc (ORCPT ); Mon, 17 Aug 2020 11:18:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A17D8205CB; Mon, 17 Aug 2020 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597677512; bh=3SszuFnMRkh91EddoT1fiCaR7YvhFDLhQ6A0QGRX8Ro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7oJ4i/9DwcAAKyAJofquyi/Y9gOz2qphMVUZp3UkuMlXlJDqGoz7mEJN+Bf2+jyL u8dIMzdIzRrOFYQBGtZOKz6Tz8x3tyqCR7qgbN++1W0NLeWVDhp8UVzaxKmJpKC75X 2CDQwfgb7kZr84jPWl4Urcd6tHGBZXHAJUoPHhoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ricardo Neri , Giovanni Gherdovich , "Peter Zijlstra (Intel)" , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.8 010/464] x86, sched: Bail out of frequency invariance if turbo frequency is unknown Date: Mon, 17 Aug 2020 17:09:23 +0200 Message-Id: <20200817143834.247565223@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Giovanni Gherdovich [ Upstream commit 51beea8862a3095559862df39554f05042e1195b ] There may be CPUs that support turbo boost but don't declare any turbo ratio, i.e. their MSR_TURBO_RATIO_LIMIT is all zeroes. In that condition scale-invariant calculations can't be performed. Fixes: 1567c3e3467c ("x86, sched: Add support for frequency invariance") Suggested-by: Ricardo Neri Signed-off-by: Giovanni Gherdovich Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Rafael J. Wysocki Tested-by: Ricardo Neri Link: https://lkml.kernel.org/r/20200531182453.15254-3-ggherdovich@suse.cz Signed-off-by: Sasha Levin --- arch/x86/kernel/smpboot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 18d292fc466cb..20e1cea262e4b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -2002,9 +2002,11 @@ static bool intel_set_max_freq_ratio(void) /* * Some hypervisors advertise X86_FEATURE_APERFMPERF * but then fill all MSR's with zeroes. + * Some CPUs have turbo boost but don't declare any turbo ratio + * in MSR_TURBO_RATIO_LIMIT. */ - if (!base_freq) { - pr_debug("Couldn't determine cpu base frequency, necessary for scale-invariant accounting.\n"); + if (!base_freq || !turbo_freq) { + pr_debug("Couldn't determine cpu base or turbo frequency, necessary for scale-invariant accounting.\n"); return false; } -- 2.25.1