From nobody Thu Oct 2 00:49:28 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44638270EA3; Thu, 25 Sep 2025 15:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758815297; cv=none; b=u5gQUwWR0XOvsJQ817hw7+1vZN6vmA07IzCdBGdmvYMAey/BbiFLQuN9ULAfPxhVx2AYyrkhBYe3GwYDjyPj+sK16Nz5xuhNER9gHf/tFLCzhDAUrMWcAdy/FXhqjg22jFQHkWENR6ToegDSNrI7gbcvYT+/a6yYMIo8LFFThx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758815297; c=relaxed/simple; bh=iVFk36o20ckpW7YD2XV1idu/9PXoJIOymEpn4VqBwhw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jfv8FOs5kryt2SRO61WtaDjNZ09gMOqJIOdc146/J5DWBmuV+1/XTQlcE7uAVK0kAZ6gPQAYzh5lbdeXW0gFUWXuSoDLfod55g8C+dKpdso1wvGonBZ4fKCleXudUnEl9LB/wV0niVprp/9ua+yuwgTZt83rdbPebZ5R1Fy7VWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pxZjRTgL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pxZjRTgL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56E62C113D0; Thu, 25 Sep 2025 15:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758815296; bh=iVFk36o20ckpW7YD2XV1idu/9PXoJIOymEpn4VqBwhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxZjRTgLpEnE6gmd7MUgwSFoiCkpfpLXpVaxIzthCOY2SBF2bNSvDP391NNwpqKsX PxtjoL1bL6rbynnqSkHDqD51Lj2tYGuj9bbuGUvK5FdFKKrGNND7l6kwaoKonCGXNM cmXS9hmzcWbHu4O0mt/TXWNE2xmAaoW4Ia5RpReBPYg3zROEklj7SKq3iQC8CG6X+Z c85MNawJTwxYNQaoQZ4uU5Eo75BiDWAAELRRSRrxgFFnGIRcoENyvmBejlf4yCbYcT UkUupCDH2elPhvGxHWNFd2wkJBLNZO0UIHPHNYbnpFWQ0A95xjXID5ltAAuXUE0QkR fxvXZP7vvoMWg== From: "Rafael J. Wysocki" To: Linux PM Cc: Shawn Guo , Qais Yousef , LKML , Viresh Kumar , Prashanth Prakash , Pierre Gondois , Mario Limonciello , Linux ACPI Subject: [PATCH v1 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency Date: Thu, 25 Sep 2025 17:44:05 +0200 Message-ID: <2346363.iZASKD2KPV@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <8605612.T7Z3S40VBb@rafael.j.wysocki> References: <8605612.T7Z3S40VBb@rafael.j.wysocki> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki Commit a755d0e2d41b ("cpufreq: Honour transition_latency over transition_delay_us") caused platforms where cpuinfo.transition_latency is CPUFREQ_ETERNAL to get a very large transition latency whereas previously it had been capped at 10 ms (and later at 2 ms). This led to a user-observable regression between 6.6 and 6.12 as described by Shawn: "The dbs sampling_rate was 10000 us on 6.6 and suddently becomes 6442450 us (4294967295 / 1000 * 1.5) on 6.12 for these platforms because the default transition delay was dropped [...]. It slows down dbs governor's reacting to CPU loading change dramatically. Also, as transition_delay_us is used by schedutil governor as rate_limit_us, it shows a negative impact on device idle power consumption, because the device gets slightly less time in the lowest OPP." Evidently, the expectation of the drivers using CPUFREQ_ETERNAL as cpuinfo.transition_latency was that it would be capped by the core, but they may as well return a default transition latency value instead of CPUFREQ_ETERNAL and the core need not do anything with it. Accordingly, introduce CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS and make all of the drivers in question use it instead of CPUFREQ_ETERNAL. Fixes: a755d0e2d41b ("cpufreq: Honour transition_latency over transition_de= lay_us") Closes: https://lore.kernel.org/linux-pm/20250922125929.453444-1-shawnguo2@= yeah.net/ Reported-by: Shawn Guo Cc: 6.6+ # 6.6+ Signed-off-by: Rafael J. Wysocki Reviewed-by: Jie Zhan Reviewed-by: Mario Limonciello (AMD) > --- --- drivers/cpufreq/cpufreq-dt.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 2 +- drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +- drivers/cpufreq/scmi-cpufreq.c | 2 +- drivers/cpufreq/scpi-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 2 +- include/linux/cpufreq.h | 3 +++ 7 files changed, 9 insertions(+), 6 deletions(-) --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -104,7 +104,7 @@ static int cpufreq_init(struct cpufreq_p =20 transition_latency =3D dev_pm_opp_get_max_transition_latency(cpu_dev); if (!transition_latency) - transition_latency =3D CPUFREQ_ETERNAL; + transition_latency =3D CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; =20 cpumask_copy(policy->cpus, priv->cpus); policy->driver_data =3D priv; --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -442,7 +442,7 @@ soc_opp_out: } =20 if (of_property_read_u32(np, "clock-latency", &transition_latency)) - transition_latency =3D CPUFREQ_ETERNAL; + transition_latency =3D CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; =20 /* * Calculate the ramp time for max voltage change in the --- a/drivers/cpufreq/mediatek-cpufreq-hw.c +++ b/drivers/cpufreq/mediatek-cpufreq-hw.c @@ -309,7 +309,7 @@ static int mtk_cpufreq_hw_cpu_init(struc =20 latency =3D readl_relaxed(data->reg_bases[REG_FREQ_LATENCY]) * 1000; if (!latency) - latency =3D CPUFREQ_ETERNAL; + latency =3D CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; =20 policy->cpuinfo.transition_latency =3D latency; policy->fast_switch_possible =3D true; --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -294,7 +294,7 @@ static int scmi_cpufreq_init(struct cpuf =20 latency =3D perf_ops->transition_latency_get(ph, domain); if (!latency) - latency =3D CPUFREQ_ETERNAL; + latency =3D CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; =20 policy->cpuinfo.transition_latency =3D latency; =20 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -157,7 +157,7 @@ static int scpi_cpufreq_init(struct cpuf =20 latency =3D scpi_ops->get_transition_latency(cpu_dev); if (!latency) - latency =3D CPUFREQ_ETERNAL; + latency =3D CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; =20 policy->cpuinfo.transition_latency =3D latency; =20 --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c @@ -182,7 +182,7 @@ static int spear_cpufreq_probe(struct pl =20 if (of_property_read_u32(np, "clock-latency", &spear_cpufreq.transition_latency)) - spear_cpufreq.transition_latency =3D CPUFREQ_ETERNAL; + spear_cpufreq.transition_latency =3D CPUFREQ_DEFAULT_TRANSITION_LATENCY_= NS; =20 cnt =3D of_property_count_u32_elems(np, "cpufreq_tbl"); if (cnt <=3D 0) { --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -32,6 +32,9 @@ */ =20 #define CPUFREQ_ETERNAL (-1) + +#define CPUFREQ_DEFAULT_TANSITION_LATENCY_NS NSEC_PER_MSEC + #define CPUFREQ_NAME_LEN 16 /* Print length for names. Extra 1 space for accommodating '\n' in prints = */ #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)