lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 18 Apr 2011 09:51:27 +0100
From:	Ian Campbell <ijc@...lion.org.uk>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
Cc:	LKML <linux-kernel@...r.kernel.org>, Greg KH <gregkh@...e.de>,
	Kay Sievers <kay.sievers@...e.de>,
	Linux PM mailing list <linux-pm@...ts.linux-foundation.org>,
	Russell King <linux@....linux.org.uk>,
	linux-omap@...r.kernel.org, Kevin Hilman <khilman@...com>,
	linux-arm-kernel@...ts.infradead.org,
	Ben Dooks <ben-linux@...ff.org>,
	Mike Frysinger <vapier@...too.org>,
	Ralf Baechle <ralf@...ux-mips.org>,
	Hans-Christian Egtvedt <hans-christian.egtvedt@...el.com>,
	Guan Xuetao <gxt@...c.pku.edu.cn>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	linuxppc-dev@...ts.ozlabs.org, Jiri Kosina <jkosina@...e.cz>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
Subject: Re: [PATCH 2/14] PM: Add missing syscore_suspend() and
 syscore_resume() calls

On Sun, 2011-04-17 at 23:06 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@...k.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@...rix.com>

> 
> Signed-off-by: Rafael J. Wysocki <rjw@...k.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@...r.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ