Re: [PATCH v8 0/1] PM: sleep: Expose last succeeded resumed timestamp in sysfs
From: Google
Date: Mon Jul 08 2024 - 19:50:18 EST
Hi Rafael,
Gentry ping. I would like to hear your comment on it.
Thank you,
On Tue, 2 Jul 2024 23:24:43 +0900
"Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote:
> Hi,
>
> Here is the 8th version of the patch to expose last succeeded resumed
> timestamp in sysfs as /sys/power/suspend_stats/last_success_resume_time.
> The previous version is here.
>
> https://lore.kernel.org/lkml/170359668692.1864392.6909734045167510522.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
>
> This version is just update against for the upstream kernel.
>
>
> On some system like the ChromeOS, the system suspend and resume are
> controlled by a power management process. The user-space tasks will be
> noticed the suspend and the resume signal from it.
> To improve the suspend/resume performance and/or to find regressions,
> we would like to know how long the resume processes are taken in kernel
> and in user-space.
>
> This patch introduces a last succeeded resumed timestamp (just before
> thawing processes) on sysfs which allows us to find when the kernel
> resume process successfully done in MONOTONIC clock. Thus user processes
> can measure the elapsed time taken by its 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 | 11 +++++++++++
> kernel/power/main.c | 28 ++++++++++++++++++++++++++++
> kernel/power/power.h | 1 +
> kernel/power/suspend.c | 1 +
> 4 files changed, 41 insertions(+)
>
> --
> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>