Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp456437pxu; Thu, 3 Dec 2020 04:46:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvXwBy6rPIpNCxtsppWRdL4W7AUbtCpLvP61w4uxWN2GIxXqXOMOx9MvIOqiatRzL96Fcu X-Received: by 2002:a17:906:d20e:: with SMTP id w14mr2276349ejz.479.1606999605792; Thu, 03 Dec 2020 04:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606999605; cv=none; d=google.com; s=arc-20160816; b=r5eEP7j1K7UdQ2IUqtRia4HEqqBcQQW49N6ZY7aIPznZ9nquiGDdIPjz4zh/Jcx7o5 p6cPp0QdzED008byjxVhYa2a20dtWVpmvVo1ARYxO1tlW2gXpn5mReeNsWLeiDGLukmn yNB8yXiUIBEt1KSEuCfQXIlM8OLC/uIzERlMvIjg6t8q0jKFGYE6tpSzwXeNlRA4mO0V dqoRPooSIx0afrF8aUxAMGkTpkpQjESAoNRkQrQyPnD/spmgYPS4bOBlU0KJib0Ftu1c s3+MdYjUNHRW/qZpDvt8m3AN8DI3EJL35RdyWqk0TdRD07Za2abAA/Ed/hFbEStATzrT PPsg== 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=rcY1pTuzOztjgznyvJvtInjHpKkyW5kZe8ZvS4Mqiwo=; b=wzEYEqrcQ+pM2HRLxlAx1yYgO/qJlRwG/qcwTk8h1VUhm2dhUZxEieHr4V+Hq1aYR5 GhYNhSyqeIcwphJehzJS7yIW9S9W918F+JPiQcDSuOOiZ1lIPvOQ3J0pMIkwiOnqEwdL a+ZFa+NTz936RVXe7o27D2jWunWfKBxA7zwDQiVhpA30RYyP0K87ZuaTYdBgmzJKmjy8 xb8UIKZ8RSCWaxz77wLHaIA/wkH7HdBzincnDT7D3gcanfx2cHRD421L9k8mFIxOXxne gbgDSNT1Uh7gid67duvl/HAcEaE00nXeSeP34tr2TUxbS8gY46QkZHAwgU5KadJr90Ug WFxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=swl2bpoK; 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 t2si1063154ejd.302.2020.12.03.04.46.21; Thu, 03 Dec 2020 04:46:45 -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=merlin.20170209 header.b=swl2bpoK; 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 S2388889AbgLCMmg (ORCPT + 99 others); Thu, 3 Dec 2020 07:42:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387998AbgLCMmf (ORCPT ); Thu, 3 Dec 2020 07:42:35 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 952C5C061A4F; Thu, 3 Dec 2020 04:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=rcY1pTuzOztjgznyvJvtInjHpKkyW5kZe8ZvS4Mqiwo=; b=swl2bpoKojQhZhwjiyg7JMJngF PncZValpmxIZQ5xpwjLKsGr0/y+u9btEM6ialPYA4ySFjOnc2EFkyShoIbXs+72+STp1uSCPd99Co 3hqjrdIjGLjqTfn52CmR/Prx8W9yE3Fi48MNrfs33S5tnBXwRzx3gyUjtwqewh85PEEu1Rd58yYA/ rF+6EPe3SjSPlm6/7838UQKrxW9lT89DmrX2U0AwxwtwokPBGfgBaASdCbr6M7DYmsu8K5O10me0s hCMZrmo7Lhavv4GYAhJjzvOin3ChO5vv5TL15oT7cf8dRjwUnjbagMLgk67vtssawBdTpJiQu89in drfBZOZA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kknvb-0004Vz-IS; Thu, 03 Dec 2020 12:41:43 +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 80A23300DAE; Thu, 3 Dec 2020 13:41:41 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6A194223615CE; Thu, 3 Dec 2020 13:41:41 +0100 (CET) Date: Thu, 3 Dec 2020 13:41:41 +0100 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: Linux PM , LKML , Viresh Kumar , Srinivas Pandruvada , Doug Smythies , Giovanni Gherdovich Subject: Re: [RFC][PATCH 1/2] cpufreq: Add special-purpose fast-switching callback for drivers Message-ID: <20201203124141.GP3021@hirez.programming.kicks-ass.net> References: <1817571.2o5Kk4Ohv2@kreacher> <2174134.tL5yAn4CWt@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2174134.tL5yAn4CWt@kreacher> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 30, 2020 at 07:37:01PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > First off, some cpufreq drivers (eg. intel_pstate) can pass hints > beyond the current target frequency to the hardware and there are no Everything CPPC, which is quite a bit these days. > + /* > + * ->fast_switch() replacement for drivers that use an internal > + * representation of performance levels and can pass hints other than > + * the target performance level to the hardware. > + */ > + void (*adjust_perf)(unsigned int cpu, bool busy, > + unsigned long min_perf, > + unsigned long target_perf, > + unsigned long capacity); > I'm not sure @busy makes sense, that's more a hack because @util had a dip and should remain inside schedutil. > @@ -454,6 +455,25 @@ static void sugov_update_single(struct u > util = sugov_get_util(sg_cpu); > max = sg_cpu->max; > util = sugov_iowait_apply(sg_cpu, time, util, max); > + > + /* > + * This code runs under rq->lock for the target CPU, so it won't run > + * concurrently on two different CPUs for the same target and it is not > + * necessary to acquire the lock in the fast switch case. > + */ > + if (sg_policy->direct_fast_switch) { > + /* > + * In this case, any optimizations that can be done are up to > + * the driver. > + */ > + cpufreq_driver_adjust_perf(sg_cpu->cpu, > + sugov_cpu_is_busy(sg_cpu), > + map_util_perf(sg_cpu->bw_dl), > + map_util_perf(util), max); > + sg_policy->last_freq_update_time = time; > + return; > + } Instead of adding more branches, would it makes sense to simply set a whole different util_hook in this case?