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]
Message-ID: <Pine.LNX.4.44L0.1103092224480.3620-100000@netrider.rowland.org>
Date:	Wed, 9 Mar 2011 22:33:17 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
cc:	LKML <linux-kernel@...r.kernel.org>, Greg KH <gregkh@...e.de>,
	Jesse Barnes <jbarnes@...tuousgeek.org>, <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Kay Sievers <kay.sievers@...e.de>,
	Linux PM mailing list <linux-pm@...ts.linux-foundation.org>,
	<tglx@...utronix.de>
Subject: Re: [linux-pm] [RFC][PATCH 1/2] Introduce struct syscore_ops and
 related functionality

On Thu, 10 Mar 2011, Rafael J. Wysocki wrote:

> Some subsystems need to carry out suspend/resume and shutdown
> operations with one CPU on-line and interrupts disabled.  The only
> way to register such operations is to define a sysdev class and
> a sysdev specifically for this purpose which is cumbersome and
> inefficient.  Moreover, the arguments taken by sysdev suspend,
> resume and shutdown callbacks are practically never necessary.
> 
> For this reason, introduce a simpler interface allowing subsystems
> to register operations to be executed very late during system suspend
> and shutdown and very early during resume in the form of
> strcut syscore_ops objects.

...

> Index: linux-2.6/drivers/base/syscore.c
> ===================================================================
> --- /dev/null
> +++ linux-2.6/drivers/base/syscore.c

It's true that the existing sys.c file lies in drivers/base; this is
presumably because it handles a bunch of class-related registration
stuff.  Now you're getting rid of all that, leaving just the
power-related operations, so doesn't it make more sense to put this
file in drivers/base/power?

> +/**
> + * syscore_suspend - Execute all the registered system core suspend callbacks.
> + *
> + * This function is executed with one CPU on-line and disabled interrupts.
> + */
> +int syscore_suspend(void)
> +{
> +	struct syscore_ops *ops;
> +
> +	list_for_each_entry_reverse(ops, &syscore_ops_list, node)
> +		if (ops->suspend) {
> +			int ret = ops->suspend();
> +			if (ret) {
> +				pr_err("PM: System core suspend callback "
> +					"%pF failed.\n", ops->suspend);
> +				return ret;

If an error occurs, you need to go back and resume all the things that
were suspended.  At least, that's what the code in sysdev_suspend does.

> +			}
> +		}
> +
> +	return 0;
> +}

Alan Stern

--
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