[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200511180702.27893-1-pmenzel@molgen.mpg.de>
Date: Mon, 11 May 2020 20:07:02 +0200
From: Paul Menzel <pmenzel@...gen.mpg.de>
To: linux-kernel@...r.kernel.org
Cc: Paul Menzel <pmenzel@...gen.mpg.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org
Subject: [PATCH] clocksource: Add `nopmtmr` to disable ACPI PM Timer at run-time
Initializing the ACPI Power Management Timer takes 33 ms on the ASUS
F2A85-M PRO.
[ 0.248373] calling init_acpi_pm_clocksource+0x0/0x197 @ 1
[ 0.282913] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[ 0.282916] initcall init_acpi_pm_clocksource+0x0/0x197 returned 0 after 33731 usecs
Currently, it’s only possible to disable that clocksource with the
Kconfig option `X86_PM_TIMER`, so add the option `nopmtmr` to disable
that clocksource at run-time.
[ 0.248381] calling init_acpi_pm_clocksource+0x0/0x197 @ 1
[ 0.248383] initcall init_acpi_pm_clocksource+0x0/0x197 returned -19 after 0 usecs
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: x86@...nel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Paul Menzel <pmenzel@...gen.mpg.de>
---
Please consider this a request for comments.
1. What would be the correct return value? Can ENODEV be used?
2. Should the attribute `__read_mostly` be added?
---
Documentation/admin-guide/kernel-parameters.txt | 2 ++
drivers/clocksource/acpi_pm.c | 15 +++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 7bc83f3d9bdf..4ea7fa94b015 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3246,6 +3246,8 @@
nopcid [X86-64] Disable the PCID cpu feature.
+ nopmtmr [X86] Disable the ACPI Power Management Timer.
+
norandmaps Don't use address space randomization. Equivalent to
echo 0 > /proc/sys/kernel/randomize_va_space
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index eb596ff9e7bb..c1249f9c9acf 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -30,6 +30,7 @@
* in arch/i386/kernel/acpi/boot.c
*/
u32 pmtmr_ioport __read_mostly;
+static bool nopmtmr;
static inline u32 read_pmtmr(void)
{
@@ -177,6 +178,9 @@ static int __init init_acpi_pm_clocksource(void)
u64 value1, value2;
unsigned int i, j = 0;
+ if (nopmtmr)
+ return -ENODEV;
+
if (!pmtmr_ioport)
return -ENODEV;
@@ -239,3 +243,14 @@ static int __init parse_pmtmr(char *arg)
return 1;
}
__setup("pmtmr=", parse_pmtmr);
+
+/*
+ * Allow to disable PMTimer at run-time.
+ */
+static int __init parse_nopmtmr(char *arg)
+{
+ nopmtmr = true;
+
+ return 0;
+}
+__setup("nopmtmr", parse_nopmtmr);
--
2.26.2
Powered by blists - more mailing lists