Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2931773rdh; Mon, 27 Nov 2023 02:39:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzWTvW3PR4SKvWC1MqNLQFMgEXcInCQh1Ws5anbcbFEQA203pyLvIc2uunjBqIMAhPdi// X-Received: by 2002:a05:6a00:2d18:b0:6b5:ec98:4289 with SMTP id fa24-20020a056a002d1800b006b5ec984289mr10983859pfb.14.1701081543604; Mon, 27 Nov 2023 02:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701081543; cv=none; d=google.com; s=arc-20160816; b=yCSRGr0yy2nSI0y9CKxtkShYklsz8AoG3qVD2+SmUW4ZeYYL8jksmRFf8P/xO/ray0 dKpDcrkbe9SjQ/GOo0xAqvk+n8IygLYkGocowWWkJqWGJX/7dmyyGSbvQePECMUIyF+N EXEgDVbXU/H36CsQsftjqtAcyN31cN1DseMeujs3+rTCV/F+UNtWSdFFN26wGuQEcD2n tafrhKMyiNJ040uTBPFTlbHGPkfp0Bi37TYshDNyjQQqDe6kpZAQ8+1P/9bluLSOkWvP UlrB+lhXGeY55SkqeGT3P2izit/k2Yy8wz5JuOPzvQcK5uqBHbHRYfao7999tAWFmS/y kBQQ== 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 :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=KLanxoIZ43gxjfzCRFngbC1OJv1JjnegLkIzMIclOdM=; fh=oiYXZnyCWaHSSrYq9dyNG2pzytK5T+ASx4J+x2KhCYU=; b=j8dLGKQ0KfoIoEofXk2OmSTK8IpUb1MFqjoeyBv4iG0UOP+HmFTVV5x9SXGS1SFVct KwnQWi+tHag4IRRpCjEyBiaJL+J6p5CzzYbiAv9rrxx7K3fYbjOBycdNO45mENHB++vr jcvi5Zwa2RlzuWx9HBzwmBixwm4Msla48h8vDJgF8WVeEZ5Cbu1zSUDxpxxPUnF6pwLS LFMRjD+OPKo0jndZWulQmiuHDL8xSdRohblhCHwDNDVyIneAT9Lu4BinU9zRNmT0mPa/ TITroZta5tGiMcN5l33GXNBFdWwmVfaa7NZzi8B2ZwmvVAiNS6CBI7u9RfpoRZrvjRNq /jAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TyIUHHg4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f3-20020a056a00228300b006cbb7b7bed0si9722070pfe.201.2023.11.27.02.39.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 02:39:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TyIUHHg4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 4E55C8067E3B; Mon, 27 Nov 2023 02:39:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233018AbjK0Kib (ORCPT + 99 others); Mon, 27 Nov 2023 05:38:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233011AbjK0Kia (ORCPT ); Mon, 27 Nov 2023 05:38:30 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3532518B for ; Mon, 27 Nov 2023 02:38:35 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDF13C433CC; Mon, 27 Nov 2023 10:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701081514; bh=6S5QzfClwV19elQA6yctifho8YSJOuo6Kodrr9D3l60=; h=From:To:Cc:Subject:Date:From; b=TyIUHHg4GYm/FuiPshCH2hFp6IIOnD3uEvwla+8K3u2GfAy+cJgM6839lux7r9wIQ +hN/RqrdPSbx4jjEVKupD3GO5heyv5c+CBEyQrF0HnzU2/PRbJivglT8xwORjIeu/m Chli1Ja2ehX7U3cqHuSzNj9gLzZ9kfLQKyL0DXYJE1KoBDLAiM72SDg0AkEQJHFx33 W0/qR4BZ5QQjFohQ1QCG+SxqzciGZvTMJ8Sp5jnpsmc7V3rtQzic/IFCK2coEcuY7q dWhBEfdry3kQlBBwLA/Gd2yLD656DI7qW/PZ2CudlSe4JC2ePe3INUfYaQzB84elS2 XTrLWmDoxr6Zg== From: "Masami Hiramatsu (Google)" To: "Rafael J . Wysocki" , Pavel Machek , Len Brown , Randy Dunlap Cc: suleiman@google.com, briannorris@google.com, Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v5 0/1] PM: sleep: Expose last succeeded resumed timestamp in sysfs Date: Mon, 27 Nov 2023 19:38:30 +0900 Message-ID: <170108151076.780347.2482745314490930894.stgit@mhiramat.roam.corp.google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 27 Nov 2023 02:39:01 -0800 (PST) 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)