lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220414164801.1051-2-mario.limonciello@amd.com>
Date:   Thu, 14 Apr 2022 11:47:56 -0500
From:   Mario Limonciello <mario.limonciello@....com>
To:     Rui Huang <ray.huang@....com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>
CC:     "open list:AMD PSTATE DRIVER" <linux-pm@...r.kernel.org>,
        Perry Yuan <Perry.Yuan@....com>,
        open list <linux-kernel@...r.kernel.org>,
        "Mario Limonciello" <mario.limonciello@....com>
Subject: [PATCH v3 1/6] cpufreq: Export acpu_cpufreq_exit for other drivers to call

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@....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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ