mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@ucw.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] swsusp: Disable nonboot CPUs before entering platform suspend
Date: Fri, 9 Mar 2007 22:24:19 +0100	[thread overview]
Message-ID: <200703092224.20432.rjw@sisk.pl> (raw)
In-Reply-To: <20070309210746.GA6374@ucw.cz>

On Friday, 9 March 2007 22:07, Pavel Machek wrote:
> Hi!
> 
> > > > > > Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
> > > > > > ===================================================================
> > > > > > --- linux-2.6.21-rc2-mm2.orig/kernel/power/disk.c
> > > > > > +++ linux-2.6.21-rc2-mm2/kernel/power/disk.c
> > > > > > @@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
> > > > > >  	switch(mode) {
> > > > > >  	case PM_DISK_PLATFORM:
> > > > > >  		if (pm_ops && pm_ops->enter) {
> > > > > > +			disable_nonboot_cpus();
> > > > > >  			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> > > > > >  			pm_ops->enter(PM_SUSPEND_DISK);
> > > > > >  			break;
> > > > > 
> > > > > ...so, if pm_ops is non-null, power_down does nonboot cpu disabling,
> > > > > otherwise we proceed with cpus enabled?
> > > > > 
> > > > > That looks ugly.
> > > > > 
> > > > > Is the warning bogus?
> > > > 
> > > > Well, maybe.  I'm not sure.
> > > > 
> > > > > Or maybe we should *always* disable nonboot cpus in powerdown path?
> > > > 
> > > > I think we should do that.
> > > 
> > > That would be acceptable.
> > > 
> > > > > > Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
> > > > > > ===================================================================
> > > > > > --- linux-2.6.21-rc2-mm2.orig/kernel/power/user.c
> > > > > > +++ linux-2.6.21-rc2-mm2/kernel/power/user.c
> > > > > > @@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
> > > > > >  
> > > > > >  		case PMOPS_ENTER:
> > > > > >  			if (data->platform_suspend) {
> > > > > > +				disable_nonboot_cpus();
> > > > > >  				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> > > > > >  				error = pm_ops->enter(PM_SUSPEND_DISK);
> > > > > > -				error = 0;
> > > > > >  			}
> > > > > >  			break;
> > > > > 
> > > > > Foe an userland application, disabling cpus during pmops_enter is at
> > > > > least surprising.......
> > > > 
> > > > Yes, but this is not a usual ioctl().  OTOH, we can call enable_nonboot_cpus()
> > > > if pm_ops->enter(PM_SUSPEND_DISK) returns an error (otherwise it souldn't
> > > > return at all, no?).
> > > 
> > > Ok.
> > 
> > Well, does the appended patch look better?
> 
> Yes.
> 
> > ---
> >  kernel/power/disk.c |    1 +
> >  kernel/power/user.c |    3 ++-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > Index: linux-2.6.21-rc3/kernel/power/disk.c
> > ===================================================================
> > --- linux-2.6.21-rc3.orig/kernel/power/disk.c
> > +++ linux-2.6.21-rc3/kernel/power/disk.c
> > @@ -58,6 +58,7 @@ static inline int platform_prepare(void)
> >  
> >  static void power_down(suspend_disk_method_t mode)
> >  {
> > +	disable_nonboot_cpus();
> >  	switch(mode) {
> >  	case PM_DISK_PLATFORM:
> >  		if (pm_ops && pm_ops->enter) {
> > Index: linux-2.6.21-rc3/kernel/power/user.c
> > ===================================================================
> > --- linux-2.6.21-rc3.orig/kernel/power/user.c
> > +++ linux-2.6.21-rc3/kernel/power/user.c
> > @@ -402,9 +402,10 @@ static int snapshot_ioctl(struct inode *
> >  
> >  		case PMOPS_ENTER:
> >  			if (data->platform_suspend) {
> > +				disable_nonboot_cpus();
> >  				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> >  				error = pm_ops->enter(PM_SUSPEND_DISK);
> > -				error = 0;
> > +				enable_nonboot_cpus();
> 
> Why did we discard return code in previous versions? Do we still want
> to do that?

I think it was a mistake.

Rafael

  reply	other threads:[~2007-03-09 21:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07 19:44 Rafael J. Wysocki
2007-03-07 21:07 ` Pavel Machek
2007-03-09  7:58   ` Rafael J. Wysocki
2007-03-09  8:54     ` Pavel Machek
2007-03-09 20:07       ` Rafael J. Wysocki
2007-03-09 21:07         ` Pavel Machek
2007-03-09 21:24           ` Rafael J. Wysocki [this message]
2007-03-09 22:13             ` Pavel Machek
2007-03-09 22:34               ` Rafael J. Wysocki
2007-03-09 22:48                 ` Pavel Machek
2007-03-09 12:29   ` Heiko Carstens
2007-03-09 19:39     ` Rafael J. Wysocki
2007-03-09 22:10     ` Pavel Machek
2007-03-07 21:16 ` Andrew Morton
2007-03-07 22:14   ` Rafael J. Wysocki
2007-03-07 22:19     ` Pavel Machek
2007-03-07 23:14       ` Rafael J. Wysocki
2007-03-07 22:49     ` Andrew Morton
2007-03-07 23:13       ` Rafael J. Wysocki
2007-03-08  0:20         ` Dave Jones
2007-03-08  0:48           ` Rafael J. Wysocki
2007-03-09  1:11         ` Len Brown
2007-03-09  7:11           ` Rafael J. Wysocki

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=200703092224.20432.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

Powered by JetHome