From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05290211A03; Wed, 11 Dec 2024 10:33:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733913219; cv=none; b=Bz7r7mX42EDBbUSMI2G4qz/JDtrX7NLgj0tGtoQ20BAF5H7z0PE7esTh1/Ft2HBlrdPIOaZqo/C2W0EadjtS56+hxTSe++v7JHyVr9zZNxW/yXql9mYEOc6zP4hiZTERyO5UUCWfgbpcTiFla+juEZdZpzZbPIAyeHaKWJ5rxTY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733913219; c=relaxed/simple; bh=N7rHFJy8aXYAhJDzRjrgX0Pwi1zSYuP66NiIJ6ZPwzM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fUC+ep1JQDy9JHSaKI9jPjvAqfSEnpH+hhd3v6B2Mne5c1RFqdYm/cEgTboTKa+qRHNzOTb9kdbaI2US6BZpqKHY/hsXcYp4m/5bsd4skVN9CMGD+tNIq6iOdSAOySfOyIKcUZd98+tl9B7HGHZnSxOsOOtpPOoiZR2k2s9rsAE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C2291063; Wed, 11 Dec 2024 02:34:03 -0800 (PST) Received: from [10.1.37.59] (e127648.arm.com [10.1.37.59]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 318683F720; Wed, 11 Dec 2024 02:33:31 -0800 (PST) Message-ID: <4d601707-8269-4c2b-86d2-62951ea0353c@arm.com> Date: Wed, 11 Dec 2024 10:33:29 +0000 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC][PATCH v021 4/9] sched/topology: Adjust cpufreq checks for EAS To: "Rafael J. Wysocki" , Linux PM Cc: LKML , Lukasz Luba , Peter Zijlstra , Srinivas Pandruvada , Dietmar Eggemann , Morten Rasmussen , Vincent Guittot , Ricardo Neri , Pierre Gondois References: <5861970.DvuYhMxLoT@rjwysocki.net> <2989520.e9J7NaK4W3@rjwysocki.net> Content-Language: en-US From: Christian Loehle In-Reply-To: <2989520.e9J7NaK4W3@rjwysocki.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/29/24 16:00, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Make it possible to use EAS with cpufreq drivers that implement the > :setpolicy() callback instead of using generic cpufreq governors. > > This is going to be necessary for using EAS with intel_pstate in its > default configuration. > > Signed-off-by: Rafael J. Wysocki > --- > > This is the minimum of what's needed, but I'd really prefer to move > the cpufreq vs EAS checks into cpufreq because messing around cpufreq > internals in topology.c feels like a butcher shop kind of exercise. Makes sense, something like cpufreq_eas_capable(). > > Besides, as I said before, I remain unconvinced about the usefulness > of these checks at all. Yes, one is supposed to get the best results > from EAS when running schedutil, but what if they just want to try > something else with EAS? What if they can get better results with > that other thing, surprisingly enough? How do you imagine this to work then? I assume we don't make any 'resulting-OPP-guesses' like sugov_effective_cpu_perf() for any of the setpolicy governors. Neither for dbs and I guess userspace. What about standard powersave and performance? Do we just have a cpufreq callback to ask which OPP to use for the energy calculation? Assume lowest/highest? (I don't think there is hardware where lowest/highest makes a difference, so maybe not bothering with the complexity could be an option, too.) > > --- > kernel/sched/topology.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > Index: linux-pm/kernel/sched/topology.c > =================================================================== > --- linux-pm.orig/kernel/sched/topology.c > +++ linux-pm/kernel/sched/topology.c > @@ -217,6 +217,7 @@ static bool sched_is_eas_possible(const > bool any_asym_capacity = false; > struct cpufreq_policy *policy; > struct cpufreq_governor *gov; > + bool cpufreq_ok; > int i; > > /* EAS is enabled for asymmetric CPU capacity topologies. */ > @@ -251,7 +252,7 @@ static bool sched_is_eas_possible(const > return false; > } > > - /* Do not attempt EAS if schedutil is not being used. */ > + /* Do not attempt EAS if cpufreq is not configured adequately */ > for_each_cpu(i, cpu_mask) { > policy = cpufreq_cpu_get(i); > if (!policy) { > @@ -261,11 +262,14 @@ static bool sched_is_eas_possible(const > } > return false; > } > + /* Require schedutil or a "setpolicy" driver */ > gov = policy->governor; > + cpufreq_ok = gov == &schedutil_gov || > + (!gov && policy->policy != CPUFREQ_POLICY_UNKNOWN); > cpufreq_cpu_put(policy); > - if (gov != &schedutil_gov) { > + if (!cpufreq_ok) { > if (sched_debug()) { > - pr_info("rd %*pbl: Checking EAS, schedutil is mandatory\n", > + pr_info("rd %*pbl: Checking EAS, unsuitable cpufreq governor\n", > cpumask_pr_args(cpu_mask)); > } > return false; The logic here looks fine to me FWIW.