Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp2187727ybm; Sun, 31 May 2020 11:31:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwTIAX8Q5NuyvYW2EmO7qeKTHzTnLlRAYdVeQeQDGf3sp5b2tDp5/eN9GWMeO25bJoYlmg X-Received: by 2002:a17:906:404:: with SMTP id d4mr8782109eja.173.1590949872303; Sun, 31 May 2020 11:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590949872; cv=none; d=google.com; s=arc-20160816; b=D688Sb/iwWOQaisTNRsLAgzOS42B6Kf/EharD+KZCLe7aZ67JbH1KeiJH2rZtVBh1B nTxG2Wuq9cJH0Q9KceZ265XztGnr5XLhvnEw7p/eVeZLI6zipL0DhHsj6Yyj/uNBdIN8 sQgMRgOpAXzEUyzkI5S7VJJ3XhOy8yf8/DawYXXUDD0glIOtTy49WgS9e9aRPUOfnNU7 kngRXTsmbcIZmJAlZ6j8X/zQ5suSlIU+xeku2GEf3H1XFW46GWk/dylb4bXBq87vec5O XiX7lVGXUJLC86fpVcoawqlfnfE4PHR4VP9mGGaBAfALDhOqp/r77JJvM+mn0f4hTCVq x85A== 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=zIcI7H3ds8+6SSgWCQvauLBLYvovqhoehb6q01vl9/s=; b=eHAiF+ax2cs0yWKHzLDQ1Hp6GSZHxgGdv56cKqaQd7lemU880wDSV5b4PLLA5uSmaF 4e6gnRahv/kXImFgWtk6n0NMVOJwhFv4rFXE31uwAt5wNtwBpUYgF+1958gUs3zRCVFn UbiQyDArJJYtfGigA4pNBkRwbgVPx0sMC11fJiu3d7bc7TNF9KjIDb6xoaXFzP3aXcPl R1RVAPWIqfhufTSW/w5d1RdHRKqK1+J77Rh/Q59uW3aQf6svUkXbxwmvaROh66BtjRif 9G0U9NO56Y8VwnRrXG56ZRKRXBBt+B7E98ZZl/Ty8EOpjvIu4MUk+IH1n6SREJiUZ499 CKIg== 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 l10si9552695edv.152.2020.05.31.11.30.49; Sun, 31 May 2020 11:31:12 -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 S1728370AbgEaS0W (ORCPT + 99 others); Sun, 31 May 2020 14:26:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:52404 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728282AbgEaS0Q (ORCPT ); Sun, 31 May 2020 14:26:16 -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 615D2AD60; Sun, 31 May 2020 18:26:15 +0000 (UTC) From: Giovanni Gherdovich To: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Borislav Petkov , "Rafael J . Wysocki" Cc: x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , Giovanni Gherdovich Subject: [PATCH v2 2/3] x86, sched: Bail out of frequency invariance if turbo frequency is unknown Date: Sun, 31 May 2020 20:24:52 +0200 Message-Id: <20200531182453.15254-3-ggherdovich@suse.cz> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200531182453.15254-1-ggherdovich@suse.cz> References: <20200531182453.15254-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 d660966d7de7..fe154c8226ba 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -2001,9 +2001,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