Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2370211ybl; Thu, 19 Dec 2019 12:23:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwFHOrRcfAuSAcqoHn8CoDZrbO9oKMx5zATGML9J54BE1SeKHtXvHjbIKbX5Pkq8/1hKH+Z X-Received: by 2002:a05:6830:9:: with SMTP id c9mr10984100otp.94.1576786982405; Thu, 19 Dec 2019 12:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576786982; cv=none; d=google.com; s=arc-20160816; b=KlVTWtxdNsf1MNtcMpgVwuSmQraS9rsi0+71OKAom+A3/EyueHUrfgmZUas8aGZhJH AJCyUGOKBNsAuk7dssz80KqhrYt/7/gVVgSounB7vcd8apz6CzywHvAnW+JWk5cqptFp WIwY3JudgVMgMnyZCvbfGoZiux6xI8nxcp0XGGuna2ON+OeHBJZzywFQRxiK16vYUMcr aE+F4txRyy+AIxhnalcBZpIGI9/7qSfApazR4K6+YjF557flz0xYXyKlOdsyNyVZkb+V 2kHlqrbUw73VoeAcdZS3AlVKZmIfFVDs8F2AvWcdqE+kQQianizc+DacrNeykKkw1xXJ ZEng== 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=S3NFDtYR12viXg0gNj4fJaabs/hXfgKCBWq1vA09lh4=; b=OshzGGNcNsUHSP3CGecKizYd5e9Anbmh0UuKTF8qLcRAGkLJk5vNNgakJZoxDqy67z z1bKJGSujvg5AFpZ2uHaUTEy1sMV9dtvofGxoIuIWtu7aECXfimFoREMMObd+glUYqyz qN7bvTBNstAF23g89eDRO4mjj20UEZDbNir4aQe/bfTOtWsTA/mZB8YyUqnULstbEJaK dc/7I9+e8ZbOBYmyE59ol8AreuHZMWd5iGnquEp81TmgfCQyRegt7532x15sT1LUW4ZP YgsehlwyJiaJSBlLDZFU1n3FM5be4OIC8K1vhgWgu//inM0J8SRFFMG5ddIH5Q2uKG/f dZZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w64si3703345oib.185.2019.12.19.12.22.51; Thu, 19 Dec 2019 12:23:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbfLSUWB (ORCPT + 99 others); Thu, 19 Dec 2019 15:22:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:47988 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbfLSUV7 (ORCPT ); Thu, 19 Dec 2019 15:21:59 -0500 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 28E59B2EF; Thu, 19 Dec 2019 20:21:57 +0000 (UTC) Message-ID: <1576787264.8929.10.camel@suse.cz> Subject: Re: [PATCH v4 1/6] x86,sched: Add support for frequency invariance From: Giovanni Gherdovich To: Peter Zijlstra Cc: Ionela Voinescu , Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Len Brown , "Rafael J . Wysocki" , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Mel Gorman , Matt Fleming , Viresh Kumar , Juri Lelli , Paul Turner , Vincent Guittot , Quentin Perret , Dietmar Eggemann , Doug Smythies Date: Thu, 19 Dec 2019 21:27:44 +0100 In-Reply-To: <20191218193429.GH11457@worktop.programming.kicks-ass.net> References: <20191113124654.18122-1-ggherdovich@suse.cz> <20191113124654.18122-2-ggherdovich@suse.cz> <20191202162232.GA9777@arm.com> <4d1b776d8e797224e92952a4d590a625@suse.cz> <20191218193429.GH11457@worktop.programming.kicks-ass.net> 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 Wed, 2019-12-18 at 20:34 +0100, Peter Zijlstra wrote: > On Fri, Dec 06, 2019 at 12:57:46PM +0100, Giovanni Gherdovich wrote: > > > On Wednesday 13 Nov 2019 at 13:46:49 (+0100), Giovanni Gherdovich wrote: > > > I see above that you enable the static key (and therefore frequency > > > invariance before setting the max frequency ratio (if possible) and > > > before you initialise the counter references. Is there any reason for > > > doing this? > > This is a fair point; mine was a deliberate choice but you're the second > > person making this remark (Peter Zijlstra also suggested I find the max > > frequency before I set the static key), so it appears this design is > > unpopular > > enough to warrant a change in v5. > > You actually 'fix' this in the next patch. I thought it was a patch > management 'fail' that it didn't end up in this patch. Uhm. I'm not sure I agree; let me paste the function intel_set_cpu_max_freq after the entire series is applied: > static void intel_set_cpu_max_freq(void) > { > u64 ratio = 1, turbo_ratio = 1; > > if (slv_set_cpu_max_freq(&ratio, &turbo_ratio)) > goto set_value; > > if (glm_set_cpu_max_freq(&ratio, &turbo_ratio)) > goto set_value; > > if (knl_set_cpu_max_freq(&ratio, &turbo_ratio)) > goto set_value; > > if (skx_set_cpu_max_freq(&ratio, &turbo_ratio)) > goto set_value; > > core_set_cpu_max_freq(&ratio, &turbo_ratio); > let's say that all functions return false; as I don't check the return value of the last one, you can very well end up here with 'ratio' and 'turbo_ratio' that are still untouched, =1 since their initialization, and I would go on and set the static key anyway (because I previously checked X86_FEATURE_APERFMPERF). Right? > set_value: > arch_max_turbo_freq = div_u64(turbo_ratio * SCHED_CAPACITY_SCALE, > ratio); > set_arch_max_freq(turbo_disabled()); > static_branch_enable(&arch_scale_freq_key); > } But again, not only people disagree with this behavior, it's probably a little misleading too in how it's written. Changing in v5. Giovanni