Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp721815pxb; Tue, 2 Feb 2021 16:41:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6him7P0wovNCCtx3/5OGpCwXOGNz71QtIWtGqcUKQwpkjUaFm6Gcfi+Go3LmcIpgyyfSx X-Received: by 2002:a17:906:fa85:: with SMTP id lt5mr612965ejb.344.1612312903662; Tue, 02 Feb 2021 16:41:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312903; cv=none; d=google.com; s=arc-20160816; b=yfHIaMDPsUJSCAgfyxZS/YcJN4qmgHe5kFhEH/MJi0YXAdSAupmDSrRPXQ0JqvQCmq EvjIyJwM7OyiTOptU7EZJ2hONblzZyXW7IZbtvyd9EI63JU7Un8amhWcFPtdJZUzTn7Z rXJxbkWnV1VF5oblUZzFhS9g75KS2BAfjMiCnfkTLFtsohy2rxNHuQnW9tRogHzuZCFY Jj+oPtVE771AHZCZrjaLaBBgeKPFxCV0iSBKbqM652rsIGbe3jVAQizuQf/vZeWK6xx4 HGcimsysamDpy2C0Klc7Ebih82OKizEoz1XndlnxBtJ2q5nKDO6SV/PAyHXP1QTqik+n qPpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=vDHKtoa2dINjq91DEdtqJMKEb/4RkQwFTAJadkfEl8c=; b=CfxYxE8fLvlahJXTXEnP91lH8++Y2VMi3Ac7m00gTHmcaJA2vb/KestUvgVvItbGxM wETiUF1W2SH50pioYEWVIqNpKimMGTI8AGZI6iepdb1H4M9yQrY89zI4Okt2uJxA6mty u7+QnEr6yxR0CB8zW5id2Nc47l0FAjaEcKC3kaQ6iVHgTPz8GLw58ps/o51bms1/Rpem BaII2IkOyqI0TsROZyVIPKnbDDugaH5X1soh41xocV9f1IFp6NyNjaPXEbuw+UEyBjyl 0PKWiDBSdsxk3BGF95v7Z57bO8aC8ZQtD8iLDkz+qTlptG8Mgrtk5iw92I9tKSk48nn8 DjZQ== 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 j5si299258ejv.429.2021.02.02.16.41.19; Tue, 02 Feb 2021 16:41:43 -0800 (PST) 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 S233833AbhBBSs1 (ORCPT + 99 others); Tue, 2 Feb 2021 13:48:27 -0500 Received: from mail-ot1-f44.google.com ([209.85.210.44]:35423 "EHLO mail-ot1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234235AbhBBSqY (ORCPT ); Tue, 2 Feb 2021 13:46:24 -0500 Received: by mail-ot1-f44.google.com with SMTP id 36so20841214otp.2; Tue, 02 Feb 2021 10:46:08 -0800 (PST) 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=vDHKtoa2dINjq91DEdtqJMKEb/4RkQwFTAJadkfEl8c=; b=CSAYRo7rCHIc/QIaziQD5x4HirGINdooEaSSrvGk8bGVBZ0avpIL8GrXutc2CggzLk foqGTUCwJatUNAwrPOJkVYrtA24sZtnb4Exqw5wCMX/W3ITF9W4RMMp5PJ2cN3vM8iFN sY4SqaYKbCo5NPVsoaWR9XJLpznKSatPczMsbdc6QS2Wwp7uU6Q/L49zOd8QRYsTXmGj Fthqo/hJli+OJNK9Fw1qTlT3zsqtPFUNBRGVh08KqVmODJ265S6zbbH/WUxF/2A7NGWj 871PBB7XTjkhCD1FROVtGwtJvpdRt5FUuTAXFDsvfhfXn/iIXx6R5T5xQfssXIYpuskC uIBQ== X-Gm-Message-State: AOAM533qhWSCPRbXUaxTaKIZWEIgox8vWct7iPy7iNkEDbKdeiJJdDuQ PQ5biDfZPZMOpPQNxpIVS/cfMgv6yFqzwKftDuI= X-Received: by 2002:a9d:7a4a:: with SMTP id z10mr16935376otm.206.1612291542781; Tue, 02 Feb 2021 10:45:42 -0800 (PST) MIME-Version: 1.0 References: <20210122204038.3238-1-ggherdovich@suse.cz> <20210122204038.3238-2-ggherdovich@suse.cz> <1611653310.11983.66.camel@suse.cz> In-Reply-To: <1611653310.11983.66.camel@suse.cz> From: "Rafael J. Wysocki" Date: Tue, 2 Feb 2021 19:45:31 +0100 Message-ID: Subject: Re: [PATCH v2 1/1] x86,sched: On AMD EPYC set freq_max = max_boost in schedutil invariant formula To: Giovanni Gherdovich Cc: Peter Zijlstra , Borislav Petkov , Ingo Molnar , "Rafael J . Wysocki" , Viresh Kumar , Jon Grimm , Nathan Fontenot , Yazen Ghannam , Thomas Lendacky , Suthikulpanit Suravee , Mel Gorman , Pu Wen , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Michael Larabel , "the arch/x86 maintainers" , Linux PM , Linux Kernel Mailing List , ACPI Devel Maling List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 26, 2021 at 5:19 PM Giovanni Gherdovich wrote: > > On Mon, 2021-01-25 at 11:04 +0100, Peter Zijlstra wrote: > > On Fri, Jan 22, 2021 at 09:40:38PM +0100, Giovanni Gherdovich wrote: > > > This workload is constant in time, so instead of using the PELT sum we can > > > pretend that scale invariance is obtained with > > > > > > util_inv = util_raw * freq_curr / freq_max1 [formula-1] > > > > > > where util_raw is the PELT util from v5.10 (which is to say, not invariant), > > > and util_inv is the PELT util from v5.11-rc4. freq_max1 comes from > > > commit 976df7e5730e ("x86, sched: Use midpoint of max_boost and max_P for > > > frequency invariance on AMD EPYC") and is (P0+max_boost)/2 = (2.25+3.4)/2 = > > > 2.825 GHz. Then we have the schedutil formula > > > > > > freq_next = 1.25 * freq_max2 * util_inv [formula-2] > > > > > > Here v5.11-rc4 uses freq_max2 = P0 = 2.25 GHz (and this patch changes it to > > > 3.4 GHz). > > > > > > Since all cores are busy, there is no boost available. Let's be generous and say > > > the tasks initially get P0, i.e. freq_curr = 2.25 GHz. Combining the formulas > > > above and taking util_raw = 825/1024 = 0.8, freq_next is: > > > > > > freq_next = 1.25 * 2.25 * 0.8 * 2.25 / 2.825 = 1.79 GHz > > > > Right, so here's a 'problem' between schedutil and cpufreq, they don't > > use the same f_max at all times. > > > > And this is also an inconsistency between acpi_cpufreq and intel_pstate > > (passive). IIRC the intel_pstate cpufreq drivers uses 4C/1C/P0 resp, > > while ACPI seems to stick to P0 f_max. > > That's correct. A different f_max is used depending on the occasion. Let me > rephrase with: OK, I confused the terminology, sorry about that. > cpufreq core asks the driver what's the f_max. What's the answer? > > intel_pstate says: 1C Yes, unless turbo is disabled, in which case it is P0. > acpi_cpufreq says: P0 This is P0+1, isn't it? > scheduler asks the freq-invariance machinery what's f_max, because it needs to > compute f_curr/f_max. What's the answer? > > Intel CPUs: 4C in most cases, 1C on Atom, something else on Xeon Phi. > AMD CPUs: (P0 + 1C) / 2. > > > Legend: > 1C = 1-core boost > 4C = 4-cores boost > P0 = max non-boost P-States