mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Al Boldi <a1426z@gawab.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: swsusp hangs on headless resume-from-ram
Date: Fri, 28 Jul 2006 10:55:47 +0200	[thread overview]
Message-ID: <200607281055.47526.rjw@sisk.pl> (raw)
In-Reply-To: <200607270034.47532.a1426z@gawab.com>

On Wednesday 26 July 2006 23:34, Al Boldi wrote:
> Rafael J. Wysocki wrote:
> > On Wednesday 26 July 2006 21:06, Al Boldi wrote:
> > > swsusp is really great, most of the time.  But sometimes it hangs after
> > > coming out of STR.  I suspect it's got something to do with display
> > > access, as this problem seems hw related.  So I removed the display
> > > card, and it positively does not resume from ram on 2.6.16+.
> > >
> > > Any easy fix for this?
> >
> > I have one idea, but you'll need a patch to test.  I'll try to prepare it
> > tomorrow.
> >
> > I guess your box is an i386?
> 
> That should be assumed by default :)

I had hoped I would be able to test it somewhere, but I couldn't.  I hope
it will compile. :-)

If it does, please send me the output of dmesg after a fresh boot.

Rafael


--
 arch/i386/kernel/setup.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Index: linux-2.6.18-rc2/arch/i386/kernel/setup.c
===================================================================
--- linux-2.6.18-rc2.orig/arch/i386/kernel/setup.c	2006-07-28 10:27:44.000000000 +0200
+++ linux-2.6.18-rc2/arch/i386/kernel/setup.c	2006-07-28 10:51:33.000000000 +0200
@@ -1301,14 +1301,33 @@ void __init remapped_pgdat_init(void)
 	}
 }
 
+/* Mark pages corresponding to given address range as nosave */
+static void __init
+e820_mark_nosave_range(unsigned long start, unsigned long end)
+{
+	unsigned long pfn, max_pfn;
+
+	if (start >= end)
+		return;
+
+	printk("Nosave address range: %016lx - %016lx\n", start, end);
+	max_pfn = end >> PAGE_SHIFT;
+	for (pfn = start >> PAGE_SHIFT; pfn < max_pfn; pfn++)
+		if(pfn_valid(pfn))
+			SetPageNosave(pfn_to_page(pfn));
+}
+
 /*
  * Request address space for all standard RAM and ROM resources
  * and also for regions reported as reserved by the e820.
+ *
+ * Mark memory gaps and the reserved regions as nosave.
  */
 static void __init
 legacy_init_iomem_resources(struct resource *code_resource, struct resource *data_resource)
 {
 	int i;
+	unsigned long paddr;
 
 	probe_roms();
 	for (i = 0; i < e820.nr_map; i++) {
@@ -1344,6 +1363,21 @@ legacy_init_iomem_resources(struct resou
 #endif
 		}
 	}
+
+	paddr = (e820.map[0].addr + e820.map[0].size) & ~(PAGE_SIZE - 1);
+	for (i = 1; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+		unsigned long base;
+
+		/* Check if we have any nosave pages here */
+		base = (ei->addr + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
+		if (paddr < ei->addr)
+			e820_mark_nosave_range(paddr, base);
+
+		paddr = (ei->addr + ei->size) & ~(PAGE_SIZE - 1);
+		if (ei->type != E820_RAM)
+			e820_mark_nosave_range(base, paddr);
+	}
 }
 
 /*

  reply	other threads:[~2006-07-28  8:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-26 19:06 Al Boldi
2006-07-26 20:07 ` Rafael J. Wysocki
2006-07-26 21:34   ` Al Boldi
2006-07-28  8:55     ` Rafael J. Wysocki [this message]
2006-07-28 13:58       ` Al Boldi
2006-07-28 14:23         ` Rafael J. Wysocki
2006-07-28 18:42           ` Rafael J. Wysocki
2006-07-28 21:00             ` Al Boldi
2006-07-28 21:05               ` Rafael J. Wysocki
2006-08-01 20:59       ` Pavel Machek
2006-08-01 21:02 ` Pavel Machek
2006-08-02 13:46   ` Al Boldi
2006-08-16 12:43     ` Pavel Machek

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=200607281055.47526.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=a1426z@gawab.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome