Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4138589ybz; Tue, 28 Apr 2020 06:27:04 -0700 (PDT) X-Google-Smtp-Source: APiQypLIf+OjDtqMno2s0DVJp4j/3fFNV14AIdRrNd46ipjFRy4xJSA7FrcJwHZVKg4mh95QLAIY X-Received: by 2002:a05:6402:17c4:: with SMTP id s4mr23196573edy.348.1588080423880; Tue, 28 Apr 2020 06:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588080423; cv=none; d=google.com; s=arc-20160816; b=xpOOGNqNwlvkULHVtELee3C9GcFj8US89ETaZrbnk+btUSxUar/etenD4/40NIrumj RugMppATBynbkPKaMZ/ip1ih2lcRuEWGN6U49HaBBk1TO7hIbrtu6eHI7MTBrfGp2Qwm U65bMlcDL4uGo46hSm7zS9Lj4NskgjdxliDRxI3uY9tCeUUNWAr3ZuGt450UQ0+U9O7o uxXSR5zVGzDiolBMlzgjX4FPWG9Jg4tKPzaDQ0/iFJSZIJAubpdafhm077cgNGRs/vjI /Lf1eew1hwTVvBA3wvAUnesCJPswa4CGHW/hzIQ8pMIZ5DW424LeNkd+YlR4uOq+d6PT mu9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=vKRlp6tenshqpOvzlJJ5+yqbP5YdoTE2EPU48cSma1g=; b=vIKoC8GS/NNeHcXHTpHSy7izup618YTYw55r7Mu6aLMzMkJdejJA5n2LGDGgF7FMpw aaD6csx0XYg0/vCnXIM0zjvDT+EF7dkaOlmwJqzVLzO9COZKD6mS4fCKzWlyyK/xOcnh w2yJoNgNRuVvh35sQI7RIlzTswjLzDpXgn+OB8UK3r4/MXfE29ub9aQk4y8rkm05sa9k AxOBzM5sA6jFHUKYkFW5dKUkB/rm6fNZUuFWbSX75Up8+ky+CLu0FJD2dipRSg8/ncKH nWI/lxp21lGvuBeUn91kvbLtOq/8RyGhc+/TGllBi0a12auNLqFMiCCT4FWYre5aUpQI 79HA== 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 h27si1932425eja.40.2020.04.28.06.26.40; Tue, 28 Apr 2020 06:27:03 -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 S1727837AbgD1NZR (ORCPT + 99 others); Tue, 28 Apr 2020 09:25:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:41830 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726940AbgD1NZM (ORCPT ); Tue, 28 Apr 2020 09:25:12 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F1D36AD85; Tue, 28 Apr 2020 13:25:09 +0000 (UTC) From: Giovanni Gherdovich To: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Len Brown , "Rafael J . Wysocki" Cc: x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , Linus Torvalds , Giovanni Gherdovich Subject: [PATCH 2/2] x86, sched: Bail out of frequency invariance if turbo frequency is unknown Date: Tue, 28 Apr 2020 15:24:50 +0200 Message-Id: <20200428132450.24901-3-ggherdovich@suse.cz> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200428132450.24901-1-ggherdovich@suse.cz> References: <20200428132450.24901-1-ggherdovich@suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Giovanni Gherdovich Suggested-by: Ricardo Neri Fixes: 1567c3e3467c ("x86, sched: Add support for frequency invariance") --- 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 4718f29a3065..ab2a0df7d1fb 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1991,9 +1991,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.16.4