All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: 2.6.19: ACPI reports AC not present after resume from STD
@ 2006-12-07 20:40 Lebedev, Vladimir P
  2006-12-16 17:38 ` Andrey Borzenkov
       [not found] ` <200702132116.05404.arvidjaar@mail.ru>
  0 siblings, 2 replies; 30+ messages in thread
From: Lebedev, Vladimir P @ 2006-12-07 20:40 UTC (permalink / raw)
  To: Alexey Starikovskiy, Rafael J. Wysocki
  Cc: Karasyov, Konstantin A, Andrey Borzenkov, linux-acpi


Please register new bug, attach acpidump and dmesg.


-----Original Message-----
From: Alexey Starikovskiy [mailto:alexey.y.starikovskiy@linux.intel.com]

Sent: Thursday, December 07, 2006 10:49 PM
To: Rafael J. Wysocki
Cc: Karasyov, Konstantin A; Andrey Borzenkov;
linux-acpi@vger.kernel.org; Lebedev, Vladimir P
Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD

Rafael J. Wysocki wrote:
> Hi,
>
> On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
>   
>> Hi,
>>
>> Unfortunately, I cannot reproduce this bug on my system, but the
problem
>> could be solved by adding a resume handler for AC adapter device.
Could
>> you try the attached patch to see if it helps.
>>     
>
> I can reproduce it and the patch doesn't help.
>
> Greetings,
> Rafael
>
>   
Any ACPI errors in dmesg?

Regards,
    Alex.

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-07 20:40 2.6.19: ACPI reports AC not present after resume from STD Lebedev, Vladimir P
@ 2006-12-16 17:38 ` Andrey Borzenkov
       [not found] ` <200702132116.05404.arvidjaar@mail.ru>
  1 sibling, 0 replies; 30+ messages in thread
From: Andrey Borzenkov @ 2006-12-16 17:38 UTC (permalink / raw)
  To: Lebedev, Vladimir P
  Cc: Alexey Starikovskiy, Rafael J. Wysocki, Karasyov, Konstantin A,
	linux-acpi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 07 December 2006 23:40, Lebedev, Vladimir P wrote:
> Please register new bug, attach acpidump and dmesg.
>

Rafael, do you have bug number (so that I can add my system to it) or should I 
open new bug report?

>
> -----Original Message-----
> From: Alexey Starikovskiy [mailto:alexey.y.starikovskiy@linux.intel.com]
>
> Sent: Thursday, December 07, 2006 10:49 PM
> To: Rafael J. Wysocki
> Cc: Karasyov, Konstantin A; Andrey Borzenkov;
> linux-acpi@vger.kernel.org; Lebedev, Vladimir P
> Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
>
> Rafael J. Wysocki wrote:
> > Hi,
> >
> > On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
> >> Hi,
> >>
> >> Unfortunately, I cannot reproduce this bug on my system, but the
>
> problem
>
> >> could be solved by adding a resume handler for AC adapter device.
>
> Could
>
> >> you try the attached patch to see if it helps.
> >
> > I can reproduce it and the patch doesn't help.
> >
> > Greetings,
> > Rafael
>
> Any ACPI errors in dmesg?
>
> Regards,
>     Alex.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFhC8uR6LMutpd94wRAhWkAJ4wyPz95I0NuRy2Wug+xrWEeMSqmACfVkIr
rE+dPs3Dpy6bUvl0OmoTrqA=
=rEV6
-----END PGP SIGNATURE-----

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
       [not found] ` <200702132116.05404.arvidjaar@mail.ru>
@ 2007-02-24  9:55   ` Andrey Borzenkov
  2007-02-24 19:46       ` Rafael J. Wysocki
  0 siblings, 1 reply; 30+ messages in thread
From: Andrey Borzenkov @ 2007-02-24  9:55 UTC (permalink / raw)
  To: Lebedev, Vladimir P; +Cc: linux-acpi, linux-pm, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > Please register new bug, attach acpidump and dmesg.
>
> http://bugzilla.kernel.org/show_bug.cgi?id=7995
>
> regards
>

Well, this starts looking like ACPI is not at fault.

When reporting AC state ACPI just reads contents of system memory (I presume 
it gets updated by BIOS/ACPI when AC state changes). It looks like this 
memory area is restored during resume from STD. I updated mentioned bug 
report with more detailed description. Now if someone could suggest a way to 
catch if specific physical address gets saved/restored this would finally 
explain it.

Gratefully waiting for patches to test :)

- -andrey

> > -----Original Message-----
> > From: Alexey Starikovskiy [mailto:alexey.y.starikovskiy@linux.intel.com]
> >
> > Sent: Thursday, December 07, 2006 10:49 PM
> > To: Rafael J. Wysocki
> > Cc: Karasyov, Konstantin A; Andrey Borzenkov;
> > linux-acpi@vger.kernel.org; Lebedev, Vladimir P
> > Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
> >
> > Rafael J. Wysocki wrote:
> > > Hi,
> > >
> > > On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
> > >> Hi,
> > >>
> > >> Unfortunately, I cannot reproduce this bug on my system, but the
> >
> > problem
> >
> > >> could be solved by adding a resume handler for AC adapter device.
> >
> > Could
> >
> > >> you try the attached patch to see if it helps.
> > >
> > > I can reproduce it and the patch doesn't help.
> > >
> > > Greetings,
> > > Rafael
> >
> > Any ACPI errors in dmesg?
> >
> > Regards,
> >     Alex.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFF4At2R6LMutpd94wRAnZGAJ9bGd98+gzCDfhIaFctH2u99M2uqQCfUzNz
7RqieTu7v4Z83jjeY79vnMw=
=GQZ6
-----END PGP SIGNATURE-----
_______________________________________________
linux-pm mailing list
linux-pm@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/linux-pm

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-24  9:55   ` Andrey Borzenkov
@ 2007-02-24 19:46       ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-24 19:46 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm

Hi,

On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > Please register new bug, attach acpidump and dmesg.
> >
> > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> >
> > regards
> >
> 
> Well, this starts looking like ACPI is not at fault.
> 
> When reporting AC state ACPI just reads contents of system memory (I presume
> it gets updated by BIOS/ACPI when AC state changes). It looks like this
> memory area is restored during resume from STD. I updated mentioned bug
> report with more detailed description. Now if someone could suggest a way to
> catch if specific physical address gets saved/restored this would finally
> explain it.

First, if you want the reserved memory areas to be left alone by swsusp,
you need to mark them as 'nosave'.  On x86_64 this is done by the function
e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
i386 with no problems.  However, we haven't found that very useful, so far,
since no one has ever reported any problems with the current approach,
which is to save and restore them.

Second, if you want to know if a suspicious page frame is saved by swsusp,
it's best to stick a test and a printk in kernel/power/pack_pfns() and
artificially fail the suspend, eg. by making swsusp_write() always return
an error.

> Gratefully waiting for patches to test :)

Sorry, no patches this time.  I have more urgent problem to fix. :-)

Greetings,
Rafael


> > > -----Original Message-----
> > > From: Alexey Starikovskiy [mailto:alexey.y.starikovskiy@linux.intel.com]
> > >
> > > Sent: Thursday, December 07, 2006 10:49 PM
> > > To: Rafael J. Wysocki
> > > Cc: Karasyov, Konstantin A; Andrey Borzenkov;
> > > linux-acpi@vger.kernel.org; Lebedev, Vladimir P
> > > Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
> > >
> > > Rafael J. Wysocki wrote:
> > > > Hi,
> > > >
> > > > On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
> > > >> Hi,
> > > >>
> > > >> Unfortunately, I cannot reproduce this bug on my system, but the
> > >
> > > problem
> > >
> > > >> could be solved by adding a resume handler for AC adapter device.
> > >
> > > Could
> > >
> > > >> you try the attached patch to see if it helps.
> > > >
> > > > I can reproduce it and the patch doesn't help.
> > > >
> > > > Greetings,
> > > > Rafael
> > >
> > > Any ACPI errors in dmesg?
> > >
> > > Regards,
> > >     Alex.
> 
> 
> 
> 

-- 
If you don't have the time to read,
you don't have the time or the tools to write.
		- Stephen King
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
@ 2007-02-24 19:46       ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-24 19:46 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm

Hi,

On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > Please register new bug, attach acpidump and dmesg.
> >
> > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> >
> > regards
> >
> 
> Well, this starts looking like ACPI is not at fault.
> 
> When reporting AC state ACPI just reads contents of system memory (I presume
> it gets updated by BIOS/ACPI when AC state changes). It looks like this
> memory area is restored during resume from STD. I updated mentioned bug
> report with more detailed description. Now if someone could suggest a way to
> catch if specific physical address gets saved/restored this would finally
> explain it.

First, if you want the reserved memory areas to be left alone by swsusp,
you need to mark them as 'nosave'.  On x86_64 this is done by the function
e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
i386 with no problems.  However, we haven't found that very useful, so far,
since no one has ever reported any problems with the current approach,
which is to save and restore them.

Second, if you want to know if a suspicious page frame is saved by swsusp,
it's best to stick a test and a printk in kernel/power/pack_pfns() and
artificially fail the suspend, eg. by making swsusp_write() always return
an error.

> Gratefully waiting for patches to test :)

Sorry, no patches this time.  I have more urgent problem to fix. :-)

Greetings,
Rafael


> > > -----Original Message-----
> > > From: Alexey Starikovskiy [mailto:alexey.y.starikovskiy@linux.intel.com]
> > >
> > > Sent: Thursday, December 07, 2006 10:49 PM
> > > To: Rafael J. Wysocki
> > > Cc: Karasyov, Konstantin A; Andrey Borzenkov;
> > > linux-acpi@vger.kernel.org; Lebedev, Vladimir P
> > > Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
> > >
> > > Rafael J. Wysocki wrote:
> > > > Hi,
> > > >
> > > > On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
> > > >> Hi,
> > > >>
> > > >> Unfortunately, I cannot reproduce this bug on my system, but the
> > >
> > > problem
> > >
> > > >> could be solved by adding a resume handler for AC adapter device.
> > >
> > > Could
> > >
> > > >> you try the attached patch to see if it helps.
> > > >
> > > > I can reproduce it and the patch doesn't help.
> > > >
> > > > Greetings,
> > > > Rafael
> > >
> > > Any ACPI errors in dmesg?
> > >
> > > Regards,
> > >     Alex.
> 
> 
> 
> 

-- 
If you don't have the time to read,
you don't have the time or the tools to write.
		- Stephen King

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-24 19:46       ` Rafael J. Wysocki
  (?)
@ 2007-02-24 23:26       ` Andrey Borzenkov
  2007-02-25 10:17           ` Rafael J. Wysocki
  -1 siblings, 1 reply; 30+ messages in thread
From: Andrey Borzenkov @ 2007-02-24 23:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm


[-- Attachment #1.1: Type: text/plain, Size: 1642 bytes --]

On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> Hi,
>
> On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > Please register new bug, attach acpidump and dmesg.
> > >
> > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > >
> > > regards
> >
> > Well, this starts looking like ACPI is not at fault.
> >
> > When reporting AC state ACPI just reads contents of system memory (I
> > presume it gets updated by BIOS/ACPI when AC state changes). It looks
> > like this memory area is restored during resume from STD. I updated
> > mentioned bug report with more detailed description. Now if someone could
> > suggest a way to catch if specific physical address gets saved/restored
> > this would finally explain it.
>
> First, if you want the reserved memory areas to be left alone by swsusp,
> you need to mark them as 'nosave'.  On x86_64 this is done by the function
> e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
> i386 with no problems.  However, we haven't found that very useful, so far,
> since no one has ever reported any problems with the current approach,
> which is to save and restore them.
>

Well, the following proof of concept patch fixes this issue for me. Please 
notice that original version of e820_mark_nosave_range() could fail to 
exclude some areas due to alignment issues (exactly what happened to me on 
first try) so it still can explain your problem too.

-andrey


[-- Attachment #1.2: nosave_reserved_memory --]
[-- Type: text/x-diff, Size: 4428 bytes --]

Mark e820 reserved memory areas as nosave for suspend/resume

From: Andrey Borzenkov <<arvidjaar@mail.ru>>

This fixes bug http://bugzilla.kernel.org/show_bug.cgi?id=7995. From
lkml:

=============
> When reporting AC state ACPI just reads contents of system memory (I
> presume
> it gets updated by BIOS/ACPI when AC state changes). It looks like this
> memory area is restored during resume from STD. I updated mentioned bug
> report with more detailed description. Now if someone could suggest a way
> to
> catch if specific physical address gets saved/restored this would finally
> explain it.

First, if you want the reserved memory areas to be left alone by swsusp,
you need to mark them as 'nosave'.  On x86_64 this is done by the function
e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
i386 with no problems.  However, we haven't found that very useful, so far,
since no one has ever reported any problems with the current approach,
which is to save and restore them.
=============

The patch adapts x84_64 version to mark as nosave all consequitive
areas. Otherwise in my case the region in question covered only partial
page and was excluded from nosave:

 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000e0000 - 00000000000eee00 (reserved)
 BIOS-e820: 00000000000eee00 - 00000000000ef000 (ACPI NVS)
 BIOS-e820: 00000000000ef000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 000000001ef60000 (usable)
 BIOS-e820: 000000001ef60000 - 000000001ef70000 (ACPI data)
 BIOS-e820: 000000001ef70000 - 0000000020000000 (reserved)
 BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)

The region in question starts at ee800.
---

 arch/i386/kernel/e820.c  |   45 +++++++++++++++++++++++++++++++++++++++++++++
 arch/i386/kernel/setup.c |    1 +
 include/asm-i386/e820.h  |    1 +
 3 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index f391abc..7c00ec7 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -311,6 +311,51 @@ static int __init request_standard_resources(void)
 
 subsys_initcall(request_standard_resources);
 
+/* Mark pages corresponding to given pfn range as nosave */
+static void __init
+e820_mark_nosave_range(unsigned long start, unsigned long end)
+{
+	unsigned long pfn, max_pfn = PFN_DOWN(end);
+
+	if (start >= end)
+		return;
+
+	printk("Nosave address range: %016lx - %016lx\n", start, end);
+	for (pfn = PFN_UP(start); pfn < max_pfn; pfn++)
+		if (pfn_valid(pfn))
+			SetPageNosave(pfn_to_page(pfn));
+}
+
+/*
+ * Find the ranges of physical addresses that do not correspond to
+ * e820 RAM areas and mark the corresponding pages as nosave for software
+ * suspend and suspend to RAM.
+ *
+ * This assumes entries are sorted and all consequitive entries are
+ * excluded together with gaps.
+ */
+void __init e820_mark_nosave_regions(void)
+{
+	int i;
+	unsigned long pstart = 0L;
+	unsigned long pend = 0L;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+
+		if (ei->type != E820_RAM) {
+			if (!pstart)
+				pstart = ei->addr;
+			if (pend < ei->addr + ei->size)
+				pend = ei->addr + ei->size;
+		} else {
+			e820_mark_nosave_range(pstart, pend);
+			pstart = pend = 0L;
+		}
+	}
+	e820_mark_nosave_range(pstart, pend);
+}
+
 void __init add_memory_region(unsigned long long start,
 			      unsigned long long size, int type)
 {
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 4b31ad7..4f43e46 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -640,6 +640,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	e820_register_memory();
+	e820_mark_nosave_regions();
 
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index c5b8fc6..80e49bc 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -43,6 +43,7 @@ extern void register_bootmem_low_pages(unsigned long max_low_pfn);
 extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
+extern void e820_mark_nosave_regions(void);
 
 #endif/*!__ASSEMBLY__*/
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-24 23:26       ` Andrey Borzenkov
@ 2007-02-25 10:17           ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-25 10:17 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm

On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > Hi,
> >
> > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > Please register new bug, attach acpidump and dmesg.
> > > >
> > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > >
> > > > regards
> > >
> > > Well, this starts looking like ACPI is not at fault.
> > >
> > > When reporting AC state ACPI just reads contents of system memory (I
> > > presume it gets updated by BIOS/ACPI when AC state changes). It looks
> > > like this memory area is restored during resume from STD. I updated
> > > mentioned bug report with more detailed description. Now if someone could
> > > suggest a way to catch if specific physical address gets saved/restored
> > > this would finally explain it.
> >
> > First, if you want the reserved memory areas to be left alone by swsusp,
> > you need to mark them as 'nosave'.  On x86_64 this is done by the function
> > e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
> > i386 with no problems.  However, we haven't found that very useful, so far,
> > since no one has ever reported any problems with the current approach,
> > which is to save and restore them.
> >
> 
> Well, the following proof of concept patch fixes this issue for me. Please 
> notice that original version of e820_mark_nosave_range() could fail to 
> exclude some areas due to alignment issues (exactly what happened to me on 
> first try) so it still can explain your problem too.

Great job, thanks for the patch!  It looks good, so I'm going to forward it for
merging.

I'll also change the x86_64 version to use PFN_UP and PFN_DOWN.

Greetings,
Rafael
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
@ 2007-02-25 10:17           ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-25 10:17 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm

On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > Hi,
> >
> > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > Please register new bug, attach acpidump and dmesg.
> > > >
> > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > >
> > > > regards
> > >
> > > Well, this starts looking like ACPI is not at fault.
> > >
> > > When reporting AC state ACPI just reads contents of system memory (I
> > > presume it gets updated by BIOS/ACPI when AC state changes). It looks
> > > like this memory area is restored during resume from STD. I updated
> > > mentioned bug report with more detailed description. Now if someone could
> > > suggest a way to catch if specific physical address gets saved/restored
> > > this would finally explain it.
> >
> > First, if you want the reserved memory areas to be left alone by swsusp,
> > you need to mark them as 'nosave'.  On x86_64 this is done by the function
> > e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
> > i386 with no problems.  However, we haven't found that very useful, so far,
> > since no one has ever reported any problems with the current approach,
> > which is to save and restore them.
> >
> 
> Well, the following proof of concept patch fixes this issue for me. Please 
> notice that original version of e820_mark_nosave_range() could fail to 
> exclude some areas due to alignment issues (exactly what happened to me on 
> first try) so it still can explain your problem too.

Great job, thanks for the patch!  It looks good, so I'm going to forward it for
merging.

I'll also change the x86_64 version to use PFN_UP and PFN_DOWN.

Greetings,
Rafael

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-25 10:17           ` Rafael J. Wysocki
  (?)
@ 2007-02-25 10:37           ` Andrey Borzenkov
  2007-02-25 10:51               ` Rafael J. Wysocki
  -1 siblings, 1 reply; 30+ messages in thread
From: Andrey Borzenkov @ 2007-02-25 10:37 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-pm, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > Hi,
> > >
> > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > Please register new bug, attach acpidump and dmesg.
> > > > >
> > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > >
> > > > > regards
> > > >
> > > > Well, this starts looking like ACPI is not at fault.
> > > >
> > > > When reporting AC state ACPI just reads contents of system memory (I
> > > > presume it gets updated by BIOS/ACPI when AC state changes). It looks
> > > > like this memory area is restored during resume from STD. I updated
> > > > mentioned bug report with more detailed description. Now if someone
> > > > could suggest a way to catch if specific physical address gets
> > > > saved/restored this would finally explain it.
> > >
> > > First, if you want the reserved memory areas to be left alone by
> > > swsusp, you need to mark them as 'nosave'.  On x86_64 this is done by
> > > the function e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that
> > > can be ported to i386 with no problems.  However, we haven't found that
> > > very useful, so far, since no one has ever reported any problems with
> > > the current approach, which is to save and restore them.
> >
> > Well, the following proof of concept patch fixes this issue for me.
> > Please notice that original version of e820_mark_nosave_range() could
> > fail to exclude some areas due to alignment issues (exactly what happened
> > to me on first try) so it still can explain your problem too.
>
> Great job, thanks for the patch!  It looks good, so I'm going to forward it
> for merging.
>

Please no; I'm currently testing slightly more polished version; I will send 
it later.

Could anybody explain (or give pointer to) what happens which region that is 
not page-aligned? In particular, the very first one:

 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)

Will the kernel allocate partial page (how?) or will the kernel ignore last 
(first) incomplete page? In the former case how those incomplete pages can be 
detected?

- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFF4WbUR6LMutpd94wRAoOVAKDNZxeHKRJ+8IVVpR2zZZF5dTYEDACg0hKi
7dffkAFBZnBSQ/3VkNP6tFU=
=nezM
-----END PGP SIGNATURE-----
_______________________________________________
linux-pm mailing list
linux-pm@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/linux-pm

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-25 10:37           ` Andrey Borzenkov
@ 2007-02-25 10:51               ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-25 10:51 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm

On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > Hi,
> > > >
> > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > >
> > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > >
> > > > > > regards
> > > > >
> > > > > Well, this starts looking like ACPI is not at fault.
> > > > >
> > > > > When reporting AC state ACPI just reads contents of system memory (I
> > > > > presume it gets updated by BIOS/ACPI when AC state changes). It looks
> > > > > like this memory area is restored during resume from STD. I updated
> > > > > mentioned bug report with more detailed description. Now if someone
> > > > > could suggest a way to catch if specific physical address gets
> > > > > saved/restored this would finally explain it.
> > > >
> > > > First, if you want the reserved memory areas to be left alone by
> > > > swsusp, you need to mark them as 'nosave'.  On x86_64 this is done by
> > > > the function e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that
> > > > can be ported to i386 with no problems.  However, we haven't found that
> > > > very useful, so far, since no one has ever reported any problems with
> > > > the current approach, which is to save and restore them.
> > >
> > > Well, the following proof of concept patch fixes this issue for me.
> > > Please notice that original version of e820_mark_nosave_range() could
> > > fail to exclude some areas due to alignment issues (exactly what happened
> > > to me on first try) so it still can explain your problem too.
> >
> > Great job, thanks for the patch!  It looks good, so I'm going to forward it
> > for merging.
> >
> 
> Please no; I'm currently testing slightly more polished version; I will send
> it later.

OK

> Could anybody explain (or give pointer to) what happens which region that is
> not page-aligned? In particular, the very first one:
> 
>  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
>  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> 
> Will the kernel allocate partial page (how?) or will the kernel ignore last
> (first) incomplete page? In the former case how those incomplete pages can be
> detected?

Well, on x86_64, if I understand e820_register_active_regions() correctly,
the partial pages won't be registered.

Greetings,
Rafael
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
@ 2007-02-25 10:51               ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-25 10:51 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm

On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > Hi,
> > > >
> > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > >
> > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > >
> > > > > > regards
> > > > >
> > > > > Well, this starts looking like ACPI is not at fault.
> > > > >
> > > > > When reporting AC state ACPI just reads contents of system memory (I
> > > > > presume it gets updated by BIOS/ACPI when AC state changes). It looks
> > > > > like this memory area is restored during resume from STD. I updated
> > > > > mentioned bug report with more detailed description. Now if someone
> > > > > could suggest a way to catch if specific physical address gets
> > > > > saved/restored this would finally explain it.
> > > >
> > > > First, if you want the reserved memory areas to be left alone by
> > > > swsusp, you need to mark them as 'nosave'.  On x86_64 this is done by
> > > > the function e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that
> > > > can be ported to i386 with no problems.  However, we haven't found that
> > > > very useful, so far, since no one has ever reported any problems with
> > > > the current approach, which is to save and restore them.
> > >
> > > Well, the following proof of concept patch fixes this issue for me.
> > > Please notice that original version of e820_mark_nosave_range() could
> > > fail to exclude some areas due to alignment issues (exactly what happened
> > > to me on first try) so it still can explain your problem too.
> >
> > Great job, thanks for the patch!  It looks good, so I'm going to forward it
> > for merging.
> >
> 
> Please no; I'm currently testing slightly more polished version; I will send
> it later.

OK

> Could anybody explain (or give pointer to) what happens which region that is
> not page-aligned? In particular, the very first one:
> 
>  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
>  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> 
> Will the kernel allocate partial page (how?) or will the kernel ignore last
> (first) incomplete page? In the former case how those incomplete pages can be
> detected?

Well, on x86_64, if I understand e820_register_active_regions() correctly,
the partial pages won't be registered.

Greetings,
Rafael

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-25 10:51               ` Rafael J. Wysocki
  (?)
@ 2007-02-25 17:14               ` Andrey Borzenkov
  2007-02-25 18:58                   ` Rafael J. Wysocki
  2007-03-05 22:07                 ` Rafael J. Wysocki
  -1 siblings, 2 replies; 30+ messages in thread
From: Andrey Borzenkov @ 2007-02-25 17:14 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm, Andrew Morton


[-- Attachment #1.1: Type: text/plain, Size: 3444 bytes --]

On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > > Hi,
> > > > >
> > > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > > >
> > > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > > >
> > > > > > > regards
> > > > > >
> > > > > > Well, this starts looking like ACPI is not at fault.
> > > > > >
> > > > > > When reporting AC state ACPI just reads contents of system memory
> > > > > > (I presume it gets updated by BIOS/ACPI when AC state changes).
> > > > > > It looks like this memory area is restored during resume from
> > > > > > STD. I updated mentioned bug report with more detailed
> > > > > > description. Now if someone could suggest a way to catch if
> > > > > > specific physical address gets saved/restored this would finally
> > > > > > explain it.
> > > > >
> > > > > First, if you want the reserved memory areas to be left alone by
> > > > > swsusp, you need to mark them as 'nosave'.  On x86_64 this is done
> > > > > by the function e820_mark_nosave_range() in
> > > > > arch/x86_64/kernel/e820.c that can be ported to i386 with no
> > > > > problems.  However, we haven't found that very useful, so far,
> > > > > since no one has ever reported any problems with the current
> > > > > approach, which is to save and restore them.
> > > >
> > > > Well, the following proof of concept patch fixes this issue for me.
> > > > Please notice that original version of e820_mark_nosave_range() could
> > > > fail to exclude some areas due to alignment issues (exactly what
> > > > happened to me on first try) so it still can explain your problem
> > > > too.
> > >
> > > Great job, thanks for the patch!  It looks good, so I'm going to
> > > forward it for merging.
> >
> > Please no; I'm currently testing slightly more polished version; I will
> > send it later.
>
> OK
>
> > Could anybody explain (or give pointer to) what happens which region that
> > is not page-aligned? In particular, the very first one:
> >
> >  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> >  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> >
> > Will the kernel allocate partial page (how?) or will the kernel ignore
> > last (first) incomplete page? In the former case how those incomplete
> > pages can be detected?
>
> Well, on x86_64, if I understand e820_register_active_regions() correctly,
> the partial pages won't be registered.
>

It appears that for low memory kernel will ignore incomplete pages for sure. I 
hope it does the same for high memory - but for now I just throw this in and 
pray :) This also significantly simplifies patch.

As this touches quite sensitive field, I Cc Andrew - if he considers this 
appropriate for mm; or would you do it as part of your tree? Also he probably 
can easily clarify memory allocation questions :p

regards

-andrey

[-- Attachment #1.2: nosave_reserved_memory --]
[-- Type: text/x-diff, Size: 4357 bytes --]

Subject: [PATCH] Mark e820 reserved memory areas as nosave for suspend/resume
From: Andrey Borzenkov <<arvidjaar@mail.ru>>

This fixes bug http://bugzilla.kernel.org/show_bug.cgi?id=7995. From
lkml discussion (http://marc.theaimsgroup.com/?t=116514878500001&r=1&w=2):

=============
> When reporting AC state ACPI just reads contents of system memory (I
> presume
> it gets updated by BIOS/ACPI when AC state changes). It looks like this
> memory area is restored during resume from STD. I updated mentioned bug
> report with more detailed description. Now if someone could suggest a way
> to
> catch if specific physical address gets saved/restored this would finally
> explain it.

First, if you want the reserved memory areas to be left alone by swsusp,
you need to mark them as 'nosave'.  On x86_64 this is done by the function
e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
i386 with no problems.  However, we haven't found that very useful, so far,
since no one has ever reported any problems with the current approach,
which is to save and restore them.
=============

The patch adds adapted x84_64 version for i386. It differs from x86_64
in that

- it does not touch memory regions not covered by e820 table (I simply
have no idea if this is appropriate to do)

- it properly marks also partial pages (like the initial one in second
line below). Apparently kernel won't allocate and use such pages, so there
is nothing to preserve there.

 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)

The region in question starts at ee800. This is likely true for x86_64 as
well.

Signed-off-by: Andrey Borzenkov <<arvidjaar@mail.ru>>

---

 arch/i386/kernel/e820.c  |   41 +++++++++++++++++++++++++++++++++++++++++
 arch/i386/kernel/setup.c |    1 +
 include/asm-i386/e820.h  |    1 +
 3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index f391abc..adf0e6f 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -311,6 +311,47 @@ static int __init request_standard_resources(void)
 
 subsys_initcall(request_standard_resources);
 
+/*
+ * Mark pages corresponding to given pfn range as nosaves
+ *
+ * For low memory kernel definitely won't use partial pages;
+ * I hope the same happens for high memory too. That is why
+ * round in outer direction to be sure to preserve those partial
+ * pages if they contain reserved regions.
+ */
+static void __init
+e820_mark_nosave_range(unsigned long long start, unsigned long long end)
+{
+	unsigned long pfn, max_pfn = PFN_UP(end);
+
+	if (start >= end)
+		return;
+
+	printk("Nosave address range: %016Lx - %016Lx\n", start, end);
+	for (pfn = PFN_DOWN(start); pfn < max_pfn; pfn++)
+		if (pfn_valid(pfn))
+			SetPageNosave(pfn_to_page(pfn));
+}
+
+/*
+ * Find the ranges of physical addresses that do not correspond to
+ * e820 RAM areas and mark the corresponding pages as nosave for software
+ * suspend and suspend to RAM.
+ *
+ * This assumes kernel won't use partial pages.
+ */
+void __init e820_mark_nosave_regions(void)
+{
+	int i;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+
+		if (ei->type != E820_RAM)
+			e820_mark_nosave_range(ei->addr, ei->addr + ei->size);
+	}
+}
+
 void __init add_memory_region(unsigned long long start,
 			      unsigned long long size, int type)
 {
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 4b31ad7..4f43e46 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -640,6 +640,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	e820_register_memory();
+	e820_mark_nosave_regions();
 
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index c5b8fc6..80e49bc 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -43,6 +43,7 @@ extern void register_bootmem_low_pages(unsigned long max_low_pfn);
 extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
+extern void e820_mark_nosave_regions(void);
 
 #endif/*!__ASSEMBLY__*/
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-25 17:14               ` Andrey Borzenkov
@ 2007-02-25 18:58                   ` Rafael J. Wysocki
  2007-03-05 22:07                 ` Rafael J. Wysocki
  1 sibling, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-25 18:58 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm, Andrew Morton

On Sunday, 25 February 2007 18:14, Andrey Borzenkov wrote:
> On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> > > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > > > >
> > > > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > > > >
> > > > > > > > regards
> > > > > > >
> > > > > > > Well, this starts looking like ACPI is not at fault.
> > > > > > >
> > > > > > > When reporting AC state ACPI just reads contents of system memory
> > > > > > > (I presume it gets updated by BIOS/ACPI when AC state changes).
> > > > > > > It looks like this memory area is restored during resume from
> > > > > > > STD. I updated mentioned bug report with more detailed
> > > > > > > description. Now if someone could suggest a way to catch if
> > > > > > > specific physical address gets saved/restored this would finally
> > > > > > > explain it.
> > > > > >
> > > > > > First, if you want the reserved memory areas to be left alone by
> > > > > > swsusp, you need to mark them as 'nosave'.  On x86_64 this is done
> > > > > > by the function e820_mark_nosave_range() in
> > > > > > arch/x86_64/kernel/e820.c that can be ported to i386 with no
> > > > > > problems.  However, we haven't found that very useful, so far,
> > > > > > since no one has ever reported any problems with the current
> > > > > > approach, which is to save and restore them.
> > > > >
> > > > > Well, the following proof of concept patch fixes this issue for me.
> > > > > Please notice that original version of e820_mark_nosave_range() could
> > > > > fail to exclude some areas due to alignment issues (exactly what
> > > > > happened to me on first try) so it still can explain your problem
> > > > > too.
> > > >
> > > > Great job, thanks for the patch!  It looks good, so I'm going to
> > > > forward it for merging.
> > >
> > > Please no; I'm currently testing slightly more polished version; I will
> > > send it later.
> >
> > OK
> >
> > > Could anybody explain (or give pointer to) what happens which region that
> > > is not page-aligned? In particular, the very first one:
> > >
> > >  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> > >  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> > >
> > > Will the kernel allocate partial page (how?) or will the kernel ignore
> > > last (first) incomplete page? In the former case how those incomplete
> > > pages can be detected?
> >
> > Well, on x86_64, if I understand e820_register_active_regions() correctly,
> > the partial pages won't be registered.
> >
> 
> It appears that for low memory kernel will ignore incomplete pages for sure. I 
> hope it does the same for high memory - but for now I just throw this in and 
> pray :)

You don't need to do this for highmem, because swsusp won't save reserved
highmem pages anyway.

> This also significantly simplifies patch. 
> 
> As this touches quite sensitive field, I Cc Andrew - if he considers this 
> appropriate for mm; or would you do it as part of your tree? Also he probably 
> can easily clarify memory allocation questions :p

The patch looks good, but the changelog does not.  First, AFAICT, the x86_64
code doesn't touch anything outside the e820 map.  Why do you think it does?

Second, it is not true that the region in question is at 0xee00 on x86_64.
At least on my box it's above the end of RAM.

I think the x86_64 version is correct too.

Greetings,
Rafael
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
@ 2007-02-25 18:58                   ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-25 18:58 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm, Andrew Morton

On Sunday, 25 February 2007 18:14, Andrey Borzenkov wrote:
> On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> > > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > > > >
> > > > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > > > >
> > > > > > > > regards
> > > > > > >
> > > > > > > Well, this starts looking like ACPI is not at fault.
> > > > > > >
> > > > > > > When reporting AC state ACPI just reads contents of system memory
> > > > > > > (I presume it gets updated by BIOS/ACPI when AC state changes).
> > > > > > > It looks like this memory area is restored during resume from
> > > > > > > STD. I updated mentioned bug report with more detailed
> > > > > > > description. Now if someone could suggest a way to catch if
> > > > > > > specific physical address gets saved/restored this would finally
> > > > > > > explain it.
> > > > > >
> > > > > > First, if you want the reserved memory areas to be left alone by
> > > > > > swsusp, you need to mark them as 'nosave'.  On x86_64 this is done
> > > > > > by the function e820_mark_nosave_range() in
> > > > > > arch/x86_64/kernel/e820.c that can be ported to i386 with no
> > > > > > problems.  However, we haven't found that very useful, so far,
> > > > > > since no one has ever reported any problems with the current
> > > > > > approach, which is to save and restore them.
> > > > >
> > > > > Well, the following proof of concept patch fixes this issue for me.
> > > > > Please notice that original version of e820_mark_nosave_range() could
> > > > > fail to exclude some areas due to alignment issues (exactly what
> > > > > happened to me on first try) so it still can explain your problem
> > > > > too.
> > > >
> > > > Great job, thanks for the patch!  It looks good, so I'm going to
> > > > forward it for merging.
> > >
> > > Please no; I'm currently testing slightly more polished version; I will
> > > send it later.
> >
> > OK
> >
> > > Could anybody explain (or give pointer to) what happens which region that
> > > is not page-aligned? In particular, the very first one:
> > >
> > >  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> > >  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> > >
> > > Will the kernel allocate partial page (how?) or will the kernel ignore
> > > last (first) incomplete page? In the former case how those incomplete
> > > pages can be detected?
> >
> > Well, on x86_64, if I understand e820_register_active_regions() correctly,
> > the partial pages won't be registered.
> >
> 
> It appears that for low memory kernel will ignore incomplete pages for sure. I 
> hope it does the same for high memory - but for now I just throw this in and 
> pray :)

You don't need to do this for highmem, because swsusp won't save reserved
highmem pages anyway.

> This also significantly simplifies patch. 
> 
> As this touches quite sensitive field, I Cc Andrew - if he considers this 
> appropriate for mm; or would you do it as part of your tree? Also he probably 
> can easily clarify memory allocation questions :p

The patch looks good, but the changelog does not.  First, AFAICT, the x86_64
code doesn't touch anything outside the e820 map.  Why do you think it does?

Second, it is not true that the region in question is at 0xee00 on x86_64.
At least on my box it's above the end of RAM.

I think the x86_64 version is correct too.

Greetings,
Rafael

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-25 18:58                   ` Rafael J. Wysocki
  (?)
@ 2007-02-26 20:35                   ` Andrey Borzenkov
  2007-02-26 21:23                       ` Rafael J. Wysocki
  -1 siblings, 1 reply; 30+ messages in thread
From: Andrey Borzenkov @ 2007-02-26 20:35 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Andrew Morton, linux-acpi, linux-pm, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
>
> The patch looks good, but the changelog does not.  First, AFAICT, the
> x86_64 code doesn't touch anything outside the e820 map.  Why do you think
> it does?
>

the following code:

       paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
        for (i = 1; i < e820.nr_map; i++) {
                struct e820entry *ei = &e820.map[i];

                if (paddr < ei->addr)
                        e820_mark_nosave_range(paddr,
                                        round_up(ei->addr, PAGE_SIZE));

obviously will mark region *between* two e820 regions if they are not 
adjacent. I do not say that it is wrong (I have no idea); but exactly because 
I have no idea I tried to avoid it.

> Second, it is not true that the region in question is at 0xee00 on x86_64.
> At least on my box it's above the end of RAM.
>

On my box the problem region starts at ee800 :) But you are right, it does not 
belong here.

> I think the x86_64 version is correct too.
>

I do not say it is not. I just say that it does something I cannot verify so I 
better avoid it (i.e. I better change existing behaviour as little as 
possible).

- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFF40SjR6LMutpd94wRAlLvAKCMkVxMkKNwpGX/J3on0jQS659+zgCgmofK
vuG4p3gR4yBjfoHuMAR0cDU=
=JG9z
-----END PGP SIGNATURE-----
_______________________________________________
linux-pm mailing list
linux-pm@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/linux-pm

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-26 20:35                   ` Andrey Borzenkov
@ 2007-02-26 21:23                       ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-26 21:23 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm, Andrew Morton

On Monday, 26 February 2007 21:35, Andrey Borzenkov wrote:
> On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> >
> > The patch looks good, but the changelog does not.  First, AFAICT, the
> > x86_64 code doesn't touch anything outside the e820 map.  Why do you think
> > it does?
> >
> 
> the following code:
> 
>        paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
>         for (i = 1; i < e820.nr_map; i++) {
>                 struct e820entry *ei = &e820.map[i];
> 
>                 if (paddr < ei->addr)
>                         e820_mark_nosave_range(paddr,
>                                         round_up(ei->addr, PAGE_SIZE));
> 
> obviously will mark region *between* two e820 regions if they are not
> adjacent. I do not say that it is wrong (I have no idea); but exactly because
> I have no idea I tried to avoid it.

Yes, you are right, sorry.  We have to do this for x86_64, because there are
such holes in there on machines with more than 2 GB of RAM and swsusp chokes
on them if they are not marked.

On i386 we shouldn't really mark reserved areas in the highmem zone(s) as
nosave, because they are handled in a different way.

> > Second, it is not true that the region in question is at 0xee00 on x86_64.
> > At least on my box it's above the end of RAM.
> >
> 
> On my box the problem region starts at ee800 :) But you are right, it does not
> belong here.
> 
> > I think the x86_64 version is correct too.
> >
> 
> I do not say it is not. I just say that it does something I cannot verify so I
> better avoid it (i.e. I better change existing behaviour as little as
> possible).

OK

Can you please test your patch with the loop in e820_mark_nosave_regions()
restricted to the zones below highmem?

Rafael
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
@ 2007-02-26 21:23                       ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-02-26 21:23 UTC (permalink / raw)
  To: Andrey Borzenkov
  Cc: Lebedev, Vladimir P, Karasyov, Konstantin A, linux-acpi,
	linux-kernel, linux-pm, Andrew Morton

On Monday, 26 February 2007 21:35, Andrey Borzenkov wrote:
> On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> >
> > The patch looks good, but the changelog does not.  First, AFAICT, the
> > x86_64 code doesn't touch anything outside the e820 map.  Why do you think
> > it does?
> >
> 
> the following code:
> 
>        paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
>         for (i = 1; i < e820.nr_map; i++) {
>                 struct e820entry *ei = &e820.map[i];
> 
>                 if (paddr < ei->addr)
>                         e820_mark_nosave_range(paddr,
>                                         round_up(ei->addr, PAGE_SIZE));
> 
> obviously will mark region *between* two e820 regions if they are not
> adjacent. I do not say that it is wrong (I have no idea); but exactly because
> I have no idea I tried to avoid it.

Yes, you are right, sorry.  We have to do this for x86_64, because there are
such holes in there on machines with more than 2 GB of RAM and swsusp chokes
on them if they are not marked.

On i386 we shouldn't really mark reserved areas in the highmem zone(s) as
nosave, because they are handled in a different way.

> > Second, it is not true that the region in question is at 0xee00 on x86_64.
> > At least on my box it's above the end of RAM.
> >
> 
> On my box the problem region starts at ee800 :) But you are right, it does not
> belong here.
> 
> > I think the x86_64 version is correct too.
> >
> 
> I do not say it is not. I just say that it does something I cannot verify so I
> better avoid it (i.e. I better change existing behaviour as little as
> possible).

OK

Can you please test your patch with the loop in e820_mark_nosave_regions()
restricted to the zones below highmem?

Rafael

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-02-25 17:14               ` Andrey Borzenkov
  2007-02-25 18:58                   ` Rafael J. Wysocki
@ 2007-03-05 22:07                 ` Rafael J. Wysocki
  2007-03-08  7:51                   ` Andrey Borzenkov
  2007-05-19 18:03                   ` Andrey Borzenkov
  1 sibling, 2 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2007-03-05 22:07 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: linux-acpi, linux-kernel, Andrew Morton, Pavel Machek

[changed Cc list]

On Sunday, 25 February 2007 18:14, Andrey Borzenkov wrote:
> On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> > > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > > > >
> > > > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > > > >
> > > > > > > > regards
> > > > > > >
> > > > > > > Well, this starts looking like ACPI is not at fault.
> > > > > > >
> > > > > > > When reporting AC state ACPI just reads contents of system memory
> > > > > > > (I presume it gets updated by BIOS/ACPI when AC state changes).
> > > > > > > It looks like this memory area is restored during resume from
> > > > > > > STD. I updated mentioned bug report with more detailed
> > > > > > > description. Now if someone could suggest a way to catch if
> > > > > > > specific physical address gets saved/restored this would finally
> > > > > > > explain it.
> > > > > >
> > > > > > First, if you want the reserved memory areas to be left alone by
> > > > > > swsusp, you need to mark them as 'nosave'.  On x86_64 this is done
> > > > > > by the function e820_mark_nosave_range() in
> > > > > > arch/x86_64/kernel/e820.c that can be ported to i386 with no
> > > > > > problems.  However, we haven't found that very useful, so far,
> > > > > > since no one has ever reported any problems with the current
> > > > > > approach, which is to save and restore them.
> > > > >
> > > > > Well, the following proof of concept patch fixes this issue for me.
> > > > > Please notice that original version of e820_mark_nosave_range() could
> > > > > fail to exclude some areas due to alignment issues (exactly what
> > > > > happened to me on first try) so it still can explain your problem
> > > > > too.
> > > >
> > > > Great job, thanks for the patch!  It looks good, so I'm going to
> > > > forward it for merging.
> > >
> > > Please no; I'm currently testing slightly more polished version; I will
> > > send it later.
> >
> > OK
> >
> > > Could anybody explain (or give pointer to) what happens which region that
> > > is not page-aligned? In particular, the very first one:
> > >
> > >  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> > >  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> > >
> > > Will the kernel allocate partial page (how?) or will the kernel ignore
> > > last (first) incomplete page? In the former case how those incomplete
> > > pages can be detected?
> >
> > Well, on x86_64, if I understand e820_register_active_regions() correctly,
> > the partial pages won't be registered.
> >
> 
> It appears that for low memory kernel will ignore incomplete pages for sure. I 
> hope it does the same for high memory - but for now I just throw this in and 
> pray :) This also significantly simplifies patch.

Well, can you please check if the appended modification of your patch still
works?

Thanks,
Rafael


---
 arch/i386/kernel/e820.c  |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 arch/i386/kernel/setup.c |    1 +
 include/asm-i386/e820.h  |    1 +
 3 files changed, 49 insertions(+)

Index: linux-2.6.21-rc2/arch/i386/kernel/e820.c
===================================================================
--- linux-2.6.21-rc2.orig/arch/i386/kernel/e820.c
+++ linux-2.6.21-rc2/arch/i386/kernel/e820.c
@@ -313,6 +313,53 @@ static int __init request_standard_resou
 
 subsys_initcall(request_standard_resources);
 
+/*
+ * Mark pages corresponding to given pfn range as 'nosave'.
+ */
+static void __init
+e820_mark_nosave_range(unsigned long start_pfn, unsigned long end_pfn)
+{
+	unsigned long pfn;
+
+	if (start_pfn >= end_pfn)
+		return;
+
+	printk("Nosave address range: %016Lx - %016Lx\n",
+				PFN_PHYS(start_pfn), PFN_PHYS(end_pfn));
+	for (pfn = start_pfn; pfn < end_pfn; pfn++)
+		if (pfn_valid(pfn))
+			SetPageNosave(pfn_to_page(pfn));
+}
+
+/*
+ * Find the ranges of physical addresses that do not correspond to
+ * e820 RAM areas and mark the corresponding pages as nosave for software
+ * suspend and suspend to RAM.
+ *
+ * This function requires the e820 map to be sorted and without any
+ * overlapping entries and assumes the first e820 area to be RAM.
+ */
+void __init e820_mark_nosave_regions(void)
+{
+	int i;
+	unsigned long pfn;
+
+	pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
+	for (i = 1; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+
+		if (pfn < PFN_UP(ei->addr))
+			e820_mark_nosave_range(pfn, PFN_UP(ei->addr));
+
+		pfn = PFN_DOWN(ei->addr + ei->size);
+		if (ei->type != E820_RAM)
+			e820_mark_nosave_range(PFN_UP(ei->addr), pfn);
+
+		if (pfn >= max_low_pfn)
+			break;
+	}
+}
+
 void __init add_memory_region(unsigned long long start,
 			      unsigned long long size, int type)
 {
Index: linux-2.6.21-rc2/arch/i386/kernel/setup.c
===================================================================
--- linux-2.6.21-rc2.orig/arch/i386/kernel/setup.c
+++ linux-2.6.21-rc2/arch/i386/kernel/setup.c
@@ -648,6 +648,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	e820_register_memory();
+	e820_mark_nosave_regions();
 
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
Index: linux-2.6.21-rc2/include/asm-i386/e820.h
===================================================================
--- linux-2.6.21-rc2.orig/include/asm-i386/e820.h
+++ linux-2.6.21-rc2/include/asm-i386/e820.h
@@ -43,6 +43,7 @@ extern void register_bootmem_low_pages(u
 extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
+extern void e820_mark_nosave_regions(void);
 
 #endif/*!__ASSEMBLY__*/
 

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-03-05 22:07                 ` Rafael J. Wysocki
@ 2007-03-08  7:51                   ` Andrey Borzenkov
  2007-05-19 18:03                   ` Andrey Borzenkov
  1 sibling, 0 replies; 30+ messages in thread
From: Andrey Borzenkov @ 2007-03-08  7:51 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-kernel, Andrew Morton, Pavel Machek

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

On Tuesday 06 March 2007, Rafael J. Wysocki wrote:
> [changed Cc list]
>
> On Sunday, 25 February 2007 18:14, Andrey Borzenkov wrote:
> > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> > > > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > > > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > > > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > > > > >
> > > > > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > >
> > > > > > > > Well, this starts looking like ACPI is not at fault.
> > > > > > > >
> > > > > > > > When reporting AC state ACPI just reads contents of system
> > > > > > > > memory (I presume it gets updated by BIOS/ACPI when AC state
> > > > > > > > changes). It looks like this memory area is restored during
> > > > > > > > resume from STD. I updated mentioned bug report with more
> > > > > > > > detailed description. Now if someone could suggest a way to
> > > > > > > > catch if specific physical address gets saved/restored this
> > > > > > > > would finally explain it.
> > > > > > >
> > > > > > > First, if you want the reserved memory areas to be left alone
> > > > > > > by swsusp, you need to mark them as 'nosave'.  On x86_64 this
> > > > > > > is done by the function e820_mark_nosave_range() in
> > > > > > > arch/x86_64/kernel/e820.c that can be ported to i386 with no
> > > > > > > problems.  However, we haven't found that very useful, so far,
> > > > > > > since no one has ever reported any problems with the current
> > > > > > > approach, which is to save and restore them.
> > > > > >
> > > > > > Well, the following proof of concept patch fixes this issue for
> > > > > > me. Please notice that original version of
> > > > > > e820_mark_nosave_range() could fail to exclude some areas due to
> > > > > > alignment issues (exactly what happened to me on first try) so it
> > > > > > still can explain your problem too.
> > > > >
> > > > > Great job, thanks for the patch!  It looks good, so I'm going to
> > > > > forward it for merging.
> > > >
> > > > Please no; I'm currently testing slightly more polished version; I
> > > > will send it later.
> > >
> > > OK
> > >
> > > > Could anybody explain (or give pointer to) what happens which region
> > > > that is not page-aligned? In particular, the very first one:
> > > >
> > > >  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> > > >  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> > > >
> > > > Will the kernel allocate partial page (how?) or will the kernel
> > > > ignore last (first) incomplete page? In the former case how those
> > > > incomplete pages can be detected?
> > >
> > > Well, on x86_64, if I understand e820_register_active_regions()
> > > correctly, the partial pages won't be registered.
> >
> > It appears that for low memory kernel will ignore incomplete pages for
> > sure. I hope it does the same for high memory - but for now I just throw
> > this in and pray :) This also significantly simplifies patch.
>
> Well, can you please check if the appended modification of your patch still
> works?
>

It works for me with caveat

/home/bor/src/linux-git/arch/i386/kernel/e820.c: In 
function ‘e820_mark_nosave_range’:
/home/bor/src/linux-git/arch/i386/kernel/e820.c:328: warning: format ‘%016Lx’ 
expects type ‘long long unsigned int’, but argument 2 has type ‘long unsigned 
int’
/home/bor/src/linux-git/arch/i386/kernel/e820.c:328: warning: format ‘%016Lx’ 
expects type ‘long long unsigned int’, but argument 3 has type ‘long unsigned 
int’

regards 

-andrey

> Thanks,
> Rafael
>
>
> ---
>  arch/i386/kernel/e820.c  |   47
> +++++++++++++++++++++++++++++++++++++++++++++++ arch/i386/kernel/setup.c | 
>   1 +
>  include/asm-i386/e820.h  |    1 +
>  3 files changed, 49 insertions(+)
>
> Index: linux-2.6.21-rc2/arch/i386/kernel/e820.c
> ===================================================================
> --- linux-2.6.21-rc2.orig/arch/i386/kernel/e820.c
> +++ linux-2.6.21-rc2/arch/i386/kernel/e820.c
> @@ -313,6 +313,53 @@ static int __init request_standard_resou
>
>  subsys_initcall(request_standard_resources);
>
> +/*
> + * Mark pages corresponding to given pfn range as 'nosave'.
> + */
> +static void __init
> +e820_mark_nosave_range(unsigned long start_pfn, unsigned long end_pfn)
> +{
> +	unsigned long pfn;
> +
> +	if (start_pfn >= end_pfn)
> +		return;
> +
> +	printk("Nosave address range: %016Lx - %016Lx\n",
> +				PFN_PHYS(start_pfn), PFN_PHYS(end_pfn));
> +	for (pfn = start_pfn; pfn < end_pfn; pfn++)
> +		if (pfn_valid(pfn))
> +			SetPageNosave(pfn_to_page(pfn));
> +}
> +
> +/*
> + * Find the ranges of physical addresses that do not correspond to
> + * e820 RAM areas and mark the corresponding pages as nosave for software
> + * suspend and suspend to RAM.
> + *
> + * This function requires the e820 map to be sorted and without any
> + * overlapping entries and assumes the first e820 area to be RAM.
> + */
> +void __init e820_mark_nosave_regions(void)
> +{
> +	int i;
> +	unsigned long pfn;
> +
> +	pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
> +	for (i = 1; i < e820.nr_map; i++) {
> +		struct e820entry *ei = &e820.map[i];
> +
> +		if (pfn < PFN_UP(ei->addr))
> +			e820_mark_nosave_range(pfn, PFN_UP(ei->addr));
> +
> +		pfn = PFN_DOWN(ei->addr + ei->size);
> +		if (ei->type != E820_RAM)
> +			e820_mark_nosave_range(PFN_UP(ei->addr), pfn);
> +
> +		if (pfn >= max_low_pfn)
> +			break;
> +	}
> +}
> +
>  void __init add_memory_region(unsigned long long start,
>  			      unsigned long long size, int type)
>  {
> Index: linux-2.6.21-rc2/arch/i386/kernel/setup.c
> ===================================================================
> --- linux-2.6.21-rc2.orig/arch/i386/kernel/setup.c
> +++ linux-2.6.21-rc2/arch/i386/kernel/setup.c
> @@ -648,6 +648,7 @@ void __init setup_arch(char **cmdline_p)
>  #endif
>
>  	e820_register_memory();
> +	e820_mark_nosave_regions();
>
>  #ifdef CONFIG_VT
>  #if defined(CONFIG_VGA_CONSOLE)
> Index: linux-2.6.21-rc2/include/asm-i386/e820.h
> ===================================================================
> --- linux-2.6.21-rc2.orig/include/asm-i386/e820.h
> +++ linux-2.6.21-rc2/include/asm-i386/e820.h
> @@ -43,6 +43,7 @@ extern void register_bootmem_low_pages(u
>  extern void e820_register_memory(void);
>  extern void limit_regions(unsigned long long size);
>  extern void print_memory_map(char *who);
> +extern void e820_mark_nosave_regions(void);
>
>  #endif/*!__ASSEMBLY__*/



[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2007-03-05 22:07                 ` Rafael J. Wysocki
  2007-03-08  7:51                   ` Andrey Borzenkov
@ 2007-05-19 18:03                   ` Andrey Borzenkov
  1 sibling, 0 replies; 30+ messages in thread
From: Andrey Borzenkov @ 2007-05-19 18:03 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-kernel, Andrew Morton, Pavel Machek

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

On Tuesday 06 March 2007, Rafael J. Wysocki wrote:
> [changed Cc list]
>
> On Sunday, 25 February 2007 18:14, Andrey Borzenkov wrote:
> > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > On Sunday, 25 February 2007 11:37, Andrey Borzenkov wrote:
> > > > On Воскресенье 25 февраля 2007, Rafael J. Wysocki wrote:
> > > > > On Sunday, 25 February 2007 00:26, Andrey Borzenkov wrote:
> > > > > > On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > > > > > > > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > > > > > > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > > > > > > > Please register new bug, attach acpidump and dmesg.
> > > > > > > > >
> > > > > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > >
> > > > > > > > Well, this starts looking like ACPI is not at fault.
> > > > > > > >
> > > > > > > > When reporting AC state ACPI just reads contents of system
> > > > > > > > memory (I presume it gets updated by BIOS/ACPI when AC state
> > > > > > > > changes). It looks like this memory area is restored during
> > > > > > > > resume from STD. I updated mentioned bug report with more
> > > > > > > > detailed description. Now if someone could suggest a way to
> > > > > > > > catch if specific physical address gets saved/restored this
> > > > > > > > would finally explain it.
> > > > > > >
> > > > > > > First, if you want the reserved memory areas to be left alone
> > > > > > > by swsusp, you need to mark them as 'nosave'.  On x86_64 this
> > > > > > > is done by the function e820_mark_nosave_range() in
> > > > > > > arch/x86_64/kernel/e820.c that can be ported to i386 with no
> > > > > > > problems.  However, we haven't found that very useful, so far,
> > > > > > > since no one has ever reported any problems with the current
> > > > > > > approach, which is to save and restore them.
> > > > > >
> > > > > > Well, the following proof of concept patch fixes this issue for
> > > > > > me. Please notice that original version of
> > > > > > e820_mark_nosave_range() could fail to exclude some areas due to
> > > > > > alignment issues (exactly what happened to me on first try) so it
> > > > > > still can explain your problem too.
> > > > >
> > > > > Great job, thanks for the patch!  It looks good, so I'm going to
> > > > > forward it for merging.
> > > >
> > > > Please no; I'm currently testing slightly more polished version; I
> > > > will send it later.
> > >
> > > OK
> > >
> > > > Could anybody explain (or give pointer to) what happens which region
> > > > that is not page-aligned? In particular, the very first one:
> > > >
> > > >  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> > > >  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> > > >
> > > > Will the kernel allocate partial page (how?) or will the kernel
> > > > ignore last (first) incomplete page? In the former case how those
> > > > incomplete pages can be detected?
> > >
> > > Well, on x86_64, if I understand e820_register_active_regions()
> > > correctly, the partial pages won't be registered.
> >
> > It appears that for low memory kernel will ignore incomplete pages for
> > sure. I hope it does the same for high memory - but for now I just throw
> > this in and pray :) This also significantly simplifies patch.
>
> Well, can you please check if the appended modification of your patch still
> works?
>

what is the state of this problem? It is still not fixed in 2.6.22-rc2 and 
this patch no more applies as well (changes are trivial but I cannot test 
them because USB refuses to suspend on my system in this version :)

In previous versions patch worked just fine.

This is http://bugzilla.kernel.org/show_bug.cgi?id=7995 BTW.

> Thanks,
> Rafael
>
>
> ---
>  arch/i386/kernel/e820.c  |   47
> +++++++++++++++++++++++++++++++++++++++++++++++ arch/i386/kernel/setup.c | 
>   1 +
>  include/asm-i386/e820.h  |    1 +
>  3 files changed, 49 insertions(+)
>
> Index: linux-2.6.21-rc2/arch/i386/kernel/e820.c
> ===================================================================
> --- linux-2.6.21-rc2.orig/arch/i386/kernel/e820.c
> +++ linux-2.6.21-rc2/arch/i386/kernel/e820.c
> @@ -313,6 +313,53 @@ static int __init request_standard_resou
>
>  subsys_initcall(request_standard_resources);
>
> +/*
> + * Mark pages corresponding to given pfn range as 'nosave'.
> + */
> +static void __init
> +e820_mark_nosave_range(unsigned long start_pfn, unsigned long end_pfn)
> +{
> +	unsigned long pfn;
> +
> +	if (start_pfn >= end_pfn)
> +		return;
> +
> +	printk("Nosave address range: %016Lx - %016Lx\n",
> +				PFN_PHYS(start_pfn), PFN_PHYS(end_pfn));
> +	for (pfn = start_pfn; pfn < end_pfn; pfn++)
> +		if (pfn_valid(pfn))
> +			SetPageNosave(pfn_to_page(pfn));
> +}
> +
> +/*
> + * Find the ranges of physical addresses that do not correspond to
> + * e820 RAM areas and mark the corresponding pages as nosave for software
> + * suspend and suspend to RAM.
> + *
> + * This function requires the e820 map to be sorted and without any
> + * overlapping entries and assumes the first e820 area to be RAM.
> + */
> +void __init e820_mark_nosave_regions(void)
> +{
> +	int i;
> +	unsigned long pfn;
> +
> +	pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
> +	for (i = 1; i < e820.nr_map; i++) {
> +		struct e820entry *ei = &e820.map[i];
> +
> +		if (pfn < PFN_UP(ei->addr))
> +			e820_mark_nosave_range(pfn, PFN_UP(ei->addr));
> +
> +		pfn = PFN_DOWN(ei->addr + ei->size);
> +		if (ei->type != E820_RAM)
> +			e820_mark_nosave_range(PFN_UP(ei->addr), pfn);
> +
> +		if (pfn >= max_low_pfn)
> +			break;
> +	}
> +}
> +
>  void __init add_memory_region(unsigned long long start,
>  			      unsigned long long size, int type)
>  {
> Index: linux-2.6.21-rc2/arch/i386/kernel/setup.c
> ===================================================================
> --- linux-2.6.21-rc2.orig/arch/i386/kernel/setup.c
> +++ linux-2.6.21-rc2/arch/i386/kernel/setup.c
> @@ -648,6 +648,7 @@ void __init setup_arch(char **cmdline_p)
>  #endif
>
>  	e820_register_memory();
> +	e820_mark_nosave_regions();
>
>  #ifdef CONFIG_VT
>  #if defined(CONFIG_VGA_CONSOLE)
> Index: linux-2.6.21-rc2/include/asm-i386/e820.h
> ===================================================================
> --- linux-2.6.21-rc2.orig/include/asm-i386/e820.h
> +++ linux-2.6.21-rc2/include/asm-i386/e820.h
> @@ -43,6 +43,7 @@ extern void register_bootmem_low_pages(u
>  extern void e820_register_memory(void);
>  extern void limit_regions(unsigned long long size);
>  extern void print_memory_map(char *who);
> +extern void e820_mark_nosave_regions(void);
>
>  #endif/*!__ASSEMBLY__*/



[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* RE: 2.6.19: ACPI reports AC not present after resume from STD
@ 2006-12-08 13:26 Karasyov, Konstantin A
  0 siblings, 0 replies; 30+ messages in thread
From: Karasyov, Konstantin A @ 2006-12-08 13:26 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Andrey Borzenkov, linux-acpi, Lebedev, Vladimir P

All,

Yes, the patch will not help, as I realize now - the same function is
called on reads from /proc/acpi/ac/.../state file, so the problem is
somewhere else. Sorry for bothering :)

Regards.
Konstantin.
>-----Original Message-----
>From: Rafael J. Wysocki [mailto:rjw@sisk.pl]
>Sent: Thursday, December 07, 2006 10:48 PM
>To: Karasyov, Konstantin A
>Cc: Andrey Borzenkov; linux-acpi@vger.kernel.org; Lebedev, Vladimir P
>Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
>
>Hi,
>
>On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
>> Hi,
>>
>> Unfortunately, I cannot reproduce this bug on my system, but the
problem
>> could be solved by adding a resume handler for AC adapter device.
Could
>> you try the attached patch to see if it helps.
>
>I can reproduce it and the patch doesn't help.
>
>Greetings,
>Rafael
>
>
>> >-----Original Message-----
>> >From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
>> >owner@vger.kernel.org] On Behalf Of Andrey Borzenkov
>> >Sent: Sunday, December 03, 2006 7:01 PM
>> >To: Alexey Starikovskiy
>> >Cc: Pavel Machek; linux-acpi@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> >Subject: Re: 2.6.19: ACPI reports AC not present after resume from
STD
>> >
>> >-----BEGIN PGP SIGNED MESSAGE-----
>> >Hash: SHA1
>> >
>> >On Sunday 03 December 2006 17:35, Alexey Starikovskiy wrote:
>> >> Andrey Borzenkov wrote:
>> >> > -----BEGIN PGP SIGNED MESSAGE-----
>> >> > Hash: SHA1
>> >> >
>> >> > On Sunday 03 December 2006 16:11, Pavel Machek wrote:
>> >> >> Hi!
>> >> >>
>> >> >>> I started to notice it some time ago; I can't say exactly if
this
>> was
>> >> >>> not present in earlier versions because recently I switched
from
>> STR
>> >> >>> (which gave me no end of troubles) to STD. So I may have not
seen
>> it
>> >> >>> before.
>> >> >>>
>> >> >>> Suspend to disk while on battery. Plug in AC, resume. ACPI
>> continues
>> >to
>> >> >>> show AC adapter as not present:
>> >> >>>
>> >> >>> {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
>> >> >>> state:                   off-line
>> >> >>>
>> >> >>> replugging AC correctly changes state to on-line.
>> >> >>
>> >> >> try echo platform > /sys/power/disk.
>> >> >
>> >> > Nope.
>> >> >
>> >> > {pts/0}% pmsuspend disk
>> >> > ... after resume
>> >> > {pts/0}% cat /sys/power/disk
>> >> > platform
>> >> > {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
>> >> > state:                   off-line
>> >>
>> >> please look if patches in 7122 work  for you.
>> >
>> >No. I applied patches from comments 38 and 52 (modified, it did not
>> apply
>> >cleanly to 2.6.19). As far as I understood, those two were final.
>> >-----BEGIN PGP SIGNATURE-----
>> >Version: GnuPG v1.4.5 (GNU/Linux)
>> >
>> >iD8DBQFFcvS3R6LMutpd94wRAp9oAKCM7+6G4SsgFEGLgkW1jxM3VMQHqQCdFSDQ
>> >14w+QsgDtxWusmfdzCMOdqo=
>> >=QDyt
>> >-----END PGP SIGNATURE-----
>> >-
>> >To unsubscribe from this list: send the line "unsubscribe
linux-acpi"
>> in
>> >the body of a message to majordomo@vger.kernel.org
>> >More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>--
>If you don't have the time to read,
>you don't have the time or the tools to write.
>		- Stephen King

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-07 19:48   ` Alexey Starikovskiy
@ 2006-12-07 20:00     ` Rafael J. Wysocki
  0 siblings, 0 replies; 30+ messages in thread
From: Rafael J. Wysocki @ 2006-12-07 20:00 UTC (permalink / raw)
  To: Alexey Starikovskiy
  Cc: Karasyov, Konstantin A, Andrey Borzenkov, linux-acpi, Lebedev,
	Vladimir P

On Thursday, 7 December 2006 20:48, Alexey Starikovskiy wrote:
> Rafael J. Wysocki wrote:
> > Hi,
> >
> > On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
> >   
> >> Hi,
> >>
> >> Unfortunately, I cannot reproduce this bug on my system, but the problem
> >> could be solved by adding a resume handler for AC adapter device. Could
> >> you try the attached patch to see if it helps.
> >>     
> >
> > I can reproduce it and the patch doesn't help.
> >
> > Greetings,
> > Rafael
> >
> >   
> Any ACPI errors in dmesg?

Not anything noticeable except for

ACPI: Unable to turn cooling device [<an address>] 'on'

which seems to be normal on this box.

Greetings,
Rafael


-- 
If you don't have the time to read,
you don't have the time or the tools to write.
		- Stephen King

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-07 19:47 ` Rafael J. Wysocki
@ 2006-12-07 19:48   ` Alexey Starikovskiy
  2006-12-07 20:00     ` Rafael J. Wysocki
  0 siblings, 1 reply; 30+ messages in thread
From: Alexey Starikovskiy @ 2006-12-07 19:48 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Karasyov, Konstantin A, Andrey Borzenkov, linux-acpi, Lebedev,
	Vladimir P

Rafael J. Wysocki wrote:
> Hi,
>
> On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
>   
>> Hi,
>>
>> Unfortunately, I cannot reproduce this bug on my system, but the problem
>> could be solved by adding a resume handler for AC adapter device. Could
>> you try the attached patch to see if it helps.
>>     
>
> I can reproduce it and the patch doesn't help.
>
> Greetings,
> Rafael
>
>   
Any ACPI errors in dmesg?

Regards,
    Alex.

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-07 18:57 Karasyov, Konstantin A
@ 2006-12-07 19:47 ` Rafael J. Wysocki
  2006-12-07 19:48   ` Alexey Starikovskiy
  0 siblings, 1 reply; 30+ messages in thread
From: Rafael J. Wysocki @ 2006-12-07 19:47 UTC (permalink / raw)
  To: Karasyov, Konstantin A; +Cc: Andrey Borzenkov, linux-acpi, Lebedev, Vladimir P

Hi,

On Thursday, 7 December 2006 19:57, Karasyov, Konstantin A wrote:
> Hi,
> 
> Unfortunately, I cannot reproduce this bug on my system, but the problem
> could be solved by adding a resume handler for AC adapter device. Could
> you try the attached patch to see if it helps.

I can reproduce it and the patch doesn't help.

Greetings,
Rafael


> >-----Original Message-----
> >From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> >owner@vger.kernel.org] On Behalf Of Andrey Borzenkov
> >Sent: Sunday, December 03, 2006 7:01 PM
> >To: Alexey Starikovskiy
> >Cc: Pavel Machek; linux-acpi@vger.kernel.org;
> linux-kernel@vger.kernel.org
> >Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
> >
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >On Sunday 03 December 2006 17:35, Alexey Starikovskiy wrote:
> >> Andrey Borzenkov wrote:
> >> > -----BEGIN PGP SIGNED MESSAGE-----
> >> > Hash: SHA1
> >> >
> >> > On Sunday 03 December 2006 16:11, Pavel Machek wrote:
> >> >> Hi!
> >> >>
> >> >>> I started to notice it some time ago; I can't say exactly if this
> was
> >> >>> not present in earlier versions because recently I switched from
> STR
> >> >>> (which gave me no end of troubles) to STD. So I may have not seen
> it
> >> >>> before.
> >> >>>
> >> >>> Suspend to disk while on battery. Plug in AC, resume. ACPI
> continues
> >to
> >> >>> show AC adapter as not present:
> >> >>>
> >> >>> {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
> >> >>> state:                   off-line
> >> >>>
> >> >>> replugging AC correctly changes state to on-line.
> >> >>
> >> >> try echo platform > /sys/power/disk.
> >> >
> >> > Nope.
> >> >
> >> > {pts/0}% pmsuspend disk
> >> > ... after resume
> >> > {pts/0}% cat /sys/power/disk
> >> > platform
> >> > {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
> >> > state:                   off-line
> >>
> >> please look if patches in 7122 work  for you.
> >
> >No. I applied patches from comments 38 and 52 (modified, it did not
> apply
> >cleanly to 2.6.19). As far as I understood, those two were final.
> >-----BEGIN PGP SIGNATURE-----
> >Version: GnuPG v1.4.5 (GNU/Linux)
> >
> >iD8DBQFFcvS3R6LMutpd94wRAp9oAKCM7+6G4SsgFEGLgkW1jxM3VMQHqQCdFSDQ
> >14w+QsgDtxWusmfdzCMOdqo=
> >=QDyt
> >-----END PGP SIGNATURE-----
> >-
> >To unsubscribe from this list: send the line "unsubscribe linux-acpi"
> in
> >the body of a message to majordomo@vger.kernel.org
> >More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
If you don't have the time to read,
you don't have the time or the tools to write.
		- Stephen King

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

* RE: 2.6.19: ACPI reports AC not present after resume from STD
@ 2006-12-07 18:57 Karasyov, Konstantin A
  2006-12-07 19:47 ` Rafael J. Wysocki
  0 siblings, 1 reply; 30+ messages in thread
From: Karasyov, Konstantin A @ 2006-12-07 18:57 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: linux-acpi, Lebedev, Vladimir P

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

Hi,

Unfortunately, I cannot reproduce this bug on my system, but the problem
could be solved by adding a resume handler for AC adapter device. Could
you try the attached patch to see if it helps.

Regards.
Konstantin.
>-----Original Message-----
>From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
>owner@vger.kernel.org] On Behalf Of Andrey Borzenkov
>Sent: Sunday, December 03, 2006 7:01 PM
>To: Alexey Starikovskiy
>Cc: Pavel Machek; linux-acpi@vger.kernel.org;
linux-kernel@vger.kernel.org
>Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On Sunday 03 December 2006 17:35, Alexey Starikovskiy wrote:
>> Andrey Borzenkov wrote:
>> > -----BEGIN PGP SIGNED MESSAGE-----
>> > Hash: SHA1
>> >
>> > On Sunday 03 December 2006 16:11, Pavel Machek wrote:
>> >> Hi!
>> >>
>> >>> I started to notice it some time ago; I can't say exactly if this
was
>> >>> not present in earlier versions because recently I switched from
STR
>> >>> (which gave me no end of troubles) to STD. So I may have not seen
it
>> >>> before.
>> >>>
>> >>> Suspend to disk while on battery. Plug in AC, resume. ACPI
continues
>to
>> >>> show AC adapter as not present:
>> >>>
>> >>> {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
>> >>> state:                   off-line
>> >>>
>> >>> replugging AC correctly changes state to on-line.
>> >>
>> >> try echo platform > /sys/power/disk.
>> >
>> > Nope.
>> >
>> > {pts/0}% pmsuspend disk
>> > ... after resume
>> > {pts/0}% cat /sys/power/disk
>> > platform
>> > {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
>> > state:                   off-line
>>
>> please look if patches in 7122 work  for you.
>
>No. I applied patches from comments 38 and 52 (modified, it did not
apply
>cleanly to 2.6.19). As far as I understood, those two were final.
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.4.5 (GNU/Linux)
>
>iD8DBQFFcvS3R6LMutpd94wRAp9oAKCM7+6G4SsgFEGLgkW1jxM3VMQHqQCdFSDQ
>14w+QsgDtxWusmfdzCMOdqo=
>=QDyt
>-----END PGP SIGNATURE-----
>-
>To unsubscribe from this list: send the line "unsubscribe linux-acpi"
in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: ac_resume.patch --]
[-- Type: application/octet-stream, Size: 1080 bytes --]

Index: linux-2.6/drivers/acpi/ac.c
===================================================================
--- linux-2.6.orig/drivers/acpi/ac.c	2006-09-20 07:42:06.000000000 +0400
+++ linux-2.6/drivers/acpi/ac.c	2006-12-07 22:52:00.000000000 +0300
@@ -55,6 +55,7 @@
 
 static int acpi_ac_add(struct acpi_device *device);
 static int acpi_ac_remove(struct acpi_device *device, int type);
+static int acpi_ac_resume(struct acpi_device *device, int state);
 static int acpi_ac_open_fs(struct inode *inode, struct file *file);
 
 static struct acpi_driver acpi_ac_driver = {
@@ -64,6 +65,7 @@
 	.ops = {
 		.add = acpi_ac_add,
 		.remove = acpi_ac_remove,
+		.resume = acpi_ac_resume,
 		},
 };
 
@@ -281,6 +283,22 @@
 	return 0;
 }
 
+static int acpi_ac_resume(struct acpi_device *device, int state)
+{
+	int result = 0;
+	struct acpi_ac *ac = NULL;
+
+
+	if (!device || !acpi_driver_data(device))
+		return -EINVAL;
+
+	ac = (struct acpi_ac *)acpi_driver_data(device);
+
+	result = acpi_ac_get_state(ac);
+
+	return (result);
+}
+
 static int __init acpi_ac_init(void)
 {
 	int result;

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-03 14:35     ` Alexey Starikovskiy
@ 2006-12-03 16:00       ` Andrey Borzenkov
  0 siblings, 0 replies; 30+ messages in thread
From: Andrey Borzenkov @ 2006-12-03 16:00 UTC (permalink / raw)
  To: Alexey Starikovskiy; +Cc: Pavel Machek, linux-acpi, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 03 December 2006 17:35, Alexey Starikovskiy wrote:
> Andrey Borzenkov wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Sunday 03 December 2006 16:11, Pavel Machek wrote:
> >> Hi!
> >>
> >>> I started to notice it some time ago; I can't say exactly if this was
> >>> not present in earlier versions because recently I switched from STR
> >>> (which gave me no end of troubles) to STD. So I may have not seen it
> >>> before.
> >>>
> >>> Suspend to disk while on battery. Plug in AC, resume. ACPI continues to
> >>> show AC adapter as not present:
> >>>
> >>> {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
> >>> state:                   off-line
> >>>
> >>> replugging AC correctly changes state to on-line.
> >>
> >> try echo platform > /sys/power/disk.
> >
> > Nope.
> >
> > {pts/0}% pmsuspend disk
> > ... after resume
> > {pts/0}% cat /sys/power/disk
> > platform
> > {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
> > state:                   off-line
>
> please look if patches in 7122 work  for you.

No. I applied patches from comments 38 and 52 (modified, it did not apply 
cleanly to 2.6.19). As far as I understood, those two were final.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFcvS3R6LMutpd94wRAp9oAKCM7+6G4SsgFEGLgkW1jxM3VMQHqQCdFSDQ
14w+QsgDtxWusmfdzCMOdqo=
=QDyt
-----END PGP SIGNATURE-----

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-03 13:52   ` Andrey Borzenkov
@ 2006-12-03 14:35     ` Alexey Starikovskiy
  2006-12-03 16:00       ` Andrey Borzenkov
  0 siblings, 1 reply; 30+ messages in thread
From: Alexey Starikovskiy @ 2006-12-03 14:35 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: Pavel Machek, linux-acpi, linux-kernel

Andrey Borzenkov wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sunday 03 December 2006 16:11, Pavel Machek wrote:
>   
>> Hi!
>>
>>     
>>> I started to notice it some time ago; I can't say exactly if this was not
>>> present in earlier versions because recently I switched from STR (which
>>> gave me no end of troubles) to STD. So I may have not seen it before.
>>>
>>> Suspend to disk while on battery. Plug in AC, resume. ACPI continues to
>>> show AC adapter as not present:
>>>
>>> {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
>>> state:                   off-line
>>>
>>> replugging AC correctly changes state to on-line.
>>>       
>> try echo platform > /sys/power/disk.
>>     
>
> Nope.
>
> {pts/0}% pmsuspend disk
> ... after resume
> {pts/0}% cat /sys/power/disk
> platform
> {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
> state:                   off-line
>   
please look if patches in 7122 work  for you.

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-03 13:11 ` Pavel Machek
@ 2006-12-03 13:52   ` Andrey Borzenkov
  2006-12-03 14:35     ` Alexey Starikovskiy
  0 siblings, 1 reply; 30+ messages in thread
From: Andrey Borzenkov @ 2006-12-03 13:52 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-acpi, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 03 December 2006 16:11, Pavel Machek wrote:
> Hi!
>
> > I started to notice it some time ago; I can't say exactly if this was not
> > present in earlier versions because recently I switched from STR (which
> > gave me no end of troubles) to STD. So I may have not seen it before.
> >
> > Suspend to disk while on battery. Plug in AC, resume. ACPI continues to
> > show AC adapter as not present:
> >
> > {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
> > state:                   off-line
> >
> > replugging AC correctly changes state to on-line.
>
> try echo platform > /sys/power/disk.

Nope.

{pts/0}% pmsuspend disk
... after resume
{pts/0}% cat /sys/power/disk
platform
{pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
state:                   off-line
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFctamR6LMutpd94wRAqnCAJwKi4wXUj2FRkD2tyq+c0gqAghnrgCgyKYZ
lep/19gowY3OTGIkpzcasfU=
=4Cgb
-----END PGP SIGNATURE-----

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

* Re: 2.6.19: ACPI reports AC not present after resume from STD
  2006-12-03 12:25 Andrey Borzenkov
@ 2006-12-03 13:11 ` Pavel Machek
  2006-12-03 13:52   ` Andrey Borzenkov
  0 siblings, 1 reply; 30+ messages in thread
From: Pavel Machek @ 2006-12-03 13:11 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: linux-acpi, linux-kernel

Hi!

> I started to notice it some time ago; I can't say exactly if this was not 
> present in earlier versions because recently I switched from STR (which gave 
> me no end of troubles) to STD. So I may have not seen it before.
> 
> Suspend to disk while on battery. Plug in AC, resume. ACPI continues to show 
> AC adapter as not present:
> 
> {pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
> state:                   off-line
> 
> replugging AC correctly changes state to on-line.

try echo platform > /sys/power/disk.
						Pavel
-- 
Thanks for all the (sleeping) penguins.

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

* 2.6.19: ACPI reports AC not present after resume from STD
@ 2006-12-03 12:25 Andrey Borzenkov
  2006-12-03 13:11 ` Pavel Machek
  0 siblings, 1 reply; 30+ messages in thread
From: Andrey Borzenkov @ 2006-12-03 12:25 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I started to notice it some time ago; I can't say exactly if this was not 
present in earlier versions because recently I switched from STR (which gave 
me no end of troubles) to STD. So I may have not seen it before.

Suspend to disk while on battery. Plug in AC, resume. ACPI continues to show 
AC adapter as not present:

{pts/0}% cat /proc/acpi/ac_adapter/ADP1/state
state:                   off-line

replugging AC correctly changes state to on-line.

The system is Toshiba Portege 4000; I am not sure which information may be 
required in this case so please tell what is needed (unfortunately I will be 
off next two weeks without access to this system).

regards

- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFcsJYR6LMutpd94wRAqSeAJ4n3lHqbdvgBeXxeIc9ZUTDe/X2jgCgyfU5
w+heEYYnA3Al/U9xHovOkQ4=
=F+Zu
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2007-05-19 18:03 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-07 20:40 2.6.19: ACPI reports AC not present after resume from STD Lebedev, Vladimir P
2006-12-16 17:38 ` Andrey Borzenkov
     [not found] ` <200702132116.05404.arvidjaar@mail.ru>
2007-02-24  9:55   ` Andrey Borzenkov
2007-02-24 19:46     ` Rafael J. Wysocki
2007-02-24 19:46       ` Rafael J. Wysocki
2007-02-24 23:26       ` Andrey Borzenkov
2007-02-25 10:17         ` Rafael J. Wysocki
2007-02-25 10:17           ` Rafael J. Wysocki
2007-02-25 10:37           ` Andrey Borzenkov
2007-02-25 10:51             ` Rafael J. Wysocki
2007-02-25 10:51               ` Rafael J. Wysocki
2007-02-25 17:14               ` Andrey Borzenkov
2007-02-25 18:58                 ` Rafael J. Wysocki
2007-02-25 18:58                   ` Rafael J. Wysocki
2007-02-26 20:35                   ` Andrey Borzenkov
2007-02-26 21:23                     ` Rafael J. Wysocki
2007-02-26 21:23                       ` Rafael J. Wysocki
2007-03-05 22:07                 ` Rafael J. Wysocki
2007-03-08  7:51                   ` Andrey Borzenkov
2007-05-19 18:03                   ` Andrey Borzenkov
  -- strict thread matches above, loose matches on Subject: below --
2006-12-08 13:26 Karasyov, Konstantin A
2006-12-07 18:57 Karasyov, Konstantin A
2006-12-07 19:47 ` Rafael J. Wysocki
2006-12-07 19:48   ` Alexey Starikovskiy
2006-12-07 20:00     ` Rafael J. Wysocki
2006-12-03 12:25 Andrey Borzenkov
2006-12-03 13:11 ` Pavel Machek
2006-12-03 13:52   ` Andrey Borzenkov
2006-12-03 14:35     ` Alexey Starikovskiy
2006-12-03 16:00       ` Andrey Borzenkov

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.