LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* swsusp: fix swsusp with intel-agp
@ 2004-05-21 10:07 Pavel Machek
  2004-05-21 11:05 ` Herbert Xu
  2004-05-21 23:20 ` Andrew Morton
  0 siblings, 2 replies; 22+ messages in thread
From: Pavel Machek @ 2004-05-21 10:07 UTC (permalink / raw)
  To: kernel list, Andrew Morton

Hi!

swsusp contained rather nasty bug where it killed machine when
intel-agp or anything else split kernel 4MB mapping. Herbert Xu
diagnosed this. Fixed by switching to "known good" mapping for during
suspend/resume.

Please apply,
							Pavel

--- tmp/linux/arch/i386/mm/init.c	2004-05-20 23:08:05.000000000 +0200
+++ linux/arch/i386/mm/init.c	2004-05-20 23:10:50.000000000 +0200
@@ -331,6 +331,13 @@
 void zap_low_mappings (void)
 {
 	int i;
+
+#ifdef CONFIG_SOFTWARE_SUSPEND
+	{
+		extern char swsusp_pg_dir[PAGE_SIZE];
+		memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
+	}
+#endif
 	/*
 	 * Zap initial low-memory mappings.
 	 *
--- tmp/linux/arch/i386/power/cpu.c	2004-05-20 23:08:05.000000000 +0200
+++ linux/arch/i386/power/cpu.c	2004-05-20 23:10:50.000000000 +0200
@@ -35,6 +35,10 @@
 unsigned long saved_context_esi, saved_context_edi;
 unsigned long saved_context_eflags;
 
+/* Special page directory for resume */
+char __nosavedata swsusp_pg_dir[PAGE_SIZE]
+                  __attribute__ ((aligned (PAGE_SIZE)));
+
 extern void enable_sep_cpu(void *);
 
 void save_processor_state(void)
--- tmp/linux/arch/i386/power/swsusp.S	2004-05-20 23:08:05.000000000 +0200
+++ linux/arch/i386/power/swsusp.S	2004-05-20 23:11:05.000000000 +0200
@@ -36,7 +38,7 @@
 	jmp .L1449
 	.p2align 4,,7
 .L1450:
-	movl $swapper_pg_dir-__PAGE_OFFSET,%ecx
+	movl $swsusp_pg_dir-__PAGE_OFFSET,%ecx
 	movl %ecx,%cr3
 
 	call do_magic_resume_1
@@ -56,8 +58,6 @@
 	movl (%ecx,%eax),%eax
 	movb (%edx,%eax),%al
 	movb %al,(%edx,%ebx)
-	movl %cr3, %eax;              
-	movl %eax, %cr3;  # flush TLB 
 
 	movl loop2,%eax
 	leal 1(%eax),%edx
--- tmp/linux/include/asm-i386/suspend.h	2003-09-28 22:06:36.000000000 +0200
+++ linux/include/asm-i386/suspend.h	2004-04-27 23:10:24.000000000 +0200
@@ -9,6 +9,9 @@
 static inline int
 arch_prepare_suspend(void)
 {
+	/* If you want to make non-PSE machine work, turn off paging
+           in do_magic. swsusp_pg_dir should have identity mapping, so
+           it could work...  */
 	if (!cpu_has_pse)
 		return -EPERM;
 	return 0;

-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 10:07 swsusp: fix swsusp with intel-agp Pavel Machek
@ 2004-05-21 11:05 ` Herbert Xu
  2004-05-21 11:16   ` Pavel Machek
  2004-05-22  2:10   ` swsusp: fix swsusp with intel-agp Andrew Morton
  2004-05-21 23:20 ` Andrew Morton
  1 sibling, 2 replies; 22+ messages in thread
From: Herbert Xu @ 2004-05-21 11:05 UTC (permalink / raw)
  To: Pavel Machek, linux-kernel

Pavel Machek <pavel@ucw.cz> wrote:
> 
> --- tmp/linux/arch/i386/mm/init.c       2004-05-20 23:08:05.000000000 +0200
> +++ linux/arch/i386/mm/init.c   2004-05-20 23:10:50.000000000 +0200
> @@ -331,6 +331,13 @@
> void zap_low_mappings (void)
> {
>        int i;
> +
> +#ifdef CONFIG_SOFTWARE_SUSPEND

Can you please define this for CONFIG_PM_DISK as well? Alternatively,
you can do the same as you did in cpu.c and define this for CONFIG_PM.
         *
> --- tmp/linux/arch/i386/power/cpu.c     2004-05-20 23:08:05.000000000 +0200
> +++ linux/arch/i386/power/cpu.c 2004-05-20 23:10:50.000000000 +0200
> @@ -35,6 +35,10 @@
> unsigned long saved_context_esi, saved_context_edi;
> unsigned long saved_context_eflags;
> 
> +/* Special page directory for resume */
> +char __nosavedata swsusp_pg_dir[PAGE_SIZE]
> +                  __attribute__ ((aligned (PAGE_SIZE)));
> +
> extern void enable_sep_cpu(void *);

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:05 ` Herbert Xu
@ 2004-05-21 11:16   ` Pavel Machek
  2004-05-21 11:18     ` Herbert Xu
  2004-05-21 11:23     ` swsusp vs. pmdisk [was Re: swsusp: fix swsusp with intel-agp] Pavel Machek
  2004-05-22  2:10   ` swsusp: fix swsusp with intel-agp Andrew Morton
  1 sibling, 2 replies; 22+ messages in thread
From: Pavel Machek @ 2004-05-21 11:16 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-kernel

Hi!

> > --- tmp/linux/arch/i386/mm/init.c       2004-05-20 23:08:05.000000000 +0200
> > +++ linux/arch/i386/mm/init.c   2004-05-20 23:10:50.000000000 +0200
> > @@ -331,6 +331,13 @@
> > void zap_low_mappings (void)
> > {
> >        int i;
> > +
> > +#ifdef CONFIG_SOFTWARE_SUSPEND
> 
> Can you please define this for CONFIG_PM_DISK as well? Alternatively,
> you can do the same as you did in cpu.c and define this for
> CONFIG_PM.

That would need few more parts to actually do something usefull on
pmdisk, right? Lowlevel code needs to know how to switch.

								Pavel

-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:16   ` Pavel Machek
@ 2004-05-21 11:18     ` Herbert Xu
  2004-05-21 11:22       ` Herbert Xu
  2004-05-21 11:23     ` swsusp vs. pmdisk [was Re: swsusp: fix swsusp with intel-agp] Pavel Machek
  1 sibling, 1 reply; 22+ messages in thread
From: Herbert Xu @ 2004-05-21 11:18 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

On Fri, May 21, 2004 at 01:16:13PM +0200, Pavel Machek wrote:
> 
> > > --- tmp/linux/arch/i386/mm/init.c       2004-05-20 23:08:05.000000000 +0200
> > > +++ linux/arch/i386/mm/init.c   2004-05-20 23:10:50.000000000 +0200
> > > @@ -331,6 +331,13 @@
> > > void zap_low_mappings (void)
> > > {
> > >        int i;
> > > +
> > > +#ifdef CONFIG_SOFTWARE_SUSPEND
> > 
> > Can you please define this for CONFIG_PM_DISK as well? Alternatively,
> > you can do the same as you did in cpu.c and define this for
> > CONFIG_PM.
> 
> That would need few more parts to actually do something usefull on
> pmdisk, right? Lowlevel code needs to know how to switch.

Well once you do this then pmdisk.S can be easily patched to do
the same thing as swsusp.S :)
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:18     ` Herbert Xu
@ 2004-05-21 11:22       ` Herbert Xu
  2004-05-21 11:41         ` Pavel Machek
  0 siblings, 1 reply; 22+ messages in thread
From: Herbert Xu @ 2004-05-21 11:22 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

On Fri, May 21, 2004 at 09:18:28PM +1000, herbert wrote:
> On Fri, May 21, 2004 at 01:16:13PM +0200, Pavel Machek wrote:
> > 
> > > > --- tmp/linux/arch/i386/mm/init.c       2004-05-20 23:08:05.000000000 +0200
> > > > +++ linux/arch/i386/mm/init.c   2004-05-20 23:10:50.000000000 +0200
> > > > @@ -331,6 +331,13 @@
> > > > void zap_low_mappings (void)
> > > > {
> > > >        int i;
> > > > +
> > > > +#ifdef CONFIG_SOFTWARE_SUSPEND
> > > 
> > > Can you please define this for CONFIG_PM_DISK as well? Alternatively,
> > > you can do the same as you did in cpu.c and define this for
> > > CONFIG_PM.

Would you object to a patch that converted current uses of
CONFIG_SOFTWARE_SUSPEND/CONFIG_PM to a new symbol that is
turned on iff one of CONFIG_SOFTWARE_SUSPEND/CONFIG_PM_DISK
is enabled?

Perhaps we can call it CONFIG_PM_DISK_COMMON?
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* swsusp vs. pmdisk [was Re: swsusp: fix swsusp with intel-agp]
  2004-05-21 11:16   ` Pavel Machek
  2004-05-21 11:18     ` Herbert Xu
@ 2004-05-21 11:23     ` Pavel Machek
  2004-05-21 11:25       ` Herbert Xu
  1 sibling, 1 reply; 22+ messages in thread
From: Pavel Machek @ 2004-05-21 11:23 UTC (permalink / raw)
  To: Herbert Xu, Andrew Morton, Patrick Mochel; +Cc: linux-kernel

Hi!

> > > --- tmp/linux/arch/i386/mm/init.c       2004-05-20 23:08:05.000000000 +0200
> > > +++ linux/arch/i386/mm/init.c   2004-05-20 23:10:50.000000000 +0200
> > > @@ -331,6 +331,13 @@
> > > void zap_low_mappings (void)
> > > {
> > >        int i;
> > > +
> > > +#ifdef CONFIG_SOFTWARE_SUSPEND
> > 
> > Can you please define this for CONFIG_PM_DISK as well? Alternatively,
> > you can do the same as you did in cpu.c and define this for
> > CONFIG_PM.
> 
> That would need few more parts to actually do something usefull on
> pmdisk, right? Lowlevel code needs to know how to switch.

What about killing pmdisk code, instead?

Its old, its not maintained any more, and it is unneccessary duplicity
of swsusp code.

Patrick, in middle of april you claimed you'll have something "by the
end of month". Can you either start looking after your code or give up
and let me remove it?
								Pavel
-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp vs. pmdisk [was Re: swsusp: fix swsusp with intel-agp]
  2004-05-21 11:23     ` swsusp vs. pmdisk [was Re: swsusp: fix swsusp with intel-agp] Pavel Machek
@ 2004-05-21 11:25       ` Herbert Xu
  2004-05-21 11:49         ` Pavel Machek
  0 siblings, 1 reply; 22+ messages in thread
From: Herbert Xu @ 2004-05-21 11:25 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Andrew Morton, Patrick Mochel, linux-kernel

On Fri, May 21, 2004 at 01:23:06PM +0200, Pavel Machek wrote:
> 
> What about killing pmdisk code, instead?
> 
> Its old, its not maintained any more, and it is unneccessary duplicity
> of swsusp code.
> 
> Patrick, in middle of april you claimed you'll have something "by the
> end of month". Can you either start looking after your code or give up
> and let me remove it?

Well if Patrick doesn't have the time to do it, I'd like to maintain
pmdisk.  It might be a bit out-of-date, by with a bit of work, it
can easily catch up again since the underlying structure is quite nice.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:22       ` Herbert Xu
@ 2004-05-21 11:41         ` Pavel Machek
  2004-05-21 11:48           ` Herbert Xu
  2004-05-21 13:06           ` Nigel Cunningham
  0 siblings, 2 replies; 22+ messages in thread
From: Pavel Machek @ 2004-05-21 11:41 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-kernel

Hi!

> > > > > --- tmp/linux/arch/i386/mm/init.c       2004-05-20 23:08:05.000000000 +0200
> > > > > +++ linux/arch/i386/mm/init.c   2004-05-20 23:10:50.000000000 +0200
> > > > > @@ -331,6 +331,13 @@
> > > > > void zap_low_mappings (void)
> > > > > {
> > > > >        int i;
> > > > > +
> > > > > +#ifdef CONFIG_SOFTWARE_SUSPEND
> > > > 
> > > > Can you please define this for CONFIG_PM_DISK as well? Alternatively,
> > > > you can do the same as you did in cpu.c and define this for
> > > > CONFIG_PM.
> 
> Would you object to a patch that converted current uses of
> CONFIG_SOFTWARE_SUSPEND/CONFIG_PM to a new symbol that is
> turned on iff one of CONFIG_SOFTWARE_SUSPEND/CONFIG_PM_DISK
> is enabled?

I guess that open-coding #if defined() || defined() is right thing to
do for now.

Suspend2 when/if merged might not need this... This one is not really
specific to suspend-to-disk. It is specific to swsusp way of doing
things, which happens to be same as pmdisk way of doing it...
								Pavel
-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:41         ` Pavel Machek
@ 2004-05-21 11:48           ` Herbert Xu
  2004-05-21 11:51             ` Pavel Machek
  2004-05-21 13:06           ` Nigel Cunningham
  1 sibling, 1 reply; 22+ messages in thread
From: Herbert Xu @ 2004-05-21 11:48 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

On Fri, May 21, 2004 at 01:41:25PM +0200, Pavel Machek wrote:
> 
> I guess that open-coding #if defined() || defined() is right thing to
> do for now.
> 
> Suspend2 when/if merged might not need this... This one is not really
> specific to suspend-to-disk. It is specific to swsusp way of doing
> things, which happens to be same as pmdisk way of doing it...

Well that symbol would not apply to just this case.  We can also use
it for arch/i386/power/cpu.c itself.  It appears to be used solely for
the purpose of suspending to disk.
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: swsusp vs. pmdisk [was Re: swsusp: fix swsusp with intel-agp]
  2004-05-21 11:25       ` Herbert Xu
@ 2004-05-21 11:49         ` Pavel Machek
  0 siblings, 0 replies; 22+ messages in thread
From: Pavel Machek @ 2004-05-21 11:49 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Andrew Morton, Patrick Mochel, linux-kernel

Hi!

> > What about killing pmdisk code, instead?
> > 
> > Its old, its not maintained any more, and it is unneccessary duplicity
> > of swsusp code.
> > 
> > Patrick, in middle of april you claimed you'll have something "by the
> > end of month". Can you either start looking after your code or give up
> > and let me remove it?
> 
> Well if Patrick doesn't have the time to do it, I'd like to maintain
> pmdisk.  It might be a bit out-of-date, by with a bit of work, it
> can easily catch up again since the underlying structure is quite nice.

What if you instead forward-ported same cleanups to swsusp? If done in
reasonably-sized chunks, it would be very welcome.

Of course, having maintained pmdisk in kernel is *way* better than
having umaintained pmdisk in kernel. So feel free to add yourself an
entry in MAINTAINERS file...

Alternatively if you bring pmdisk up-to-date (and maintain it), I
might as well kill swsusp. But I like the name (SWap SUSPend) slightly
better than pmdisk... :-).
								Pavel
-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:48           ` Herbert Xu
@ 2004-05-21 11:51             ` Pavel Machek
  0 siblings, 0 replies; 22+ messages in thread
From: Pavel Machek @ 2004-05-21 11:51 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-kernel

Hi!

> > I guess that open-coding #if defined() || defined() is right thing to
> > do for now.
> > 
> > Suspend2 when/if merged might not need this... This one is not really
> > specific to suspend-to-disk. It is specific to swsusp way of doing
> > things, which happens to be same as pmdisk way of doing it...
> 
> Well that symbol would not apply to just this case.  We can also use
> it for arch/i386/power/cpu.c itself.  It appears to be used solely for
> the purpose of suspending to disk.

Well, all those symbols might get pretty confusing, but I guess we can
live with that.
								Pavel

-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:41         ` Pavel Machek
  2004-05-21 11:48           ` Herbert Xu
@ 2004-05-21 13:06           ` Nigel Cunningham
  2004-05-21 13:19             ` Pavel Machek
  1 sibling, 1 reply; 22+ messages in thread
From: Nigel Cunningham @ 2004-05-21 13:06 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Herbert Xu, linux-kernel

Hi.

Pavel Machek wrote:
> Suspend2 when/if merged might not need this... This one is not really

I use it too :>

Nigel

-- 
Nigel & Michelle Cunningham
C/- Westminster Presbyterian Church Belconnen
61 Templeton Street, Cook, ACT 2614.
+61 (2) 6251 7727(wk); +61 (2) 6254 0216 (home)

Evolution (n): A hypothetical process whereby infinitely improbable 
events occur
with alarming frequency, order arises from chaos, and no one is given 
credit.

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 13:19             ` Pavel Machek
@ 2004-05-21 13:18               ` Nigel Cunningham
  2004-05-21 13:26                 ` Herbert Xu
  2004-05-21 13:22               ` Herbert Xu
  1 sibling, 1 reply; 22+ messages in thread
From: Nigel Cunningham @ 2004-05-21 13:18 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Herbert Xu, linux-kernel

Hi.

Pavel Machek wrote:
> Aha, okay then. How should the option be called, then?

Since we're all using it, is there a problem with just using CONFIG_PM?

Nigel

-- 
Nigel & Michelle Cunningham
C/- Westminster Presbyterian Church Belconnen
61 Templeton Street, Cook, ACT 2614.
+61 (2) 6251 7727(wk); +61 (2) 6254 0216 (home)

Evolution (n): A hypothetical process whereby infinitely improbable 
events occur
with alarming frequency, order arises from chaos, and no one is given 
credit.

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 13:06           ` Nigel Cunningham
@ 2004-05-21 13:19             ` Pavel Machek
  2004-05-21 13:18               ` Nigel Cunningham
  2004-05-21 13:22               ` Herbert Xu
  0 siblings, 2 replies; 22+ messages in thread
From: Pavel Machek @ 2004-05-21 13:19 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: Herbert Xu, linux-kernel

Hi!

> >Suspend2 when/if merged might not need this... This one is not really
> 
> I use it too :>

Aha, okay then. How should the option be called, then?
								Pavel

-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 13:19             ` Pavel Machek
  2004-05-21 13:18               ` Nigel Cunningham
@ 2004-05-21 13:22               ` Herbert Xu
  1 sibling, 0 replies; 22+ messages in thread
From: Herbert Xu @ 2004-05-21 13:22 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Nigel Cunningham, linux-kernel

On Fri, May 21, 2004 at 03:19:16PM +0200, Pavel Machek wrote:
> 
> > >Suspend2 when/if merged might not need this... This one is not really
> > 
> > I use it too :>
> 
> Aha, okay then. How should the option be called, then?

I like PM_DISK but that's taken already.  Perhaps PM_DISK_COMMON?

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 13:18               ` Nigel Cunningham
@ 2004-05-21 13:26                 ` Herbert Xu
  0 siblings, 0 replies; 22+ messages in thread
From: Herbert Xu @ 2004-05-21 13:26 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: Pavel Machek, linux-kernel

On Fri, May 21, 2004 at 11:18:56PM +1000, Nigel Cunningham wrote:
> 
> Pavel Machek wrote:
> >Aha, okay then. How should the option be called, then?
> 
> Since we're all using it, is there a problem with just using CONFIG_PM?

Well it is possible to use CONFIG_PM without doing suspend-to-disk,
but I guess no one will notice if we just slipped it in :)
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 10:07 swsusp: fix swsusp with intel-agp Pavel Machek
  2004-05-21 11:05 ` Herbert Xu
@ 2004-05-21 23:20 ` Andrew Morton
  2004-05-23 17:54   ` Pavel Machek
  1 sibling, 1 reply; 22+ messages in thread
From: Andrew Morton @ 2004-05-21 23:20 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

Pavel Machek <pavel@ucw.cz> wrote:
>
> +#ifdef CONFIG_SOFTWARE_SUSPEND
> +	{
> +		extern char swsusp_pg_dir[PAGE_SIZE];
> +		memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
> +	}
> +#endif

Please move the declaration of swsusp_pg_dir[] to a header file where it is
visible to both the users and the definition site, then resend.  Thanks.

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 11:05 ` Herbert Xu
  2004-05-21 11:16   ` Pavel Machek
@ 2004-05-22  2:10   ` Andrew Morton
  1 sibling, 0 replies; 22+ messages in thread
From: Andrew Morton @ 2004-05-22  2:10 UTC (permalink / raw)
  To: Herbert Xu; +Cc: pavel, linux-kernel

Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> Pavel Machek <pavel@ucw.cz> wrote:
>  > 
>  > --- tmp/linux/arch/i386/mm/init.c       2004-05-20 23:08:05.000000000 +0200
>  > +++ linux/arch/i386/mm/init.c   2004-05-20 23:10:50.000000000 +0200
>  > @@ -331,6 +331,13 @@
>  > void zap_low_mappings (void)
>  > {
>  >        int i;
>  > +
>  > +#ifdef CONFIG_SOFTWARE_SUSPEND
> 
>  Can you please define this for CONFIG_PM_DISK as well? Alternatively,
>  you can do the same as you did in cpu.c and define this for CONFIG_PM.

Pleeeeeze don't remove me from Cc when replying to emails.  Thanks.

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-21 23:20 ` Andrew Morton
@ 2004-05-23 17:54   ` Pavel Machek
  2004-05-23 20:08     ` Andrew Morton
  0 siblings, 1 reply; 22+ messages in thread
From: Pavel Machek @ 2004-05-23 17:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Hi!

> >
> > +#ifdef CONFIG_SOFTWARE_SUSPEND
> > +	{
> > +		extern char swsusp_pg_dir[PAGE_SIZE];
> > +		memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
> > +	}
> > +#endif
> 
> Please move the declaration of swsusp_pg_dir[] to a header file where it is
> visible to both the users and the definition site, then resend.

Hmm, on second thought, it is accessed from one C file and once from
assembly => prototype should not be needed.

Upon popular request I made it depend on CONFIG_PM (pmdisk will need
it, too, and suspend2 wants it also). If you don't like that please
simply replace CONFIG_PM with CONFIG_SOFTWARE_SUSPEND...

								Pavel

--- clean/arch/i386/power/swsusp.S	2004-05-20 23:08:05.000000000 +0200
+++ linux/arch/i386/power/swsusp.S	2004-05-20 23:11:05.000000000 +0200
@@ -36,7 +38,7 @@
 	jmp .L1449
 	.p2align 4,,7
 .L1450:
-	movl $swapper_pg_dir-__PAGE_OFFSET,%ecx
+	movl $swsusp_pg_dir-__PAGE_OFFSET,%ecx
 	movl %ecx,%cr3
 
 	call do_magic_resume_1
--- clean/arch/i386/mm/init.c	2004-05-20 23:08:05.000000000 +0200
+++ linux/arch/i386/mm/init.c	2004-05-23 19:43:22.000000000 +0200
@@ -328,9 +328,20 @@
 #endif
 }
 
+#ifdef CONFIG_PM
+/* Swap suspend & friends need this for resume */
+char __nosavedata swsusp_pg_dir[PAGE_SIZE] 
+	__attribute__ ((aligned (PAGE_SIZE)));
+#endif
+
 void zap_low_mappings (void)
 {
 	int i;
+
+#ifdef CONFIG_PM
+	memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
+#endif
+
 	/*
 	 * Zap initial low-memory mappings.
 	 *


-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-23 17:54   ` Pavel Machek
@ 2004-05-23 20:08     ` Andrew Morton
  2004-05-23 20:24       ` Pavel Machek
  2004-05-23 21:27       ` Nigel Cunningham
  0 siblings, 2 replies; 22+ messages in thread
From: Andrew Morton @ 2004-05-23 20:08 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

Pavel Machek <pavel@suse.cz> wrote:
>
> > >
>  > > +#ifdef CONFIG_SOFTWARE_SUSPEND
>  > > +	{
>  > > +		extern char swsusp_pg_dir[PAGE_SIZE];
>  > > +		memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
>  > > +	}
>  > > +#endif
>  > 
>  > Please move the declaration of swsusp_pg_dir[] to a header file where it is
>  > visible to both the users and the definition site, then resend.
> 
>  Hmm, on second thought, it is accessed from one C file and once from
>  assembly => prototype should not be needed.
> 
>  Upon popular request I made it depend on CONFIG_PM (pmdisk will need
>  it, too, and suspend2 wants it also). If you don't like that please
>  simply replace CONFIG_PM with CONFIG_SOFTWARE_SUSPEND...

Mabe it's a sign of advancing years, but I still think that 4k is worth
saving ;)  I ended up with the below.

You say that pmdisk needs this.  I assume that means that we should also
replace swapper_pg_dir with swsusp_pg_dir in pmdisk.S?



From: Pavel Machek <pavel@suse.cz>

swsusp contained rather nasty bug where it killed machine when intel-agp or
anything else split kernel 4MB mapping.  Herbert Xu diagnosed this.  Fixed by
switching to "known good" mapping for during suspend/resume.


---

 25-akpm/arch/i386/mm/init.c      |   21 +++++++++++++++++++++
 25-akpm/arch/i386/power/swsusp.S |    2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff -puN arch/i386/mm/init.c~swsusp-fix-swsusp-with-intel-agp arch/i386/mm/init.c
--- 25/arch/i386/mm/init.c~swsusp-fix-swsusp-with-intel-agp	2004-05-23 13:01:00.497765968 -0700
+++ 25-akpm/arch/i386/mm/init.c	2004-05-23 13:03:47.195424072 -0700
@@ -327,9 +327,30 @@ static void __init pagetable_init (void)
 #endif
 }
 
+#if defined(CONFIG_PM_DISK) || defined(CONFIG_SOFTWARE_SUSPEND)
+/*
+ * Swap suspend & friends need this for resume because things like the intel-agp
+ * driver might have split up a kernel 4MB mapping.
+ */
+char __nosavedata swsusp_pg_dir[PAGE_SIZE]
+	__attribute__ ((aligned (PAGE_SIZE)));
+
+static inline void save_pg_dir(void)
+{
+	memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
+}
+#else
+static inline void save_pg_dir(void)
+{
+}
+#endif
+
 void zap_low_mappings (void)
 {
 	int i;
+
+	save_pg_dir();
+
 	/*
 	 * Zap initial low-memory mappings.
 	 *
diff -puN arch/i386/power/swsusp.S~swsusp-fix-swsusp-with-intel-agp arch/i386/power/swsusp.S
--- 25/arch/i386/power/swsusp.S~swsusp-fix-swsusp-with-intel-agp	2004-05-23 13:01:00.499765664 -0700
+++ 25-akpm/arch/i386/power/swsusp.S	2004-05-23 13:01:00.503765056 -0700
@@ -36,7 +36,7 @@ ENTRY(do_magic)
 	jmp .L1449
 	.p2align 4,,7
 .L1450:
-	movl $swapper_pg_dir-__PAGE_OFFSET,%ecx
+	movl $swsusp_pg_dir-__PAGE_OFFSET,%ecx
 	movl %ecx,%cr3
 
 	call do_magic_resume_1

_


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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-23 20:08     ` Andrew Morton
@ 2004-05-23 20:24       ` Pavel Machek
  2004-05-23 21:27       ` Nigel Cunningham
  1 sibling, 0 replies; 22+ messages in thread
From: Pavel Machek @ 2004-05-23 20:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Hi!

> > > >
> >  > > +#ifdef CONFIG_SOFTWARE_SUSPEND
> >  > > +	{
> >  > > +		extern char swsusp_pg_dir[PAGE_SIZE];
> >  > > +		memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
> >  > > +	}
> >  > > +#endif
> >  > 
> >  > Please move the declaration of swsusp_pg_dir[] to a header file where it is
> >  > visible to both the users and the definition site, then resend.
> > 
> >  Hmm, on second thought, it is accessed from one C file and once from
> >  assembly => prototype should not be needed.
> > 
> >  Upon popular request I made it depend on CONFIG_PM (pmdisk will need
> >  it, too, and suspend2 wants it also). If you don't like that please
> >  simply replace CONFIG_PM with CONFIG_SOFTWARE_SUSPEND...
> 
> Mabe it's a sign of advancing years, but I still think that 4k is worth
> saving ;)  I ended up with the below.

Ok, thanks ;-).

> You say that pmdisk needs this.  I assume that means that we should also
> replace swapper_pg_dir with swsusp_pg_dir in pmdisk.S?

Yes, that should do the trick.
								Pavel
-- 
934a471f20d6580d5aad759bf0d97ddc

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

* Re: swsusp: fix swsusp with intel-agp
  2004-05-23 20:08     ` Andrew Morton
  2004-05-23 20:24       ` Pavel Machek
@ 2004-05-23 21:27       ` Nigel Cunningham
  1 sibling, 0 replies; 22+ messages in thread
From: Nigel Cunningham @ 2004-05-23 21:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Pavel Machek, linux-kernel

Andrew Morton wrote:
> +#if defined(CONFIG_PM_DISK) || defined(CONFIG_SOFTWARE_SUSPEND)

Okay. So I'll just patch it to add || defined(CONFIG_SOFTWARE_SUSPEND2) 
for now :>

Nigel
-- 
Nigel & Michelle Cunningham
C/- Westminster Presbyterian Church Belconnen
61 Templeton Street, Cook, ACT 2614.
+61 (2) 6251 7727(wk); +61 (2) 6254 0216 (home)

Evolution (n): A hypothetical process whereby infinitely improbable 
events occur
with alarming frequency, order arises from chaos, and no one is given 
credit.

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

end of thread, other threads:[~2004-05-23 21:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-21 10:07 swsusp: fix swsusp with intel-agp Pavel Machek
2004-05-21 11:05 ` Herbert Xu
2004-05-21 11:16   ` Pavel Machek
2004-05-21 11:18     ` Herbert Xu
2004-05-21 11:22       ` Herbert Xu
2004-05-21 11:41         ` Pavel Machek
2004-05-21 11:48           ` Herbert Xu
2004-05-21 11:51             ` Pavel Machek
2004-05-21 13:06           ` Nigel Cunningham
2004-05-21 13:19             ` Pavel Machek
2004-05-21 13:18               ` Nigel Cunningham
2004-05-21 13:26                 ` Herbert Xu
2004-05-21 13:22               ` Herbert Xu
2004-05-21 11:23     ` swsusp vs. pmdisk [was Re: swsusp: fix swsusp with intel-agp] Pavel Machek
2004-05-21 11:25       ` Herbert Xu
2004-05-21 11:49         ` Pavel Machek
2004-05-22  2:10   ` swsusp: fix swsusp with intel-agp Andrew Morton
2004-05-21 23:20 ` Andrew Morton
2004-05-23 17:54   ` Pavel Machek
2004-05-23 20:08     ` Andrew Morton
2004-05-23 20:24       ` Pavel Machek
2004-05-23 21:27       ` Nigel Cunningham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).