Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2658276pxa; Mon, 17 Aug 2020 15:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOqe+47BmkcPeZsuKRyBdNP3GHAZDH8Q2Nu3cJT47/UdtveBkk35eM9z4iXOKmaVztYzVs X-Received: by 2002:a17:906:37d1:: with SMTP id o17mr17768479ejc.98.1597704304789; Mon, 17 Aug 2020 15:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704304; cv=none; d=google.com; s=arc-20160816; b=y95SIcAmpgoDS9RL7l24cTG4qV4gpTzftBPKxL+WS//MDWm/5maVctjzniT8Zj3kZH F0vEc2wwTxqNYN9/keXjVhv+JyPpmrZWTumxIZGqqjc2tM7WkVNZThzG1V+37tnYQUL2 YDfub7JbXEp8DOuogKzNa6BqCQJ29ajHdoNOfVVDYC9EgcCWaXQRay6CVNlXYwTWovSS 2tZH0OwF9Br0ioHF4ns7KzH2rklP5WPyNtlO3B1oY9KhtTLt+wtMQr8iug3cXBOqluty r9gWjDfsDO1HtauMdzlRhGB4EnKkwrABtUA6DJqbQhhYqvIA6YGbCIZwGJrrAOop7+g+ NNbw== 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=f8pB4cSlG2eCD1XwvnxMhIieP6XtEZsdw+GqKyLdits=; b=AAwCZQeoYLWTE8HhBi1ZcPzGIJtv9g9ZPMoqlU/vlOOFkWwxMoe4x+C9Y40+LvBaih BPLxNqIS0oBJvYznF3P7Yl6A6rByswu98wQKIBXTgYlfxzKAgfcQh/IB+xRQyFCmERmk P8J2LPHlDYbPdZDHZ0u/xwpoPisDhL3/fjXCehOltasXiWCCfJXgobNlDJ1N2+MyKnnE ifR8Wm++rWZXRAeDc2OemuHwltFYH9QNuwZ7/Chn9qi/KQV3pMXbwuctrmLTKdbabrH9 EfjTDGZ6LVicLGZREjo1dtLjsa2EH6GI5T3Xm48L9IZEKrXf6sVMBdOLxYtGXPUWj1Qf 083Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fcoACj3K; 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 v19si11674699edx.39.2020.08.17.15.44.41; Mon, 17 Aug 2020 15:45:04 -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=fcoACj3K; 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 S2404103AbgHQTKs (ORCPT + 99 others); Mon, 17 Aug 2020 15:10:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:51272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730753AbgHQPlg (ORCPT ); Mon, 17 Aug 2020 11:41:36 -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 05C382075B; Mon, 17 Aug 2020 15:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678895; bh=ZP78nRBu0zFa6HikHbRlcMnRoQrOzDOzp1XtjT6hGhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fcoACj3KE218q7U1qc7Kf26gmoJsv+5oGQWbNxbQLR9EagWGfGhbuErCLwvUPJwxZ EwZWCXk4BTC64o7cRJTIiRNvzJM223DA+p2SrT0eUvyTKjk9H+4iT/1xVrjB0ZgQYM yU87yxjEiysgRvLrammdIX91H33AYA+wBILqGi+U= 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.7 008/393] x86, sched: Bail out of frequency invariance if turbo frequency is unknown Date: Mon, 17 Aug 2020 17:10:58 +0200 Message-Id: <20200817143819.989905377@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@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 2f24c334a938b..3917a2de1580c 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1999,9 +1999,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