Skip to contentSkip to conversation

pm selftest: rtc paranoia

PATCH In review David Brownell 2 participants 7 messages Jul 25, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pm selftest: rtc paranoia

From: David Brownell <[email protected]>

Cope with a quirk of some RTCs (notably ACPI ones) which aren't guaranteed to implement oneshot behavior when they woke the system from sleeep: forcibly disable the alarm, just in case.

---
 kernel/power/main.c |    7 +++++++
 1 file changed, 7 insertions(+)
kernel/power/main.c +7 -0
@@ -635,6 +635,13 @@ static void __init test_wakealarm(struct
 	}
 	if (status < 0)
 		printk(err_suspend, status);
+
+	/* Some platforms can't detect that the alarm triggered the
+	 * wakeup, or (accordingly) disable it after it afterwards.
+	 * It's supposed to give oneshot behavior; cope.
+	 */
+	alm.enabled = false;
+	rtc_set_alarm(rtc, &alm);
 }
 
 static int __init has_wakealarm(struct device *dev, void *name_ptr)
#1 lore raw
Quoted 18 lines · On Fri, 25 Jul 2008 13:26:51 -0700 David Brownell <[email protected]> wrote:

From: David Brownell <[email protected]>

Cope with a quirk of some RTCs (notably ACPI ones) which aren't guaranteed to implement oneshot behavior when they woke the system from sleeep: forcibly disable the alarm, just in case.

---
 kernel/power/main.c |    7 +++++++
 1 file changed, 7 insertions(+)
kernel/power/main.c +0 -0
@@ -635,6 +635,13 @@ static void __init test_wakealarm(struct
 	}
 	if (status < 0)
 		printk(err_suspend, status);

kernel/power/main.c static void __init test_wakealarm(struct · line 647

Quoted 10 lines
kernel/power/main.c +7 -0
+
+	/* Some platforms can't detect that the alarm triggered the
+	 * wakeup, or (accordingly) disable it after it afterwards.
+	 * It's supposed to give oneshot behavior; cope.
+	 */
+	alm.enabled = false;
+	rtc_set_alarm(rtc, &alm);
 }
 
 static int __init has_wakealarm(struct device *dev, void *name_ptr)

I assume this fixes some reported bug? Any references?

Is this needed in 2.6.26.x? 2.6.25.x?

#2 lore raw
In reply to David Brownell
Quoted 18 lines · On Fri, 25 Jul 2008 13:26:51 -0700 David Brownell <[email protected]> wrote:

From: David Brownell <[email protected]>

Cope with a quirk of some RTCs (notably ACPI ones) which aren't guaranteed to implement oneshot behavior when they woke the system from sleeep: forcibly disable the alarm, just in case.

---
 kernel/power/main.c |    7 +++++++
 1 file changed, 7 insertions(+)
kernel/power/main.c +0 -0
@@ -635,6 +635,13 @@ static void __init test_wakealarm(struct
 	}
 	if (status < 0)
 		printk(err_suspend, status);

kernel/power/main.c static void __init test_wakealarm(struct · line 647

Quoted 10 lines
kernel/power/main.c +7 -0
+
+	/* Some platforms can't detect that the alarm triggered the
+	 * wakeup, or (accordingly) disable it after it afterwards.
+	 * It's supposed to give oneshot behavior; cope.
+	 */
+	alm.enabled = false;
+	rtc_set_alarm(rtc, &alm);
 }
 
 static int __init has_wakealarm(struct device *dev, void *name_ptr)

I assume this fixes some reported bug? Any references?

Is this needed in 2.6.26.x? 2.6.25.x?

#3 lore raw
Quoted 12 lines · On Fri, 25 Jul 2008 14:49:46 -0700 Andrew Morton <[email protected]>…
Quoted 12 lines
kernel/power/main.c +7 -0
 	}
 	if (status < 0)
 		printk(err_suspend, status);
+
+	/* Some platforms can't detect that the alarm triggered the
+	 * wakeup, or (accordingly) disable it after it afterwards.
+	 * It's supposed to give oneshot behavior; cope.
+	 */
+	alm.enabled = false;
+	rtc_set_alarm(rtc, &alm);
 }
Quoted 5 lines
Quoted 1 line

static int __init has_wakealarm(struct device *dev, void *name_ptr)

I assume this fixes some reported bug? Any references?

Is this needed in 2.6.26.x? 2.6.25.x?

oh. pm-selftest is new. Ignore me.

#4 lore raw
In reply to Andrew Morton
Quoted 12 lines · On Fri, 25 Jul 2008 14:49:46 -0700 Andrew Morton <[email protected]>…
Quoted 12 lines
kernel/power/main.c +7 -0
 	}
 	if (status < 0)
 		printk(err_suspend, status);
+
+	/* Some platforms can't detect that the alarm triggered the
+	 * wakeup, or (accordingly) disable it after it afterwards.
+	 * It's supposed to give oneshot behavior; cope.
+	 */
+	alm.enabled = false;
+	rtc_set_alarm(rtc, &alm);
 }
Quoted 5 lines
Quoted 1 line

static int __init has_wakealarm(struct device *dev, void *name_ptr)

I assume this fixes some reported bug? Any references?

Is this needed in 2.6.26.x? 2.6.25.x?

oh. pm-selftest is new. Ignore me.

#5 lore raw
In reply to Andrew Morton
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Fri, 25 Jul 2008 13:26:51 -0700 David Brownell <[email protected]> wrote:

From: David Brownell <[email protected]>

Quoted 8 lines
Quoted 6 lines

Cope with a quirk of some RTCs (notably ACPI ones) which aren't guaranteed to implement oneshot behavior when they woke the system from sleeep: forcibly disable the alarm, just in case.

...

I assume this fixes some reported bug? Any references?

It's more paranoia than anything else ... I saw a version of this with on x86, but that was because of problems in the HPET glue (fixed by a previous patch).

Quoted 1 line

Is this needed in 2.6.26.x? 2.6.25.x?

The selftest only merged this week, so not 2.6.25; and since it's just paranoia, it shouldn't be critical for 2.6.26 either.

- Dave

#6 lore raw
In reply to Andrew Morton
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Fri, 25 Jul 2008 13:26:51 -0700 David Brownell <[email protected]> wrote:

From: David Brownell <[email protected]>

Quoted 8 lines
Quoted 6 lines

Cope with a quirk of some RTCs (notably ACPI ones) which aren't guaranteed to implement oneshot behavior when they woke the system from sleeep: forcibly disable the alarm, just in case.

...

I assume this fixes some reported bug? Any references?

It's more paranoia than anything else ... I saw a version of this with on x86, but that was because of problems in the HPET glue (fixed by a previous patch).

Quoted 1 line

Is this needed in 2.6.26.x? 2.6.25.x?

The selftest only merged this week, so not 2.6.25; and since it's just paranoia, it shouldn't be critical for 2.6.26 either.

- Dave