Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3741291pxb; Tue, 26 Jan 2021 03:38:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIJU2/yGlACnLOoWS8LwJGiOQP+oNtVA21frftFAAHWvLUVGhU9lneUSMetaQ88KJYRWcj X-Received: by 2002:a17:906:5290:: with SMTP id c16mr3072487ejm.403.1611661083938; Tue, 26 Jan 2021 03:38:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611661083; cv=none; d=google.com; s=arc-20160816; b=UrFgPCKb6HZaoZslY4RH0UHTu48rnPZxTPHbHgK+mh5AtNiL9O/qzCeZ59o1fhAc/x 9ScRm97nEHRdlei3PMLHyseTYG6td46KohYY6UdTSK7oG0Cc18EQ+BLSe01wAJuppvdn tVYhusqfrhaK7aj0nnEKJLu+950QjQ6bUPwgL5142NLfaWhEYGUWCoQz5lwFDZj1c5dn qh0bV/qJVFLm9F2PnaZVNEyKqJBMg6Ggp8J5aS7IJkQ2Pp5hLc8LmRP98lctgniRoMKN jP+hYs8KNdBOBDzvlIITZWpan18KAv1iotucdUnSAuPJer4ADtkgjFMgxDs0hl6fiIwg /tpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+kPzGNU12fuOGcg8WL76MmT72as1QhBaLqRMdjDE51Y=; b=maCjAqKZbAyRxbgnbkXCWClqZXfeX2FBGcf5/9lGwWdul/60e/H3zdorCrZTHpUwKz 3BWPs06JHZMnkzKpUzkO4bWOn3w3DrMbVf6Gdinps9UROEzFknMlBWYOtiKnLpeBc7zy TgsrieLeRhwxd+YczLbw3PDSytfOPpBc6FUCnkfwrw6qhg3TmMT80EJX4kLu0qY1muGv C0yFILVKTbXCmnwrYIHFHlpDTgCUoCuSeYvA4QgD0/Mbb0YvrZr+tZYggbRw2mkTbiAU BV55COiYxWdfYWfGqO86MMLrMB0qtxVePfHlcAfJOSfmCzSlYeI3te3S8qSx4Ksi8Rpp Q6eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pvezCzoH; 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 e6si6568389edz.362.2021.01.26.03.37.40; Tue, 26 Jan 2021 03:38:03 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pvezCzoH; 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 S2405054AbhAZLdz (ORCPT + 99 others); Tue, 26 Jan 2021 06:33:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391307AbhAZKGk (ORCPT ); Tue, 26 Jan 2021 05:06:40 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C88CEC06174A; Tue, 26 Jan 2021 02:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+kPzGNU12fuOGcg8WL76MmT72as1QhBaLqRMdjDE51Y=; b=pvezCzoH/WtrAlLIICs0RpSpiD 3GvaMlQdberOS3T537LcfBj+Kx/F0aAzYm1A7eD0bSnLoP+q8FAZNLreZyzgpc5xdoaDW3+VVpR/R xd5pxE/iMaoqcVwWLqTUEMlv+ShJuvynxy2g57RCqc3Uj03pFYRtIYlHdgB/zifVZAgN6faDwqE7I Vsot7u6rUQzhqTpyO4GAwTdzEB3v7469gtQRxoUSY9FdmLY3w00ixx7CvhyLt0fSXC5WW8gRSsNHI AxmlzYeJJTvuOL3S9vTQqY7fBIXlGY497Y+1tSWn9o+DJXuAqPVQwox+ACM1DLvxMKGwNFM29XOZ7 +phTkUng==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l4LBP-005P2b-59; Tue, 26 Jan 2021 10:03:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B1C0E3010C8; Tue, 26 Jan 2021 11:02:45 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9EC79209C50F3; Tue, 26 Jan 2021 11:02:45 +0100 (CET) Date: Tue, 26 Jan 2021 11:02:45 +0100 From: Peter Zijlstra To: Giovanni Gherdovich Cc: 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 , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH v2 1/1] x86,sched: On AMD EPYC set freq_max = max_boost in schedutil invariant formula Message-ID: References: <20210122204038.3238-1-ggherdovich@suse.cz> <20210122204038.3238-2-ggherdovich@suse.cz> <1611653310.11983.66.camel@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1611653310.11983.66.camel@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 26, 2021 at 10:28:30AM +0100, 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: > > cpufreq core asks the driver what's the f_max. What's the answer? > > intel_pstate says: 1C Oh indeed it does... > acpi_cpufreq says: P0 > > 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. Right, and thwn freq-invariance uses larger f_max than cpufreq uses for frequency selection, we under select exactly like you found.