Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp515868ybz; Wed, 29 Apr 2020 04:34:57 -0700 (PDT) X-Google-Smtp-Source: APiQypIc5agFIllBoZOSlqEFlT6zD96VXLx0pkjNUH8XsIGqheB+SIZAzYF6NVDatXBBArxCTa4Y X-Received: by 2002:a17:906:1690:: with SMTP id s16mr1982473ejd.339.1588160096769; Wed, 29 Apr 2020 04:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588160096; cv=none; d=google.com; s=arc-20160816; b=zpQ8ZqhHlbLDJ0lUiNi129ZI/Bf/EGE4d5b+Rxw1hxrsclGr5yUSejvyLm1TBvRSQb ThkWyzU4bsqmDLTaO6kW0EuPUAOQKElt1Z1H2EfSV+a164LLIgYlI28zpJsjaY5mJA1A Db52nPICPvQ3TTrd+pnq8m/PDncOsyz6HoDWb+RvCLsvSpu3sYI0FigSj92f/Fr8p7L0 4McJH5NGeH3h5oXQByEQxn13Ep5z9fjnWnmJTGWlbWYtKNWbKzErlAzq38ou32B6YXtc Qz2n+dxIAaLIGXm32QEwWxCMXI9qISdCvggjJWG1hQpQ3kPBe6LFGHWqV8YEs1CT81Fa Go8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=heSLd4npprlNejenb5g45wkQja+dNAq9zzOcbGYSaDc=; b=CIHeua4I0k2YdXDW6zoZrFL39BFzCw0QvbsEkRlE3O9aUsvxhK/kg683aoV2XrvYEU DhErmux3r+o0CfeltTv6UJwmb6kTJ4NSClEcLwmuZjJwlVBIOlLsMhCObS+jjb57Z5aq mFLC+29OCBoxZajk13MUfhkQnJ9a3EsbiFiAemDX1Lmx+eEUlmeUU/a+rYz3TK2QWODe eyg6ta4WoRze3fMipMqPuC9EIStC9BTtlHTveghLtCmk7quH2wWizRysrTaB65HIKMRO I+ELkJ9vf3gW/paTtrZTP15CfckRWJOceveQ4EbT58JxVP/G8qD86j9ddV9yZ1RueB1e 53SA== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si3563672ejf.272.2020.04.29.04.34.33; Wed, 29 Apr 2020 04:34:56 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726975AbgD2Laz (ORCPT + 99 others); Wed, 29 Apr 2020 07:30:55 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:40706 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726836AbgD2Laz (ORCPT ); Wed, 29 Apr 2020 07:30:55 -0400 Received: by mail-oi1-f196.google.com with SMTP id t199so1461892oif.7; Wed, 29 Apr 2020 04:30:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=heSLd4npprlNejenb5g45wkQja+dNAq9zzOcbGYSaDc=; b=WnjWbi3/V2pjffEx2+R4V6Llf7vZNCwlWzTK8tTRktZTEohSbxSafSYTz3Dh8O0C7c Zbfl+nPHx2ZnpvtLIeM7/AWRE2Bli79IenKso5MhO3rwCJGp+ka9f4xW7HMVbmbYyi/+ ZUWAYm9SmVRh3I7hopGRlCfEa6JsjTZrpf8l9PCl4hO2yT5QGqYRAMJXeBLYia33MpHJ zEaw/UqgFOGXMsryhAfrtQK/L+SRzJB//CmQhH5c2ATnEQhkBj1fDkkm3zi+imPNGIzW oX2kbORf6wPhlqahqUkBAqsqUdRUAep8LbeyohPmAtJGGW80HxN4XPGxtaDtQP6OO5bN m1cQ== X-Gm-Message-State: AGi0PuYMHY3idDJXetPKuqRjvv9lD5Kmb3Ud4CBOjs67vgJ4SRFwXRfl pKZoecjqIqzyAIhgtNQPAx59tBXzdCNCst1thL4= X-Received: by 2002:aca:c441:: with SMTP id u62mr1351091oif.110.1588159854355; Wed, 29 Apr 2020 04:30:54 -0700 (PDT) MIME-Version: 1.0 References: <20200428132450.24901-1-ggherdovich@suse.cz> <20200428132450.24901-3-ggherdovich@suse.cz> In-Reply-To: <20200428132450.24901-3-ggherdovich@suse.cz> From: "Rafael J. Wysocki" Date: Wed, 29 Apr 2020 13:30:43 +0200 Message-ID: Subject: Re: [PATCH 2/2] x86, sched: Bail out of frequency invariance if turbo frequency is unknown To: Giovanni Gherdovich Cc: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Len Brown , "Rafael J . Wysocki" , "the arch/x86 maintainers" , Linux PM , Linux Kernel Mailing List , Ricardo Neri , Linus Torvalds Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 28, 2020 at 3:25 PM Giovanni Gherdovich wrote: > > 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") Acked-by: Rafael J. Wysocki > --- > 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 >