Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp724375pxb; Tue, 2 Feb 2021 16:46:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+77EfwzZwR7AiutdSZMGNvSlMRVf5sCzw621JVMe3yoh9WoAd+xL+o1SH7quDOhuR2z7p X-Received: by 2002:a17:906:8617:: with SMTP id o23mr595257ejx.289.1612313201441; Tue, 02 Feb 2021 16:46:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612313201; cv=none; d=google.com; s=arc-20160816; b=hQX5lNt0zdgat75VHT/1AcDzEhLqvOASyZ5TR+oGApOekMSS8/a8fgXMjTxqeAHv28 fMrJBkugDAOMz7dodGVLiAZXCNUxsPevU888OMJPwgNJASGp3+o4jfGQxq7UckNmY7fR 9nRCUrNi21hJ/9PCu1G09Io0sPbDFHMU7g0kzHK7UEeqA4FooYrohuoGvf95ohWAd44B lb4TxGHqVTHvyP2A6gvvTqOuvIT0/n/rt12PPf5b5zEg67J+nCkXfPEea7srZOhFZD6f zlmpRuHqCw8dohD5vclagBj7runTFSdO/AxppmqhewgaZa5uIQ/g39lYqlScrQKukuWD wa3g== 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=a+JeHbdnuibuIZ2G2YzY3S3qg4y03usyq52pjaAExoU=; b=xJ2M5HOUhsYsod9ikTuQzte+czCucKnn6HCqm3ZfHt6GN1KSlfrVzANO/swNrG1G8K I7Ho4fOw7yK+8hna004rjM970b1N/W6BDNNe403GNvRduvh2Brqysvwsoi/tWHAUALtH W3cWSeGGZmtW/yDhd0sYhV9SnTqWiXMcF8NY7NFhG2JoSI5KiiqPomxe7wPFcsgBWiz8 g2PUUEYhnKfMSMh6FdPiVmvVD7JVafwhAz/UKVJJGk/qGFUnfB9Hcnrc+vWIeT5QC1yF V0d7rAbLOdnMe4dynxoYY5GRTXe2uUc1BKaEqD3k/q9wC3P7Sx78DMUSYmPtYKg5+u9S QXRw== 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 pg5si295745ejb.488.2021.02.02.16.46.17; Tue, 02 Feb 2021 16:46:41 -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 S239574AbhBBTPd (ORCPT + 99 others); Tue, 2 Feb 2021 14:15:33 -0500 Received: from mail-oo1-f49.google.com ([209.85.161.49]:42498 "EHLO mail-oo1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239430AbhBBTL5 (ORCPT ); Tue, 2 Feb 2021 14:11:57 -0500 Received: by mail-oo1-f49.google.com with SMTP id g46so5392268ooi.9; Tue, 02 Feb 2021 11:11:40 -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=a+JeHbdnuibuIZ2G2YzY3S3qg4y03usyq52pjaAExoU=; b=ZRXcLPcgRJJuTU7VZ8dNQ+a7S0N3HnD/QoSoQ87p1iwT6yzRGceiuBwd3Pgota3z/F wkxq8AXwE4Oht4lTY8dykFd2/KMzqefI+YVbG3OmTjtdUoTyszB3uET8Ns/b8UXFIo39 v0pIbbtO0CeHz2iCmcRzC0WLnZwSRA3372aBgOx6j5ku0NLrdFdKIcRMFLJbkTyiJ+/r n06PmQ7XtZmp1jc+YM+z7vIFHJJohA42pF5xoJ6vPaFeh10bCNI9ltKtYjfYkoBy9KBu Gr6LWlhT3o5fgMwaUQZLsx/pIzRhUM0hBfgJOGuNRHLutwhG7FVTy01gXF4WbM9p6pkS flVw== X-Gm-Message-State: AOAM531IrhGSqg4A4RxwaOsnDGL+4I9WfWJ0KbGT58zp7ngXMCoM3f3o H2QzOC9saIP3BIqoFuIT9GwOk3qoks3ANKfHjZU= X-Received: by 2002:a4a:9873:: with SMTP id z48mr16639097ooi.44.1612293075062; Tue, 02 Feb 2021 11:11:15 -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: From: "Rafael J. Wysocki" Date: Tue, 2 Feb 2021 20:11:04 +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, Feb 2, 2021 at 7:45 PM Rafael J. Wysocki wrote: > > 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. BTW, and that actually is quite important, the max_freq reported by intel_pstate doesn't matter for schedutil after the new ->adjust_perf callback has been added, because that doesn't even use the frequency. So, as a long-term remedy, it may just be better to implement ->adjust_perf in acpi_cpufreq(). Again, I'm terribly sorry for missing this thread and the patch. > > 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