public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	Andrew Morton <akpm@zip.com.au>
Cc: seife@suse.de, Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Nigel Cunningham <ncunningham@linuxmail.com>,
	Roland Stigge <stigge@antcom.de>,
	234976@bugs.debian.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Bug#234976: kernel-source-2.6.4: Software Suspend doesn't work
Date: Tue, 27 Apr 2004 23:52:36 +0200	[thread overview]
Message-ID: <20040427215236.GA469@elf.ucw.cz> (raw)
In-Reply-To: <20040427125402.GA16740@gondor.apana.org.au>

Hi!

> > --- tmp/linux/arch/i386/power/cpu.c	2003-09-28 22:05:30.000000000 +0200
> > +++ linux/arch/i386/power/cpu.c	2004-04-27 14:44:03.000000000 +0200
> > @@ -35,6 +35,9 @@
> >  unsigned long saved_context_esi, saved_context_edi;
> >  unsigned long saved_context_eflags;
> >  
> > +/* Special page directory for resume */
> > +char swsusp_pg_dir[PAGE_SIZE];
> > +
> 
> You forgot to mark this as nosave.

More importantly, I forgot to mark it as aligned on PAGE_SIZE. Oops
(er... double fault). Here's fixed patch, and this one should work.

Andrew, the crashes with intel-agp were not driver fault after
all. swsusp assumed 4MB pages, and intel-agp driver broke 4MB page
down, resulting in nasty crash.

Herbert's solution was to copy memory backwards, and avoid the crash
by luck (But thanks a lot for explaining me the problem!).

Non-PSE cpus are still not supported; but it should be easier when we
are running in pagedir with identity-mapped pages.

This solution copies page table at boot, where it is "known good",
still 4MB. Could you apply it?

								Pavel

--- tmp/linux/arch/i386/mm/init.c	2004-04-05 10:45:11.000000000 +0200
+++ linux/arch/i386/mm/init.c	2004-04-27 23:39:07.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	2003-09-28 22:05:30.000000000 +0200
+++ linux/arch/i386/power/cpu.c	2004-04-27 23:41:01.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	2003-09-28 22:05:30.000000000 +0200
+++ linux/arch/i386/power/swsusp.S	2004-04-27 14:41:54.000000000 +0200
@@ -29,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
--- 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

  parent reply	other threads:[~2004-04-27 21:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1B6on4-0005EW-00@gondolin.me.apana.org.au>
     [not found] ` <1080310299.2108.10.camel@atari.stigge.org>
     [not found]   ` <20040326142617.GA291@elf.ucw.cz>
     [not found]     ` <1080315725.2951.10.camel@atari.stigge.org>
     [not found]       ` <20040326155315.GD291@elf.ucw.cz>
     [not found]         ` <1080317555.12244.5.camel@atari.stigge.org>
     [not found]           ` <20040326161717.GE291@elf.ucw.cz>
     [not found]             ` <1080325072.2112.89.camel@atari.stigge.org>
2004-04-26  9:48               ` Bug#234976: kernel-source-2.6.4: Software Suspend doesn't work Herbert Xu
2004-04-26 10:40                 ` Herbert Xu
2004-04-26 11:27                   ` Nigel Cunningham
2004-04-26 12:11                     ` Herbert Xu
2004-04-26 12:15                       ` Nigel Cunningham
2004-04-26 13:46                         ` Pavel Machek
2004-04-26 20:39                           ` Nigel Cunningham
2004-04-26 13:11                     ` Pavel Machek
2004-04-27  6:56                       ` Benjamin Herrenschmidt
2004-04-27  8:56                         ` Nigel Cunningham
2004-04-27 10:21                         ` Pavel Machek
2004-04-27 10:23                           ` Herbert Xu
2004-04-27 10:26                             ` Pavel Machek
2004-04-27 12:48                             ` Pavel Machek
2004-04-27 12:54                               ` Herbert Xu
2004-04-27 13:53                                 ` Pavel Machek
2004-04-27 21:52                                 ` Pavel Machek [this message]
2004-04-27 22:58                                   ` Nigel Cunningham
2004-04-27 23:16                                     ` Pavel Machek
2004-04-27 23:16                                       ` Nigel Cunningham
2004-04-27 23:24                                         ` Benjamin Herrenschmidt
2004-04-27 23:30                                           ` Nigel Cunningham
2004-04-28  0:17                                           ` Pavel Machek
2004-04-26 13:08                 ` Pavel Machek
2004-04-27  8:02                   ` Herbert Xu
     [not found] <1E2xl-5lP-23@gated-at.bofh.it>
     [not found] ` <1E4z7-77w-13@gated-at.bofh.it>
     [not found]   ` <1Pb4h-8hZ-11@gated-at.bofh.it>
     [not found]     ` <1Pc0Y-BC-45@gated-at.bofh.it>
     [not found]       ` <1PcWn-1tE-11@gated-at.bofh.it>
     [not found]         ` <1Pf8I-3qP-31@gated-at.bofh.it>
     [not found]           ` <1PuTf-7ZO-7@gated-at.bofh.it>
     [not found]             ` <1Py1q-1ZH-23@gated-at.bofh.it>
     [not found]               ` <1Py1y-1ZH-43@gated-at.bofh.it>
     [not found]                 ` <1PAlX-3Vx-1@gated-at.bofh.it>
2004-04-27 23:30                   ` Karol Kozimor
2004-04-27 23:33                     ` Pavel Machek
2004-04-27 23:46                       ` Karol Kozimor
2004-04-28  0:56                         ` Pavel Machek
2004-04-28  9:05                           ` Karol Kozimor

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=20040427215236.GA469@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=234976@bugs.debian.org \
    --cc=akpm@zip.com.au \
    --cc=benh@kernel.crashing.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@linuxmail.com \
    --cc=seife@suse.de \
    --cc=stigge@antcom.de \
    /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