From mboxrd@z Thu Jan 1 00:00:00 1970 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 A4A972FD1D1; Tue, 12 Aug 2025 17:41:15 +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=1755020475; cv=none; b=de2blm1vQLZ1NxgMR8m7KzAqZbm+rQmqTML/Dl96jdC+voioeGJa3WXxIFNjX4g+7CMVb0GYc8PXOWV7MuDQNTjtopXuxqqwtQhN1zrlszJzxaENcmJ9kVQGLFxVLccR75RFcigDRjl3cockT7gqpLqu1gFuA6RWf8hmEw67Pcc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755020475; c=relaxed/simple; bh=iU6ntrNK5285kYkdj/Cmf0JUPq2XasCHb88TkoAEHwA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lSI9DvVXCeTPXaAJ7ynfQy1d+vP8uTU/BV0++9Dx0JsnaSxPByZzEH3VbrJuqZgPxybMYsnT9rI+8YrPpHKLOkn9H+EgV94nzSwd+JgijBndKUqtDHCFeWg/9RCows1DyOzj1mZKxLzNMymb5jko7w2c0ayT92PA+OATMpvYI10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PyuADsni; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="PyuADsni" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26693C4CEF0; Tue, 12 Aug 2025 17:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755020475; bh=iU6ntrNK5285kYkdj/Cmf0JUPq2XasCHb88TkoAEHwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PyuADsni7YJM5GMrF9BivEEfO74at9CEIxb/tdOC+U2WFPBlrAL5jYsMTdWaHri+B jPUkJ6Z4Le1CABmQJGEZJu9/VZDqlcHdIMUnFq0fYYDln9CxqXQE31uwGI7ChSy6Qm 03ownUtu01JjNYeSHUZ+iDxy2AEs1Qt/xPkQkf0A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lifeng Zheng , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.1 090/253] cpufreq: Initialize cpufreq-based frequency-invariance later Date: Tue, 12 Aug 2025 19:27:58 +0200 Message-ID: <20250812172952.565155060@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812172948.675299901@linuxfoundation.org> References: <20250812172948.675299901@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lifeng Zheng [ Upstream commit 2a6c727387062a2ea79eb6cf5004820cb1b0afe2 ] The cpufreq-based invariance is enabled in cpufreq_register_driver(), but never disabled after registration fails. Move the invariance initialization to where all other initializations have been successfully done to solve this problem. Fixes: 874f63531064 ("cpufreq: report whether cpufreq supports Frequency Invariance (FI)") Signed-off-by: Lifeng Zheng Link: https://patch.msgid.link/20250709104145.2348017-2-zhenglifeng1@huawei.com [ rjw: New subject ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/cpufreq.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 3f35ce19c7b6..1d18a56dccab 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2882,15 +2882,6 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data; write_unlock_irqrestore(&cpufreq_driver_lock, flags); - /* - * Mark support for the scheduler's frequency invariance engine for - * drivers that implement target(), target_index() or fast_switch(). - */ - if (!cpufreq_driver->setpolicy) { - static_branch_enable_cpuslocked(&cpufreq_freq_invariance); - pr_debug("supports frequency invariance"); - } - if (driver_data->setpolicy) driver_data->flags |= CPUFREQ_CONST_LOOPS; @@ -2921,6 +2912,15 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) hp_online = ret; ret = 0; + /* + * Mark support for the scheduler's frequency invariance engine for + * drivers that implement target(), target_index() or fast_switch(). + */ + if (!cpufreq_driver->setpolicy) { + static_branch_enable_cpuslocked(&cpufreq_freq_invariance); + pr_debug("supports frequency invariance"); + } + pr_debug("driver %s up and running\n", driver_data->name); goto out; -- 2.39.5