* [FIX] apm.c: ignore_normal_resume is set to 1 a bit too late
@ 2005-06-13 9:45 Thomas Hood
[not found] ` <20050613222003.2895ac2c.sfr@canb.auug.org.au>
2005-06-13 21:38 ` [FIX] apm.c: ignore_normal_resume is set to 1 " Jesper Juhl
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Hood @ 2005-06-13 9:45 UTC (permalink / raw)
To: linux-kernel; +Cc: sfr
This message contains a fix for a bug in the apm driver.
A bug report was submitted to the Debian BTS saying that on the
submitter's system the apmd proxy script was being run twice on resume.
Having seen exactly the same problem some years ago and knowing that the
solution then was to ensure that the ignore_normal_resume flag got set
before there was any chance of an APM RESUME event being processed, I
checked the current apm.c and I found that ignore_normal_resume was once
again being set too late. I asked the submitter to move the line where
the flag was set and he reported that this change solved the problem. I
append the message in question. The line numbers I mention there are
for Linux 2.6.11.
Please make the indicated change to the apm driver.
-------- Forwarded Message --------
jdthood@aglu.demon.nl wrote to the submitter of Debian bug #310865:
> In arch/i386/kernel/apm.c there is at approximately line 1229:
>
> ignore_normal_resume = 1;
>
> Move this up so that it occurs right after line 1222:
>
> err = set_system_power_state(APM_STATE_SUSPEND);
>
> Let us know if that helps.
It does. Very nice.
I don't understand what I did and how it works. Will you try to
push that into kernel sources or is this no permanent fix?
--
Thomas Hood <jdthood@aglu.demon.nl>
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <20050613222003.2895ac2c.sfr@canb.auug.org.au>]
* [PATCH] apm.c: ignore_normal_resume is set a bit too late [not found] ` <20050613222003.2895ac2c.sfr@canb.auug.org.au> @ 2005-06-13 13:50 ` Thomas Hood 0 siblings, 0 replies; 3+ messages in thread From: Thomas Hood @ 2005-06-13 13:50 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-kernel, 310865-submitter, Stephen Rothwell [-- Attachment #1: Type: text/plain, Size: 673 bytes --] On Mon, 2005-06-13 at 22:20 +1000, Stephen Rothwell wrote: > I am not using APM any more and have no way to test such a change. So, > can you please do a proper patch with comment and Signed-off-by line and > send it to Andrew Morton (akpm@osdl.org) (and cc lkml, I guess). When I > see it, I will Ack it to Andrew. Summary: apm: Prevent double APM resume on Thinkpad X31 This patch causes the ignore_normal_resume flag to be set slightly earlier, before there is a chance that the apm driver will receive the normal resume event from the BIOS. (Addresses Debian bug #310865) Signed-off-by: Thomas Hood <jdthood@yahoo.co.uk> -- Thomas Hood <jdthood@aglu.demon.nl> [-- Attachment #2: apm.c_double_resume_fix_20050613jdth1.patch --] [-- Type: text/x-patch, Size: 554 bytes --] --- kernel-source-2.6.11/arch/i386/kernel/apm.c_ORIG 2005-03-02 08:37:47.000000000 +0100 +++ kernel-source-2.6.11/arch/i386/kernel/apm.c 2005-06-13 14:59:51.000000000 +0200 @@ -1220,13 +1220,13 @@ static int suspend(int vetoable) save_processor_state(); err = set_system_power_state(APM_STATE_SUSPEND); + ignore_normal_resume = 1; restore_processor_state(); write_seqlock_irq(&xtime_lock); spin_lock(&i8253_lock); reinit_timer(); set_time(); - ignore_normal_resume = 1; spin_unlock(&i8253_lock); write_sequnlock_irq(&xtime_lock); ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FIX] apm.c: ignore_normal_resume is set to 1 a bit too late 2005-06-13 9:45 [FIX] apm.c: ignore_normal_resume is set to 1 a bit too late Thomas Hood [not found] ` <20050613222003.2895ac2c.sfr@canb.auug.org.au> @ 2005-06-13 21:38 ` Jesper Juhl 1 sibling, 0 replies; 3+ messages in thread From: Jesper Juhl @ 2005-06-13 21:38 UTC (permalink / raw) To: Thomas Hood; +Cc: linux-kernel, Stephen Rothwell, Andrew Morton [-- Attachment #1: Type: text/plain, Size: 2692 bytes --] On 6/13/05, Thomas Hood <jdthood@aglu.demon.nl> wrote: > This message contains a fix for a bug in the apm driver. > > A bug report was submitted to the Debian BTS saying that on the > submitter's system the apmd proxy script was being run twice on resume. > > Having seen exactly the same problem some years ago and knowing that the > solution then was to ensure that the ignore_normal_resume flag got set > before there was any chance of an APM RESUME event being processed, I > checked the current apm.c and I found that ignore_normal_resume was once > again being set too late. I asked the submitter to move the line where > the flag was set and he reported that this change solved the problem. I > append the message in question. The line numbers I mention there are > for Linux 2.6.11. > > Please make the indicated change to the apm driver. > > -------- Forwarded Message -------- > jdthood@aglu.demon.nl wrote to the submitter of Debian bug #310865: > > In arch/i386/kernel/apm.c there is at approximately line 1229: > > > > ignore_normal_resume = 1; > > > > Move this up so that it occurs right after line 1222: > > > > err = set_system_power_state(APM_STATE_SUSPEND); > > > > Let us know if that helps. > > > It does. Very nice. > I don't understand what I did and how it works. Will you try to > push that into kernel sources or is this no permanent fix? > -- > Thomas Hood <jdthood@aglu.demon.nl> > Here it is in the form of a patch against 2.6.12-rc6-mm1 for easier merging - Stephen, Andrew, is this a valid fix? I don't know the apm code well enough to properly judge. (also attached since gmail tends to mangle inline patches) Prevent double resume in apm. Signed-off-by: Jesper juhl <jesper.juhl@gmail.com> --- arch/i386/kernel/apm.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) --- linux-2.6.12-rc6-mm1-orig/arch/i386/kernel/apm.c 2005-06-12 15:58:34.000000000 +0200 +++ linux-2.6.12-rc6-mm1/arch/i386/kernel/apm.c 2005-06-13 23:39:57.000000000 +0200 @@ -1222,6 +1222,7 @@ static int suspend(int vetoable) save_processor_state(); err = set_system_power_state(APM_STATE_SUSPEND); + ignore_normal_resume = 1; restore_processor_state(); local_irq_disable(); @@ -1229,7 +1230,6 @@ static int suspend(int vetoable) spin_lock(&i8253_lock); reinit_timer(); set_time(); - ignore_normal_resume = 1; spin_unlock(&i8253_lock); write_sequnlock(&xtime_lock); -- Jesper Juhl <jesper.juhl@gmail.com> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: prevent-double-resume-in-apm.patch --] [-- Type: text/x-patch; name="prevent-double-resume-in-apm.patch", Size: 592 bytes --] --- linux-2.6.12-rc6-mm1-orig/arch/i386/kernel/apm.c 2005-06-12 15:58:34.000000000 +0200 +++ linux-2.6.12-rc6-mm1/arch/i386/kernel/apm.c 2005-06-13 23:39:57.000000000 +0200 @@ -1222,6 +1222,7 @@ static int suspend(int vetoable) save_processor_state(); err = set_system_power_state(APM_STATE_SUSPEND); + ignore_normal_resume = 1; restore_processor_state(); local_irq_disable(); @@ -1229,7 +1230,6 @@ static int suspend(int vetoable) spin_lock(&i8253_lock); reinit_timer(); set_time(); - ignore_normal_resume = 1; spin_unlock(&i8253_lock); write_sequnlock(&xtime_lock); ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-06-13 21:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-13 9:45 [FIX] apm.c: ignore_normal_resume is set to 1 a bit too late Thomas Hood
[not found] ` <20050613222003.2895ac2c.sfr@canb.auug.org.au>
2005-06-13 13:50 ` [PATCH] apm.c: ignore_normal_resume is set " Thomas Hood
2005-06-13 21:38 ` [FIX] apm.c: ignore_normal_resume is set to 1 " Jesper Juhl
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox