ACK: [PATCH] lib: fwts_pm_method: save t_start for logind outside of logind_on_signal
Alex Hung
alex.hung at canonical.com
Thu Jan 3 02:10:47 UTC 2019
On 2018-12-19 7:14 p.m., Robert Liu wrote:
> Buglink: https://bugs.launchpad.net/bugs/1809096
>
> On some systems without logind system-sleep hooks (e.g. Ubuntu Core),
> the t_start value sometimes cannot be stored in logind_on_signal()
> before s3/s4. The t_start then be updated after system resumed. This
> condition makes the s3/s4 duration become 0 and FWTS reports a medium
> failure (ShortSuspend) and a high failure (PMActionFailedPreS3).
>
> This commit moves the statement of storing t_start from
> logind_on_signal() to fwts_logind_wait_for_resume_from_action() and
> eliminate the failures.
> Although it will make the timestamp not accurate, but the latency is
> quite small and could be ignored.
>
> Signed-off-by: Robert Liu <robert.liu at canonical.com>
> ---
> src/lib/src/fwts_pm_method.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_pm_method.c b/src/lib/src/fwts_pm_method.c
> index e9faede..143cd5c 100644
> --- a/src/lib/src/fwts_pm_method.c
> +++ b/src/lib/src/fwts_pm_method.c
> @@ -129,7 +129,6 @@ static void logind_on_signal(
> if (status) {
> char buffer[50];
>
> - (void)time(&(fwts_settings->t_start));
> snprintf(buffer, sizeof(buffer), "Starting fwts %s\n",
> is_s3 ? "suspend" : "hibernate");
> (void)fwts_klog_write(fwts_settings->fw, buffer);
> @@ -318,10 +317,12 @@ int fwts_logind_wait_for_resume_from_action(
> /* Start the main loop */
> fwts_settings->gmainloop = g_main_loop_new(NULL, FALSE);
> if (fwts_settings->gmainloop) {
> + (void)time(&(fwts_settings->t_start));
> g_timeout_add(1, logind_do, fwts_settings);
>
> g_main_loop_run(fwts_settings->gmainloop);
> - duration = (int)(fwts_settings->t_end - fwts_settings->t_start);
> + if (fwts_settings->t_end > 0)
> + duration = (int)(fwts_settings->t_end - fwts_settings->t_start);
>
> /* Optional, as it will be freed together with the struct */
> g_main_loop_unref(fwts_settings->gmainloop);
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list