Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2227567rdh; Sun, 29 Oct 2023 06:31:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuzN48VcTSAzeygy7hmOCoj8cH15XJ5fqr6zH8Gz9IMlI3O7tyJeEq3w13yqmPx5cO1km8 X-Received: by 2002:a05:6a20:734f:b0:157:e4c6:766a with SMTP id v15-20020a056a20734f00b00157e4c6766amr6735756pzc.41.1698586283931; Sun, 29 Oct 2023 06:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698586283; cv=none; d=google.com; s=arc-20160816; b=kBnxSJeUgSUgxWZ1gN1pLoNhkwRqlB+KnEUlp7XqIDxIwJ9/8euHIIdnR8DddJuVEn dXyKuzdX5eXGAwyj5mtMB/hH79ZegStKaunbGvCPn9YLtyB6x4uempKNTyYhaBcOphYz ku+u/6Z865oaCHsqPyOjVr0xox3PAe+8HV2QRKLiaKKdKectEYEdBrzH/OsNrJjQ0qJI blQU3WQglLwveRo2kIznCsjE568Q3GW3YMW2ajmRU8wGVcGECTef+wvbJCGw4+ySqjLb x8misg4xpg7IKlcQbmiZtlL+4j+JXnl+vhdkvaWLkCFg7JLMOXn8TBaFYGM8G8IZ2nUm 3TMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SJRnNumI7z/HQp+WuPZFBthP45aHzCZzpOVj4kZSaSY=; fh=wZTHUQZMCbjsZLZNE0ThFy5fpzknZUk0xLL1XlpKyi8=; b=rHxm1TOv5rG8sWCQeih40wUOxtQAHkJrfP080Izt9wmKrNHgGBs9V5cxfpj6FjmcOQ XGayKqp6pg4F0k6jx+UpIkEogJjrLW2h0xFpclv/CfgRynAsL8vnXQmEGu/7K9LB+FhA i+fq+U6T1DFn062XAl1G7CBV5zUUvXa5pvjw9+MYFQLyKziqg0hyG6apNVwjbqxut7Ue oqa970KCdWHklAnbGki22R2qTAhCcWXJyu+Wf7ELx+MuxZyLSs/xuDNWjzvK/cLTz3ic qmefTySZzU+GsmRM8MiIYWFePU/uszKQtct8nTnhZam/2mUUhMeE54VL8A/gNWrxHk9/ eT3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J5ifICcU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y8-20020a17090a86c800b002747da1ef66si3615423pjv.53.2023.10.29.06.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 06:31:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J5ifICcU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4BBEC8067B7A; Sun, 29 Oct 2023 06:31:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbjJ2N25 (ORCPT + 99 others); Sun, 29 Oct 2023 09:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjJ2N24 (ORCPT ); Sun, 29 Oct 2023 09:28:56 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2438CC1; Sun, 29 Oct 2023 06:28:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1757C433C7; Sun, 29 Oct 2023 13:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698586133; bh=HHba25T9VztARaJU/UjlQBuEQ+GeLE7wN3ts9+h9slA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=J5ifICcU0IZCpXfoCjmcKe+D1febVcVQD2bkY8aShIwKcL6LOpkUB/QSpdU0TNiBK 5sPUxV8bBaa21b/EFfv4DvR8qqGwhUY4VOiyV8QYfFxhjHmGAgdeTFrQVh1FTBiH5y wI855t6EsX4BLa+YNrV7gIhIq/745BO4GPQNc1L5acT/IaMCqLydQ54sAxC8g9qWiA vbvM/1XgZJZJ6MkQt1em9HLyBHchRSTUtG6ODZERvvaE0oVEjPBXcZZArPiZZHJJ71 vtzjdMeNcKvdZ/N0z5OTfw4CFetGPCn2qZJQAC+WaOD772VcYIx+hfpn4b+QomQNCt LBy3S3CzbcYwQ== Date: Sun, 29 Oct 2023 22:28:49 +0900 From: Masami Hiramatsu (Google) To: Randy Dunlap Cc: "Rafael J . Wysocki" , Pavel Machek , Len Brown , suleiman@google.com, briannorris@google.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v3] PM: sleep: Expose last succeeded resumed timestamp in sysfs Message-Id: <20231029222849.768feb0bbc3a2e37db2bb2c6@kernel.org> In-Reply-To: <2e507e97-8ac6-43a2-a290-e0e80af0d044@infradead.org> References: <169849758243.1357961.4105003693126485611.stgit@mhiramat.roam.corp.google.com> <20231029115449.8c942b131312c2464eda6970@kernel.org> <2e507e97-8ac6-43a2-a290-e0e80af0d044@infradead.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 29 Oct 2023 06:31:21 -0700 (PDT) Hi, On Sun, 29 Oct 2023 05:16:49 -0700 Randy Dunlap wrote: > Hi. > > On 10/28/23 19:54, Masami Hiramatsu (Google) wrote: > > On Sat, 28 Oct 2023 09:48:36 -0700 > > Randy Dunlap wrote: > > > >> Hi, > >> > >> On 10/28/23 05:53, Masami Hiramatsu (Google) wrote: > >>> From: Masami Hiramatsu > >>> > >>> Expose last succeeded resumed timestamp as last_success_resume_time > >>> attribute of suspend_stats in sysfs. This timestamp is recorded in > >>> CLOCK_MONOTONIC. So user can find the actual resumed time and > >>> measure the elapsed time from the time when the kernel finished > >>> the resume to the user-space action (e.g. display the UI). > >> > >> Can you go into the use-case a bit more, please? > >> You have said "what", but not "why". > >> What do you (or google) plan to do with this? > > and what about this part of my questions? ^^^^^^^^^ Oh, sorry I missed it. I would like to know the actual (accurate) elapsed time from the succeeded kernel resume time to displaying UI so that we can identify the user visible (noticable) resume delay happens in the kernel or the user resume process. The kernel side will be recorded on the dmesg if we use PRINTK_TIME, but the PRINTK_TIME is recorded by local_clock(), we can not know the actual time in the user space. I also considered to expose current local_clock() by introducing CLOCK_LOCAL, but that may be more user-space intrusive change, so I chose this way. Thank you, > > > >> > >>> > >>> Signed-off-by: Masami Hiramatsu (Google) > >>> --- > >>> Changes in v3: > >>> - Add (unsigned long long) casting for %llu. > >>> - Add a line after last_success_resume_time_show(). > >>> Changes in v2: > >>> - Use %llu instead of %lu for printing u64 value. > >>> - Remove unneeded indent spaces from the last_success_resume_time > >>> line in the debugfs suspend_stat file. > >>> --- > >>> 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(+) > >>> > >>> diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power > >>> index a3942b1036e2..63659765dee1 100644 > >>> --- a/Documentation/ABI/testing/sysfs-power > >>> +++ b/Documentation/ABI/testing/sysfs-power > >>> @@ -442,6 +442,16 @@ Description: > >>> 'total_hw_sleep' and 'last_hw_sleep' may not be accurate. > >>> This number is measured in microseconds. > >>> > >>> +What: /sys/power/suspend_stats/last_success_resume_time > >>> +Date: Oct 2023 > >>> +Contact: Masami Hiramatsu > >>> +Description: > >>> + The /sys/power/suspend_stats/last_success_resume_time file > >>> + contains the timestamp of when the kernel successfully > >>> + resumed from suspend/hibernate. > >>> + This floating number is measured in seconds by monotonic > >> > >> What does "floating" mean here? Not floating point... > > > > Oops, it should be "floating point number". > > > > Thank you! > > > >> > >> > >>> + clock. > >>> + > >>> What: /sys/power/sync_on_suspend > >>> Date: October 2019 > >>> Contact: Jonas Meurer > >> > >> [snip] > >> > >> Thanks. > >> -- > >> ~Randy > > > > > > -- > ~Randy -- Masami Hiramatsu (Google)