linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Patrick Mochel <mochel@osdl.org>
Cc: torvalds@transmeta.com, kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [pm] Make software resume be called at resume
Date: Mon, 29 Sep 2003 21:42:48 +0200	[thread overview]
Message-ID: <20030929194248.GA1815@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.44.0309290955050.968-100000@localhost.localdomain>

Hi!

> > [Yes, software_suspend needs to return int and do some error
> > handling. But not today, and this is better than random bit flips.]
> 
> Random bit flips? I have no idea what you're talking about. 

If cpu does not support big pagetables, then, during resume,
pagetables are all around the memory and hardware is setting
"accessed" bits in them. Very bad stuff might happen.

> > --- clean/kernel/power/swsusp.c	2003-09-28 22:06:45.000000000 +0200
> > +++ linux/kernel/power/swsusp.c	2003-09-29 00:19:37.000000000 +0200
> > @@ -5,7 +5,10 @@
> >   * machine suspend feature using pretty near only high-level routines
> >   *
> >   * Copyright (C) 1998-2001 Gabor Kuti <seasons@fornax.hu>
> > - * Copyright (C) 1998,2001,2002 Pavel Machek <pavel@suse.cz>
> > + * Copyright (C) 1998,2001-2003 Pavel Machek <pavel@suse.cz>
> > + * Copyright (C) 2003 Patrick Mochel <mochel@osdl.org>
> 
> Please remove this. I want as little correlation between my name and 
> swsusp as possible. 

There are some comments I took from your code, and you have copyright
on them. (I plan to take more of your code.) If you want me not to add
copyright notice next time I copy your code, please say so.

> >  static void do_software_suspend(void)
> >  {
> > -	arch_prepare_suspend();
> > +	if (arch_prepare_suspend())
> > +		panic("Architecture failed to prepare\n");
> 
> For crying out loud, why? WTF is wrong with:
> 
> 
> 		printk("Architecture failed to prepare\n");
> 		return;
> 
> ? Why do that to your users? 

This is changed rather easily...

								Pavel

--- clean/kernel/power/swsusp.c	2003-09-28 22:06:45.000000000 +0200
+++ linux/kernel/power/swsusp.c	2003-09-29 21:39:21.000000000 +0200
@@ -5,7 +5,9 @@
  * machine suspend feature using pretty near only high-level routines
  *
  * Copyright (C) 1998-2001 Gabor Kuti <seasons@fornax.hu>
- * Copyright (C) 1998,2001,2002 Pavel Machek <pavel@suse.cz>
+ * Copyright (C) 1998,2001-2003 Pavel Machek <pavel@suse.cz>
+ *
+ * This file is released under the GPLv2.
  *
  * I'd like to thank the following people for their work:
  * 
@@ -681,7 +678,10 @@
 
 static void do_software_suspend(void)
 {
-	arch_prepare_suspend();
+	if (arch_prepare_suspend()) {
+		printk("%sArchitecture failed to prepare\n", name_suspend);
+		return;
+	}		
 	if (pm_prepare_console())
 		printk( "%sCan't allocate a console... proceeding\n", name_suspend);
 	if (!prepare_suspend_processes()) {
@@ -1031,12 +1031,18 @@
 	return error;
 }
 
-/*
- * Called from init kernel_thread.
- * We check if we have an image and if so we try to resume
+/**
+ *	software_resume - Resume from a saved image.
+ *
+ *	Called as a late_initcall (so all devices are discovered and 
+ *	initialized), we call swsusp to see if we have a saved image or not.
+ *	If so, we quiesce devices, then restore the saved image. We will 
+ *	return above (in pm_suspend_disk() ) if everything goes well. 
+ *	Otherwise, we fail gracefully and return to the normally 
+ *	scheduled program.
+ *
  */
-
-void software_resume(void)
+static void software_resume(void)
 {
 	if (num_online_cpus() > 1) {
 		printk(KERN_WARNING "Software Suspend has malfunctioning SMP support. Disabled :(\n");	
@@ -1075,6 +1081,8 @@
 	return;
 }
 
+late_initcall(software_resume);
+
 static int __init resume_setup(char *str)
 {
 	if (resume_status == NORESUME)



-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

      reply	other threads:[~2003-09-29 19:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-28 22:24 [pm] Make software resume be called at resume Pavel Machek
2003-09-29 16:57 ` Patrick Mochel
2003-09-29 19:42   ` Pavel Machek [this message]

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=20030929194248.GA1815@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=torvalds@transmeta.com \
    /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;
as well as URLs for NNTP newsgroup(s).