From patchwork Thu Nov 17 22:58:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 21978 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp665375wrr; Thu, 17 Nov 2022 15:01:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf7IS6JlBcH+qlfIx9U3lAnaVDCjT7OmnbeKzuHlrFOexcDfZ4w5YfpyM+EbyMYeebNs8Cc3 X-Received: by 2002:a17:906:a397:b0:7ae:5381:bd02 with SMTP id k23-20020a170906a39700b007ae5381bd02mr3767955ejz.286.1668726103023; Thu, 17 Nov 2022 15:01:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668726103; cv=pass; d=google.com; s=arc-20160816; b=lLo02gegZCGCoND5DLwYuBRMOWrkhhmgzugk/gvajJcgLLNac6NZZ3Zi1sXzHhGMGe CcKd2Bjdx77r2PmvfjRCIj5UfQOWlFYpeqFnFju6tsgxQiMjgzHxZpGEC+jNxGzB3BdI owygpJBNgxkVW24N20ASwoQKwC+s1LLguG4qzdCb/d+PtkLHk96Fv7gYRrqFg6uiswjJ IzE3y3TOOhHYkkIJYhodpLgoDQVskHBnWCv8y/t77DDwjnPCDTX5InRHv08dnr5teSGL IjB/rO/HW8U3zU5FnDOO0J61U5MRLQmLF2F19wIGmHEfFQUPTIxZXgIanX4Q+gZ5CJBl tBfg== 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=9vYM9RH7QTI+zoueCoHtEf8XndNeINySFB4MYccqk4w=; b=lbR5Gj1D0OoJH5Ra6upz9lZ8aHqJ5q67PiwarVdEGRNATshy9TxtaQ5eaC9ehtAwmb yuKAx+LgmJXcsOw3zToDpOB7Jw6ZBUgIafPxY6HRfoNzZhccRq7i6fiHeki2Z9/fMupn 6hyxtIY08jAB7sILjFnQq5SKfJFUNkLOPYkp/dKlWLPcwbSsf1xRfXjnaMaNTYcTDFZ7 TyLcyNpPBN6PKoQqv03tWIlfU7CvRjOrr5I5UhgQI8YJwutru72weG0ENjiu4yLr4OjJ xsPIKkZSbcYJNyQNL9GT+u9Zh2XB9R8NWdV+3fyLcXMWIBW1ExsIywL9cZnYSmJME/vr A2HA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Rf0Ix+s7; 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 qw11-20020a1709066a0b00b00787bacce740si1733134ejc.537.2022.11.17.15.01.13; Thu, 17 Nov 2022 15:01:43 -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=Rf0Ix+s7; 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 S240724AbiKQW67 (ORCPT + 99 others); Thu, 17 Nov 2022 17:58:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235129AbiKQW6r (ORCPT ); Thu, 17 Nov 2022 17:58:47 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2081.outbound.protection.outlook.com [40.107.101.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95741A193; Thu, 17 Nov 2022 14:58:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggeBx1EZsHzve8zDQDyUbgHV6e5yUllhMEmKBBZSXRTyVtRikndnAsKiAM6Ux9iNP6lnHEDk0z1FG0u2zCdXd6rAIhKc0QjRakZpXFhxIFJi5JGc7ZkqfSNMXvd+IWHi+nNXId6a3Fj0woGBkiQXMO0wY9UggzegqAWeM0LpoAU3FAuEQNKduu/eWweOxdisMsLLYnqOxFU8Tv0v79Bb4WXYnQb6GunikFzCUUYeX8nMxhnbHpMGm/7eSZ6n7Z/6gc7VchDQzpBDJYtav5nydgRo/8ujbpzOB+WAm2lngTjROa05s+j57pBCtgV6yDH996ONUJ/OMzQ6jPHklBgShg== 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=9vYM9RH7QTI+zoueCoHtEf8XndNeINySFB4MYccqk4w=; b=ZpatHFOvYxLWPbiGQjs4ZFFE2nl6V3JiS8gZj69FR283UnmLKDJLnkv83K40Ry9ygHzTQdilK7Nb+Kt211uTMNropQdeFx//0Fzn4I9cAZHkDpFbEeLe6Msi4qKNZgFunw0+JMDJfvFo1Lf2pEufyZ0vkF5rezfIE54P++IfxTjIvdS/b9c8OdFBb1eMqUq6kecz2oSh90yESWBJIYusXBVnYO/QMggdbThIjOQ17csNq/DkwVgoRGML9PcNyJ0/DwOs1Ml4p5irJ0WuO2gUTz4wxZjg2g7qnaSecAGEso6twJHl+W2XVxsoUqkijm5O7C/C+Dr7PAQpFM7BcxmJIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=9vYM9RH7QTI+zoueCoHtEf8XndNeINySFB4MYccqk4w=; b=Rf0Ix+s795RpYADCFS1MPaWP9o5xlbrIgRpWwQ9499HRTBLCjCleR6zLVvBfrhY1b43Or48BWbLr8i1nuBGa58k5jhJGL7ODJ5zlhNtQa/S5XpcfbNpgk2ZQUx0ScbT8t6lBbgGFfdmWXhPvzqQDN2p4JysuNo2caAnQQTYwr1w= Received: from MW4PR04CA0222.namprd04.prod.outlook.com (2603:10b6:303:87::17) by IA1PR12MB6044.namprd12.prod.outlook.com (2603:10b6:208:3d4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.18; Thu, 17 Nov 2022 22:58:25 +0000 Received: from CO1NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::fd) by MW4PR04CA0222.outlook.office365.com (2603:10b6:303:87::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20 via Frontend Transport; Thu, 17 Nov 2022 22:58:25 +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 CO1NAM11FT057.mail.protection.outlook.com (10.13.174.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Thu, 17 Nov 2022 22:58:25 +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.34; Thu, 17 Nov 2022 16:58:24 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , Pavel Machek , "Len Brown" , John Stultz , "Thomas Gleixner" , Stephen Boyd CC: Sven van Ashbrook , Raul Rangel , , , Rajneesh Bhardwaj , S-k Shyam-sundar , Rajat Jain , David E Box , "Hans de Goede" , , "Mario Limonciello" Subject: [RFC v4 1/5] PM: Add a sysfs file to represent the percentage of sleep in hardware state Date: Thu, 17 Nov 2022 16:58:17 -0600 Message-ID: <20221117225822.16154-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117225822.16154-1-mario.limonciello@amd.com> References: <20221117225822.16154-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: CO1NAM11FT057:EE_|IA1PR12MB6044:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d85abbd-56bd-4961-daf9-08dac8ef3bfd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pEBbrXsstFrZB6K0U74zfbXx9/m+wR6o9VdKvF2lOVe2ErY9k4hCaWh2nexCYmSqgbp4cBB9C7KcEJ4HKOzF8IfyqwWEE0p4+kST0h62cOn9XKRxiapCfbWfrQOIsF9hCWB9JlJuO2pnyf413Rs8EdvcnEL0I5Ha+xIEgtplr5qah1ysJlZXhdCGg6w0TTbuUS6vnl8782VtbwceKfpZ28GNYhFJ346V70xkEjt8MrAmAuHZW5eOe072syJrRC0qAh6plMrWXQVsZAqgvTP/67NziGaNva21gW6e0FSB6V+x/znw55E9aOay0xwaE7j6Qtdxxj1xT8iDcwGi5/ANhUuFB7lRERahcMkhYWPVsjuDom+nXolAZy1+q1Q1atfxj5tyvC1AEMOYWCl2jl0V38AGxNNqPUozVoaEun9Iadavbqo6Ra2/qDbzlXWiyxHaICyBRSGQoOsRJ4MuO/0cVujZivS+8P+Us/zRgntq3DF1JZVcZ9bHqa0RgnTbgJZI3lNacb00q3PbpCNl1Y5TgVtN/ENfVItyA2DxLndGXe13A/tEr0dSgjad9F4H4kPYObApNqXwf1a3Prb1acHOaYWAWl17odzkjMx3xFpVy3QGOSwLxYKmkQLcvjUbMnGsJca142lAIfxsyTvyZv3tUbvA7fUT3FyqV3W10LKZyO7FGPNPPbVeytArY+AUVgyVfIbOpu8bTXN0N717BH3YXNBaDJwMwYG85kyhett6g04= 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)(376002)(396003)(39860400002)(346002)(136003)(451199015)(36840700001)(40470700004)(46966006)(426003)(40480700001)(47076005)(336012)(5660300002)(316002)(2906002)(356005)(186003)(40460700003)(41300700001)(1076003)(70586007)(36756003)(7416002)(8936002)(16526019)(44832011)(36860700001)(26005)(82740400003)(2616005)(70206006)(83380400001)(4326008)(8676002)(86362001)(54906003)(81166007)(110136005)(7696005)(82310400005)(6666004)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 22:58:25.4015 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d85abbd-56bd-4961-daf9-08dac8ef3bfd 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: CO1NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6044 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?1749786142053664462?= X-GMAIL-MSGID: =?utf-8?q?1749786142053664462?= Userspace can't easily discover how much of a sleep cycle was spent in a hardware sleep state without using kernel tracing and vendor specific sysfs or debugfs files. To make this information more discoverable, introduce a new sysfs file to represent the percentage of time spent in a sleep state. This file will be present only if the system supports s2idle. Signed-off-by: Mario Limonciello --- RFC v3->v4 * Switch to a percentage for reporting * Hook into timekeeping differently --- Documentation/ABI/testing/sysfs-power | 9 +++++++ include/linux/suspend.h | 2 ++ include/linux/timekeeping.h | 1 + kernel/power/main.c | 36 +++++++++++++++++++++++++++ kernel/time/timekeeping.c | 20 ++++++++++++--- 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power index f99d433ff311..60b6948f5982 100644 --- a/Documentation/ABI/testing/sysfs-power +++ b/Documentation/ABI/testing/sysfs-power @@ -413,6 +413,15 @@ 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_sleep_percent +Date: December 2022 +Contact: Mario Limonciello +Description: + The /sys/power/suspend_stats/last_hw_sleep_percent file + contains the percentage of time that the last suspend cycle + was spent in a hardware sleep state. It is expressed as an + integer between between 0 and 100. + 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..e0f2ac5f4406 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -68,6 +68,7 @@ struct suspend_stats { int last_failed_errno; int errno[REC_FAILED_NUM]; int last_failed_step; + u64 last_hw_sleep; enum suspend_stat_step failed_steps[REC_FAILED_NUM]; }; @@ -489,6 +490,7 @@ 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_sleep_time(u64 t); #define pm_notifier(fn, pri) { \ static struct notifier_block fn##_nb = \ diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index fe1e467ba046..2a81366f3e31 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -70,6 +70,7 @@ extern ktime_t ktime_get_coarse_with_offset(enum tk_offsets offs); extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs); extern ktime_t ktime_get_raw(void); extern u32 ktime_get_resolution_ns(void); +extern u64 get_suspend_duration_ns(void); /** * ktime_get_real - get the real (wall-) time in ktime_t format diff --git a/kernel/power/main.c b/kernel/power/main.c index 31ec4a9b9d70..be82f4a740c0 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 @@ -83,6 +84,12 @@ int unregister_pm_notifier(struct notifier_block *nb) } EXPORT_SYMBOL_GPL(unregister_pm_notifier); +void pm_set_hw_sleep_time(u64 t) +{ + suspend_stats.last_hw_sleep = t; +} +EXPORT_SYMBOL_GPL(pm_set_hw_sleep_time); + int pm_notifier_call_chain_robust(unsigned long val_up, unsigned long val_down) { int ret; @@ -377,6 +384,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_sleep_percent_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + u64 t = get_suspend_duration_ns(); + int p; + + if (!t) + return -EINVAL; + + p = min((100 * NSEC_PER_USEC * suspend_stats.last_hw_sleep) / t, 100); + return sysfs_emit(buf, "%llu\n", p); +} +static struct kobj_attribute last_hw_sleep_percent = __ATTR_RO(last_hw_sleep_percent); + static struct attribute *suspend_attrs[] = { &success.attr, &fail.attr, @@ -391,12 +412,27 @@ static struct attribute *suspend_attrs[] = { &last_failed_dev.attr, &last_failed_errno.attr, &last_failed_step.attr, + &last_hw_sleep_percent.attr, NULL, }; +static umode_t suspend_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx) +{ + if (attr == &last_hw_sleep_percent.attr) { +#ifdef CONFIG_ACPI + if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) + return 0444; +#endif + return 0; + } + + return 0444; +} + 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/time/timekeeping.c b/kernel/time/timekeeping.c index f72b9f1de178..49119a942cb2 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1779,7 +1779,7 @@ void timekeeping_resume(void) struct timekeeper *tk = &tk_core.timekeeper; struct clocksource *clock = tk->tkr_mono.clock; unsigned long flags; - struct timespec64 ts_new, ts_delta; + struct timespec64 ts_new; u64 cycle_now, nsec; bool inject_sleeptime = false; @@ -1806,16 +1806,16 @@ void timekeeping_resume(void) cycle_now = tk_clock_read(&tk->tkr_mono); nsec = clocksource_stop_suspend_timing(clock, cycle_now); if (nsec > 0) { - ts_delta = ns_to_timespec64(nsec); + timekeeping_suspend_time = ns_to_timespec64(nsec); inject_sleeptime = true; } else if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) { - ts_delta = timespec64_sub(ts_new, timekeeping_suspend_time); + timekeeping_suspend_time = timespec64_sub(ts_new, timekeeping_suspend_time); inject_sleeptime = true; } if (inject_sleeptime) { suspend_timing_needed = false; - __timekeeping_inject_sleeptime(tk, &ts_delta); + __timekeeping_inject_sleeptime(tk, &timekeeping_suspend_time); } /* Re-base the last cycle value */ @@ -2232,6 +2232,18 @@ void update_wall_time(void) clock_was_set_delayed(); } +/** + * get_suspend_duration_ns - Return the duration of a system suspend. + * + * Returns the calculation of the duration of time that passed while a + * system was suspended. + * + */ +u64 get_suspend_duration_ns(void) +{ + return timespec64_to_ns(&timekeeping_suspend_time); +} + /** * getboottime64 - Return the real time of system boot. * @ts: pointer to the timespec64 to be set From patchwork Thu Nov 17 22:58:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 21977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp664297wrr; Thu, 17 Nov 2022 14:59:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iNawhpUWUSf2d3Es9aA+pg6ylU623hOByVzdQ/ktexssis7I9BN5yc7/ZaT1Ybc1wFAwT X-Received: by 2002:a17:90a:7a82:b0:211:55d8:4cdd with SMTP id q2-20020a17090a7a8200b0021155d84cddmr4761010pjf.133.1668725971835; Thu, 17 Nov 2022 14:59:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668725971; cv=pass; d=google.com; s=arc-20160816; b=xWWccf0WfM/2X01YOV1e1IVXarBgxP/d7QbtAJWhEXau796XpHFDSbkUx5qH1EAtrg IVsBOUPXdOWFgKokqcTt6z0ZhPVWFHROUm7Mr9sdPiwZUYOHJestRF2qUezuKThgcwDD ePBeQ7MlZKbub8Vh7pck/OHEcRxaxjur2Pkb0GCZSXAKNvtUq+QoWyw9t0Xw+fFdN0nd iohPAsvFSuCeeDsgX1LLl9y0+NBEpodAdJEu2sBhdrf5NRp8/yJJlrkY8T4CEuw56XwO ZNBKTvgtlvQvL/68zt2u7Fz6C6QK9jpc02XEHjar47cEuJBgGLOCGIdiE4yNArwUBtdA dLjw== 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=6Cn+SZ0pQkRRHNig5rZRmIcZCeUdeodXgn9qZED4OZs=; b=1AmnhwBIENEMNUmn04tXi8NyIv7HuU1TkVHLLdZC05JMIrREqLnTdrtWtLURcBY2Kr C9f+mGX8DBThm61I114vt6F2tpLlbKuzp5vmHKxx7C4kZGOtdfXGN/U7w1BDJaGTFOIU 3EEMrx1T769VJZCPdJvGn7V6HFkjRMBemo6qvQsJrKgsgJlF4kdJheGE5e+/DAHS05QP G1t6LyIsT1eJBSrtVs1CfjjVeo/gxlaPKHm6qhZYFyebj9F29YhagVl3aPOvDbKRt3A+ mS3ng7t6kEBjPzAul8j29vL2RyQ+SXiwCYasSYFyI1yCD2RE3Oq9O+gVLBt2OYJLRP7u 6t0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=sNQ7cLkf; 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 63-20020a630442000000b0046f622b47b9si2213196pge.180.2022.11.17.14.59.14; Thu, 17 Nov 2022 14:59:31 -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=sNQ7cLkf; 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 S240662AbiKQW6w (ORCPT + 99 others); Thu, 17 Nov 2022 17:58:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234959AbiKQW6r (ORCPT ); Thu, 17 Nov 2022 17:58:47 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2048.outbound.protection.outlook.com [40.107.243.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73444E09A; Thu, 17 Nov 2022 14:58:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ik5V3btbzYIMxNYi9/Q+pnWIhAJa+UusVPLKHv3bnL+DY7QBEsMbd55ywcuFsOxxEBgplXpixqg0aAs6NP00W0CRbm0mGySkP7twsKz67b2yipc+LcTpatFTnRS0BXMAaDdgedzhYd5hVRRo70XlJgOBP3qhgaOlZ7krr1X4n24UaLaV5Ge1bx6yfHigVZuFle3Hw0BK01xSJSTcliGfyVm1fH406jeU+Ucw5Zz1c2qXePpMDbJUmTiXfKlWTB+f5f2IeIe9biHiq807VKvdABK3DM6eQnbElzd4Nq59I7T5WqJV0pXFAcP2vGgMyVIhc33Lahr+exuMrRl0FV9q1A== 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=6Cn+SZ0pQkRRHNig5rZRmIcZCeUdeodXgn9qZED4OZs=; b=ifVMq2JRSfdGObWS5D8wKkT7lWg+TeH8vV79uPwd2b99ORwQYMuIrFp0JbFSkre4xEQCVdCu74BbjzjN1ojRMTTRlQvWE0ike1amRrL1FmDD+EGrBOdun15fvsOncBRj/U5N1EBoZxbeI4oo/LGDeohM+MPCpFQgKpKKFvOg4ER5HNXqSydmy40uFZPRZwE2COu5ZxQnn5OOKFqJK8GZEIOzyRW+UF+O41xepUQRWFw1QSfWVRm4B6VweW7tpFSR8HzLrSN4bLSRK6/KbbHVb5fN51id4WZAz6W2XhAp5W+93BFcVy7yyBhrWhoWoUKSgoBtDgYaSDH51t25zV3Rlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=6Cn+SZ0pQkRRHNig5rZRmIcZCeUdeodXgn9qZED4OZs=; b=sNQ7cLkfJOGHVLlxjj3h5BQAz8wX+MgU2FfyZQGqKhK7SKrPN4HCHEc1mzW+rVVyIeK0bai8Se32OPFw0kZbzbLCtZxwa9exmt4jv/0/YfeCpZzdPvHH77iON6sC2LU8kQhZ8XW1Qs+UOT71LkjE0ja4fN6H2W5K+wreDd5YXhs= Received: from MW4PR04CA0080.namprd04.prod.outlook.com (2603:10b6:303:6b::25) by PH7PR12MB5687.namprd12.prod.outlook.com (2603:10b6:510:13e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.18; Thu, 17 Nov 2022 22:58:27 +0000 Received: from CO1NAM11FT083.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6b:cafe::dc) by MW4PR04CA0080.outlook.office365.com (2603:10b6:303:6b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20 via Frontend Transport; Thu, 17 Nov 2022 22:58:27 +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 CO1NAM11FT083.mail.protection.outlook.com (10.13.174.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Thu, 17 Nov 2022 22:58: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.34; Thu, 17 Nov 2022 16:58:25 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , Shyam Sundar S K CC: Sven van Ashbrook , Raul Rangel , , , Pavel Machek , Len Brown , John Stultz , Thomas Gleixner , Stephen Boyd , Rajneesh Bhardwaj , Rajat Jain , David E Box , Hans de Goede , , Mario Limonciello , Mark Gross Subject: [RFC v4 2/5] platform/x86/amd: pmc: Report duration of time in deepest hw state Date: Thu, 17 Nov 2022 16:58:18 -0600 Message-ID: <20221117225822.16154-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117225822.16154-1-mario.limonciello@amd.com> References: <20221117225822.16154-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: CO1NAM11FT083:EE_|PH7PR12MB5687:EE_ X-MS-Office365-Filtering-Correlation-Id: b25f84a3-17b0-48d2-81e8-08dac8ef3d1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IuDltS+EzcYsEvzJ8c1ERWk6y8Rs3mJTjf24IqgG1AW3oFtJW3mrLbsgr7MXd/E93cEPC4DAOhFCRuEIsu/WwtbYSihjQCpS8szzMDSZJtUfEThqztJk0k8GMJRHyWLo+9er64Jc6ImUWGB3hGpImWoRFgR+ZgyDRLA31ekM40tHuENHN2JE1JgxkX4ycL/uDMvW0Uo+CX4o6PaB9zP4GggIVYPNAAGzzDICuJ0WIepWBfFvnb9CQCh+x0YDqlKzJIwCWvR+w4u3uxBzyzdx6rhczOmsKhhvHNkH6irR1/68ZB1PAfaZq4hnT3KYwMFyR1kYBWAm7y0w7BfwPCiEoG8fFix23tya42UBCW30DmpEQkVgk8L/s3WlORpp4+pD0LToJzDXAat8bG5AsVSByxb077PQKMOBYvh67bjd3/QzjPoTEGkwC8Di2P9VM5sw52YTqhwNBa2/4u50+vhibDfAcU0cUGyKIbeVQjXI4rWyrJYDnVrrn2c02qip9RRjuzwqijzan169d99qoWwZ67jxPCAkDnXLFVGy2p1lIyE7C1e/638p8bGrLEcoxzLFXtfObW4FVbKt+bRqRl15SeIN36kCz6nc7LQ9vL+KCNWsTtiy7dJSPY+YIFfSTh10gOysvERFHlGxi6ltWWsEYSDtvjBaLPbiTExtO1D21Qet5Ky44BBmYJrZVO7vCR9I7Ao54yr85TJ92GmTNmkmCwcVHqNzOvmjMM+WbzYy/Wo= 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)(396003)(376002)(39860400002)(136003)(451199015)(46966006)(40470700004)(36840700001)(47076005)(336012)(426003)(1076003)(16526019)(186003)(2616005)(36756003)(86362001)(6636002)(110136005)(40460700003)(316002)(54906003)(356005)(478600001)(82740400003)(81166007)(40480700001)(82310400005)(36860700001)(7416002)(6666004)(26005)(83380400001)(7696005)(41300700001)(8936002)(5660300002)(70586007)(44832011)(8676002)(70206006)(4326008)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 22:58:27.2867 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b25f84a3-17b0-48d2-81e8-08dac8ef3d1d 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: CO1NAM11FT083.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5687 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?1749786004435430710?= X-GMAIL-MSGID: =?utf-8?q?1749786004435430710?= 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 kernel for usage in displaying to an end user. Signed-off-by: Mario Limonciello --- RFC v4: * Report time to kernel again, letting kernel calculate percentage --- drivers/platform/x86/amd/pmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c index 96e790e639a2..2e3d8ff5659e 100644 --- a/drivers/platform/x86/amd/pmc.c +++ b/drivers/platform/x86/amd/pmc.c @@ -363,9 +363,8 @@ 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_sleep_time(table.s0i3_last_entry_status ? + table.timein_s0i3_lastcapture : 0); } #endif From patchwork Thu Nov 17 22:58:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 21981 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp671376wrr; Thu, 17 Nov 2022 15:15:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf49DjW8gA89uE+dDudxxDRBVNkUj4m5BXnDxJicE1jNG4uFSsyiqoMXRAUyZjk/xy4vmOf9 X-Received: by 2002:a17:902:7449:b0:187:31da:a274 with SMTP id e9-20020a170902744900b0018731daa274mr4847417plt.103.1668726939736; Thu, 17 Nov 2022 15:15:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668726939; cv=pass; d=google.com; s=arc-20160816; b=e0Wxa12Jbhvt6vBWEPvggWbpX92+/G8IOS1EAdX/7quW2N9fe+RlCwcV26LfTGPmMm PD4ZIuqQle9kOPwgOxiVzzk6P2px6y31Eg2ltb/EWs3e8q4h7XlrnUERtWo3UipaaauR KGW1ntVs10B3bxpXUg14RXA+sc3MhKWWKzFIcdqf9eoF+n/eA5rLNJ5Hil0KnPx79l9n TEGADPPCFAOFfQ7zvb75YhoDW0fBFXl9/6si4ABarSiSkreT4tCu+ANThWYH86KDPVXz Z5k6fiE8/CiTsG84xVe0PQYPopVxeJDS5wiuQNJC0kPINb0GVEwlAMJImJq3GqpaYdBU YR5Q== 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=L+/X29lmRHgI2UbPvsa4Gj8XsmqN3IqycqK0f56Sb7A=; b=PMBMX54CXizS2feYKJNfVyNsWTSyJuikElgbt969YSmcbXYz2hc2Bp4lcRK885n12X 5Lhvx5CLq4yjYMxMGk0aKmohQVU+2JKOUSaDbJ0pkJGaMHeN5SunBnikisdOq8dp5Qlx 6YdkZuxbwM3AyXljtfhM7rr85AzoRvgeSFKW96H23DfYFNDsT+u7zaNYGDYKrTV6bfxz 9AGTYVWjnfegmu/SCOzGTp6towh1wLqdUXO7FT1d35sZpGiv8rbV9F2tsW6tKimTkdks 3eHc5bBJdHUVLVTNNPScQj5igJgurwsBYD+FSLuuqiPrqCFLr+5tYe502MD5oKHIbUJu xqww== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=BCYhQWFF; 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 o20-20020a63fb14000000b0046f6afe556bsi2238915pgh.651.2022.11.17.15.15.24; Thu, 17 Nov 2022 15:15:39 -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=BCYhQWFF; 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 S240728AbiKQW7G (ORCPT + 99 others); Thu, 17 Nov 2022 17:59:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240455AbiKQW6s (ORCPT ); Thu, 17 Nov 2022 17:58:48 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2058.outbound.protection.outlook.com [40.107.220.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0ACB10B5C; Thu, 17 Nov 2022 14:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PByVHZEmndZEVolMbyihxNZ0V5ZSuHfUGyh1gC6GPicAtVORbczkQ+Fh8Zt2wrdK1DT/ggw+moY50ypAcyWez7LNM6Y5hL1eUDRIqSiGQtKcpcQ+2ajwx7+PqGuEyKrQ6XNHxJ77EcFryE1NmnhnZJA8For2vKgCWYXZKLWVz/Um5TkEmaeiC86i+/2k3O0FTO6SUnetmarNFV4fpW5wgzfkCaaggHgYc91OosF30wVfvYI0AIuBc9Y+HLEEALnI7a+zDg8D8K5cLDQepcyFs6TkQoO1/SeVukHpnHzfanvK6cLs0MLiubaIAg1ArMgfZTiA9P0W5l6Ku63MjDrOJw== 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=L+/X29lmRHgI2UbPvsa4Gj8XsmqN3IqycqK0f56Sb7A=; b=PABlshNxbGDgdjdM30EDLLWoZyvQpbkHDeslZXdIThVyaKzqyCXx8ir0RsdXQQQesbjOmpiF/mOIK3LDSBVFpL0wAKT9WSuCUcPddsNdwWPb+lMydsN/SXVtGbq+akhrgkJIu7sfVJjbO0931mZuOXiGFNzVfTek/Z5qYLyAfe3yIUc+LFEnYSDtgJuU7qbVHAwPxY8tBoyHJU6lZUx6Ic6mdoaaTA3FoBkuhgNNv8SmCyrbC5fwFfikU5ahLRomQoF7AqJhFEtE8nEXit2CiVtUxo6ORd3Io2uLr4+ft3waCmHtsWXtEFDtbAMwja6I+WdpS9gf+m68O9yYLj9i5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=L+/X29lmRHgI2UbPvsa4Gj8XsmqN3IqycqK0f56Sb7A=; b=BCYhQWFFP/8wGdJ+AATed23arR4uBLCRdJrxeaHuRTk+89z41kaq18JkrocltN795g0UN/HoxAa1ns0ThCwsSJMqc2LQIcWwatoRh/9fwrSa+NHxW4hc78X4DLGoZ3MWM733SUrLi9Q5hI/6wCgahGTaA0jywt7gu3mEvALN8Fo= Received: from MW4P223CA0006.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::11) by BL1PR12MB5828.namprd12.prod.outlook.com (2603:10b6:208:397::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.19; Thu, 17 Nov 2022 22:58:29 +0000 Received: from CO1NAM11FT092.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::e8) by MW4P223CA0006.outlook.office365.com (2603:10b6:303:80::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20 via Frontend Transport; Thu, 17 Nov 2022 22:58:29 +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 CO1NAM11FT092.mail.protection.outlook.com (10.13.175.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Thu, 17 Nov 2022 22:58: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.34; Thu, 17 Nov 2022 16:58:26 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , Rajneesh Bhardwaj , David E Box CC: Sven van Ashbrook , Raul Rangel , , , Pavel Machek , Len Brown , John Stultz , Thomas Gleixner , Stephen Boyd , S-k Shyam-sundar , Rajat Jain , Hans de Goede , , Mario Limonciello , Mark Gross Subject: [RFC v4 3/5] platform/x86/intel/pmc: core: Drop check_counters Date: Thu, 17 Nov 2022 16:58:19 -0600 Message-ID: <20221117225822.16154-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117225822.16154-1-mario.limonciello@amd.com> References: <20221117225822.16154-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: CO1NAM11FT092:EE_|BL1PR12MB5828:EE_ X-MS-Office365-Filtering-Correlation-Id: 528dab81-d01a-4428-0302-08dac8ef3e03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zFM60C1uNwv7+cA+ge1ofwV5zNd43ja+NRT0X4m01/EyqCdMXqx7lm4JBqptPoRG+a2TZtXMCm1Y/U55D3Eku2qkNmZ7nEfAONb0Nhe5siBq78uEe2+g/EBiP9ZNmaqVhaW9VjPDUC/BZde+6cGXw37RmSno8sw/IaxaJv9lCortHZ/VRsvK6nnBMnwubaC6Fom+r+suMFl3a9k8ex1krU+H7ID8Fho8598pPs2ySK2r2r88yEzJKtgBG5Donh6XskSwY6Ah6VQW+Tp75iwViE9bUnL9H2FExUb/vfTf3K3IV6E41WpiHwBNwCv3MUlf12iHYV87oGn4QQtS74p1Z0iYzCLJGIw33RWyernxmGDsztYiosvZmkP/SyaQK8vufARJpuKDF3v+mAuIU8cZ7kWULXvEeLVcX++p7hgbTY5X9NvFeCp5SqQBvxXEb7icvxPm6HhmncuK+Dm3NiOPGwUDia7MHBlk/YPc0ElQNdhiKBpXiz65qW0v9hQBuHqlEn8HoS2ljWjzkkEbWfzqvqSJ2a4e/LGuI5Ig/NK9g+0f0jbVl3cM3mGsEhhVjQrkCW0xkv3LQtZAS4mNFvseU3zFHI81sCNkv4uvKrEsrD9x9JCtNPl/P71SSJz9CWcaEV5TTL/7aUIVeMnnSiN1ro6hA96AZiR4BRGh316+3PLs5CiM9LWtetLcuGPNWYuyS3JDm5mcZfg8ZRwrHLYohSoaYOOnKX0s0G4FNtk+fO8= 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)(39860400002)(376002)(136003)(396003)(346002)(451199015)(46966006)(40470700004)(36840700001)(2906002)(356005)(8936002)(40480700001)(7416002)(81166007)(44832011)(5660300002)(82310400005)(4326008)(70586007)(478600001)(7696005)(6666004)(26005)(36756003)(8676002)(36860700001)(40460700003)(83380400001)(70206006)(41300700001)(82740400003)(54906003)(16526019)(2616005)(86362001)(47076005)(426003)(1076003)(336012)(186003)(110136005)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 22:58:28.7907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 528dab81-d01a-4428-0302-08dac8ef3e03 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: CO1NAM11FT092.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5828 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?1749787019975126613?= X-GMAIL-MSGID: =?utf-8?q?1749787019975126613?= `check_counters` is a stateful variable for indicating whether or not to be checking if counters incremented on resume from s2idle. As the module already has code to gate whether to check the counters that will fail the suspend when this is enabled, use that instead. Signed-off-by: Mario Limonciello --- RFC v3->v4: * No changes --- drivers/platform/x86/intel/pmc/core.c | 7 ++----- drivers/platform/x86/intel/pmc/core.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 17ec5825d13d..adc2cae4db28 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -2059,8 +2059,6 @@ static __maybe_unused int pmc_core_suspend(struct device *dev) { struct pmc_dev *pmcdev = dev_get_drvdata(dev); - pmcdev->check_counters = false; - /* No warnings on S0ix failures */ if (!warn_on_s0ix_failures) return 0; @@ -2077,7 +2075,6 @@ static __maybe_unused int pmc_core_suspend(struct device *dev) if (pmc_core_dev_state_get(pmcdev, &pmcdev->s0ix_counter)) return -EIO; - pmcdev->check_counters = true; return 0; } @@ -2113,10 +2110,10 @@ static __maybe_unused int pmc_core_resume(struct device *dev) const struct pmc_bit_map **maps = pmcdev->map->lpm_sts; int offset = pmcdev->map->lpm_status_offset; - if (!pmcdev->check_counters) + if (!pmc_core_is_s0ix_failed(pmcdev)) return 0; - if (!pmc_core_is_s0ix_failed(pmcdev)) + if (!warn_on_s0ix_failures) return 0; if (pmc_core_is_pc10_failed(pmcdev)) { diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h index 7a059e02c265..5687e91e884c 100644 --- a/drivers/platform/x86/intel/pmc/core.h +++ b/drivers/platform/x86/intel/pmc/core.h @@ -316,7 +316,6 @@ struct pmc_reg_map { * @pmc_xram_read_bit: flag to indicate whether PMC XRAM shadow registers * used to read MPHY PG and PLL status are available * @mutex_lock: mutex to complete one transcation - * @check_counters: On resume, check if counters are getting incremented * @pc10_counter: PC10 residency counter * @s0ix_counter: S0ix residency (step adjusted) * @num_lpm_modes: Count of enabled modes From patchwork Thu Nov 17 22:58:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 21980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp669880wrr; Thu, 17 Nov 2022 15:11:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4bx+HbkAPL0cwRma8kMy7sGkAUaDfeLxITjdni1d8aPtkFh5Y9NCAn82sKAa7Ii8ulr+y3 X-Received: by 2002:a17:906:a1a:b0:79e:9aea:7b60 with SMTP id w26-20020a1709060a1a00b0079e9aea7b60mr3960648ejf.444.1668726698619; Thu, 17 Nov 2022 15:11:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668726698; cv=pass; d=google.com; s=arc-20160816; b=sfP4cowh1BPjEBAWRf5ndWR1MvuLh9Py6Qt8tXI0GWKTY/SnfPW8eyXHNNyL+rsu9Z ZLK7UTtOXx+Ep5EYblAN8MWhlupdj1lozoFObPcVUUI2al/UqSl1CGvv7j8nMkzDD4GZ LvC/aHxJ9LqQBW1v2DgUh9nF2GuRhTM6TKk8tFNDU1aGQeUPKLtfWiJhyeAm80PlFDIA aEYzNWtEmAct57CTDt5oH2GW3UbAwwlJysedFUTW+o4H1Yh3uTn5hIP3gXZqoO/ZJSpG 9NLSjkOLAjEnaBCZDUEwg+q44u7pCVWjKoGIb2+kOUHSyoZ+KvxSZZoudQQ1Z2aqK20o nNsw== 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=Ex27RW0cibhWiM+YZoJD3N4nbEElqwCzQ/Q7Nx4RqsU=; b=acW+W6sKU+cHHF5gyDiDjxhaJ8mpEAmzl2l36wo8Iamkf4sNMqH397JYblc0yIf3FQ IPeJHad0/0+VO+EXh8HMxt8Z4sdbXOs0T/M3P6mumpXxKAs618jE9Bbl9OTwPBtWV0iq WCw8cVATR4xnCh5C1Q3LxT8qXk7doD5JGDXe93nFYnOzYvqlGkWYvBxG5xaS/CwurRzA +9VaGEJ+9VjHMU8MTzW/haHYyfIPVrIxuUeOlO4pCjl2WXf1ougLmzjR9oqNB3qpmKLf m17YM7o1FRXzLwG4Xwf8zM5bTkOL9LyYMBaIj+OG0rHIv6WmlJOUOMsJVAE5FTsg8XAw a72Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=M4xzqJ7q; 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 hp11-20020a1709073e0b00b0079744630e4asi1691689ejc.780.2022.11.17.15.11.13; Thu, 17 Nov 2022 15:11:38 -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=M4xzqJ7q; 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 S240752AbiKQW7Q (ORCPT + 99 others); Thu, 17 Nov 2022 17:59:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240483AbiKQW6t (ORCPT ); Thu, 17 Nov 2022 17:58:49 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2081.outbound.protection.outlook.com [40.107.223.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E75811155; Thu, 17 Nov 2022 14:58:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9o4ZgamFJvqJ2V7q07XPFiYiIttwAHrI99RPLprn6pinZ85mZX9wn8imigemtMShFEP0lJj1wn3Ba9nI5cs2gKhrOPtqUvTMrTOAurZxbU9XTYWndIx2XqsAZgGBTWvt4TdHBhuimQ8o+nL9hXdGZ5KpGbzL4rGSkOnpzRRrCPiaLhNXCnAs/1gSlY2TMzwbM6zg2Rx+V1SCI4lkSCkHy62SaGNZKA70d0YaO5za0GCIbDOn8ZXjXfjTs3fLEb2QucPp0hfynzdZKU99DYRBroSR/Sa4GNYX4KGhIB35YVGimegAIuboqzc2YWlggVlW4S+aGnf/WJ7QsRWucmh+g== 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=Ex27RW0cibhWiM+YZoJD3N4nbEElqwCzQ/Q7Nx4RqsU=; b=YJ0H783K/gaX6ld7HRzme0oAXn0C6a2QYKoY9CBMfpvHmfkQmasmrJR/hq+IOAL+5+Mhc8VItc9MDgeWfTAPxrlTZWzEEl/wo9Bav6aXymXe4c7CaiRUXLd+icn4FwKfybm8tGSOjFQ8lUuw6tK6Pet8A/Iw0mSungJct2qMnyqReNKbvSUQ3M8QyiXdm4J4K8gHLVYNOdh1Xr+2hRnk64ga7bEhvszp5q1IBo4gzkUn1ADPV6DYsXhGTg1ipL3rB38ilPcybnzdLoZ5/olbK9HOpby18F57uyNHx/G4EZ3ryR6DkvXZZKpv7Q5WmeYT0+z6h2TGsdwmlVJL2+B2+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=Ex27RW0cibhWiM+YZoJD3N4nbEElqwCzQ/Q7Nx4RqsU=; b=M4xzqJ7qi9Vv+6KtSIzsiIaSik8PB0Jp7OiAgsTV7Tv07E9j5EqFbss0nAdFeeXQy3l1qCON6XSHuXzb2n1obVnT5haIXcz8kPGdFCdETsTHPC7aI0WAhzcuJ7niFTLYmOY0vbRatEuB+dL+CC33u0dWpQhhFjBKfryKM1vxam0= Received: from MW4P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::17) by BL1PR12MB5255.namprd12.prod.outlook.com (2603:10b6:208:315::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.19; Thu, 17 Nov 2022 22:58:30 +0000 Received: from CO1NAM11FT092.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::62) by MW4P223CA0012.outlook.office365.com (2603:10b6:303:80::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20 via Frontend Transport; Thu, 17 Nov 2022 22:58:29 +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 CO1NAM11FT092.mail.protection.outlook.com (10.13.175.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Thu, 17 Nov 2022 22:58:29 +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.34; Thu, 17 Nov 2022 16:58:28 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , Rajneesh Bhardwaj , David E Box CC: Sven van Ashbrook , Raul Rangel , , , Pavel Machek , Len Brown , John Stultz , Thomas Gleixner , Stephen Boyd , S-k Shyam-sundar , Rajat Jain , Hans de Goede , , Mario Limonciello , Mark Gross Subject: [RFC v4 4/5] platform/x86/intel/pmc: core: Always capture counters on suspend Date: Thu, 17 Nov 2022 16:58:20 -0600 Message-ID: <20221117225822.16154-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117225822.16154-1-mario.limonciello@amd.com> References: <20221117225822.16154-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: CO1NAM11FT092:EE_|BL1PR12MB5255:EE_ X-MS-Office365-Filtering-Correlation-Id: cb989b5c-5b4e-47df-e64f-08dac8ef3e8a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hAKDsCZrHJNX20Qnr9USVvkF6NEH31XBowymQmxr0Ba4DZDzs0jCi2Yd205vb58HhY0hKK6WzEv/k3gQhg3RaO98/WYt+SVt9lc8uZBG+Ko2XJYvQcZZcq4u0FykJWZcOok7TVN/7Djkf8aaMNxhm6FAzQCEjP0QT9NiihvMsCXif8LdA4zgjXzZweiwK7uQYKXj9qAGnvg+eSs/zQeIDUHyvsplH+UdrDomkj3hZyxQdLMYGVW2E8Xxe8EzWYYR6L7ZGkdJnBWAokRxOTxv2n2sc8FYK0qB9KDj6yTGWDo2uNqGqYLMCR0BNCoUZ6G8CEcVRLCxXhIIu/1fpQ4+iUg2R/nNfpjjH/EzJmcL1ICIP1CerId9yOe4oSecizSptA/Hbf5a9mrodvk/vJdNnORJGHxpbQ1mr16Y1/mc44XjbtLwK7rciFQH6M4H9G49bTlLXUj9o+xGW4STP1s+i1aS/K4rBQ2vAqNXAqem/JDDQLyXjjdIiNKBwN224nG3hSTPcjTM9C+49pJ4g8kZEMRrpNdQ8dTZQgnbJJg/zpx12uArhMDDCFtpGfsbREH1e3osPaP7OztzauD6nP3xD2Nou3i1vudqTXRpIeTMWteVhI6QXZlegHIMTj8nHgOzX/fVSVG3BFerLWG06VDiY+1VlWHHGKg5piEPBQEod5naQRk0lv/oJO8P6dDPISaj6jkHNCM7w2NAQbAqwKXGiu51IcmjRVPGNUVsolQjXRU= 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)(39860400002)(346002)(376002)(396003)(136003)(451199015)(36840700001)(46966006)(40470700004)(36860700001)(7416002)(86362001)(83380400001)(82740400003)(15650500001)(8936002)(356005)(81166007)(2906002)(4744005)(4326008)(82310400005)(8676002)(41300700001)(6666004)(40460700003)(5660300002)(44832011)(110136005)(40480700001)(70206006)(7696005)(26005)(47076005)(186003)(1076003)(2616005)(336012)(316002)(54906003)(70586007)(16526019)(426003)(478600001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 22:58:29.6813 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb989b5c-5b4e-47df-e64f-08dac8ef3e8a 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: CO1NAM11FT092.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5255 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?1749786766911032278?= X-GMAIL-MSGID: =?utf-8?q?1749786766911032278?= Currently counters are only captured during suspend when the warn_on_s0ix_failures module parameter is set. In order to relay this counter information to the kernel reporting infrastructure adjust it so that the counters are always captured. Signed-off-by: Mario Limonciello --- RFC v3->v4: * New patch --- drivers/platform/x86/intel/pmc/core.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index adc2cae4db28..9baf2bb443c8 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -2059,10 +2059,6 @@ static __maybe_unused int pmc_core_suspend(struct device *dev) { struct pmc_dev *pmcdev = dev_get_drvdata(dev); - /* No warnings on S0ix failures */ - if (!warn_on_s0ix_failures) - return 0; - /* Check if the syspend will actually use S0ix */ if (pm_suspend_via_firmware()) return 0; From patchwork Thu Nov 17 22:58: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: 21979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp668614wrr; Thu, 17 Nov 2022 15:08:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf6o2kYzV2yO/BywKisPRA35jx7v3yxZAFCTD2keOYbq+kz8Um7ZbWTDbDYL59ZOVbm6WyRb X-Received: by 2002:aa7:c58f:0:b0:469:668:3a63 with SMTP id g15-20020aa7c58f000000b0046906683a63mr927772edq.331.1668726519484; Thu, 17 Nov 2022 15:08:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668726519; cv=pass; d=google.com; s=arc-20160816; b=wzR5C8Czk6EHEgKaSWa3S7DNSpqYXgbtMFs08+y11cpeKenwcd/SYtscpsTNeMTNni P6y2ziTMgeihaCPiAtxFZgm5L7VvI7bzcFjFp8LkcRXAxZJAuwiT3OMph4sbJbJRFd4G kQA+sfUQ87XzGjw1k5I84UVCXTb3mvBl7VSIJsqgbxr33EHhNIbzKFYjnx4jvoCE8av+ 6/MUny6W+rsvXorACpdCJGmDM1H2pTra79lJBlcyjchHuLXfoQBUy7AIFoNXNH4q5GQi e8IG3Q9R3gdxAsjpZia+XwkcsqVNe/QkWiZ/Ddj0u3lfDt+yvuiCj3BpXP2kowXqhmBP adDQ== 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=mFpWtiOZ35dp3m8Jcz7NLsEPoVL9M2+PpIKQgIoVC2s=; b=q8gpX+BsuQZG0FikISSq/tSTUqSfU8prLKTrhyFa4o8QJ8rpANr+aqU1JlRjTIyqUV hGz2lHOjrB520DC7xWqf2xRND1nTgLSQvja/vb0T4SboMGel97zXBV2uk4c72eSdCKsf hETMQ/rUoE7FIJ82Uh+oAgTtLa0GX4eBdhi+w72BSYu7avGeuXbMWBrDVQK7WWrf+SjD bPBLlSi7vyU23kl7tcZCwrcBAslkFVPyhIrBg+wZ98dP29mxDlRfJGrQz0H6/0yAJMsK qpfGAt/SiGkPRiTJ864TDgdFkVfvnAVnTo5Akm7D7Y5vteJAK9Soo6GFQsBKoRMcmUlX ewDg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ga+RwUt1; 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 r13-20020a05640251cd00b00462e5d768b3si2153822edd.612.2022.11.17.15.08.12; Thu, 17 Nov 2022 15:08:39 -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=Ga+RwUt1; 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 S240740AbiKQW7M (ORCPT + 99 others); Thu, 17 Nov 2022 17:59:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240320AbiKQW6u (ORCPT ); Thu, 17 Nov 2022 17:58:50 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2078.outbound.protection.outlook.com [40.107.243.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 541CC1A83F; Thu, 17 Nov 2022 14:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lt3cCPLH9sm35xzoVtftk0WcZtlDVWrNXlSLvp/xVkgDHSU+w18jznWbEZJYjFrquulTMZ1dxpxIfRzRQvXPAiiee9Au0+GxoGX5a++Xm3mrR7oP38ddrbhn863v5fG8NtmrVzssD/ZcCN0m0HzHgtjKwbcbJGIRWVw36bWx4p00gq+KqGM3aqJ/8I1U7LS9oIsvUuXplJCaz85iLAJ+Ma5qUwx7n7qZ1Tc5PHCEHRJah8qUEmJ3opi3O34RZo/8GQwon8nbOnq5cc4E6DPvx/Outl6HN0gYRT0OdNdlXGGyAOwbvaKwYfGtOSmG5nHkeoQx7A3yR9SpMBKOaf35DQ== 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=mFpWtiOZ35dp3m8Jcz7NLsEPoVL9M2+PpIKQgIoVC2s=; b=H/EmCoO4NN2RcZAib43TirA5WzDsWaTHnUTBgkyhFwMa6WbjtwEbS8puCsblAeRb+KsCUe/Ffahx5kJO3Gxuv4daD/1PPMZ4a2KSEVWcBYuPutMRp2RM8cfO12A099mhUthcsW+xWXp2kOKWMDOerD70Ijo9KH4BrKbRFYXmlJ8PpKYCPcgq6eUQV6i7DS07a4KyGosnR6kO0sJaB3rvQbEvb3gE8Ujxjbhx6O9i4CDHab4OE0gCkfM9Qj9MgYozA3q+3FykVlMYfdj82AmzIK9TSla52wiRMpKDDGxGKCHRNtkFktxEZab/5GzeTS7CpNo1S5IYMJXXQ9FfPtw6iw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=mFpWtiOZ35dp3m8Jcz7NLsEPoVL9M2+PpIKQgIoVC2s=; b=Ga+RwUt1G6aCd0im2TEaFS/gvBVs8yYqp5q2B3PseQVwRCtGd0KUN8jJFUz3TNroXnvhH+1eJLYIgwjR5yRuUav+mPT/LPaZTga5I+l0wW40cxNuIb6ONxUUXhGA3mISL9teVcnA5uLAcruERBvuH8LsJNoTtWUaeJTEzLgZ12E= Received: from MW4PR04CA0197.namprd04.prod.outlook.com (2603:10b6:303:86::22) by MN2PR12MB4237.namprd12.prod.outlook.com (2603:10b6:208:1d6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17; Thu, 17 Nov 2022 22:58:31 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::de) by MW4PR04CA0197.outlook.office365.com (2603:10b6:303:86::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20 via Frontend Transport; Thu, 17 Nov 2022 22:58:31 +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 CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Thu, 17 Nov 2022 22:58:31 +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.34; Thu, 17 Nov 2022 16:58:29 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , Rajneesh Bhardwaj , David E Box CC: Sven van Ashbrook , Raul Rangel , , , Pavel Machek , Len Brown , John Stultz , Thomas Gleixner , Stephen Boyd , S-k Shyam-sundar , Rajat Jain , Hans de Goede , , Mario Limonciello , Mark Gross Subject: [RFC v4 5/5] platform/x86/intel/pmc: core: Report duration of time in HW sleep state Date: Thu, 17 Nov 2022 16:58:21 -0600 Message-ID: <20221117225822.16154-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117225822.16154-1-mario.limonciello@amd.com> References: <20221117225822.16154-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: CO1NAM11FT064:EE_|MN2PR12MB4237:EE_ X-MS-Office365-Filtering-Correlation-Id: af4678a2-97f0-4c9b-e859-08dac8ef3f7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cBuanw/yfmB6gxkEtMCLBeCmmpEybS8nJZRGgn4QQsWW6+vygolE5q2V315TIvP/+bF6IiiY9kVLiRwR1vfz1b1NF6cyaioop9kSwXnkWwBfG5cpVmJlt4Ootm7I49NdVoXpqTg59OJj6quEYKf4vlmoQ/dcYpxJMYlYM34wWcTLhiT0E7UNGmrkCG5awpz4U9K9K9XsX1Y01xJoSGBU0XdQGQiWRG3k3QTk13MDNyY8AswnqkD1wjkPLEK9+eZqsPiRqtK6CpwFUhPpOGimEog19fkccZzAlj8qqgOJ3r0ZX7aNBxDoJzwtdJvXriO80yDLeiA6JjBzSgFzv0qII/EiouwTau8U90HpHQJOX6T25G2N9H79W8nWWinbQc2dAB3bV1mS6l8bF7/DTZpbdMo4QoVVpg0TVv+skGE45dZOzxEOxHKhrzOEv2TQrEQYTaR4cqp9bu70yApnmTTBBCRmfff2ZvBeGP4hWn27c7NfJREZ9wIzYlkfR1FSZdY0aiG+Ene8bjq+0EAhRULA2nW+MYflQeqs3pPQKY+7G19jBuE97Zqq1yt7ESHytGweBwqWsQQRX5aQKypkBVLASIV2QW2uDVaAPa+MQNM93gOhjqjlz0yADvSAEWOEOlugvX1K7Fy6KZPh7aZF3y4nMY3tCarh+uhxV5zYMnshak1U2samhXog5SgNU/S9E9Q4XM6tmWExAKdbFYHyN1+agb6cGWiJgfLyXifmCQmDeY0= 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)(376002)(136003)(39860400002)(396003)(451199015)(46966006)(40470700004)(36840700001)(478600001)(6666004)(70586007)(41300700001)(5660300002)(316002)(54906003)(44832011)(186003)(110136005)(26005)(1076003)(4744005)(7416002)(8676002)(8936002)(70206006)(2616005)(336012)(7696005)(16526019)(40460700003)(36756003)(40480700001)(86362001)(2906002)(47076005)(83380400001)(426003)(82740400003)(82310400005)(4326008)(36860700001)(356005)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 22:58:31.2804 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af4678a2-97f0-4c9b-e859-08dac8ef3f7e 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4237 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?1749786578835389648?= X-GMAIL-MSGID: =?utf-8?q?1749786578835389648?= intel_pmc_core displays a warning when the module parameter `warn_on_s0ix_failures` is set and a suspend didn't get to a HW sleep state. Report this to the standard kernel reporting infrastructure that will be used to display a percentage of time spent in a hw sleep state. Signed-off-by: Mario Limonciello --- RFC v3->v4: * New patch --- 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 9baf2bb443c8..0e25348f1c2a 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -2094,6 +2094,8 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev) if (pmc_core_dev_state_get(pmcdev, &s0ix_counter)) return false; + pm_set_hw_sleep_time(s0ix_counter - pmcdev->s0ix_counter); + if (s0ix_counter == pmcdev->s0ix_counter) return true;