* save/restore sysdev - re:2.6.9 S4: clock not updated after resume
@ 2004-10-25 6:16 Li, Shaohua
[not found] ` <16A54BF5D6E14E4D916CE26C9AD3057563CCE1-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Li, Shaohua @ 2004-10-25 6:16 UTC (permalink / raw)
To: Pavel Machek, ML ACPI-devel
>
>> I use with success 'echo disk > /sys/power/state' on my ASUS M6N
(BIOS
>> 0210A), Debian /experimental/, vanilla 2.6.9, XFree86/GNOME, with all
>> the modules installed (i.e, ALSA, bcm5700, ipw2100, USB, radeonfb,
>AGP/DRM).
>>
>> The resume is always ok, even if I suspend from battery or from AC,
>> there're no problem at all. The only remark is that the internal
clock
>> is 'freezed' at the time I suspended the machine and I must re-update
it
>> using the NTP service. This is not so problematic if your machine is
>> always connected to Internet, but as sometimes I work offline, I
should
>> re-update the internal clock by hand.
>
>It is a bug, here's the fix.
>
>
Pavel
>--- clean/arch/i386/kernel/time.c 2004-10-01 00:29:59.000000000
+0200
>+++ linux/arch/i386/kernel/time.c 2004-10-19 15:16:14.000000000
+0200
>@@ -319,7 +319,7 @@
> return retval;
> }
>
>-static long clock_cmos_diff;
>+static long clock_cmos_diff, sleep_start;
>
> static int time_suspend(struct sys_device *dev, u32 state)
> {
>@@ -328,6 +328,7 @@
> */
> clock_cmos_diff = -get_cmos_time();
> clock_cmos_diff += get_seconds();
>+ sleep_start = get_cmos_time();
> return 0;
> }
>
>@@ -335,10 +336,13 @@
> {
> unsigned long flags;
> unsigned long sec = get_cmos_time() + clock_cmos_diff;
>+ unsigned long sleep_length = get_cmos_time() - sleep_start;
>+
> write_seqlock_irqsave(&xtime_lock, flags);
> xtime.tv_sec = sec;
> xtime.tv_nsec = 0;
> write_sequnlock_irqrestore(&xtime_lock, flags);
>+ jiffies += sleep_length * HZ;
> return 0;
> }
The patch is useless. The sysdev suspend/resume isn't invoked by swsusp,
as Bjorn has mentioned before.
http://marc.theaimsgroup.com/?l=linux-kernel&m=109753613422952&w=2
Thanks,
Shaohua
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: save/restore sysdev - re:2.6.9 S4: clock not updated after resume
[not found] ` <16A54BF5D6E14E4D916CE26C9AD3057563CCE1-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2004-10-29 10:18 ` Pavel Machek
0 siblings, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2004-10-29 10:18 UTC (permalink / raw)
To: Li, Shaohua; +Cc: ML ACPI-devel
Hi!
> The patch is useless. The sysdev suspend/resume isn't invoked by swsusp,
> as Bjorn has mentioned before.
> http://marc.theaimsgroup.com/?l=linux-kernel&m=109753613422952&w=2
This patch should add sysdev suspend/resume. Can you verify it helps
for you?
Pavel
--- clean/kernel/power/disk.c 2004-10-01 00:30:32.000000000 +0200
+++ linux/kernel/power/disk.c 2004-10-29 11:57:26.000000000 +0200
@@ -102,6 +116,7 @@
static void finish(void)
{
+ sysdev_resume();
device_resume();
platform_finish();
enable_nonboot_cpus();
@@ -133,8 +148,12 @@
free_some_memory();
disable_nonboot_cpus();
- if ((error = device_suspend(PM_SUSPEND_DISK)))
+ if ((error = device_suspend(PMSG_SUSPEND_DISK))) {
+ printk("Some devices failed to suspend\n");
goto Finish;
+ }
+
+ sysdev_suspend(PMSG_SUSPEND_DISK);
return 0;
Finish:
--- clean/kernel/power/main.c 2004-10-01 00:30:32.000000000 +0200
+++ linux/kernel/power/main.c 2004-10-29 11:56:59.000000000 +0200
@@ -825,6 +812,7 @@
int swsusp_write(void)
{
int error;
+ sysdev_resume();
device_resume();
lock_swapdevices();
error = write_suspend_image();
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-------------------------------------------------------
This Newsletter Sponsored by: Macrovision
For reliable Linux application installations, use the industry's leading
setup authoring tool, InstallShield X. Learn more and evaluate
today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: save/restore sysdev - re:2.6.9 S4: clock not updated after resume
@ 2004-11-04 7:08 Li, Shaohua
[not found] ` <16A54BF5D6E14E4D916CE26C9AD30575796CEB-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Li, Shaohua @ 2004-11-04 7:08 UTC (permalink / raw)
To: Pavel Machek; +Cc: ML ACPI-devel
>
>> The patch is useless. The sysdev suspend/resume isn't invoked by
swsusp,
>> as Bjorn has mentioned before.
>> http://marc.theaimsgroup.com/?l=linux-kernel&m=109753613422952&w=2
>
>This patch should add sysdev suspend/resume. Can you verify it helps
>for you?
Sorry for being so late to reply. Yes, the patch (after fix some
compiling error) works for me. But one comment is sysdev_resume/suspend
are designed to work with IRQ disabled.
Thanks,
Shaohua
>--- clean/kernel/power/disk.c 2004-10-01 00:30:32.000000000 +0200
>+++ linux/kernel/power/disk.c 2004-10-29 11:57:26.000000000 +0200
>@@ -102,6 +116,7 @@
>
> static void finish(void)
> {
>+ sysdev_resume();
> device_resume();
> platform_finish();
> enable_nonboot_cpus();
>@@ -133,8 +148,12 @@
> free_some_memory();
>
> disable_nonboot_cpus();
>- if ((error = device_suspend(PM_SUSPEND_DISK)))
>+ if ((error = device_suspend(PMSG_SUSPEND_DISK))) {
>+ printk("Some devices failed to suspend\n");
> goto Finish;
>+ }
>+
>+ sysdev_suspend(PMSG_SUSPEND_DISK);
>
> return 0;
> Finish:
>--- clean/kernel/power/main.c 2004-10-01 00:30:32.000000000 +0200
>+++ linux/kernel/power/main.c 2004-10-29 11:56:59.000000000 +0200
>@@ -825,6 +812,7 @@
> int swsusp_write(void)
> {
> int error;
>+ sysdev_resume();
> device_resume();
> lock_swapdevices();
> error = write_suspend_image();
>
>
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: save/restore sysdev - re:2.6.9 S4: clock not updated after resume
[not found] ` <16A54BF5D6E14E4D916CE26C9AD30575796CEB-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2004-11-16 12:26 ` Pavel Machek
[not found] ` <20041116122648.GB1013-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2004-11-16 12:26 UTC (permalink / raw)
To: Li, Shaohua; +Cc: ML ACPI-devel
Hi!
> >> The patch is useless. The sysdev suspend/resume isn't invoked by
> swsusp,
> >> as Bjorn has mentioned before.
> >> http://marc.theaimsgroup.com/?l=linux-kernel&m=109753613422952&w=2
> >
> >This patch should add sysdev suspend/resume. Can you verify it helps
> >for you?
> Sorry for being so late to reply. Yes, the patch (after fix some
> compiling error) works for me. But one comment is sysdev_resume/suspend
> are designed to work with IRQ disabled.
Hmm, yes, you are right. Can you test this replacement? [And possibly
forward it to andrew, it is hard for me to maintain it since my tree
diverged a lot].
Pavel
--- clean/kernel/power/swsusp.c 2004-10-19 14:16:29.000000000 +0200
+++ linux/kernel/power/swsusp.c 2004-11-16 13:14:49.000000000 +0100
@@ -854,11 +840,13 @@
if ((error = arch_prepare_suspend()))
return error;
local_irq_disable();
+ sysdev_suspend(PMSG_FREEZE);
save_processor_state();
error = swsusp_arch_suspend();
/* Restore control flow magically appears here */
restore_processor_state();
restore_highmem();
+ sysdev_resume();
local_irq_enable();
return error;
}
@@ -878,6 +866,7 @@
{
int error;
local_irq_disable();
+ sysdev_suspend(PMSG_FREEZE);
/* We'll ignore saved state, but this gets preempt count (etc) right */
save_processor_state();
error = swsusp_arch_resume();
@@ -887,6 +876,7 @@
BUG_ON(!error);
restore_processor_state();
restore_highmem();
+ sysdev_resume();
local_irq_enable();
return error;
}
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: save/restore sysdev - re:2.6.9 S4: clock not updated after resume
[not found] ` <20041116122648.GB1013-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
@ 2004-11-17 8:19 ` Li Shaohua
0 siblings, 0 replies; 5+ messages in thread
From: Li Shaohua @ 2004-11-17 8:19 UTC (permalink / raw)
To: Pavel Machek; +Cc: ML ACPI-devel
On Tue, 2004-11-16 at 20:26, Pavel Machek wrote:
> Hi!
>
> > >> The patch is useless. The sysdev suspend/resume isn't invoked by
> > swsusp,
> > >> as Bjorn has mentioned before.
> > >>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=109753613422952&w=2
> > >
> > >This patch should add sysdev suspend/resume. Can you verify it
> helps
> > >for you?
> > Sorry for being so late to reply. Yes, the patch (after fix some
> > compiling error) works for me. But one comment is
> sysdev_resume/suspend
> > are designed to work with IRQ disabled.
>
> Hmm, yes, you are right. Can you test this replacement? [And possibly
> forward it to andrew, it is hard for me to maintain it since my tree
> diverged a lot].
This one is much clean to me. I didn't find the definition of
'PMSG_FREEZE' in latest bk tree. Is it the state convention you will
add?
Shaohua
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-11-17 8:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-25 6:16 save/restore sysdev - re:2.6.9 S4: clock not updated after resume Li, Shaohua
[not found] ` <16A54BF5D6E14E4D916CE26C9AD3057563CCE1-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-10-29 10:18 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2004-11-04 7:08 Li, Shaohua
[not found] ` <16A54BF5D6E14E4D916CE26C9AD30575796CEB-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-11-16 12:26 ` Pavel Machek
[not found] ` <20041116122648.GB1013-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-11-17 8:19 ` Li Shaohua
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox