linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Mochel <mochel@osdl.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <ncunningham@clear.net.nz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: SWSUSP Discontiguous pagedir patch
Date: Mon, 10 Mar 2003 10:49:01 -0600 (CST)	[thread overview]
Message-ID: <Pine.LNX.4.33.0303101012230.1002-100000@localhost.localdomain> (raw)
In-Reply-To: <20030307202759.GA2447@elf.ucw.cz>


> But your solution would also only support *one* suspend partition,
> right? (And patches for using more than one swap partition are
> available for 2.4.X; I don't like them due to added complexity).

Having a dedicated partition has an advantage in just that - it's 
dedicated to saving system state. Users must consciously create it, and 
must make it as big as the size of memory they have (or will have). Plus, 
it's not tied to the amount of memory being used when you suspend. 

Swap space has a specific purpose, I see it as a detriment to overload its 
intended usage. Of couse, that's just my opinion, and I don't have code to 
back it up. 

> > - Not resetting swap signature if a resume failed. 
> 
> Can be fixed in userland. Add option -s that for mkswap that fixes
> signature only if it was overwritten by suspend, and add mkswap -s
> /swap/partiton in your init scripts.

That's wrong, IMO. If the kernel modifies it, it should reset it. You 
shouldn't impose extra burden on the users because your code failed. 
Besides, it's fixed anyway. 

> > - Almost complete lack of a recovery path if anything failed (i.e. trying 
> >   to back out of what has happened, instead of calling BUG() or
> > panic()).
> 
> Those BUGs / panics should be impossible to trigger. [And this has
> nothing to do with fact we suspend-to-swap].

[ I know these are not suspend-to-swap specific; sorry for implying that.]

If they're really impossible to trigger, then they shouldn't be there at 
all. If you can recover from them, then you should, instead of giving up. 
Besides, a lot of them were completely bogus things like

	BUG_ON(sizeof(foo) != sizeof(bar))

Which are known at compile time, but were buried in the code to read/write 
the data, and only convoluted the code even more. 

> > - Function names like do_magic() and friends. 
> 
> It is pretty magical operation, so you are at least warned. [And this has
> nothing to do with fact we suspend-to-swap].

IMO, warnings should be conveyed in comments, not in cryptic function 
names. Besides, there is nothing magical about it, unless that sequence of 
instructions actually does make your computer glow, levitate, or turn into 
a mermaid. In which case, I would like to know where I can find one. ;)

Seriously, you described below what it does, which helps a lot more than 
anything named 'magic'. 

> > The general problems that I see with the solution are:
> > 
> > - It simply won't work if you're low on swap or memory. 
> 
> Your solution will not work with too small suspend partition
> too. Being low on memory... You'd have to have > 50% of your memory
> allocated by kernel for swsusp to fail. I do not think it can be
> sanely done other way. [Having separate disk drivers just for suspend
> is *not* sane.]
> 
> > - It won't work if you're swap is not persistant across reboots. 
> 
> Your solution will not work if your suspend partition is not
> persistant across reboots. AND WHAT?
> 
> > - It won't work if you don't use swap. 
> 
> Your solution will not work if your suspend partition is not there.

I didn't mean to sound like a hypocrit, I apologize. The advantage of 
using a dedicated partition over swap is that in order to create the 
partition, the user must make a conscious decision to do so. 

There are parameters that can be enforced when making the partition, like 
the size and its existence on a persistant medium. These can be enforced 
by a user making a swap partition, but it places extra burden on the user. 


> > I've created a registration mechanism for PM 'drivers', and a way for
> > users to select which driver they want to use for the different PM states.  
> > In the patch, swsusp is just another driver. It can coexist with ACPI or
> > APM (theoretically) just fine, without requiring a kernel rebuild or
> > reboot.
> 
> I believe it can coexist with ACPI and APM already just okay. You can
> echo 4b to /proc/acpi/sleep to trigger S4bios.
> 
> > This also involves a generic framework for doing system-wide power 
> > management. In this, I've begun extracting bits from swsusp that are 
> > useful for any PM sequence. My goal is to reduce swsusp to just a small 
> > layer that writes/reads the saved pages from swap. The rest of the 
> > sequence, including memory and device handling, happens in generic
> > code. 
> 
> So you don't really want to create separate "suspend partition"? Good.

Sorry, the patch included a few distinct things, and I should have made it
a bit more clear. In includes:

- A generic PM framework which PM drivers can register with. 

Users can specificy which handler they wish to use for different states, 
based on their preference or the capabilities of their systems. 

They can also use one mechanism for entering power states: 
/sys/power/power_state, instead of relying different mechanisms for 
different PM drivers (/proc/acpi/sleep vs. apm(1) vs. sys_reboot()). 

- Generic sequence for entering sleep states, in drivers/power/main.c

- Clean up of swsusp.

- Conversion of swsusp and ACPI to register with the PM model.

- Extraction of swsusp-specific features into the generic PM framework, so 
  they can be shared with everyone. 


In the long run, I'd like to develop a solution using a dedicated 
partition. But, that wouldn't necessarily obviate the use of swsusp. It 
would coexist alongside it. 

> > I understand you may not a rewrite of swsusp (regardless of how much
> > cleaner the code is), and I respect that. I'm completely willing to leave
> > kernel/suspend.c intact, and let you work in the integration into the
> > generic PM model, and/or simply rename the new code something like
> > swsusp2, swsusp-XP, or swsusp-pat. ;)
> 
> So you want to develop swsusp-pat that will suspend to partition,
> allow another kernel version, and you think you can suspend when 90%
> of your memory is kmalloc()-ed? Do you agree that separate disk
> drivers for suspend is bad idea?

Yes.


	-pat


  parent reply	other threads:[~2003-03-10 17:03 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1045784829.3821.10.camel@laptop-linux.cunninghams>
     [not found] ` <20030223223757.GA120@elf.ucw.cz>
     [not found]   ` <1046136752.1784.15.camel@laptop-linux.cunninghams>
     [not found]     ` <20030227132024.GB27084@atrey.karlin.mff.cuni.cz>
2003-02-27 18:42       ` SWSUSP Discontiguous pagedirs Nigel Cunningham
2003-03-01  4:22       ` SWSUSP Discontiguous pagedir patch Nigel Cunningham
2003-03-02 23:55         ` Patrick Mochel
2003-03-03  2:06           ` Nigel Cunningham
2003-03-03  2:31           ` Nigel Cunningham
2003-03-03 12:30           ` Pavel Machek
2003-03-04 20:36             ` Patrick Mochel
2003-03-05 20:50               ` Pavel Machek
2003-03-05 21:52                 ` Linux vs Windows temperature anomaly Jonathan Lundell
2003-03-05 23:11                   ` Herman Oosthuysen
2003-03-05 23:38                     ` Con Kolivas
2003-03-05 23:50                       ` Russell King
2003-03-06  0:29                         ` Ed Sweetman
2003-03-06  0:47                           ` Trever L. Adams
2003-03-06  9:45                             ` Russell King
2003-03-06  1:58                           ` Jonathan Lundell
2003-03-06  7:18                       ` Corvus Corax
2003-03-06  7:57                         ` Ed Sweetman
2003-03-06  8:18                           ` Corvus Corax
2003-03-06  8:58                             ` Ed Sweetman
2003-03-06 15:41                               ` Jesse Pollard
2003-03-06 14:27                         ` Jesse Pollard
2003-03-06  2:57                   ` David Rees
2003-03-06  6:12                   ` Matthias Schniedermeyer
2003-03-06 16:07                     ` Jonathan Lundell
2003-03-07  0:40                   ` Horst von Brand
2003-03-05 18:02           ` SWSUSP Discontiguous pagedir patch Pavel Machek
2003-03-07 17:14             ` Patrick Mochel
2003-03-07 20:27               ` Pavel Machek
2003-03-09 19:39                 ` Benjamin Herrenschmidt
2003-03-09 20:12                   ` Pavel Machek
2003-03-10 16:49                 ` Patrick Mochel [this message]
2003-03-10 19:23                   ` Pavel Machek
2003-03-10 19:05                     ` Patrick Mochel
2003-03-10 22:17                     ` Nigel Cunningham
2003-03-10 23:20                       ` Pavel Machek
2003-03-07 20:36               ` Pavel Machek
2003-03-10 16:51                 ` Patrick Mochel
2003-03-10 19:12                   ` Pavel Machek
2003-03-10 18:59                     ` Patrick Mochel
2003-03-07 20:41               ` 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=Pine.LNX.4.33.0303101012230.1002-100000@localhost.localdomain \
    --to=mochel@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@clear.net.nz \
    --cc=pavel@ucw.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;
as well as URLs for NNTP newsgroup(s).