From patchwork Thu Nov 10 06:47:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 17982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp765090wru; Wed, 9 Nov 2022 22:56:32 -0800 (PST) X-Google-Smtp-Source: AMsMyM5G0CKgLq1FFQ1eAe+MITjnlv9H5MLiO3/LbLpGw0Zqx2CMWsGySNL2S1f1Jt7kRdpT90J8 X-Received: by 2002:a17:906:48e:b0:78d:b3ef:656c with SMTP id f14-20020a170906048e00b0078db3ef656cmr2184686eja.627.1668063392408; Wed, 09 Nov 2022 22:56:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668063392; cv=pass; d=google.com; s=arc-20160816; b=iKS2IgGxATgRlNBjdRHqEEwIzgthkvPMltkjaUCPFka5vBBYLn59xFFj/D/mNRg8Rs Ces8X3qZFTqBONN2mmrv7IAmtMNBqNJPIuzVByigXSQP3KhbHqDJSwLkqHnnhSf89pfs UZGlMXBHDl3v+MtjD61PwQst2tUR4PzBptWFxSzN1jwbnjoXUuLnhQrGUt5MnWY9ZvwA CCEEIiTQIpefX1RUKJj5NXJ0iYPQLQSoVX+ht0s5ISy5f/37O6wrtmJXh/8B0WgqAK3k kPo9Fr8TxPmBI1k+wiKpLR4FvN6SAaKSel1QfaDwAWiQ4Jrmn7K0CGBQH54b2X1RW9B1 oo/A== ARC-Message-Signature: i=2; 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:date:subject:cc:to:from :dkim-signature; bh=lcplZ2AaUdxKohANIdm9S+CdjyqW3W6VNIMpelnDjSc=; b=YXt9HanSkbdBcioueRTsPjgWdtspdkTHtUOEXj1YroMpTmCtJ6wag/dsWppMptBdZ1 +Gd7D3YN4R3Q2KhgsmXUrL1C2psNOx6rp+Ky7XgNvUIOJThOw4oJKnNoAyOPpn669Q1K FfnjM4Eyu18WPwI5dDYcwCtLgFHQtTgJt1CVvLXVdMBq+dLib0bKPWXoWJtxTZqcsMpS dt3+NMP4DYUsVcrEY+YuqYo6+BMxUQmTbsYs9MDxC87wZkgWTZr3598OHpbkh4ACNqsj upvefTBGj2q5XuMJkbrJelpVMwuiP2OkaqBpuXoMuedQTk0niBS7PTyoQTq2q6yWy66s 0X2g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=OHiowf4O; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a05640250cc00b00452dfa2bb27si6779723edb.134.2022.11.09.22.56.08; Wed, 09 Nov 2022 22:56:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=OHiowf4O; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232635AbiKJGtb (ORCPT + 99 others); Thu, 10 Nov 2022 01:49:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbiKJGta (ORCPT ); Thu, 10 Nov 2022 01:49:30 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2054.outbound.protection.outlook.com [40.107.244.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3E0B2D752; Wed, 9 Nov 2022 22:49:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ediHTmqYSDZozhmnNtuR3VjlmOKD0otkujwCJgWEAJBEN4FXKzsOithKmJAYreqO/etcw4NtKSY7AoJRHKm0loT/A8ycsgJojgdDxEc2+9IoqMQlzcr/3dCYKBHSlJNdgbidBLSJ1u7D3BD3Z9MHsLoKk6F2uRu3Q7jPKP8Xgw4Nhrly7LrkXnPECGG4n2ynJB4kp1tXCnOQDGyBBWPoR82y5zHOltLHmp7r+IEGTg7iMvjrzlRFt4/HxZrhx0FdO5beWFRDGw7Om7+Gf7DQtumYmFYGqZw1zA8hF413+/Cs7LC0YAkgqwaReyh5DkYJ6VZLSqp4uds5hnKv+S2L9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lcplZ2AaUdxKohANIdm9S+CdjyqW3W6VNIMpelnDjSc=; b=frFSRMU/jkZMNkisL45FfN+YYCWpprVedXv2msKarBEDa9vd/9ZX9RUvJiwO0WHIRzUC3QkQTZczFNyeCZ0U3x+zx9uIc0c7sc2q0kyGXJwdKXIl33Sx9xXReo3xOem4+sqgnHFqxnyhSRiT5NfmTwKA0eZxy9qHit4V38i56rv+yR3YbH5PGnaunc5kekL2WjuQNKunbB943x16QncucJhHyd5aPKt0MJT4SR+KkzCKVSP/iba7WpdDVl0P48qr7ZSrQjf7iKjBvOfsOW9zUI8esX1opRBhabxYcNnZ4Nx5xESzTTd0lMxlClDqYQYkDbjhihq80CIy362ezpqq9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=chromium.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lcplZ2AaUdxKohANIdm9S+CdjyqW3W6VNIMpelnDjSc=; b=OHiowf4OhLHnpdBp/AZ2wERyDIcfuFwLQeK+QdsaF9R5BNJ25lbcMV39lV1dalSUy8Jb6QJ3iI+q6F/zqmPqxXrgdCwumU/jYFtdF5iZz51O1vZYxLMlpYp4oftB5nogFndikPxmaJ/SRp6Tmtnp6KQnciYgaefezcjoQU5iuQI= Received: from MW4PR03CA0024.namprd03.prod.outlook.com (2603:10b6:303:8f::29) by DM4PR12MB6280.namprd12.prod.outlook.com (2603:10b6:8:a2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.26; Thu, 10 Nov 2022 06:49:27 +0000 Received: from CO1NAM11FT103.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::62) by MW4PR03CA0024.outlook.office365.com (2603:10b6:303:8f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.21 via Frontend Transport; Thu, 10 Nov 2022 06:49:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT103.mail.protection.outlook.com (10.13.174.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5813.12 via Frontend Transport; Thu, 10 Nov 2022 06:49:26 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 00:49:04 -0600 From: Mario Limonciello To: Sven van Ashbrook , Rafael J Wysocki , , , Pavel Machek , Len Brown , John Stultz , Thomas Gleixner , Stephen Boyd CC: Rajneesh Bhardwaj , S-k Shyam-sundar , , Rajat Jain , David E Box , Hans de Goede , , Mario Limonciello Subject: [RFC v2 1/3] PM: Add a sysfs files to represent sleep duration Date: Thu, 10 Nov 2022 00:47:21 -0600 Message-ID: <20221110064723.8882-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221110064723.8882-1-mario.limonciello@amd.com> References: <20221110064723.8882-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT103:EE_|DM4PR12MB6280:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cbf64c7-a050-44cf-ebc2-08dac2e7b5bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 50ATUK4afSFoNmaik0L4HkU8dCXqepgSq7XWzO4ou1N2XdG+7KabclB+XtVuDE6FPhzWO4PwxX/6K4TjLjp7aEKoB1jkWMuX9m9vtB+gl5ZPzQvEckhu4CxeYg6r5R3v6yGJRvRF9e+pVM9Sxtktoy7jcObSQcNM1BhdfbtbnsZ3UxU/a2Kjw1CQp8YDaP67yEzc7LrxtMk/1UMnOAyr7lxOI1+7Frg/Ufrru69qZVtHmJa/2XpRwWYZx/JL8G5Bmm0P/fafvp00wx12I9WZjPmu0vJKLEzfr4RovUjSxtDpU4hkzs+BzyAVHKKB3mUsy/ncmmHY+1Ves8kMhMgX01ah+C9HEX+yk72KXuWWxHBzt/jWF9K9jh30YJ+8vLL/qc+yPlCSUROK4FB95U6i7JYgpNvEuSNKyVzX1Xg6NxZM0ahGZ6tPz85REz328XZl8e9JLxbakh8E33OEKkcfH2bW+NZcg/ZoayBohTSCsQfdlRZCoqgw4ADRQSGc8yGOomvgKXypU/vvubF7O8RVZ4uE5ilX4QCz7sVdOnGkwt3O+biy30ztc9lKApF1spFO9NMs5+LiL7HDwgjAfieVKOZ1bTpHOKx64B3OWHgL5dDuAtXHGRrZkko/x+WqV3GM4JTIEu3OK/JfWOIzHe4PjHGvXIK8Fjk9nNnuB8EwfAi3IsLNWq+khKwBVgWLUOMeHmjso5u0slJWRmAbXutKwLJn1TvksThuhvviNLokeuAaUtFy6Zxj6Q+orDEX/3YoGCA5x/VFsxbFkDp6uZqZJpAqL4mz7oQuYEm91NcnVVmdXB16JsPAUmVwU2LBp8Ut X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(346002)(136003)(376002)(451199015)(36840700001)(46966006)(40470700004)(36756003)(66899015)(81166007)(86362001)(44832011)(47076005)(7416002)(2906002)(1076003)(26005)(426003)(336012)(83380400001)(5660300002)(16526019)(7696005)(186003)(36860700001)(82740400003)(8676002)(8936002)(2616005)(4326008)(41300700001)(70206006)(110136005)(316002)(70586007)(356005)(40480700001)(54906003)(82310400005)(6666004)(478600001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2022 06:49:26.7428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cbf64c7-a050-44cf-ebc2-08dac2e7b5bf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT103.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6280 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749091239891727697?= X-GMAIL-MSGID: =?utf-8?q?1749091239891727697?= Both AMD and Intel SoCs have a concept of reporting whether the hardware reached a hardware sleep state over s2idle as well as how much time was spent in such a state. This information is valuable to both chip designers and system designers as it helps to identify when there are problems with power consumption over an s2idle cycle. To make the information discoverable, create a new sysfs file and a symbol that drivers from supported manufacturers can use to advertise this information. This file will only be exported when the system supports low power idle in the ACPI table. In order to effectively use this information you will ideally want to compare against the total duration of sleep, so export a second sysfs file that will show total time. This file will be exported on all systems and used both for s2idle and s3. Suggested-by: David E Box Signed-off-by: Mario Limonciello --- Documentation/ABI/testing/sysfs-power | 17 +++++++++++ include/linux/suspend.h | 4 +++ kernel/power/main.c | 42 +++++++++++++++++++++++++++ kernel/power/suspend.c | 2 ++ kernel/time/timekeeping.c | 2 ++ 5 files changed, 67 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power index f99d433ff311..5b47cbb4dc9e 100644 --- a/Documentation/ABI/testing/sysfs-power +++ b/Documentation/ABI/testing/sysfs-power @@ -413,6 +413,23 @@ Description: The /sys/power/suspend_stats/last_failed_step file contains the last failed step in the suspend/resume path. +What: /sys/power/suspend_stats/last_hw_state_residency +Date: December 2022 +Contact: Mario Limonciello +Description: + The /sys/power/suspend_stats/last_hw_state_residency file contains + the amount of time spent in a hardware sleep state. + This attribute is only available if the system supports + low power idle. This is measured in microseconds. + +What: /sys/power/suspend_stats/last_suspend_total +Date: December 2022 +Contact: Mario Limonciello +Description: + The /sys/power/suspend_stats/last_suspend_total file contains + the total duration of the sleep cycle. + This is measured in microseconds. + What: /sys/power/sync_on_suspend Date: October 2019 Contact: Jonas Meurer diff --git a/include/linux/suspend.h b/include/linux/suspend.h index cfe19a028918..af343c3f8198 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -68,6 +68,8 @@ struct suspend_stats { int last_failed_errno; int errno[REC_FAILED_NUM]; int last_failed_step; + u64 last_hw_state_residency; + u64 last_suspend_total; enum suspend_stat_step failed_steps[REC_FAILED_NUM]; }; @@ -489,6 +491,8 @@ void restore_processor_state(void); extern int register_pm_notifier(struct notifier_block *nb); extern int unregister_pm_notifier(struct notifier_block *nb); extern void ksys_sync_helper(void); +extern void pm_set_hw_state_residency(u64 duration); +extern void pm_account_suspend_type(const struct timespec64 *t); #define pm_notifier(fn, pri) { \ static struct notifier_block fn##_nb = \ diff --git a/kernel/power/main.c b/kernel/power/main.c index 31ec4a9b9d70..11bd658583b0 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -6,6 +6,7 @@ * Copyright (c) 2003 Open Source Development Lab */ +#include #include #include #include @@ -54,6 +55,19 @@ void unlock_system_sleep(unsigned int flags) } EXPORT_SYMBOL_GPL(unlock_system_sleep); +void pm_set_hw_state_residency(u64 duration) +{ + suspend_stats.last_hw_state_residency = duration; +} +EXPORT_SYMBOL_GPL(pm_set_hw_state_residency); + +void pm_account_suspend_type(const struct timespec64 *t) +{ + suspend_stats.last_suspend_total += (s64)t->tv_sec * USEC_PER_SEC + + t->tv_nsec / NSEC_PER_USEC; +} +EXPORT_SYMBOL_GPL(pm_account_suspend_type); + void ksys_sync_helper(void) { ktime_t start; @@ -377,6 +391,20 @@ static ssize_t last_failed_step_show(struct kobject *kobj, } static struct kobj_attribute last_failed_step = __ATTR_RO(last_failed_step); +static ssize_t last_hw_state_residency_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%llu\n", suspend_stats.last_hw_state_residency); +} +static struct kobj_attribute last_hw_state_residency = __ATTR_RO(last_hw_state_residency); + +static ssize_t last_suspend_total_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%llu\n", suspend_stats.last_suspend_total); +} +static struct kobj_attribute last_suspend_total = __ATTR_RO(last_suspend_total); + static struct attribute *suspend_attrs[] = { &success.attr, &fail.attr, @@ -391,12 +419,26 @@ static struct attribute *suspend_attrs[] = { &last_failed_dev.attr, &last_failed_errno.attr, &last_failed_step.attr, + &last_hw_state_residency.attr, + &last_suspend_total.attr, NULL, }; +static umode_t suspend_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx) +{ + if (attr != &last_hw_state_residency.attr) + return 0444; +#ifdef CONFIG_ACPI + if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) + return 0444; +#endif + return 0; +} + static const struct attribute_group suspend_attr_group = { .name = "suspend_stats", .attrs = suspend_attrs, + .is_visible = suspend_attr_is_visible, }; #ifdef CONFIG_DEBUG_FS diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index fa3bf161d13f..b6c4a3733212 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -423,6 +423,8 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) if (suspend_test(TEST_PLATFORM)) goto Platform_wake; + suspend_stats.last_suspend_total = 0; + if (state == PM_SUSPEND_TO_IDLE) { s2idle_loop(); goto Platform_wake; diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index f72b9f1de178..e1b356787e53 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "tick-internal.h" #include "ntp_internal.h" @@ -1698,6 +1699,7 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk, tk_set_wall_to_mono(tk, timespec64_sub(tk->wall_to_monotonic, *delta)); tk_update_sleep_time(tk, timespec64_to_ktime(*delta)); tk_debug_account_sleep_time(delta); + pm_account_suspend_type(delta); } #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_RTC_HCTOSYS_DEVICE) From patchwork Thu Nov 10 06:47:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 17983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp765107wru; Wed, 9 Nov 2022 22:56:35 -0800 (PST) X-Google-Smtp-Source: AMsMyM4LX2p+dtsG8u1/ugFZBSR9Q7bLBzk+7eGexm6KbOHhSoGigUHa9CcuM7BuERBg87SChTK6 X-Received: by 2002:a17:902:c643:b0:186:9efc:67a1 with SMTP id s3-20020a170902c64300b001869efc67a1mr63448108pls.30.1668063394693; Wed, 09 Nov 2022 22:56:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668063394; cv=pass; d=google.com; s=arc-20160816; b=PRiQ7kAtwkFzwJquJ6lmaa6QIizQunK94dQsFZqUxhISuY6dz4YtUmOvmi1skrL0TM Bps1fS8gwPkj+IA95c7+iL+GqeaRNdODEtiX+HG8a4Kv7cDRhCtCC9/wqVSTCcjgH37d yFvTjA7BEDdaNSX0ioEvEmbVOllfqC9u1Q+mBrAl72kQHgBkPQQT2iuERKCYa2CGYItc N6iTOjrM65t4a4WbaXaLSXC56TXMzaCVKNVWq3w/2ekaEcD3k7wT05RePkJA91xBEZ83 lxgTrg2tNkrkcWzFojCxKpAIpcmjuUAbWu5mKPKvSRUakFNCbvQQLbma9t1zOLYGs0wx jG7w== ARC-Message-Signature: i=2; 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:date:subject:cc:to:from :dkim-signature; bh=ee+mbOGvEiSCH3gE1+nUkaYutzOUMeYFRaKsl7RE2cQ=; b=Sy+PYnuxt6YFm7s0wA7Nq6d8mcTHwwygSOpukrlS5EA8ayaiuqlN0WMfnumHKMnrlE Exl0zBdS2au/mcaQ/MOpLiNGTsyHLU/EJyb+0BLEo/4m1iU8kW1s/agANIBcK+ic5+Fo 7BazO7oNlzmo5h6QprdXOf9k1XSsPB4QhNucMxxp2UZE21l1Ubgl+PUXcgf78O3N/K2x 4fqIJY3Kwi/kYWFt6IeeEfOUkZGDkw84zxrc8P0z8fVRZKLJuefpuOaItc62UkTEq7K6 1SmQDs+yEdVrDYfaljMY+2f3C7vj9ApRJOiZad5zvRuVHY+rDi8Kbt/R//ai1vnzpAPe +jwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pK30lSVs; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc13-20020a17090325cd00b001729cfb3cb5si17560588plb.610.2022.11.09.22.56.17; Wed, 09 Nov 2022 22:56:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pK30lSVs; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232645AbiKJGtf (ORCPT + 99 others); Thu, 10 Nov 2022 01:49:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232628AbiKJGtc (ORCPT ); Thu, 10 Nov 2022 01:49:32 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2054.outbound.protection.outlook.com [40.107.100.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 926402EF55; Wed, 9 Nov 2022 22:49:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FRCl/Vq51U1oHhkrba/tNHxiyiBq9rMhz3P5zUo7j90OIf/Sb2TrsAvRS6P3cT1LrnpI89ULoxxo4Kti8ImKduep5sLLotWwKScE+mjMpgG4OptEunmJcQMXP39cFT+W2iFsQspawBlqMGNyFpNmTAwI1AyuC/vJmAyIjqY69jzEdlOSGHdXj0YonpmwAxMe0hj/B+oIi6o/XaAz5Uc0O2t/mwDTnSbJgrGkQoj0cAxmCFt9QBryotHmm0zVIQKQmLuY3CzE/6TyHtwvv3m2jsiAoafZeJIXFRJlvTP9VwGNevNz5pWzGxEHypNczkvt5uHHnBz0kvrFVw1DbWkJnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ee+mbOGvEiSCH3gE1+nUkaYutzOUMeYFRaKsl7RE2cQ=; b=A6TbpKQVTW8JbKxQt5E1vmbLOB3MoBx/8PKPCRuFtUBvO1ttdax//vVxcMEfAVgoeNjwVNyYUvJx4MfvgITM46wXALtYMoPClpN8R0xw+h9YITroItTJ5LEgSvp1e5biUQ5v+Trv7QG7OvRI8XG6NdWdtDPpCdfdUwbvwyRhmQvWPuqDnRucoCeI+H4jv1eIxEB6MKK4az/NZjPqt4fg7qfXNNuFldq36zzWfn6/iOTFKkr12T9Srb48MIIPK6F4OLcPZLOfLmWzkQWjSpmPTskvcKRxblnKhr3pg2DpH+icJxJEFBuebC0b8/xPyJztzEKZCnOTppe/0AWCvI4R4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=chromium.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ee+mbOGvEiSCH3gE1+nUkaYutzOUMeYFRaKsl7RE2cQ=; b=pK30lSVsIHY+Nb4HRqsSRVSKINPSB705pcSlW+4xYCOBUI1umoj7TB8TxdHvUuuOWBXRT0pl9qRLdwQCpXZcMPgCq79ZUrMUTH7Ld1O/wn2y7i/RViCbwEcEs1AYVzA8cDvNp5hxek5UE7qZlo9ikBMiH0TSBp7SKMNF5zTYo58= Received: from MW4PR03CA0011.namprd03.prod.outlook.com (2603:10b6:303:8f::16) by CH2PR12MB5002.namprd12.prod.outlook.com (2603:10b6:610:6d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12; Thu, 10 Nov 2022 06:49:28 +0000 Received: from CO1NAM11FT103.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::c4) by MW4PR03CA0011.outlook.office365.com (2603:10b6:303:8f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.21 via Frontend Transport; Thu, 10 Nov 2022 06:49:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT103.mail.protection.outlook.com (10.13.174.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5813.12 via Frontend Transport; Thu, 10 Nov 2022 06:49:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 00:49:05 -0600 From: Mario Limonciello To: Sven van Ashbrook , Rafael J Wysocki , , , Shyam Sundar S K CC: Rajneesh Bhardwaj , , Rajat Jain , David E Box , "Hans de Goede" , , "Mario Limonciello" , Mark Gross Subject: [RFC v2 2/3] platform/x86/amd: pmc: Report duration of time in deepest hw state Date: Thu, 10 Nov 2022 00:47:22 -0600 Message-ID: <20221110064723.8882-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221110064723.8882-1-mario.limonciello@amd.com> References: <20221110064723.8882-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT103:EE_|CH2PR12MB5002:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bb0439e-bcec-471b-cb86-08dac2e7b672 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vnmYbh/+wElOH2WYg9alt2pabkMlw7syi3YhYw2o50ZEg8LH52TS2GAwQhlDOKKgdQEGDhKQq8Accm4oeolKsJNZ7u84osJCUvKDr0s0/29RYytKEOfrVPIPbCtjqcNNuJguNQucopki/TiGKVmdIqSToU4/nErK8fLZz/MTUmbbZbowaaq8afoeV4pGNV5xWdFk0XJEY9F7iynMONFQY5cNdw+gqD5Zvo96ifdTkeOfL/pVD8LzYwQCjFlAfFWNlQS3Q9tCtbXKzUbHvS/70R+oJ+F6Eym/dC6b7pGjyZA9lv4vwdf4NtiD7ekMW8H0WR8HMRF7/WnF3cLNCIyfwavcGvMeDwWvhpDEMu+J+3WU+z9oGq981SSjHAeAaSMQS99cE3mcfUjX0//qSRUwJgThmvLpJ5F+sGq0N+iv0ee65BmFCqTNvhT8F0k1wk98miSttNj9D+S8PgU5lj7ro7W7oM+WECAYAnHmKdMHW/9qz91HdNovtgUZB5KMN7Pvit+uh5kIbpL7V54L7mspQBG/7k2XqxJM+x6NelclekDt3Y1g76C7xj+kvOsUR7+saJHbFOff+Iy8sNDfqz74IVQr/gUnsLywGGLAUzzFcHIEucjwXhrtAMLMa4i12J2fFwJNINc2hLKI0LruzqxFtL28SB1ynjh6zte41Ca1/SSoEKzaaSKYOKQ69yyTblE+pHThI5gRd3zCQ4LOXhTcXcMa1E7vA+hJihIlgrO8yLHU/eyiP0jniquNOlkJMP+3EhAOg5NPdvrGdWTbnKA05DoOef1vOxzu2h8zkCOyBCieoWoP6h4/WiMOhmx2f4j5 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(376002)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(1076003)(8936002)(47076005)(426003)(16526019)(5660300002)(186003)(478600001)(2906002)(83380400001)(336012)(7416002)(44832011)(2616005)(36756003)(7696005)(6666004)(40480700001)(41300700001)(36860700001)(26005)(82740400003)(81166007)(70206006)(356005)(8676002)(70586007)(4326008)(82310400005)(54906003)(316002)(86362001)(110136005)(40460700003)(6636002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2022 06:49:27.8992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3bb0439e-bcec-471b-cb86-08dac2e7b672 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT103.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB5002 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749091242018408148?= X-GMAIL-MSGID: =?utf-8?q?1749091242018408148?= amd_pmc displays a warning when a suspend didn't get to the deepest state and a dynamic debugging message with the duration if it did. Rather than logging to dynamic debugging the duration spent in the deepest state, report this to the standard kernel reporting infrastructure that can be accessed from sysfs. Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c index 96e790e639a2..e583bf966f47 100644 --- a/drivers/platform/x86/amd/pmc.c +++ b/drivers/platform/x86/amd/pmc.c @@ -363,9 +363,7 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev) if (!table.s0i3_last_entry_status) dev_warn(pdev->dev, "Last suspend didn't reach deepest state\n"); - else - dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n", - table.timein_s0i3_lastcapture); + pm_set_hw_state_residency(table.s0i3_last_entry_status ? table.timein_s0i3_lastcapture : 0); } #endif From patchwork Thu Nov 10 06:47:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 17984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp765238wru; Wed, 9 Nov 2022 22:56:58 -0800 (PST) X-Google-Smtp-Source: AMsMyM6BimxaeHViYsZdA7suW0DlQ8D9UjBVCmt6fxsc/5dQhoSA8hkZBr6WW909mx8uh0E+N/Ac X-Received: by 2002:a63:f47:0:b0:46f:da0:f093 with SMTP id 7-20020a630f47000000b0046f0da0f093mr1937494pgp.441.1668063418200; Wed, 09 Nov 2022 22:56:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668063418; cv=pass; d=google.com; s=arc-20160816; b=sbcSp68I7+stCW3LRKD8F8P0A3THpKgDHNwSkES8uGrQ/x1qIpmQ0jWc7nPaaeisGb qnEmfWQxsCWJ/QyY52elrYsGIxBIRIjjXiOQBvoEiCVF5RQ/JrrARcaqBevdTt+u7lFQ zFXDilNjC6cNdjkQvYm9cMUdv3tWFrFjxwS+JXjPVZc8Nm+nBM5zcIs0Ol2PFtes0vU0 mtEUv85OWIGqw0Du5BX/iu5PrArXQY/IIO4VdPhcOVGpsSU/vsFX6fj0ovOFQmUp3OVD 2eHqeKDfThXxkq9h8tVnSyt91ovaY42tr+ux5ouxu+8RufifdfNAtQXuLCTxJwmjQNgE ML9w== ARC-Message-Signature: i=2; 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:date:subject:cc:to:from :dkim-signature; bh=5yUpJzh6QRUAzZSYvx6zTIHg+TdlbMVNpquqUA0Mhvg=; b=FuzIKMyf31T+rf8WBIvtKrNghcgQ4zUguJjEpUCcYWaZsuuKhn8MUoyul6AU1jj0X5 Ohybv4gdXuwyrt/W3akp9OaTyAhZTLfZcUHVF6/TXYgMzH9UB2BhQg3uRHJAJ2TerWQS bkDPfOJHR0+Ijkb/H4MsSPsnUCD55w55fjNnIp3J825XorKcBUkCJfPoxzLCOYr7oURa hIKlQKToYgvvCAoKikP6tJsoyyfHfxEaaSBpYAY1eGlgEMCwc9OSv3c+JO6/FKO4zAcD HSdsi6kPu9Nw0VeuDCViclbHEVrTdQ4p0oIWXjrkRoIFkoy6lSa5N7A88r8uuz+Yaoex 2GFQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=vCHGEhaj; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 128-20020a630186000000b004708630981asi9595609pgb.353.2022.11.09.22.56.43; Wed, 09 Nov 2022 22:56:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=vCHGEhaj; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232244AbiKJGtk (ORCPT + 99 others); Thu, 10 Nov 2022 01:49:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbiKJGtd (ORCPT ); Thu, 10 Nov 2022 01:49:33 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20601.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::601]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E08F2F03C; Wed, 9 Nov 2022 22:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ezPI0iW5+Ozb1CkBjqpvwHxGs2fl2uX+ly9I+DfpMl7M2dyTzmBoi9zN8OGEflXHCFgE7AkMSQoicdk0OOCJwGGtjZl1ksnb5EG0jWu0D5nNhq+PLQSt6FMYurjlFHizP9EayKkq2u8hmq79qC+axGEgGvMBoVmZSx2wMSV9P6yFhvtGmqkp4IHsEt/wwkO/nYfFI1Vy/egWAv0BKPYTe4H95DWBNIUYQplTwJicCEQielQ8itkNzPXYBSKh/rOZDbPTDKFT8X0jcycvAhCEOzhS84qsZQqwV2O/IIK7hDVWujiNbVVM/F01//XXQvk5/8ET7tkF+1lJnTSqp2PUMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5yUpJzh6QRUAzZSYvx6zTIHg+TdlbMVNpquqUA0Mhvg=; b=R+HEPNsP5HBXebZullUwKlv0bHfoXUY0ESQDJfEeN9A7MEEtiJvpiVZxEFRwV+E/OGfOowr93n7QSA6npNqdmPYdPnqycXkGj/bd0wOY4uQQsTpO5oWpCzsDqwcpiZJntIWnTGO4SZWeID5LrgjojRFb4kB2R8GhzyUcqBbaRy0AkrmkWxefedWJinRIYcffj++Dc5btjdrzS1LO7ZnfW5WW82QK+0f7O4Wfj4lB0491aCN3Ncync1bH4nnmFuvG5u8sseS1el6J70riVHIROcuIDeV7niLvzqjk/V5yWPAk9rAIdXGngquMYvMkUxQCQhABYsP6TIMol8oOHh6Yyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=chromium.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5yUpJzh6QRUAzZSYvx6zTIHg+TdlbMVNpquqUA0Mhvg=; b=vCHGEhajLSZkJYDKwymPk+cP2kS6C/hvdftHenN38NpBfnfBuIx80eakIXaZ0hYnwL3dodA4VtzOE5rK7mUc+AZkBlSJ7PQidY6ez9A7j9H+jV0kxbWd6L/6qCDSsYccE2YG8aQYOHyvXN5o2PZoAIZ81zjF5I+EEAO/H9oBwks= Received: from MW4PR04CA0377.namprd04.prod.outlook.com (2603:10b6:303:81::22) by DS7PR12MB8081.namprd12.prod.outlook.com (2603:10b6:8:e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Thu, 10 Nov 2022 06:49:29 +0000 Received: from CO1NAM11FT101.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::b0) by MW4PR04CA0377.outlook.office365.com (2603:10b6:303:81::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.13 via Frontend Transport; Thu, 10 Nov 2022 06:49:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT101.mail.protection.outlook.com (10.13.175.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5813.12 via Frontend Transport; Thu, 10 Nov 2022 06:49:28 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 00:49:06 -0600 From: Mario Limonciello To: Sven van Ashbrook , Rafael J Wysocki , , , Rajneesh Bhardwaj , David E Box CC: S-k Shyam-sundar , , "Rajat Jain" , Hans de Goede , , Mario Limonciello , Mark Gross Subject: [RFC v2 3/3] platform/x86/intel/pmc: core: Report duration of time in HW sleep state Date: Thu, 10 Nov 2022 00:47:23 -0600 Message-ID: <20221110064723.8882-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221110064723.8882-1-mario.limonciello@amd.com> References: <20221110064723.8882-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT101:EE_|DS7PR12MB8081:EE_ X-MS-Office365-Filtering-Correlation-Id: 592d4884-0d0a-4580-b8ea-08dac2e7b6de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JBWJkffu80cD+caBcBUXI1WkSTHYg/oYSMj2x0pQ/DZ/i3TOaZ6zpXzktjMjijY3Y4dYeOVHbooAAg1pHyv7P5Q7CEuvj3gRCCFfAwwVuUoH2QHBhmRJ99urFnDEnPA+JENIb+TM0IaNd0znV1JfpDNemweiv1XDjrQV8WIoc+l19FIlRM+YrmI39PtRIQwaSC/3ukHTcMTDI/BTw9l4axch7jwfRL/6jobFrFY/TUi/nfyDR3Df2cCZMTCgAjRvargF0O/9Yft2gtkRXMwjexQ9tXSYL90wPYnEVqKeTc2JBwBULdJ70rug2dYAvzd6CPLqleFXQcUkXfCb2MEOQIjd49igCinAVwy3aHgESE2g027eYEvabV+uQcYJLCYS1AKlFk0vfX3TAAPItsczhYsVpWbyHcFUe7CJ9xaWfRGsVaNOocnz5MxE7aadY+ZRoyDtWOIE1/b6bGTzJfqnqBgiR+QN3K0JxZxZywSE+r9LWfbeAswr06x1r0tzL5JBh71EDvl9Z2KP4/oSjp9sKkvC7IqFK52PegfpoZ32YdI0x5jkJYIx/9YKDBe7VJhP4jboCC9r6A9eCLeGrmbSlDAf3CfslW2UjHXCo4bi+LmTqoK+3od7D0IzQTg6r82rm3UuRnQpFI7s7WYH/F16SEdO7b+3udfXu2zuN0TmsGtM0PSljX4/fRc2IQPw0AgoLHlUnTSsgA+4ChmAROe2d8YANnnpQZuKScP4ZkvgihUcHClC8vuJQullgfgKjIQFyLLUlqu8aqjoNMUTnjmpatD10ibm15xQmns9qaUrTx0gXdVwG84W/Y89zIuRuyYk X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(396003)(39860400002)(376002)(451199015)(46966006)(36840700001)(40470700004)(1076003)(47076005)(16526019)(7416002)(2616005)(83380400001)(336012)(81166007)(82310400005)(356005)(44832011)(426003)(186003)(82740400003)(2906002)(36860700001)(4744005)(8936002)(40460700003)(5660300002)(6666004)(40480700001)(41300700001)(478600001)(26005)(4326008)(316002)(70206006)(8676002)(54906003)(110136005)(70586007)(7696005)(86362001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2022 06:49:28.5911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 592d4884-0d0a-4580-b8ea-08dac2e7b6de X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT101.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8081 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749091266607605415?= X-GMAIL-MSGID: =?utf-8?q?1749091266607605415?= intel_pmc_core displays a warning when a suspend didn't get to a HW sleep state. This information is generally useful to userspace as well which may use it to collect further debugging data. Report this to the standard kernel reporting infrastructure that can be accessed from sysfs. Signed-off-by: Mario Limonciello --- drivers/platform/x86/intel/pmc/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 17ec5825d13d..ef2055209213 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -2116,6 +2116,8 @@ static __maybe_unused int pmc_core_resume(struct device *dev) if (!pmcdev->check_counters) return 0; + pm_set_hw_state_residency(pmcdev->s0ix_counter); + if (!pmc_core_is_s0ix_failed(pmcdev)) return 0;