All of lore.kernel.org
 help / color / mirror / Atom feed
* + rtc-disable-hpet-emulation-on-suspend.patch added to -mm tree
@ 2009-10-13 22:08 akpm
  2009-10-14  5:56 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: akpm @ 2009-10-13 22:08 UTC (permalink / raw)
  To: mm-commits; +Cc: maximlevitsky, david-b, hpa, mingo, rjw, tglx


The patch titled
     rtc: disable hpet emulation on suspend
has been added to the -mm tree.  Its filename is
     rtc-disable-hpet-emulation-on-suspend.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: rtc: disable hpet emulation on suspend
From: Maxim Levitsky <maximlevitsky@gmail.com>

I noticed that rtc wont generate interrupts after a resume from disk.
Here hpet rtc emulation is used.

Problem is that rtc hpet comparator, isn't reinitialized after resume.
Easiest way to solve this, is always mask all hpet interrupts on suspend
This is triggered, when suspending with alarm set.


Otherwise, hpet driver will think it doesn't need to reinitialize
the rtc comparator, thus rtc interrupts won't work.

This emulation isn't need for wakealarm.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---


diff -puN drivers/rtc/rtc-cmos.c~rtc-disable-hpet-emulation-on-suspend drivers/rtc/rtc-cmos.c
--- a/drivers/rtc/rtc-cmos.c~rtc-disable-hpet-emulation-on-suspend
+++ a/drivers/rtc/rtc-cmos.c
@@ -871,8 +871,9 @@ static int cmos_suspend(struct device *d
 			mask = RTC_IRQMASK;
 		tmp &= ~mask;
 		CMOS_WRITE(tmp, RTC_CONTROL);
-		hpet_mask_rtc_irq_bit(mask);
 
+		/* shut down hpet emulation - we don't need it for alarm */
+		hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
 		cmos_checkintr(cmos, tmp);
 	}
 	spin_unlock_irq(&rtc_lock);
_

Patches currently in -mm which might be from maximlevitsky@gmail.com are

rtc-disable-hpet-emulation-on-suspend.patch


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: + rtc-disable-hpet-emulation-on-suspend.patch added to -mm tree
  2009-10-13 22:08 + rtc-disable-hpet-emulation-on-suspend.patch added to -mm tree akpm
@ 2009-10-14  5:56 ` Ingo Molnar
  2009-10-14  6:27   ` Maxim Levitsky
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-10-14  5:56 UTC (permalink / raw)
  To: akpm
  Cc: mm-commits, maximlevitsky, david-b, hpa, rjw, tglx, linux-kernel,
	Pallipadi, Venkatesh, Suresh Siddha


* akpm@linux-foundation.org <akpm@linux-foundation.org> wrote:

> ------------------------------------------------------
> Subject: rtc: disable hpet emulation on suspend
> From: Maxim Levitsky <maximlevitsky@gmail.com>
> 
> I noticed that rtc wont generate interrupts after a resume from disk.
> Here hpet rtc emulation is used.
> 
> Problem is that rtc hpet comparator, isn't reinitialized after resume.
> Easiest way to solve this, is always mask all hpet interrupts on suspend
> This is triggered, when suspending with alarm set.
> 
> 
> Otherwise, hpet driver will think it doesn't need to reinitialize
> the rtc comparator, thus rtc interrupts won't work.
> 
> This emulation isn't need for wakealarm.

> -		hpet_mask_rtc_irq_bit(mask);
>  
> +		/* shut down hpet emulation - we don't need it for alarm */
> +		hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
>  		cmos_checkintr(cmos, tmp);

Would be nice to also unconditionally reinitialize the hpet/rtc after 
resume - regardless of what state we left it in.

Also, are you sure this does not break things like 
CONFIG_PM_TEST_SUSPEND=y which rely on wakealarm?

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: + rtc-disable-hpet-emulation-on-suspend.patch added to -mm tree
  2009-10-14  5:56 ` Ingo Molnar
@ 2009-10-14  6:27   ` Maxim Levitsky
  2009-10-14  6:35     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Levitsky @ 2009-10-14  6:27 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: akpm, mm-commits, david-b, hpa, rjw, tglx, linux-kernel,
	Pallipadi, Venkatesh, Suresh Siddha

On Wed, 2009-10-14 at 07:56 +0200, Ingo Molnar wrote:
> * akpm@linux-foundation.org <akpm@linux-foundation.org> wrote:
> 
> > ------------------------------------------------------
> > Subject: rtc: disable hpet emulation on suspend
> > From: Maxim Levitsky <maximlevitsky@gmail.com>
> > 
> > I noticed that rtc wont generate interrupts after a resume from disk.
> > Here hpet rtc emulation is used.
> > 
> > Problem is that rtc hpet comparator, isn't reinitialized after resume.
> > Easiest way to solve this, is always mask all hpet interrupts on suspend
> > This is triggered, when suspending with alarm set.
> > 
> > 
> > Otherwise, hpet driver will think it doesn't need to reinitialize
> > the rtc comparator, thus rtc interrupts won't work.
> > 
> > This emulation isn't need for wakealarm.
> 
> > -		hpet_mask_rtc_irq_bit(mask);
> >  
> > +		/* shut down hpet emulation - we don't need it for alarm */
> > +		hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
> >  		cmos_checkintr(cmos, tmp);
> 
> Would be nice to also unconditionally reinitialize the hpet/rtc after 
> resume - regardless of what state we left it in.

I think this is already done.
Problem was that rtc driver was leaving the RTC_AIE, thus breaking the
initialization.

If there are no users of hpet on suspend, (periodic,alarm,update), then
it won't be initialized on resume (only rtc comparator part, other parts
are initialized correctly nowadays) but as soon as anybody start using
it, it will be.
 

> 
> Also, are you sure this does not break things like 
> CONFIG_PM_TEST_SUSPEND=y which rely on wakealarm?


This shouldn't break anything. hpet irqs aren't used for the actual
alarm.

In fact I used a script to loop over real hibernation cycles, and it
works with or without this patch.

But with this patch, hwclock works after a resume.


Best regards,
	Maxim Levitsky


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: + rtc-disable-hpet-emulation-on-suspend.patch added to -mm tree
  2009-10-14  6:27   ` Maxim Levitsky
@ 2009-10-14  6:35     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-10-14  6:35 UTC (permalink / raw)
  To: Maxim Levitsky
  Cc: akpm, mm-commits, david-b, hpa, rjw, tglx, linux-kernel,
	Pallipadi, Venkatesh, Suresh Siddha


* Maxim Levitsky <maximlevitsky@gmail.com> wrote:

> On Wed, 2009-10-14 at 07:56 +0200, Ingo Molnar wrote:
> > * akpm@linux-foundation.org <akpm@linux-foundation.org> wrote:
> > 
> > > ------------------------------------------------------
> > > Subject: rtc: disable hpet emulation on suspend
> > > From: Maxim Levitsky <maximlevitsky@gmail.com>
> > > 
> > > I noticed that rtc wont generate interrupts after a resume from disk.
> > > Here hpet rtc emulation is used.
> > > 
> > > Problem is that rtc hpet comparator, isn't reinitialized after resume.
> > > Easiest way to solve this, is always mask all hpet interrupts on suspend
> > > This is triggered, when suspending with alarm set.
> > > 
> > > 
> > > Otherwise, hpet driver will think it doesn't need to reinitialize
> > > the rtc comparator, thus rtc interrupts won't work.
> > > 
> > > This emulation isn't need for wakealarm.
> > 
> > > -		hpet_mask_rtc_irq_bit(mask);
> > >  
> > > +		/* shut down hpet emulation - we don't need it for alarm */
> > > +		hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
> > >  		cmos_checkintr(cmos, tmp);
> > 
> > Would be nice to also unconditionally reinitialize the hpet/rtc after 
> > resume - regardless of what state we left it in.
> 
> I think this is already done.
> Problem was that rtc driver was leaving the RTC_AIE, thus breaking the
> initialization.
> 
> If there are no users of hpet on suspend, (periodic,alarm,update), then
> it won't be initialized on resume (only rtc comparator part, other parts
> are initialized correctly nowadays) but as soon as anybody start using
> it, it will be.
>  
> 
> > 
> > Also, are you sure this does not break things like 
> > CONFIG_PM_TEST_SUSPEND=y which rely on wakealarm?
> 
> 
> This shouldn't break anything. hpet irqs aren't used for the actual
> alarm.
> 
> In fact I used a script to loop over real hibernation cycles, and it 
> works with or without this patch.
> 
> But with this patch, hwclock works after a resume.

Excellent - thanks!

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-14  6:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13 22:08 + rtc-disable-hpet-emulation-on-suspend.patch added to -mm tree akpm
2009-10-14  5:56 ` Ingo Molnar
2009-10-14  6:27   ` Maxim Levitsky
2009-10-14  6:35     ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.