mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* FW: [linux-pm] select with timeout across S3
@ 2008-08-28 17:32 Leisner, Martin
  2008-08-28 20:57 ` Andreas Mohr
  2008-09-01  6:25 ` FW: " Pavel Machek
  0 siblings, 2 replies; 7+ messages in thread
From: Leisner, Martin @ 2008-08-28 17:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-pm

[-- Attachment #1: Type: text/plain, Size: 1560 bytes --]

The behavior of linux (in both 2.4.x and 2.6.x) is when the processor
sleeps, timeouts on select don't take into account the sleep time,
only the run time.

For example, this program should pause for 10 minutes -- however
if we go into S3 in the middle its pausing for (10 minutes + time in
S3)

I saw this on both 2.6.20 and 2.6.22...

marty

-----Original Message-----
From: linux-pm-bounces@lists.linux-foundation.org
[mailto:linux-pm-bounces@lists.linux-foundation.org] On Behalf Of Pavel
Machek
Sent: Thursday, August 28, 2008 10:30 AM
To: Leisner, Martin
Cc: linux-pm@lists.linux-foundation.org
Subject: Re: [linux-pm] select with timeout across S3

On Wed 2008-08-27 15:23:13, Leisner, Martin wrote:
> What's a good way to "wait" across a transition to/from processor
sleep
> (acpi S3 or other means)?
> 
> 
> It seems the timeouts on select(2) only deal with with time correctly
> when the processor is awake -- when the processor is sleeping its not
> subtracted from the request...
> 
> The desirable behavior out of select would be for it to timeout
whenever
> the system wakes up if the desired interval has elapsed...

That sounds like a bug. Can you write small demo program and post it
to lkml?

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures)
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[-- Attachment #2: select.c --]
[-- Type: application/octet-stream, Size: 194 bytes --]

#include <sys/select.h>
#include <stdio.h>

main()
{
	struct timeval t;
	int ret;

	t.tv_sec = 60 * 10;
	t.tv_usec = 0;

	ret = select(0, NULL, NULL, NULL, &t);
	printf("ret = %d\n", ret);
}

	

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

* Re: [linux-pm] select with timeout across S3
  2008-08-28 17:32 FW: [linux-pm] select with timeout across S3 Leisner, Martin
@ 2008-08-28 20:57 ` Andreas Mohr
  2008-09-01  6:25 ` FW: " Pavel Machek
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Mohr @ 2008-08-28 20:57 UTC (permalink / raw)
  To: Leisner, Martin, linux-kernel; +Cc: linux-pm

Hi,

dito.

This also happened to me a couple (4?) months ago, likely on 2.6.24 or
2.6.25.
And for me it had the "very nice" effect of not obeying DHCP lease time,
with a red-faced IT guy appearing in my door the next morning thusly... ;)

>From examining it more closely, it was rather obvious that select timeout
happened maybe 10 hours later than it should have (with 12h lease time),
due to hitting nightly S2R about two hours into the lease time.
Annoying, to say the least.

I think I then privately asked some timer guy about it, but I didn't get
a reply.

The DHCP client to hit this was pump, IIRC (can re-check).

Andreas Mohr

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

* Re: FW: [linux-pm] select with timeout across S3
  2008-08-28 17:32 FW: [linux-pm] select with timeout across S3 Leisner, Martin
  2008-08-28 20:57 ` Andreas Mohr
@ 2008-09-01  6:25 ` Pavel Machek
  2008-09-11  6:17   ` Leisner, Martin
  1 sibling, 1 reply; 7+ messages in thread
From: Pavel Machek @ 2008-09-01  6:25 UTC (permalink / raw)
  To: Leisner, Martin; +Cc: linux-kernel, linux-pm

Hi!

> The behavior of linux (in both 2.4.x and 2.6.x) is when the processor
> sleeps, timeouts on select don't take into account the sleep time,
> only the run time.
> 
> For example, this program should pause for 10 minutes -- however
> if we go into S3 in the middle its pausing for (10 minutes + time in
> S3)
> 
> I saw this on both 2.6.20 and 2.6.22...

Can you test this on 2.6.27-rc? We did have some fixes in that
area....

							Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* RE: FW: [linux-pm] select with timeout across S3
  2008-09-01  6:25 ` FW: " Pavel Machek
@ 2008-09-11  6:17   ` Leisner, Martin
  2008-09-11  9:24     ` Pavel Machek
  0 siblings, 1 reply; 7+ messages in thread
From: Leisner, Martin @ 2008-09-11  6:17 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel, linux-pm, martyleisner

Hi,

I finally got 2.6.27-rc5 running...no change in my test program...

I'm going to look at the patches we're using for 2.4.20/2.6.20...
 
marty


-----Original Message-----
From: Pavel Machek [mailto:pavel@suse.cz]
Sent: Mon 9/1/2008 2:25 AM
To: Leisner, Martin
Cc: linux-kernel@vger.kernel.org; linux-pm@lists.linux-foundation.org
Subject: Re: FW: [linux-pm] select with timeout across S3
 
Hi!

> The behavior of linux (in both 2.4.x and 2.6.x) is when the processor
> sleeps, timeouts on select don't take into account the sleep time,
> only the run time.
> 
> For example, this program should pause for 10 minutes -- however
> if we go into S3 in the middle its pausing for (10 minutes + time in
> S3)
> 
> I saw this on both 2.6.20 and 2.6.22...

Can you test this on 2.6.27-rc? We did have some fixes in that
area....

							Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


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

* Re: FW: [linux-pm] select with timeout across S3
  2008-09-11  6:17   ` Leisner, Martin
@ 2008-09-11  9:24     ` Pavel Machek
  2008-09-12 15:29       ` marty
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Machek @ 2008-09-11  9:24 UTC (permalink / raw)
  To: Leisner, Martin; +Cc: linux-kernel, linux-pm, martyleisner

On Thu 2008-09-11 02:17:10, Leisner, Martin wrote:
> Hi,
> 
> I finally got 2.6.27-rc5 running...no change in my test program...
> 
> I'm going to look at the patches we're using for 2.4.20/2.6.20...

So the bug is still there, or did 2.6.27-rc5 magically solve the problem?

> marty
> 
> 
> -----Original Message-----
> From: Pavel Machek [mailto:pavel@suse.cz]
> Sent: Mon 9/1/2008 2:25 AM
> To: Leisner, Martin
> Cc: linux-kernel@vger.kernel.org; linux-pm@lists.linux-foundation.org
> Subject: Re: FW: [linux-pm] select with timeout across S3
>  
> Hi!
> 
> > The behavior of linux (in both 2.4.x and 2.6.x) is when the processor
> > sleeps, timeouts on select don't take into account the sleep time,
> > only the run time.
> > 
> > For example, this program should pause for 10 minutes -- however
> > if we go into S3 in the middle its pausing for (10 minutes + time in
> > S3)
> > 
> > I saw this on both 2.6.20 and 2.6.22...
> 
> Can you test this on 2.6.27-rc? We did have some fixes in that
> area....
> 
> 							Pavel
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: FW: [linux-pm] select with timeout across S3
  2008-09-11  9:24     ` Pavel Machek
@ 2008-09-12 15:29       ` marty
  2009-01-27  9:15         ` Pavel Machek
  0 siblings, 1 reply; 7+ messages in thread
From: marty @ 2008-09-12 15:29 UTC (permalink / raw)
  To: Leisner, Martin, Pavel Machek; +Cc: linux-kernel, linux-pm

I don't see a behavior change in the current kernels.

Select(2) timeouts only count the time the machine is up -- not sleeping...

I had a patch for 2.6.20 that I tried (it modified schedule_timeout) -- 
it didn't do anything useful in 2.6.27-rc5.

marty


--- On Thu, 9/11/08, Pavel Machek <pavel@suse.cz> wrote:

> From: Pavel Machek <pavel@suse.cz>
> Subject: Re: FW: [linux-pm] select with timeout across S3
> To: "Leisner, Martin" <Martin.Leisner@xerox.com>
> Cc: linux-kernel@vger.kernel.org, linux-pm@lists.linux-foundation.org, martyleisner@yahoo.com
> Date: Thursday, September 11, 2008, 5:24 AM
> On Thu 2008-09-11 02:17:10, Leisner, Martin wrote:
> > Hi,
> > 
> > I finally got 2.6.27-rc5 running...no change in my
> test program...
> > 
> > I'm going to look at the patches we're using
> for 2.4.20/2.6.20...
> 
> So the bug is still there, or did 2.6.27-rc5 magically
> solve the problem?
> 
> > marty
> > 
> > 
> > -----Original Message-----
> > From: Pavel Machek [mailto:pavel@suse.cz]
> > Sent: Mon 9/1/2008 2:25 AM
> > To: Leisner, Martin
> > Cc: linux-kernel@vger.kernel.org;
> linux-pm@lists.linux-foundation.org
> > Subject: Re: FW: [linux-pm] select with timeout across
> S3
> >  
> > Hi!
> > 
> > > The behavior of linux (in both 2.4.x and 2.6.x)
> is when the processor
> > > sleeps, timeouts on select don't take into
> account the sleep time,
> > > only the run time.
> > > 
> > > For example, this program should pause for 10
> minutes -- however
> > > if we go into S3 in the middle its pausing for
> (10 minutes + time in
> > > S3)
> > > 
> > > I saw this on both 2.6.20 and 2.6.22...
> > 
> > Can you test this on 2.6.27-rc? We did have some fixes
> in that
> > area....
> > 
> > 							Pavel
> > 
> 
> -- 
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures)
> http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


      

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

* Re: FW: [linux-pm] select with timeout across S3
  2008-09-12 15:29       ` marty
@ 2009-01-27  9:15         ` Pavel Machek
  0 siblings, 0 replies; 7+ messages in thread
From: Pavel Machek @ 2009-01-27  9:15 UTC (permalink / raw)
  To: marty; +Cc: Leisner, Martin, linux-kernel, linux-pm

> I don't see a behavior change in the current kernels.
> 
> Select(2) timeouts only count the time the machine is up -- not sleeping...
> 
> I had a patch for 2.6.20 that I tried (it modified schedule_timeout) -- 
> it didn't do anything useful in 2.6.27-rc5.

Do you have some code to demonstrate that? We may want to fix this one
some day...
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

end of thread, other threads:[~2009-01-27  9:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-28 17:32 FW: [linux-pm] select with timeout across S3 Leisner, Martin
2008-08-28 20:57 ` Andreas Mohr
2008-09-01  6:25 ` FW: " Pavel Machek
2008-09-11  6:17   ` Leisner, Martin
2008-09-11  9:24     ` Pavel Machek
2008-09-12 15:29       ` marty
2009-01-27  9:15         ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®