Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp245033ybz; Thu, 23 Apr 2020 22:58:16 -0700 (PDT) X-Google-Smtp-Source: APiQypKSHMU1PgzwI+JsHUYVp0CvbKxfYDxJvhEfCzlNhQVXAWXm41Rpf9ETS7TT1zWwzVUkYkCF X-Received: by 2002:a17:907:1185:: with SMTP id uz5mr5764473ejb.335.1587707896770; Thu, 23 Apr 2020 22:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587707896; cv=none; d=google.com; s=arc-20160816; b=QMa7EkhYrLfqgIis1V45LTstuHegK7dYIeurg4dv0b1ft7Ow/N053k0Q56tBJlmw4u 2uyoyNMncizI5pjW2FXsv56KUjBrDXOYQnH5fVZGq0Y/CglvRfkptOoq1E2PalKs6kh3 zrnAhN5p6UAOcxghyfKfKDqjJ1Y2oJmDryZPClpebmnGuI684eScx3E00cfAfJzOOOBQ ZqtGKrNJO9x2/++2TG2kItBdI2R/fFBGWvMVXsfwUN3edY6kAjdQ/n+nqZmpsJuY4Fqw TrzG1WStUyuOGdU7geFdyelqpdyrqNHP8SK8my+9OZuitG2XLJNRhuazLbtLjzWGiCS4 1sXQ== 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 :references:in-reply-to:date:cc:to:from:subject:message-id; bh=4Yn5Pp27rrPuOWDy6/w1XiwngMGf6XlEveQXKy51YHw=; b=yytmYkZuW3h5t8fwDX2U0urUEdFzXe+CYzFNIKMdH+9wD/a8fy3OxgcHXO5aaNYE0O CEma2CjR67Zi88YYHbbI+4NuNlayyTWGIB1O8as37NopjZxZeoeTdOgtKZIpLw4yBZw8 UH7ktDoyiSXRNFns/fKJsDxXVe//STtIeVx8znnEauZt7kLQOUeHCCmzYRcQ4xol9qDu YP+9NiJHeA3XYJ8L0PZBNo/DUZXJVPWNoeDaBqroB3XmMNrtqtTr3+Zgb0FlO+tM3KKg K3X20bKZgMOZvfvxiHUFh+elZRArvTaAI0TKEoXPFVVErQj1ZprmWsOT0RmonBIwl8LM ZCCg== 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 r18si2354136edp.599.2020.04.23.22.57.53; Thu, 23 Apr 2020 22:58:16 -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 S1726512AbgDXFxW (ORCPT + 99 others); Fri, 24 Apr 2020 01:53:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:37274 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726324AbgDXFxV (ORCPT ); Fri, 24 Apr 2020 01:53:21 -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 E520DAD9A; Fri, 24 Apr 2020 05:53:17 +0000 (UTC) Message-ID: <1587707595.28179.11.camel@suse.cz> Subject: Re: [PATCH 1/4] x86, sched: Bail out of frequency invariance if base frequency is unknown From: Giovanni Gherdovich To: Ricardo Neri Cc: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Len Brown , "Rafael J . Wysocki" , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Mel Gorman , Doug Smythies , Like Xu , Neil Rickert , Chris Wilson Date: Fri, 24 Apr 2020 07:53:15 +0200 In-Reply-To: <20200424013222.GA26355@ranerica-svr.sc.intel.com> References: <20200416054745.740-1-ggherdovich@suse.cz> <20200416054745.740-2-ggherdovich@suse.cz> <20200422171547.GA11942@ranerica-svr.sc.intel.com> <1587629164.28094.11.camel@suse.cz> <20200424013222.GA26355@ranerica-svr.sc.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-04-23 at 18:32 -0700, Ricardo Neri wrote: > On Thu, Apr 23, 2020 at 10:06:04AM +0200, Giovanni Gherdovich wrote: > > > > > > It may be possible that MSR_TURBO_RATIO_LIMIT is also all-zeros. In > > > such case, turbo_freq will be also zero. If that is the case, > > > arch_max_freq_ratio will be zero and we will see a division by zero > > > exception in arch_scale_freq_tick() because mcnt is multiplied by > > > arch_max_freq_ratio(). > > > > Thanks Ricardo for clarifying this. > > > > Follow-up question: when I see an all-zeros MSR_TURBO_RATIO_LIMIT, can I > > assume the CPU doesn't support turbo boost? Or is it possible that such a CPU > > has turbo boost, just the turbo ratios aren't declared in the MSR? > > > > Some context: this feature (called "frequency invariance") wants to know > > what's the max clock freq a CPU can have at any time (it needs it for some > > scheduler calculations). This is hard to know precisely, because turbo can > > kick in at any time and depends on many factors. So it settles for an > > "average maximum frequency", which I decided the 4 cores turbo is a good > > estimate for. Now, if an all-zeros MSR_TURBO_RATIO_LIMIT means "turbo boost > > unsupported", this is actually the easy case because then I know exactly what > > the max freq is (base frequency). If, on the other hand, an all-zeros MSR > > means "there may or may not be turbo, and you don't know how much" then I must > > disable frequency invariance. > > I'd say that there can be cases in which the CPU has turbo boost and yet the > turbo ratios are not declared in MSR_TURBO_RATIO_LIMIT. Hence, frequency > invariance should be disabled. Great, thanks for the information Ricardo! For the tip tree maintainers: Ricardo is identifying an additional corner case I need to take care of, but this series stands on its own: the commits correctly do what their changelog says, and fix existing bugs. I'll send an additional patch that follows Ricardo's recommendations, and it will apply on top of this series. Giovanni