linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/1] PM: sleep: Expose last succeeded resumed timestamp in sysfs
@ 2023-11-27 10:38 Masami Hiramatsu (Google)
  2023-11-27 10:38 ` [PATCH v5] " Masami Hiramatsu (Google)
  0 siblings, 1 reply; 8+ messages in thread
From: Masami Hiramatsu (Google) @ 2023-11-27 10:38 UTC (permalink / raw)
  To: Rafael J . Wysocki, Pavel Machek, Len Brown, Randy Dunlap
  Cc: suleiman, briannorris, Masami Hiramatsu, linux-kernel, linux-pm

Hi,

Here is the 5th version of the patch to expose last succeeded resumed
timestamp in sysfs as /sys/power/suspend_stats/last_success_resume_time.
This version is just updated for v6.7-rc3.

This allows us to find when the kernel resume process successfully done
in the sysfs in MONOTONIC clock. Thus we can measure the time taken by
the user space resume process at any point in time.

This will help us to detect abnormal value (longer time) process in
the resuming and quickly decide the root cause is in the kernel or
user-space. The kernel side we can use many tools (e.g. printk or
ftrace) but for user-space we need to define the starting point of
the resuming process. Actually, the kernel side needs to use local
clock because the clock subsystem is also suspended. But in that
case, user space can not use that timestamp because the local clock
is not exposed.

So this will be used something like

where_the_user_space_resume_finish() {
	clock_gettime(CLOCK_MONOTONIC, &etime_ts);
	fileread("/sys/.../last_success_resume_time", stime);
	convert_timespec(stime, &stime_ts);
	user_resume_time = timespec_delta(&etime_ts, &stime_ts);
	...
}

Thank you,

---

Masami Hiramatsu (1):
      PM: sleep: Expose last succeeded resumed timestamp in sysfs


 Documentation/ABI/testing/sysfs-power |   10 ++++++++++
 include/linux/suspend.h               |    2 ++
 kernel/power/main.c                   |   15 +++++++++++++++
 kernel/power/suspend.c                |    1 +
 4 files changed, 28 insertions(+)

--
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-12 22:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-27 10:38 [PATCH v5 0/1] PM: sleep: Expose last succeeded resumed timestamp in sysfs Masami Hiramatsu (Google)
2023-11-27 10:38 ` [PATCH v5] " Masami Hiramatsu (Google)
2023-11-27 23:47   ` Randy Dunlap
2023-11-29 13:18     ` Masami Hiramatsu
2023-12-12 13:39   ` Rafael J. Wysocki
2023-12-12 14:32     ` Masami Hiramatsu
2023-12-12 14:57       ` Rafael J. Wysocki
2023-12-12 22:19         ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).