aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/sleep.c3
-rw-r--r--drivers/base/power/main.c30
-rw-r--r--drivers/base/syscore.c5
-rw-r--r--include/trace/events/power.h84
-rw-r--r--kernel/cpu.c5
-rw-r--r--kernel/power/hibernate.c3
-rw-r--r--kernel/power/process.c3
-rw-r--r--kernel/power/suspend.c14
8 files changed, 115 insertions, 32 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index c11e3795431b..b3e3cc73ba79 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -19,6 +19,7 @@
19#include <linux/acpi.h> 19#include <linux/acpi.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <trace/events/power.h>
22 23
23#include "internal.h" 24#include "internal.h"
24#include "sleep.h" 25#include "sleep.h"
@@ -501,6 +502,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
501 502
502 ACPI_FLUSH_CPU_CACHE(); 503 ACPI_FLUSH_CPU_CACHE();
503 504
505 trace_suspend_resume(TPS("acpi_suspend"), acpi_state, true);
504 switch (acpi_state) { 506 switch (acpi_state) {
505 case ACPI_STATE_S1: 507 case ACPI_STATE_S1:
506 barrier(); 508 barrier();
@@ -516,6 +518,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
516 pr_info(PREFIX "Low-level resume complete\n"); 518 pr_info(PREFIX "Low-level resume complete\n");
517 break; 519 break;
518 } 520 }
521 trace_suspend_resume(TPS("acpi_suspend"), acpi_state, false);
519 522
520 /* This violates the spec but is required for bug compatibility. */ 523 /* This violates the spec but is required for bug compatibility. */
521 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); 524 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 343ffad59377..bf412961a934 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -214,9 +214,6 @@ static void initcall_debug_report(struct device *dev, ktime_t calltime,
214 pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), 214 pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
215 error, (unsigned long long)nsecs >> 10); 215 error, (unsigned long long)nsecs >> 10);
216 } 216 }
217
218 trace_device_pm_report_time(dev, info, nsecs, pm_verb(state.event),
219 error);
220} 217}
221 218
222/** 219/**
@@ -387,7 +384,9 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev,
387 calltime = initcall_debug_start(dev); 384 calltime = initcall_debug_start(dev);
388 385
389 pm_dev_dbg(dev, state, info); 386 pm_dev_dbg(dev, state, info);
387 trace_device_pm_callback_start(dev, info, state.event);
390 error = cb(dev); 388 error = cb(dev);
389 trace_device_pm_callback_end(dev, error);
391 suspend_report_result(cb, error); 390 suspend_report_result(cb, error);
392 391
393 initcall_debug_report(dev, calltime, error, state, info); 392 initcall_debug_report(dev, calltime, error, state, info);
@@ -545,6 +544,7 @@ static void dpm_resume_noirq(pm_message_t state)
545 struct device *dev; 544 struct device *dev;
546 ktime_t starttime = ktime_get(); 545 ktime_t starttime = ktime_get();
547 546
547 trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, true);
548 mutex_lock(&dpm_list_mtx); 548 mutex_lock(&dpm_list_mtx);
549 pm_transition = state; 549 pm_transition = state;
550 550
@@ -587,6 +587,7 @@ static void dpm_resume_noirq(pm_message_t state)
587 dpm_show_time(starttime, state, "noirq"); 587 dpm_show_time(starttime, state, "noirq");
588 resume_device_irqs(); 588 resume_device_irqs();
589 cpuidle_resume(); 589 cpuidle_resume();
590 trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, false);
590} 591}
591 592
592/** 593/**
@@ -664,6 +665,7 @@ static void dpm_resume_early(pm_message_t state)
664 struct device *dev; 665 struct device *dev;
665 ktime_t starttime = ktime_get(); 666 ktime_t starttime = ktime_get();
666 667
668 trace_suspend_resume(TPS("dpm_resume_early"), state.event, true);
667 mutex_lock(&dpm_list_mtx); 669 mutex_lock(&dpm_list_mtx);
668 pm_transition = state; 670 pm_transition = state;
669 671
@@ -703,6 +705,7 @@ static void dpm_resume_early(pm_message_t state)
703 mutex_unlock(&dpm_list_mtx); 705 mutex_unlock(&dpm_list_mtx);
704 async_synchronize_full(); 706 async_synchronize_full();
705 dpm_show_time(starttime, state, "early"); 707 dpm_show_time(starttime, state, "early");
708 trace_suspend_resume(TPS("dpm_resume_early"), state.event, false);
706} 709}
707 710
708/** 711/**
@@ -834,6 +837,7 @@ void dpm_resume(pm_message_t state)
834 struct device *dev; 837 struct device *dev;
835 ktime_t starttime = ktime_get(); 838 ktime_t starttime = ktime_get();
836 839
840 trace_suspend_resume(TPS("dpm_resume"), state.event, true);
837 might_sleep(); 841 might_sleep();
838 842
839 mutex_lock(&dpm_list_mtx); 843 mutex_lock(&dpm_list_mtx);
@@ -875,6 +879,7 @@ void dpm_resume(pm_message_t state)
875 dpm_show_time(starttime, state, NULL); 879 dpm_show_time(starttime, state, NULL);
876 880
877 cpufreq_resume(); 881 cpufreq_resume();
882 trace_suspend_resume(TPS("dpm_resume"), state.event, false);
878} 883}
879 884
880/** 885/**
@@ -913,7 +918,9 @@ static void device_complete(struct device *dev, pm_message_t state)
913 918
914 if (callback) { 919 if (callback) {
915 pm_dev_dbg(dev, state, info); 920 pm_dev_dbg(dev, state, info);
921 trace_device_pm_callback_start(dev, info, state.event);
916 callback(dev); 922 callback(dev);
923 trace_device_pm_callback_end(dev, 0);
917 } 924 }
918 925
919 device_unlock(dev); 926 device_unlock(dev);
@@ -932,6 +939,7 @@ void dpm_complete(pm_message_t state)
932{ 939{
933 struct list_head list; 940 struct list_head list;
934 941
942 trace_suspend_resume(TPS("dpm_complete"), state.event, true);
935 might_sleep(); 943 might_sleep();
936 944
937 INIT_LIST_HEAD(&list); 945 INIT_LIST_HEAD(&list);
@@ -951,6 +959,7 @@ void dpm_complete(pm_message_t state)
951 } 959 }
952 list_splice(&list, &dpm_list); 960 list_splice(&list, &dpm_list);
953 mutex_unlock(&dpm_list_mtx); 961 mutex_unlock(&dpm_list_mtx);
962 trace_suspend_resume(TPS("dpm_complete"), state.event, false);
954} 963}
955 964
956/** 965/**
@@ -1086,6 +1095,7 @@ static int dpm_suspend_noirq(pm_message_t state)
1086 ktime_t starttime = ktime_get(); 1095 ktime_t starttime = ktime_get();
1087 int error = 0; 1096 int error = 0;
1088 1097
1098 trace_suspend_resume(TPS("dpm_suspend_noirq"), state.event, true);
1089 cpuidle_pause(); 1099 cpuidle_pause();
1090 suspend_device_irqs(); 1100 suspend_device_irqs();
1091 mutex_lock(&dpm_list_mtx); 1101 mutex_lock(&dpm_list_mtx);
@@ -1126,6 +1136,7 @@ static int dpm_suspend_noirq(pm_message_t state)
1126 } else { 1136 } else {
1127 dpm_show_time(starttime, state, "noirq"); 1137 dpm_show_time(starttime, state, "noirq");
1128 } 1138 }
1139 trace_suspend_resume(TPS("dpm_suspend_noirq"), state.event, false);
1129 return error; 1140 return error;
1130} 1141}
1131 1142
@@ -1222,6 +1233,7 @@ static int dpm_suspend_late(pm_message_t state)
1222 ktime_t starttime = ktime_get(); 1233 ktime_t starttime = ktime_get();
1223 int error = 0; 1234 int error = 0;
1224 1235
1236 trace_suspend_resume(TPS("dpm_suspend_late"), state.event, true);
1225 mutex_lock(&dpm_list_mtx); 1237 mutex_lock(&dpm_list_mtx);
1226 pm_transition = state; 1238 pm_transition = state;
1227 async_error = 0; 1239 async_error = 0;
@@ -1257,6 +1269,7 @@ static int dpm_suspend_late(pm_message_t state)
1257 } else { 1269 } else {
1258 dpm_show_time(starttime, state, "late"); 1270 dpm_show_time(starttime, state, "late");
1259 } 1271 }
1272 trace_suspend_resume(TPS("dpm_suspend_late"), state.event, false);
1260 return error; 1273 return error;
1261} 1274}
1262 1275
@@ -1295,7 +1308,9 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
1295 1308
1296 calltime = initcall_debug_start(dev); 1309 calltime = initcall_debug_start(dev);
1297 1310
1311 trace_device_pm_callback_start(dev, info, state.event);
1298 error = cb(dev, state); 1312 error = cb(dev, state);
1313 trace_device_pm_callback_end(dev, error);
1299 suspend_report_result(cb, error); 1314 suspend_report_result(cb, error);
1300 1315
1301 initcall_debug_report(dev, calltime, error, state, info); 1316 initcall_debug_report(dev, calltime, error, state, info);
@@ -1461,6 +1476,7 @@ int dpm_suspend(pm_message_t state)
1461 ktime_t starttime = ktime_get(); 1476 ktime_t starttime = ktime_get();
1462 int error = 0; 1477 int error = 0;
1463 1478
1479 trace_suspend_resume(TPS("dpm_suspend"), state.event, true);
1464 might_sleep(); 1480 might_sleep();
1465 1481
1466 cpufreq_suspend(); 1482 cpufreq_suspend();
@@ -1498,6 +1514,7 @@ int dpm_suspend(pm_message_t state)
1498 dpm_save_failed_step(SUSPEND_SUSPEND); 1514 dpm_save_failed_step(SUSPEND_SUSPEND);
1499 } else 1515 } else
1500 dpm_show_time(starttime, state, NULL); 1516 dpm_show_time(starttime, state, NULL);
1517 trace_suspend_resume(TPS("dpm_suspend"), state.event, false);
1501 return error; 1518 return error;
1502} 1519}
1503 1520
@@ -1549,8 +1566,11 @@ static int device_prepare(struct device *dev, pm_message_t state)
1549 callback = dev->driver->pm->prepare; 1566 callback = dev->driver->pm->prepare;
1550 } 1567 }
1551 1568
1552 if (callback) 1569 if (callback) {
1570 trace_device_pm_callback_start(dev, info, state.event);
1553 ret = callback(dev); 1571 ret = callback(dev);
1572 trace_device_pm_callback_end(dev, ret);
1573 }
1554 1574
1555 device_unlock(dev); 1575 device_unlock(dev);
1556 1576
@@ -1582,6 +1602,7 @@ int dpm_prepare(pm_message_t state)
1582{ 1602{
1583 int error = 0; 1603 int error = 0;
1584 1604
1605 trace_suspend_resume(TPS("dpm_prepare"), state.event, true);
1585 might_sleep(); 1606 might_sleep();
1586 1607
1587 mutex_lock(&dpm_list_mtx); 1608 mutex_lock(&dpm_list_mtx);
@@ -1612,6 +1633,7 @@ int dpm_prepare(pm_message_t state)
1612 put_device(dev); 1633 put_device(dev);
1613 } 1634 }
1614 mutex_unlock(&dpm_list_mtx); 1635 mutex_unlock(&dpm_list_mtx);
1636 trace_suspend_resume(TPS("dpm_prepare"), state.event, false);
1615 return error; 1637 return error;
1616} 1638}
1617 1639
diff --git a/drivers/base/syscore.c b/drivers/base/syscore.c
index e8d11b6630ee..dbb8350ea8dc 100644
--- a/drivers/base/syscore.c
+++ b/drivers/base/syscore.c
@@ -10,6 +10,7 @@
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <trace/events/power.h>
13 14
14static LIST_HEAD(syscore_ops_list); 15static LIST_HEAD(syscore_ops_list);
15static DEFINE_MUTEX(syscore_ops_lock); 16static DEFINE_MUTEX(syscore_ops_lock);
@@ -49,6 +50,7 @@ int syscore_suspend(void)
49 struct syscore_ops *ops; 50 struct syscore_ops *ops;
50 int ret = 0; 51 int ret = 0;
51 52
53 trace_suspend_resume(TPS("syscore_suspend"), 0, true);
52 pr_debug("Checking wakeup interrupts\n"); 54 pr_debug("Checking wakeup interrupts\n");
53 55
54 /* Return error code if there are any wakeup interrupts pending. */ 56 /* Return error code if there are any wakeup interrupts pending. */
@@ -70,6 +72,7 @@ int syscore_suspend(void)
70 "Interrupts enabled after %pF\n", ops->suspend); 72 "Interrupts enabled after %pF\n", ops->suspend);
71 } 73 }
72 74
75 trace_suspend_resume(TPS("syscore_suspend"), 0, false);
73 return 0; 76 return 0;
74 77
75 err_out: 78 err_out:
@@ -92,6 +95,7 @@ void syscore_resume(void)
92{ 95{
93 struct syscore_ops *ops; 96 struct syscore_ops *ops;
94 97
98 trace_suspend_resume(TPS("syscore_resume"), 0, true);
95 WARN_ONCE(!irqs_disabled(), 99 WARN_ONCE(!irqs_disabled(),
96 "Interrupts enabled before system core resume.\n"); 100 "Interrupts enabled before system core resume.\n");
97 101
@@ -103,6 +107,7 @@ void syscore_resume(void)
103 WARN_ONCE(!irqs_disabled(), 107 WARN_ONCE(!irqs_disabled(),
104 "Interrupts enabled after %pF\n", ops->resume); 108 "Interrupts enabled after %pF\n", ops->resume);
105 } 109 }
110 trace_suspend_resume(TPS("syscore_resume"), 0, false);
106} 111}
107EXPORT_SYMBOL_GPL(syscore_resume); 112EXPORT_SYMBOL_GPL(syscore_resume);
108#endif /* CONFIG_PM_SLEEP */ 113#endif /* CONFIG_PM_SLEEP */
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 9a7e08d61258..d19840b0cac8 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -7,6 +7,9 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/pm_qos.h> 8#include <linux/pm_qos.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10#include <linux/ftrace_event.h>
11
12#define TPS(x) tracepoint_string(x)
10 13
11DECLARE_EVENT_CLASS(cpu, 14DECLARE_EVENT_CLASS(cpu,
12 15
@@ -90,6 +93,17 @@ TRACE_EVENT(pstate_sample,
90#define PWR_EVENT_EXIT -1 93#define PWR_EVENT_EXIT -1
91#endif 94#endif
92 95
96#define pm_verb_symbolic(event) \
97 __print_symbolic(event, \
98 { PM_EVENT_SUSPEND, "suspend" }, \
99 { PM_EVENT_RESUME, "resume" }, \
100 { PM_EVENT_FREEZE, "freeze" }, \
101 { PM_EVENT_QUIESCE, "quiesce" }, \
102 { PM_EVENT_HIBERNATE, "hibernate" }, \
103 { PM_EVENT_THAW, "thaw" }, \
104 { PM_EVENT_RESTORE, "restore" }, \
105 { PM_EVENT_RECOVER, "recover" })
106
93DEFINE_EVENT(cpu, cpu_frequency, 107DEFINE_EVENT(cpu, cpu_frequency,
94 108
95 TP_PROTO(unsigned int frequency, unsigned int cpu_id), 109 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
@@ -97,58 +111,76 @@ DEFINE_EVENT(cpu, cpu_frequency,
97 TP_ARGS(frequency, cpu_id) 111 TP_ARGS(frequency, cpu_id)
98); 112);
99 113
100TRACE_EVENT(machine_suspend, 114TRACE_EVENT(device_pm_callback_start,
101 115
102 TP_PROTO(unsigned int state), 116 TP_PROTO(struct device *dev, const char *pm_ops, int event),
103 117
104 TP_ARGS(state), 118 TP_ARGS(dev, pm_ops, event),
105 119
106 TP_STRUCT__entry( 120 TP_STRUCT__entry(
107 __field( u32, state ) 121 __string(device, dev_name(dev))
122 __string(driver, dev_driver_string(dev))
123 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
124 __string(pm_ops, pm_ops ? pm_ops : "none ")
125 __field(int, event)
108 ), 126 ),
109 127
110 TP_fast_assign( 128 TP_fast_assign(
111 __entry->state = state; 129 __assign_str(device, dev_name(dev));
130 __assign_str(driver, dev_driver_string(dev));
131 __assign_str(parent,
132 dev->parent ? dev_name(dev->parent) : "none");
133 __assign_str(pm_ops, pm_ops ? pm_ops : "none ");
134 __entry->event = event;
112 ), 135 ),
113 136
114 TP_printk("state=%lu", (unsigned long)__entry->state) 137 TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver),
138 __get_str(device), __get_str(parent), __get_str(pm_ops),
139 pm_verb_symbolic(__entry->event))
115); 140);
116 141
117TRACE_EVENT(device_pm_report_time, 142TRACE_EVENT(device_pm_callback_end,
118 143
119 TP_PROTO(struct device *dev, const char *pm_ops, s64 ops_time, 144 TP_PROTO(struct device *dev, int error),
120 char *pm_event_str, int error),
121 145
122 TP_ARGS(dev, pm_ops, ops_time, pm_event_str, error), 146 TP_ARGS(dev, error),
123 147
124 TP_STRUCT__entry( 148 TP_STRUCT__entry(
125 __string(device, dev_name(dev)) 149 __string(device, dev_name(dev))
126 __string(driver, dev_driver_string(dev)) 150 __string(driver, dev_driver_string(dev))
127 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
128 __string(pm_ops, pm_ops ? pm_ops : "none ")
129 __string(pm_event_str, pm_event_str)
130 __field(s64, ops_time)
131 __field(int, error) 151 __field(int, error)
132 ), 152 ),
133 153
134 TP_fast_assign( 154 TP_fast_assign(
135 const char *tmp = dev->parent ? dev_name(dev->parent) : "none";
136 const char *tmp_i = pm_ops ? pm_ops : "none ";
137
138 __assign_str(device, dev_name(dev)); 155 __assign_str(device, dev_name(dev));
139 __assign_str(driver, dev_driver_string(dev)); 156 __assign_str(driver, dev_driver_string(dev));
140 __assign_str(parent, tmp);
141 __assign_str(pm_ops, tmp_i);
142 __assign_str(pm_event_str, pm_event_str);
143 __entry->ops_time = ops_time;
144 __entry->error = error; 157 __entry->error = error;
145 ), 158 ),
146 159
147 /* ops_str has an extra space at the end */ 160 TP_printk("%s %s, err=%d",
148 TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d", 161 __get_str(driver), __get_str(device), __entry->error)
149 __get_str(driver), __get_str(device), __get_str(parent), 162);
150 __get_str(pm_event_str), __get_str(pm_ops), 163
151 __entry->ops_time, __entry->error) 164TRACE_EVENT(suspend_resume,
165
166 TP_PROTO(const char *action, int val, bool start),
167
168 TP_ARGS(action, val, start),
169
170 TP_STRUCT__entry(
171 __field(const char *, action)
172 __field(int, val)
173 __field(bool, start)
174 ),
175
176 TP_fast_assign(
177 __entry->action = action;
178 __entry->val = val;
179 __entry->start = start;
180 ),
181
182 TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
183 (__entry->start)?"begin":"end")
152); 184);
153 185
154DECLARE_EVENT_CLASS(wakeup_source, 186DECLARE_EVENT_CLASS(wakeup_source,
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 247979a1b815..759feaaa9bb0 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -20,6 +20,7 @@
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/lockdep.h> 22#include <linux/lockdep.h>
23#include <trace/events/power.h>
23 24
24#include "smpboot.h" 25#include "smpboot.h"
25 26
@@ -522,7 +523,9 @@ int disable_nonboot_cpus(void)
522 for_each_online_cpu(cpu) { 523 for_each_online_cpu(cpu) {
523 if (cpu == first_cpu) 524 if (cpu == first_cpu)
524 continue; 525 continue;
526 trace_suspend_resume(TPS("CPU_OFF"), cpu, true);
525 error = _cpu_down(cpu, 1); 527 error = _cpu_down(cpu, 1);
528 trace_suspend_resume(TPS("CPU_OFF"), cpu, false);
526 if (!error) 529 if (!error)
527 cpumask_set_cpu(cpu, frozen_cpus); 530 cpumask_set_cpu(cpu, frozen_cpus);
528 else { 531 else {
@@ -566,7 +569,9 @@ void __ref enable_nonboot_cpus(void)
566 arch_enable_nonboot_cpus_begin(); 569 arch_enable_nonboot_cpus_begin();
567 570
568 for_each_cpu(cpu, frozen_cpus) { 571 for_each_cpu(cpu, frozen_cpus) {
572 trace_suspend_resume(TPS("CPU_ON"), cpu, true);
569 error = _cpu_up(cpu, 1); 573 error = _cpu_up(cpu, 1);
574 trace_suspend_resume(TPS("CPU_ON"), cpu, false);
570 if (!error) { 575 if (!error) {
571 printk(KERN_INFO "CPU%d is up\n", cpu); 576 printk(KERN_INFO "CPU%d is up\n", cpu);
572 continue; 577 continue;
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index df88d55dc436..49e0a20fd010 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -28,6 +28,7 @@
28#include <linux/syscore_ops.h> 28#include <linux/syscore_ops.h>
29#include <linux/ctype.h> 29#include <linux/ctype.h>
30#include <linux/genhd.h> 30#include <linux/genhd.h>
31#include <trace/events/power.h>
31 32
32#include "power.h" 33#include "power.h"
33 34
@@ -292,7 +293,9 @@ static int create_image(int platform_mode)
292 293
293 in_suspend = 1; 294 in_suspend = 1;
294 save_processor_state(); 295 save_processor_state();
296 trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, true);
295 error = swsusp_arch_suspend(); 297 error = swsusp_arch_suspend();
298 trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false);
296 if (error) 299 if (error)
297 printk(KERN_ERR "PM: Error %d creating hibernation image\n", 300 printk(KERN_ERR "PM: Error %d creating hibernation image\n",
298 error); 301 error);
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 06ec8869dbf1..0ca8d83e2369 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -17,6 +17,7 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <linux/kmod.h> 19#include <linux/kmod.h>
20#include <trace/events/power.h>
20 21
21/* 22/*
22 * Timeout for stopping processes 23 * Timeout for stopping processes
@@ -175,6 +176,7 @@ void thaw_processes(void)
175 struct task_struct *g, *p; 176 struct task_struct *g, *p;
176 struct task_struct *curr = current; 177 struct task_struct *curr = current;
177 178
179 trace_suspend_resume(TPS("thaw_processes"), 0, true);
178 if (pm_freezing) 180 if (pm_freezing)
179 atomic_dec(&system_freezing_cnt); 181 atomic_dec(&system_freezing_cnt);
180 pm_freezing = false; 182 pm_freezing = false;
@@ -201,6 +203,7 @@ void thaw_processes(void)
201 203
202 schedule(); 204 schedule();
203 printk("done.\n"); 205 printk("done.\n");
206 trace_suspend_resume(TPS("thaw_processes"), 0, false);
204} 207}
205 208
206void thaw_kernel_threads(void) 209void thaw_kernel_threads(void)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 963e6d0f050b..4dd8822f732a 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -177,7 +177,9 @@ static int suspend_prepare(suspend_state_t state)
177 if (error) 177 if (error)
178 goto Finish; 178 goto Finish;
179 179
180 trace_suspend_resume(TPS("freeze_processes"), 0, true);
180 error = suspend_freeze_processes(); 181 error = suspend_freeze_processes();
182 trace_suspend_resume(TPS("freeze_processes"), 0, false);
181 if (!error) 183 if (!error)
182 return 0; 184 return 0;
183 185
@@ -240,7 +242,9 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
240 * all the devices are suspended. 242 * all the devices are suspended.
241 */ 243 */
242 if (state == PM_SUSPEND_FREEZE) { 244 if (state == PM_SUSPEND_FREEZE) {
245 trace_suspend_resume(TPS("machine_suspend"), state, true);
243 freeze_enter(); 246 freeze_enter();
247 trace_suspend_resume(TPS("machine_suspend"), state, false);
244 goto Platform_wake; 248 goto Platform_wake;
245 } 249 }
246 250
@@ -256,7 +260,11 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
256 if (!error) { 260 if (!error) {
257 *wakeup = pm_wakeup_pending(); 261 *wakeup = pm_wakeup_pending();
258 if (!(suspend_test(TEST_CORE) || *wakeup)) { 262 if (!(suspend_test(TEST_CORE) || *wakeup)) {
263 trace_suspend_resume(TPS("machine_suspend"),
264 state, true);
259 error = suspend_ops->enter(state); 265 error = suspend_ops->enter(state);
266 trace_suspend_resume(TPS("machine_suspend"),
267 state, false);
260 events_check_enabled = false; 268 events_check_enabled = false;
261 } 269 }
262 syscore_resume(); 270 syscore_resume();
@@ -294,7 +302,6 @@ int suspend_devices_and_enter(suspend_state_t state)
294 if (need_suspend_ops(state) && !suspend_ops) 302 if (need_suspend_ops(state) && !suspend_ops)
295 return -ENOSYS; 303 return -ENOSYS;
296 304
297 trace_machine_suspend(state);
298 if (need_suspend_ops(state) && suspend_ops->begin) { 305 if (need_suspend_ops(state) && suspend_ops->begin) {
299 error = suspend_ops->begin(state); 306 error = suspend_ops->begin(state);
300 if (error) 307 if (error)
@@ -331,7 +338,6 @@ int suspend_devices_and_enter(suspend_state_t state)
331 else if (state == PM_SUSPEND_FREEZE && freeze_ops->end) 338 else if (state == PM_SUSPEND_FREEZE && freeze_ops->end)
332 freeze_ops->end(); 339 freeze_ops->end();
333 340
334 trace_machine_suspend(PWR_EVENT_EXIT);
335 return error; 341 return error;
336 342
337 Recover_platform: 343 Recover_platform:
@@ -365,6 +371,7 @@ static int enter_state(suspend_state_t state)
365{ 371{
366 int error; 372 int error;
367 373
374 trace_suspend_resume(TPS("suspend_enter"), state, true);
368 if (state == PM_SUSPEND_FREEZE) { 375 if (state == PM_SUSPEND_FREEZE) {
369#ifdef CONFIG_PM_DEBUG 376#ifdef CONFIG_PM_DEBUG
370 if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) { 377 if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
@@ -382,9 +389,11 @@ static int enter_state(suspend_state_t state)
382 if (state == PM_SUSPEND_FREEZE) 389 if (state == PM_SUSPEND_FREEZE)
383 freeze_begin(); 390 freeze_begin();
384 391
392 trace_suspend_resume(TPS("sync_filesystems"), 0, true);
385 printk(KERN_INFO "PM: Syncing filesystems ... "); 393 printk(KERN_INFO "PM: Syncing filesystems ... ");
386 sys_sync(); 394 sys_sync();
387 printk("done.\n"); 395 printk("done.\n");
396 trace_suspend_resume(TPS("sync_filesystems"), 0, false);
388 397
389 pr_debug("PM: Preparing system for %s sleep\n", pm_states[state].label); 398 pr_debug("PM: Preparing system for %s sleep\n", pm_states[state].label);
390 error = suspend_prepare(state); 399 error = suspend_prepare(state);
@@ -394,6 +403,7 @@ static int enter_state(suspend_state_t state)
394 if (suspend_test(TEST_FREEZER)) 403 if (suspend_test(TEST_FREEZER))
395 goto Finish; 404 goto Finish;
396 405
406 trace_suspend_resume(TPS("suspend_enter"), state, false);
397 pr_debug("PM: Entering %s sleep\n", pm_states[state].label); 407 pr_debug("PM: Entering %s sleep\n", pm_states[state].label);
398 pm_restrict_gfp_mask(); 408 pm_restrict_gfp_mask();
399 error = suspend_devices_and_enter(state); 409 error = suspend_devices_and_enter(state);