Re: sata suspend resume ...

From: Arkadiusz Miskiewicz
Date: Thu Apr 20 2006 - 09:25:49 EST


On Wednesday 19 April 2006 18:13, Hugh Dickins wrote:

> A bisection found that Matt Mackall's sensible
> rc1 patch, to speed up get_cmos_time, has removed what often used to be
> a 2 second delay in resuming: things work well when I reinstate that
> delay (1 second has proved not enough). Below is the patch I'm using -
> where I've failed to resist mucking around to avoid those double calls
> to get_cmos_time, sorry: really it's just mdelay(2000) needed somewhere
> (until someone who knows puts in something more scientific).

FYI: I've started using 2.6.17rc2 + that patch and now resume (from suspend to
ram) works well on ThinkPad Z60m! (so far several suspend/resume cycles)


> Hugh
>
> --- 2.6.17-rc2/arch/i386/kernel/time.c 2006-03-20 05:53:29.000000000 +0000
> +++ linux/arch/i386/kernel/time.c 2006-04-19 09:56:02.000000000 +0100
> @@ -379,6 +379,7 @@ void notify_arch_cmos_timer(void)
> }
>
> static long clock_cmos_diff, sleep_start;
> +unsigned long resume_mdelay = 2000;
>
> static struct timer_opts *last_timer;
> static int timer_suspend(struct sys_device *dev, pm_message_t state)
> @@ -386,9 +387,8 @@ static int timer_suspend(struct sys_devi
> /*
> * Estimate time zone so that set_time can update the clock
> */
> - clock_cmos_diff = -get_cmos_time();
> - clock_cmos_diff += get_seconds();
> sleep_start = get_cmos_time();
> + clock_cmos_diff = get_seconds() - sleep_start;
> last_timer = cur_timer;
> cur_timer = &timer_none;
> if (last_timer->suspend)
> @@ -407,10 +407,11 @@ static int timer_resume(struct sys_devic
> hpet_reenable();
> #endif
> setup_pit_timer();
> - sec = get_cmos_time() + clock_cmos_diff;
> - sleep_length = (get_cmos_time() - sleep_start) * HZ;
> + mdelay(resume_mdelay);
> + sec = get_cmos_time();
> + sleep_length = (sec - sleep_start) * HZ;
> write_seqlock_irqsave(&xtime_lock, flags);
> - xtime.tv_sec = sec;
> + xtime.tv_sec = clock_cmos_diff + sec;
> xtime.tv_nsec = 0;
> jiffies_64 += sleep_length;
> wall_jiffies += sleep_length;


--
Arkadiusz Miśkiewicz PLD/Linux Team
arekm / maven.pl http://ftp.pld-linux.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/