Skip to contentSkip to conversation

acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails

PATCH In review John Stultz 3 participants 4 messages Jan 14, 2011 – Jan 21, 2011 Clocksource, clockevent drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails

From: Konrad Rzeszutek Wilk <[email protected]>

If the acpi pm timer throws invalid data, clear pmtmr_ioport so the pm timer won't accidentally be used.

This was found when using Xen where there is a acpi pm reported, but gives bogus values, and other code was continuing to try to use the pm timer after the initialization failed.

[jstultz: Catch additional failure and reword changelog message. ]

---
 drivers/clocksource/acpi_pm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/clocksource/acpi_pm.c +5 -1
index cfb0f52..effe797 100644
@@ -202,17 +202,21 @@ static int __init init_acpi_pm_clocksource(void)
 			printk(KERN_INFO "PM-Timer had inconsistent results:"
 			       " 0x%#llx, 0x%#llx - aborting.\n",
 			       value1, value2);
+			pmtmr_ioport = 0;
 			return -EINVAL;
 		}
 		if (i == ACPI_PM_READ_CHECKS) {
 			printk(KERN_INFO "PM-Timer failed consistency check "
 			       " (0x%#llx) - aborting.\n", value1);
+			pmtmr_ioport = 0;
 			return -ENODEV;
 		}
 	}
 
-	if (verify_pmtmr_rate() != 0)
+	if (verify_pmtmr_rate() != 0){
+		pmtmr_ioport = 0;
 		return -ENODEV;
+	}
 
 	return clocksource_register_hz(&clocksource_acpi_pm,
 						PMTMR_TICKS_PER_SEC);
Signature · 1 line
1.7.3.2.146.gca209
#1 lore raw
Quoted 2 lines · John Stultz

From: Konrad Rzeszutek Wilk <[email protected]>

tgl,

Are you OK pushing this up to Linus or should I do it? We can also delay this till the next merge window as the other fix that John proposed solves the bootup issue so it is not that urgent.

Quoted 8 lines

If the acpi pm timer throws invalid data, clear pmtmr_ioport so the pm timer won't accidentally be used.

This was found when using Xen where there is a acpi pm reported, but gives bogus values, and other code was continuing to try to use the pm timer after the initialization failed.

[jstultz: Catch additional failure and reword changelog message. ]

Thank you John.

Quoted 39 lines
---
 drivers/clocksource/acpi_pm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/clocksource/acpi_pm.c +5 -1
index cfb0f52..effe797 100644
@@ -202,17 +202,21 @@ static int __init init_acpi_pm_clocksource(void)
 			printk(KERN_INFO "PM-Timer had inconsistent results:"
 			       " 0x%#llx, 0x%#llx - aborting.\n",
 			       value1, value2);
+			pmtmr_ioport = 0;
 			return -EINVAL;
 		}
 		if (i == ACPI_PM_READ_CHECKS) {
 			printk(KERN_INFO "PM-Timer failed consistency check "
 			       " (0x%#llx) - aborting.\n", value1);
+			pmtmr_ioport = 0;
 			return -ENODEV;
 		}
 	}
 
-	if (verify_pmtmr_rate() != 0)
+	if (verify_pmtmr_rate() != 0){
+		pmtmr_ioport = 0;
 		return -ENODEV;
+	}
 
 	return clocksource_register_hz(&clocksource_acpi_pm,
 						PMTMR_TICKS_PER_SEC);
Signature · 1 line
1.7.3.2.146.gca209
#2 lore raw
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 2 lines · John Stultz

From: Konrad Rzeszutek Wilk <[email protected]>

tgl,

Are you OK pushing this up to Linus or should I do it? We can also delay this till the next merge window as the other fix that John proposed solves the bootup issue so it is not that urgent.

It's in my queue, no worry.

#3 lore raw
In reply to John Stultz
Commit-ID:  db6b175fa6ad1408cbb2fb62949a6d55cfece03e
Gitweb:     http://git.kernel.org/tip/db6b175fa6ad1408cbb2fb62949a6d55cfece03e
Author:     Konrad Rzeszutek Wilk <[email protected]>
AuthorDate: Fri, 14 Jan 2011 09:47:26 -0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 21 Jan 2011 17:38:19 +0100

acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails

If the acpi pm timer throws invalid data, clear pmtmr_ioport so the pm timer won't accidentally be used.

This was found when using Xen where there is a acpi pm reported, but gives bogus values, and other code was continuing to try to use the pm timer after the initialization failed.

[jstultz: Catch additional failure and reword changelog message. ]

LKML-Reference: <[email protected]>

---
 drivers/clocksource/acpi_pm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/clocksource/acpi_pm.c +5 -1
index cfb0f52..effe797 100644
@@ -202,17 +202,21 @@ static int __init init_acpi_pm_clocksource(void)
 			printk(KERN_INFO "PM-Timer had inconsistent results:"
 			       " 0x%#llx, 0x%#llx - aborting.\n",
 			       value1, value2);
+			pmtmr_ioport = 0;
 			return -EINVAL;
 		}
 		if (i == ACPI_PM_READ_CHECKS) {
 			printk(KERN_INFO "PM-Timer failed consistency check "
 			       " (0x%#llx) - aborting.\n", value1);
+			pmtmr_ioport = 0;
 			return -ENODEV;
 		}
 	}
 
-	if (verify_pmtmr_rate() != 0)
+	if (verify_pmtmr_rate() != 0){
+		pmtmr_ioport = 0;
 		return -ENODEV;
+	}
 
 	return clocksource_register_hz(&clocksource_acpi_pm,
 						PMTMR_TICKS_PER_SEC);