diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-06-12 07:43:08 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-06-12 07:43:08 -0400 |
commit | d715a226b0b3dae48865d05e8c36175a8f75a809 (patch) | |
tree | 996e45c4075f8e3032daeea8de7bd355fde3cc00 /drivers/base | |
parent | 589e18a973bd6bb8abd2c6d4d8a1dcf5ae1dff61 (diff) | |
parent | e8bca479c3f269ebb3a3acea5ef63314bb677060 (diff) |
Merge branch 'pm-sleep'
* pm-sleep:
PM / sleep: trace events for device PM callbacks
PM / sleep: trace events for suspend/resume
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/main.c | 30 | ||||
-rw-r--r-- | drivers/base/syscore.c | 5 |
2 files changed, 31 insertions, 4 deletions
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 | ||
14 | static LIST_HEAD(syscore_ops_list); | 15 | static LIST_HEAD(syscore_ops_list); |
15 | static DEFINE_MUTEX(syscore_ops_lock); | 16 | static 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 | } |
107 | EXPORT_SYMBOL_GPL(syscore_resume); | 112 | EXPORT_SYMBOL_GPL(syscore_resume); |
108 | #endif /* CONFIG_PM_SLEEP */ | 113 | #endif /* CONFIG_PM_SLEEP */ |