mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: LKML <linux-kernel@vger.kernel.org>, Greg KH <gregkh@suse.de>,
	Kay Sievers <kay.sievers@suse.de>,
	Linux PM mailing list <linux-pm@lists.linux-foundation.org>,
	Russell King <linux@arm.linux.org.uk>,
	linux-omap@vger.kernel.org, Kevin Hilman <khilman@ti.com>,
	linux-arm-kernel@lists.infradead.org,
	Ben Dooks <ben-linux@fluff.org>,
	Mike Frysinger <vapier@gentoo.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>,
	Guan Xuetao <gxt@mprc.pku.edu.cn>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linuxppc-dev@lists.ozlabs.org, Jiri Kosina <jkosina@suse.cz>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Subject: Re: [PATCH 2/14] PM: Add missing syscore_suspend() and syscore_resume() calls
Date: Mon, 18 Apr 2011 09:51:27 +0100	[thread overview]
Message-ID: <1303116687.5997.109.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <201104172306.49462.rjw@sisk.pl>

On Sun, 2011-04-17 at 23:06 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Device suspend/resume infrastructure is used not only by the suspend
> and hibernate code in kernel/power, but also by , APM, Xen and the
> kexec jump feature.  However, commit 40dc166cb5dddbd36aa4ad11c03915ea
> (PM / Core: Introduce struct syscore_ops for core subsystems PM)
> failed to add syscore_suspend() and syscore_resume() calls to that
> code, which generally leads to breakage when the features in question
> are used.
> 
> To fix this problem, add the missing syscore_suspend() and
> syscore_resume() calls to arch/x86/kernel/apm_32.c, kernel/kexec.c
> and drivers/xen/manage.c.

Xen bit looks ok to me:
Acked-by: Ian Campbell <ian.campbell@citrix.com>

> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
>  arch/x86/kernel/apm_32.c |    5 +++++
>  drivers/xen/manage.c     |    9 ++++++++-
>  kernel/kexec.c           |    7 +++++++
>  3 files changed, 20 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/kernel/kexec.c
> ===================================================================
> --- linux-2.6.orig/kernel/kexec.c
> +++ linux-2.6/kernel/kexec.c
> @@ -33,6 +33,7 @@
>  #include <linux/vmalloc.h>
>  #include <linux/swap.h>
>  #include <linux/kmsg_dump.h>
> +#include <linux/syscore_ops.h>
>  
>  #include <asm/page.h>
>  #include <asm/uaccess.h>
> @@ -1532,6 +1533,11 @@ int kernel_kexec(void)
>  		local_irq_disable();
>  		/* Suspend system devices */
>  		error = sysdev_suspend(PMSG_FREEZE);
> +		if (!error) {
> +			error = syscore_suspend();
> +			if (error)
> +				sysdev_resume();
> +		}
>  		if (error)
>  			goto Enable_irqs;
>  	} else
> @@ -1546,6 +1552,7 @@ int kernel_kexec(void)
>  
>  #ifdef CONFIG_KEXEC_JUMP
>  	if (kexec_image->preserve_context) {
> +		syscore_resume();
>  		sysdev_resume();
>   Enable_irqs:
>  		local_irq_enable();
> Index: linux-2.6/drivers/xen/manage.c
> ===================================================================
> --- linux-2.6.orig/drivers/xen/manage.c
> +++ linux-2.6/drivers/xen/manage.c
> @@ -8,6 +8,7 @@
>  #include <linux/sysrq.h>
>  #include <linux/stop_machine.h>
>  #include <linux/freezer.h>
> +#include <linux/syscore_ops.h>
>  
>  #include <xen/xen.h>
>  #include <xen/xenbus.h>
> @@ -70,8 +71,13 @@ static int xen_suspend(void *data)
>  	BUG_ON(!irqs_disabled());
>  
>  	err = sysdev_suspend(PMSG_FREEZE);
> +	if (!err) {
> +		err = syscore_suspend();
> +		if (err)
> +			sysdev_resume();
> +	}
>  	if (err) {
> -		printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
> +		printk(KERN_ERR "xen_suspend: system core suspend failed: %d\n",
>  			err);
>  		return err;
>  	}
> @@ -95,6 +101,7 @@ static int xen_suspend(void *data)
>  		xen_timer_resume();
>  	}
>  
> +	syscore_resume();
>  	sysdev_resume();
>  
>  	return 0;
> Index: linux-2.6/arch/x86/kernel/apm_32.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/apm_32.c
> +++ linux-2.6/arch/x86/kernel/apm_32.c
> @@ -228,6 +228,7 @@
>  #include <linux/kthread.h>
>  #include <linux/jiffies.h>
>  #include <linux/acpi.h>
> +#include <linux/syscore_ops.h>
>  
>  #include <asm/system.h>
>  #include <asm/uaccess.h>
> @@ -1238,6 +1239,7 @@ static int suspend(int vetoable)
>  
>  	local_irq_disable();
>  	sysdev_suspend(PMSG_SUSPEND);
> +	syscore_suspend();
>  
>  	local_irq_enable();
>  
> @@ -1255,6 +1257,7 @@ static int suspend(int vetoable)
>  		apm_error("suspend", err);
>  	err = (err == APM_SUCCESS) ? 0 : -EIO;
>  
> +	syscore_resume();
>  	sysdev_resume();
>  	local_irq_enable();
>  
> @@ -1280,6 +1283,7 @@ static void standby(void)
>  
>  	local_irq_disable();
>  	sysdev_suspend(PMSG_SUSPEND);
> +	syscore_suspend();
>  	local_irq_enable();
>  
>  	err = set_system_power_state(APM_STATE_STANDBY);
> @@ -1287,6 +1291,7 @@ static void standby(void)
>  		apm_error("standby", err);
>  
>  	local_irq_disable();
> +	syscore_resume();
>  	sysdev_resume();
>  	local_irq_enable();
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
Ian Campbell

Tact in audacity is knowing how far you can go without going too far.
		-- Jean Cocteau


  reply	other threads:[~2011-04-18  8:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27 23:25 [PATCH 0/7] ARM: Use syscore_ops for "core" power management Rafael J. Wysocki
2011-03-27 23:26 ` [PATCH 1/7] ARM: Use struct syscore_ops instead of sysdevs for PM in common code Rafael J. Wysocki
2011-03-27 23:27 ` [PATCH 2/7] ARM / OMAP: Use struct syscore_ops for "core" power management Rafael J. Wysocki
2011-03-28 16:18   ` Kevin Hilman
2011-03-27 23:27 ` [PATCH 3/7] ARM / Integrator: " Rafael J. Wysocki
2011-03-27 23:28 ` [PATCH 4/7] ARM / SA1100: " Rafael J. Wysocki
2011-03-27 23:29 ` [PATCH 5/7] ARM / PXA: " Rafael J. Wysocki
2011-03-27 23:29 ` [PATCH 6/7] ARM / Samsung: " Rafael J. Wysocki
2011-03-27 23:45   ` Ben Dooks
2011-03-28 19:42     ` Rafael J. Wysocki
2011-07-08 18:12     ` Rafael J. Wysocki
2011-03-27 23:30 ` [PATCH 7/7] ARM: Select CONFIG_ARCH_NO_SYSDEV_OPS Rafael J. Wysocki
2011-04-17 21:01 ` [PATCH 0/14] Remove sysdev suspend/resume and shutdown operations Rafael J. Wysocki
2011-04-17 21:05   ` [PATCH 1/14] PM: Fix error code paths executed after failing syscore_suspend() Rafael J. Wysocki
2011-04-17 21:06   ` [PATCH 2/14] PM: Add missing syscore_suspend() and syscore_resume() calls Rafael J. Wysocki
2011-04-18  8:51     ` Ian Campbell [this message]
2011-04-17 21:07   ` [PATCH 3/14] ARM: Use struct syscore_ops instead of sysdevs for PM in common code Rafael J. Wysocki
2011-04-17 21:08   ` [PATCH 4/14] ARM / OMAP: Use struct syscore_ops for "core" power management Rafael J. Wysocki
2011-04-17 21:09   ` [PATCH 5/14] ARM / Integrator: Use struct syscore_ops for core PM Rafael J. Wysocki
2011-04-17 21:10   ` [PATCH 6/14] ARM / SA1100: Use struct syscore_ops for "core" power management Rafael J. Wysocki
2011-04-17 21:10   ` [PATCH 7/14] ARM / PXA: " Rafael J. Wysocki
2011-04-17 21:11   ` [PATCH 8/14] ARM / Samsung: " Rafael J. Wysocki
2011-04-17 21:49     ` Kukjin Kim
2011-04-17 21:11   ` [PATCH 9/14] PM / Blackfin: Use struct syscore_ops instead of sysdevs for PM Rafael J. Wysocki
2011-04-18  2:34     ` Mike Frysinger
2011-04-18 21:43       ` Rafael J. Wysocki
2011-04-17 21:12   ` [PATCH 10/14] PM / MIPS: " Rafael J. Wysocki
2011-04-18 10:12     ` Ralf Baechle
2011-04-18 20:03       ` Rafael J. Wysocki
2011-04-19  3:08     ` Lars-Peter Clausen
2011-04-17 21:13   ` [PATCH 11/14] PM / AVR32: " Rafael J. Wysocki
2011-04-26 12:22     ` Hans-Christian Egtvedt
2011-04-26 17:14       ` Rafael J. Wysocki
2011-04-17 21:13   ` [PATCH 12/14] PM / UNICORE32: " Rafael J. Wysocki
2011-04-19  8:02     ` Guan Xuetao
2011-04-17 21:14   ` [PATCH 13/14] PM / PowerPC: " Rafael J. Wysocki
2011-04-17 21:15   ` [PATCH 14/14] PM: Remove sysdev suspend, resume and shutdown operations Rafael J. Wysocki
2011-04-18  6:02   ` [PATCH 0/14] Remove sysdev suspend/resume " Greg KH

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=1303116687.5997.109.camel@zakaz.uk.xensource.com \
    --to=ijc@hellion.org.uk \
    --cc=ben-linux@fluff.org \
    --cc=benh@kernel.crashing.org \
    --cc=gregkh@suse.de \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=hans-christian.egtvedt@atmel.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=jkosina@suse.cz \
    --cc=kay.sievers@suse.de \
    --cc=khilman@ti.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ralf@linux-mips.org \
    --cc=rjw@sisk.pl \
    --cc=vapier@gentoo.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®