Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be770021 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge back earlier suspend/hibernate material for v4.1.

parents e5e02de0 f321c9cb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3462,6 +3462,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
			improve throughput, but will also increase the
			amount of memory reserved for use by the client.

	suspend.pm_test_delay=
			[SUSPEND]
			Sets the number of seconds to remain in a suspend test
			mode before resuming the system (see
			/sys/power/pm_test). Only available when CONFIG_PM_DEBUG
			is set. Default value is 5.

	swapaccount=[0|1]
			[KNL] Enable accounting of swap in memory resource
			controller if no parameter or 1 is given or disable
+6 −4
Original line number Diff line number Diff line
@@ -75,12 +75,14 @@ you should do the following:
# echo platform > /sys/power/disk
# echo disk > /sys/power/state

Then, the kernel will try to freeze processes, suspend devices, wait 5 seconds,
resume devices and thaw processes.  If "platform" is written to
Then, the kernel will try to freeze processes, suspend devices, wait a few
seconds (5 by default, but configurable by the suspend.pm_test_delay module
parameter), resume devices and thaw processes.  If "platform" is written to
/sys/power/pm_test , then after suspending devices the kernel will additionally
invoke the global control methods (eg. ACPI global control methods) used to
prepare the platform firmware for hibernation.  Next, it will wait 5 seconds and
invoke the platform (eg. ACPI) global methods used to cancel hibernation etc.
prepare the platform firmware for hibernation.  Next, it will wait a
configurable number of seconds and invoke the platform (eg. ACPI) global
methods used to cancel hibernation etc.

Writing "none" to /sys/power/pm_test causes the kernel to switch to the normal
hibernation/suspend operations.  Also, when open for reading, /sys/power/pm_test
+6 −4
Original line number Diff line number Diff line
#ifndef _ASM_X86_RESUME_TRACE_H
#define _ASM_X86_RESUME_TRACE_H
#ifndef _ASM_X86_PM_TRACE_H
#define _ASM_X86_PM_TRACE_H

#include <asm/asm.h>

@@ -14,8 +14,10 @@ do { \
			     ".previous"			\
			     :"=r" (tracedata)			\
			     : "i" (__LINE__), "i" (__FILE__));	\
		generate_resume_trace(tracedata, user);		\
		generate_pm_trace(tracedata, user);		\
	}							\
} while (0)

#endif /* _ASM_X86_RESUME_TRACE_H */
#define TRACE_SUSPEND(user)	TRACE_RESUME(user)

#endif /* _ASM_X86_PM_TRACE_H */
+16 −4
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/resume-trace.h>
#include <linux/pm-trace.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/async.h>
@@ -1017,6 +1017,9 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
	char *info = NULL;
	int error = 0;

	TRACE_DEVICE(dev);
	TRACE_SUSPEND(0);

	if (async_error)
		goto Complete;

@@ -1057,6 +1060,7 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a

Complete:
	complete_all(&dev->power.completion);
	TRACE_SUSPEND(error);
	return error;
}

@@ -1078,7 +1082,7 @@ static int device_suspend_noirq(struct device *dev)
{
	reinit_completion(&dev->power.completion);

	if (pm_async_enabled && dev->power.async_suspend) {
	if (is_async(dev)) {
		get_device(dev);
		async_schedule(async_suspend_noirq, dev);
		return 0;
@@ -1157,6 +1161,9 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
	char *info = NULL;
	int error = 0;

	TRACE_DEVICE(dev);
	TRACE_SUSPEND(0);

	__pm_runtime_disable(dev, false);

	if (async_error)
@@ -1198,6 +1205,7 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
		async_error = error;

Complete:
	TRACE_SUSPEND(error);
	complete_all(&dev->power.completion);
	return error;
}
@@ -1219,7 +1227,7 @@ static int device_suspend_late(struct device *dev)
{
	reinit_completion(&dev->power.completion);

	if (pm_async_enabled && dev->power.async_suspend) {
	if (is_async(dev)) {
		get_device(dev);
		async_schedule(async_suspend_late, dev);
		return 0;
@@ -1338,6 +1346,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
	int error = 0;
	DECLARE_DPM_WATCHDOG_ON_STACK(wd);

	TRACE_DEVICE(dev);
	TRACE_SUSPEND(0);

	dpm_wait_for_children(dev, async);

	if (async_error)
@@ -1444,6 +1455,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
	if (error)
		async_error = error;

	TRACE_SUSPEND(error);
	return error;
}

@@ -1465,7 +1477,7 @@ static int device_suspend(struct device *dev)
{
	reinit_completion(&dev->power.completion);

	if (pm_async_enabled && dev->power.async_suspend) {
	if (is_async(dev)) {
		get_device(dev);
		async_schedule(async_suspend, dev);
		return 0;
+3 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * devices may be working.
 */

#include <linux/resume-trace.h>
#include <linux/pm-trace.h>
#include <linux/export.h>
#include <linux/rtc.h>

@@ -154,7 +154,7 @@ EXPORT_SYMBOL(set_trace_device);
 * it's not any guarantee, but it's a high _likelihood_ that
 * the match is valid).
 */
void generate_resume_trace(const void *tracedata, unsigned int user)
void generate_pm_trace(const void *tracedata, unsigned int user)
{
	unsigned short lineno = *(unsigned short *)tracedata;
	const char *file = *(const char **)(tracedata + 2);
@@ -164,7 +164,7 @@ void generate_resume_trace(const void *tracedata, unsigned int user)
	file_hash_value = hash_string(lineno, file, FILEHASH);
	set_magic_time(user_hash_value, file_hash_value, dev_hash_value);
}
EXPORT_SYMBOL(generate_resume_trace);
EXPORT_SYMBOL(generate_pm_trace);

extern char __tracedata_start, __tracedata_end;
static int show_file_hash(unsigned int value)
Loading