mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Rui Huang <ray.huang@amd.com>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: "open list:AMD PSTATE DRIVER" <linux-pm@vger.kernel.org>,
	Perry Yuan <Perry.Yuan@amd.com>,
	open list <linux-kernel@vger.kernel.org>,
	"Mario Limonciello" <mario.limonciello@amd.com>
Subject: [PATCH v3 1/6] cpufreq: Export acpu_cpufreq_exit for other drivers to call
Date: Thu, 14 Apr 2022 11:47:56 -0500	[thread overview]
Message-ID: <20220414164801.1051-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20220414164801.1051-1-mario.limonciello@amd.com>

Currently, the only way to load an alternative cpufreq driver is to unload
acpi-cpufreq first.

Loosen that restriction to allow other kernel modules to unregister a
registered driver.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Move to include header
 * Create a new symbol to prevent NX protected page fault calling exit
   function from other modules.
v1->v2:
 * Export symbol instead of changing internals

 drivers/cpufreq/acpi-cpufreq.c | 10 ++++++++--
 include/linux/cpufreq.h        |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 3d514b82d055..38358ed1f932 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -1033,7 +1033,7 @@ static int __init acpi_cpufreq_init(void)
 	return ret;
 }
 
-static void __exit acpi_cpufreq_exit(void)
+void acpi_cpufreq_exit(void)
 {
 	pr_debug("%s\n", __func__);
 
@@ -1043,6 +1043,12 @@ static void __exit acpi_cpufreq_exit(void)
 
 	free_acpi_perf_data();
 }
+EXPORT_SYMBOL_GPL(acpi_cpufreq_exit);
+
+void __exit acpi_cpufreq_module_exit(void)
+{
+	acpi_cpufreq_exit();
+}
 
 module_param(acpi_pstate_strict, uint, 0644);
 MODULE_PARM_DESC(acpi_pstate_strict,
@@ -1050,7 +1056,7 @@ MODULE_PARM_DESC(acpi_pstate_strict,
 	"performed during frequency changes.");
 
 late_initcall(acpi_cpufreq_init);
-module_exit(acpi_cpufreq_exit);
+module_exit(acpi_cpufreq_module_exit);
 
 static const struct x86_cpu_id __maybe_unused acpi_cpufreq_ids[] = {
 	X86_MATCH_FEATURE(X86_FEATURE_ACPI, NULL),
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 35c7d6db4139..223bf9760117 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -273,6 +273,9 @@ static inline void cpufreq_stats_record_transition(struct cpufreq_policy *policy
 						   unsigned int new_freq) { }
 #endif /* CONFIG_CPU_FREQ_STAT */
 
+#if defined(CONFIG_X86_ACPI_CPUFREQ) || defined(CONFIG_X86_ACPI_CPUFREQ_MODULE)
+void acpi_cpufreq_exit(void);
+#endif
 /*********************************************************************
  *                      CPUFREQ DRIVER INTERFACE                     *
  *********************************************************************/
-- 
2.34.1


  reply	other threads:[~2022-04-14 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 16:47 [PATCH v3 0/6] Improve usability for amd-pstate Mario Limonciello
2022-04-14 16:47 ` Mario Limonciello [this message]
2022-04-14 16:47 ` [PATCH v3 2/6] cpufreq: amd-pstate: Only show shared memory solution message once Mario Limonciello
2022-04-27 13:46   ` Huang Rui
2022-04-14 16:47 ` [PATCH v3 3/6] cpufreq: amd-pstate: Move cpufreq driver check later Mario Limonciello
2022-04-27 14:45   ` Huang Rui
2022-04-14 16:47 ` [PATCH v3 4/6] cpufreq: amd-pstate: Allow replacing acpi-cpufreq when loaded Mario Limonciello
2022-04-14 17:32   ` Nathan Fontenot
2022-04-14 17:58     ` Limonciello, Mario
2022-04-21 18:38       ` Rafael J. Wysocki
2022-04-28  7:15         ` Huang Rui
2022-04-29  2:36           ` Nathan Fontenot
2022-04-29  6:26             ` Huang Rui
2022-04-14 16:48 ` [PATCH v3 5/6] cpufreq: amd-pstate: Add a module device table Mario Limonciello
2022-04-14 16:48 ` [PATCH v3 6/6] cpufreq: amd-pstate: Default to replace acpi-cpufreq Mario Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220414164801.1051-2-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Perry.Yuan@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®