mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Pavel Machek <pavel@suse.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: swsusp: fix swsusp with intel-agp
Date: Sun, 23 May 2004 13:08:09 -0700	[thread overview]
Message-ID: <20040523130809.03ca7209.akpm@osdl.org> (raw)
In-Reply-To: <20040523175444.GE804@elf.ucw.cz>

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

_


  reply	other threads:[~2004-05-23 20:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-21 10:07 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 [this message]
2004-05-23 20:24       ` Pavel Machek
2004-05-23 21:27       ` Nigel Cunningham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040523130809.03ca7209.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®