mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Patrick Mochel <mochel@digitalimplant.org>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@zip.com.au>
Subject: Re: [0/25] Merge pmdisk and swsusp
Date: Fri, 6 Aug 2004 21:43:52 +0200	[thread overview]
Message-ID: <20040806194352.GK3048@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.50.0408012220160.8159-100000@monsoon.he.net>

Hi!

> > * if machine halt fails, it is very dangerous to continue.
> >
> > diff -ur linux.middle/kernel/power/disk.c linux/kernel/power/disk.c
> > --- linux.middle/kernel/power/disk.c	2004-07-19 08:58:08.000000000 -0700
> > +++ linux/kernel/power/disk.c	2004-07-19 15:00:16.000000000 -0700
> > @@ -63,6 +63,9 @@
> >  		break;
> >  	}
> >  	machine_halt();
> > +	/* Valid image is on the disk, if we continue we risk serious data corruption
> > +	   after resume. */
> > +	while(1);
> >  	device_power_up();
> >  	local_irq_restore(flags);
> >  	return 0;
> 
> This is nasty. We have to fail gracefully, ideally without expecting user
> input.
> 
> Adding 'while(1)' will cause the CPU to enter a busy loop, artificially
> increasing the power consumption of the system, which would be counter-
> productive in a system that was configured to suspend when the battery was
> low.

> We need to at least print a message specifying what happened and
> instructing them to reboot. It's dorky, but over time, all every system
> should eventually be fixed to either enter a low-power mode or shut down
> properly.

Ok, it was a "too hot hotfix". Your solution is better (but see below).

> Perhaps we could also fill in machine_halt(), which the patch below also
> does.

Good.

> > * copy_page() is dangerous. This is actually my fault.
> 
> Why is copy_page() dangerous? Shouldn't it be fixed if that is the
> case?

copy_page sometimes changes struct task_struct, does copy, changes it
back. That makes it bad choice for copying task_structs,
unfortunately. Do you want me to retransmit the patch?

> ===== kernel/power/disk.c 1.16 vs edited =====
> --- 1.16/kernel/power/disk.c	2004-08-01 20:36:39 -07:00
> +++ edited/kernel/power/disk.c	2004-08-01 22:38:19 -07:00
> @@ -59,6 +59,7 @@
>  		machine_restart(NULL);
>  		break;
>  	}
> +	printk(KERN_EMERG "Suspend-to-disk succeeded, but power-down failed. Please reboot.\n");
>  	machine_halt();
>  	device_power_up();
>  	local_irq_restore(flags);

If i386 got it wrong, it is possible that other architectures get it
wrong, too. Fixing i386 is good, but we should not risk continuing
machine with valid image on disk.

I guess "device_power_up / local_irq_restore" should be replaced with
BUG() or while(1)?

								Pavel
-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

  reply	other threads:[~2004-08-06 19:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-17 22:34 Patrick Mochel
2004-07-18 22:04 ` Pavel Machek
2004-07-18 22:04   ` Nigel Cunningham
2004-07-19  1:24   ` Andrew Morton
2004-07-18 22:27 ` Pavel Machek
2004-08-02  5:13   ` Patrick Mochel
2004-07-20 16:46 ` Pavel Machek
2004-07-20 19:28   ` sam
2004-07-20 17:41     ` Dmitry Torokhov
2004-07-20 19:21       ` Pavel Machek
2004-08-02  5:42   ` Patrick Mochel
2004-08-06 19:43     ` Pavel Machek [this message]
2004-07-27  7:17 ` Felipe Alfaro Solana

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=20040806194352.GK3048@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@digitalimplant.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

all inboxes | Powered by JetHome®