From patchwork Thu Dec 7 10:19:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 1873560 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmX7n3bBwz23yk for ; Fri, 8 Dec 2023 11:29:09 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rBOjn-0003LC-Qz; Fri, 08 Dec 2023 00:29:04 +0000 Received: from mail-mw2nam12on2071.outbound.protection.outlook.com ([40.107.244.71] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rBOji-0003Ji-S5 for fwts-devel@lists.ubuntu.com; Fri, 08 Dec 2023 00:28:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SNlHmETso3cCITmQSJknbST9VscsAnGv5fvz/ifJheSVVMH3Lx4vyAgbWezKnheJjm8OLA4Gys3tRq/Jgpssj75KTMItJMR55wnAVNh92eGvP2Na1t9MyUe8rLjwDQbPZA+tQoUSG1Bl9Rgg0RTEJF/TCJlsDXB6kYmjNInNDbV9OXxyp3pwpm30dx6/IbTfkgQHX3qo6zgWgAZYfXcKhNUo39ORk8OnDMMW3QYW3/bVgTXkIy7DFs8fPPNmeeVsBXN5N+t3z8YFfNuUCy+Cr6jDiFhGfzPYyIBK9Fb9/xjvQcTWFOr4DX03tlNwtML69eN6LXeFg4UrNGuefvvsTw== 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=1cWQfQabCdyNtBp4Eil1OgLtFeW7wYb5xBeJi0WIqLw=; b=WlRGcQHpwpK3w/R9WkOZSYgIV6pI92DNRpKxHKbzCwY3rJwjplFOgW0FaXMbjc4ZefClAyYGAjDfVCcqPexv0f9ydKEMf09LSAyughoQ7jsg7na/p831VuekxEGu62NOzos0ZcokErG2yxHB6CA874l8Lz6eyggtwTmoYsbMCNfiI/kdXVJFRwQGEsg4TSd5PslFHogbaNgt3kSyArd9ecvRcxaaDvw0T92hsCY/ECAOrrWe0Qh+QBm/ozTemc9s21xlCOGQT9kERozuJX6XLgrYn99I3OwzNiewRnIRRBLNKgawIFlUMtGi7q/oYvfz+guUSnjC2s4Gsc54xtDZcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.ubuntu.com 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 (0) Received: from SA1P222CA0019.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::20) by MN0PR12MB6101.namprd12.prod.outlook.com (2603:10b6:208:3cb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 00:28:53 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::c8) by SA1P222CA0019.outlook.office365.com (2603:10b6:806:22c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27 via Frontend Transport; Fri, 8 Dec 2023 00:28:52 +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 SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 00:28:52 +0000 Received: from AUS-P9-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.2507.34; Thu, 7 Dec 2023 18:28:49 -0600 From: Mario Limonciello To: Subject: [PATCH 1/3] s3: Add support for reading total s2idle residency from generic API Date: Thu, 7 Dec 2023 04:19:25 -0600 Message-ID: <20231207101927.9378-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231207101927.9378-1-mario.limonciello@amd.com> References: <20231207101927.9378-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001509:EE_|MN0PR12MB6101:EE_ X-MS-Office365-Filtering-Correlation-Id: 37c23190-91fd-4c8e-5c34-08dbf784a787 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p77ioEQtGtbhdGJwkopN42Q5Qg9t6DCCqaFPgLX1yCjKPwvtGPYFoDwlODzCVaiq8pS/5meafvKu+3oD5GRLPczQD3q+YhS2UfXu5RjSZv7+l9FBfnjBfIJ/uKGcQXKULDFWPDBqy9svCy9+5MwuAD8vAFQyY5wrhc5S41uPxgh82mNaDTAgglu4ykO46D/cmAsiaNj8oC9RUs60QY+7CB2jxFTj22IgxYMNVdukUfOZwXsjUPu8mYpCzJrEQko3wlKEjBlZwcjQzsQWOssX3gGXtOl6t+nO4AShuplJN9qu10qJfFLjbJi4xtYmfqY5w0/+OSoguXfA0DguHZblC79wwMu1Rykfo720zEJ5d4dXRRSiLdP35oCRwejBKheuoR+sdHAxos0pf3V4S8/X0ekhGAe+rI0EF7XbGdfEoK8ZqkqGJp4D0yUWYA0A/MmoXY0BhIbDkOazjVVq4iMOnzMtN5Op7bKyn0ZzOThGFYT0cC8+e9s0LR0rqq6lWhJXLxiIITqDKZ4STGfSexG5cTajOmcAng6yAGh9GNMGHxNDwZa/63xY1Xv1xIpRZu6C5lB04flwGonN7MDr8ZAdS0puhgY7wsqjkDIcp3ggFvg7tXjUHmSIucGkKnnuENQsNDyPXxMtLTaPZCTctLlLvq9rJzGTLoYNd6/jIsZKWTz4A0xv6gZgtxrkqX2PUCKgO3fib9K5jwL+6wDXJX5jtyWcz+zs61i5Ppb0bV5GkZ2FU0c/QWuXeU9JgKvpkq2lPVAX4JSB3Ew8i2MYVZH6eHMAwc8eIqGvPYWBXSMxchM= 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:(13230031)(4636009)(396003)(39860400002)(376002)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(82310400011)(40470700004)(46966006)(36840700001)(36860700001)(356005)(16526019)(26005)(1076003)(5660300002)(47076005)(41300700001)(86362001)(2616005)(81166007)(83380400001)(336012)(82740400003)(40480700001)(426003)(6666004)(7696005)(478600001)(8676002)(40460700003)(70586007)(4326008)(6916009)(70206006)(316002)(8936002)(44832011)(2906002)(36756003)(41533002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 00:28:52.0841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37c23190-91fd-4c8e-5c34-08dbf784a787 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: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6101 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mario Limonciello Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" A generic API has been introduced in the kernel for reading s2idle residency. It works for AMD as well. Use this API if present, fall back to the properietary Intel specific API otherwise. Signed-off-by: Mario Limonciello Acked-by: Ivan Hu --- src/acpi/s3/s3.c | 61 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c index 7c2da431..ba705441 100644 --- a/src/acpi/s3/s3.c +++ b/src/acpi/s3/s3.c @@ -33,8 +33,9 @@ #define PM_SUSPEND_PMUTILS "pm-suspend" #define PM_SUSPEND_HYBRID_PMUTILS "pm-suspend-hybrid" #define PM_SUSPEND_PATH "/sys/power/mem_sleep" -#define PM_S2IDLE_SLP_S0 "/sys/kernel/debug/pmc_core/slp_s0_residency_usec" +#define PM_SUSPEND_TOTAL_HW_SLEEP "/sys/power/suspend_stats/total_hw_sleep" #define WAKEUP_SOURCE_PATH "/sys/kernel/debug/wakeup_sources" +#define INTEL_PM_S2IDLE_SLP_S0 "/sys/kernel/debug/pmc_core/slp_s0_residency_usec" static char sleep_type[7]; static char sleep_type_orig[7]; @@ -361,16 +362,12 @@ static int wrap_pmutils_do_suspend(fwts_pm_method_vars *fwts_settings, return status; } -/* - * get_s2_idle_residency() - * read PM_S2IDLE_SLP_S0, return 0 if it is not available - */ -static uint64_t get_s2_idle_residency(void) +static uint64_t get_uint64_sysfs(const char *path) { - char *str; uint64_t val; + char *str; - str = fwts_get(PM_S2IDLE_SLP_S0); + str = fwts_get(path); if (!str) return 0; @@ -380,12 +377,39 @@ static uint64_t get_s2_idle_residency(void) return val; } +/* + * get_total_s2idle_residency() + * @fname: Optional parameter to set the filename used to check residency + * + * Returns: + * - Total hardware sleep residency since the system was booted + * - 0 if it is not available + * + */ +static uint64_t get_total_s2idle_residency(const char **fname) +{ + const char *check; + uint64_t val; + + if (access(PM_SUSPEND_TOTAL_HW_SLEEP, F_OK) == 0) + check = PM_SUSPEND_TOTAL_HW_SLEEP; + else + check = INTEL_PM_S2IDLE_SLP_S0; + + val = get_uint64_sysfs(check); + + if (fname) + *fname = check; + + return val; +} + static int s3_do_suspend_resume(fwts_framework *fw, int *hw_errors, int *pm_errors, int *hook_errors, int *s2idle_errors, - uint64_t *s2idle_residency, + uint64_t *total_s2idle_residency, int delay, int percent) { @@ -528,15 +552,16 @@ static int s3_do_suspend_resume(fwts_framework *fw, } if (!strncmp(sleep_type, "s2idle", strlen("s2idle"))) { - uint64_t residency = get_s2_idle_residency(); - bool intel; - if (fwts_cpu_is_Intel(&intel) == FWTS_OK && intel && residency <= *s2idle_residency) { + const char *fname; + uint64_t residency = get_total_s2idle_residency(&fname); + + if (residency <= *total_s2idle_residency) { (*s2idle_errors)++; - fwts_failed(fw, LOG_LEVEL_HIGH, "S2idleNotDeepest", - "Expected %s to increase from %" PRIu64 ", got %" PRIu64 ".", - PM_S2IDLE_SLP_S0, *s2idle_residency, residency); + fwts_failed(fw, LOG_LEVEL_CRITICAL, "S2idleNotDeepest", + "Expected %s to increase from %" PRIu64 ", got %" PRIu64 ".", + fname, *total_s2idle_residency, residency); } - *s2idle_residency = residency; + *total_s2idle_residency = residency; } if (duration < delay) { @@ -740,7 +765,7 @@ static int s3_test_multiple(fwts_framework *fw) int resume_too_long = 0; int awake_delay = s3_min_delay * 1000; int delta = (int)(s3_delay_delta * 1000.0); - uint64_t s2idle_residency = get_s2_idle_residency(); + uint64_t total_s2idle_residency = get_total_s2idle_residency(NULL); int pm_debug; #if FWTS_ENABLE_LOGIND @@ -766,7 +791,7 @@ static int s3_test_multiple(fwts_framework *fw) fwts_log_error(fw, "Cannot read kernel log."); ret = s3_do_suspend_resume(fw, &hw_errors, &pm_errors, &hook_errors, - &s2idle_errors, &s2idle_residency, + &s2idle_errors, &total_s2idle_residency, s3_sleep_delay, percent); if (ret == FWTS_OUT_OF_MEMORY) { fwts_log_error(fw, "%s cycle %d failed - out of memory error.", sleep_type, i+1); From patchwork Thu Dec 7 10:19:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 1873559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmX7n2J89z23nS for ; Fri, 8 Dec 2023 11:29:08 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rBOjk-0003K5-Vm; Fri, 08 Dec 2023 00:29:01 +0000 Received: from mail-mw2nam12on2053.outbound.protection.outlook.com ([40.107.244.53] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rBOjh-0003Jc-AZ for fwts-devel@lists.ubuntu.com; Fri, 08 Dec 2023 00:28:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PUv9cyrTlFSPhWopTz779EDSKL5ODoJ4B2jdobdqhfx5edyPR1rECFvWLxOhej4JyTlj07bdtwMP3zEQfE7A0o66lM0zxGpS3GPFFLOPO9S2BekhRryN/0b9tC73YXF8BLMKQgPJgG1qoyTv/4NA1uVAWd4c4U8IIlAAIGaWnIbc7m7W3aAHKJNC20oFoO00j8JO3g7W+mefi97bkGcU7h+dO6q5ybMDAdl4rhCNmd9EdbRLkN+z4G0gwbzvbECWefXdvhU8Po51XsDXErsqLwHXm2xdbOSRWiy9ew2yTO94AIURYaEMczUn8Wa/3E1RD/21uB46FlLZAbd5+dI89g== 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=BULQKbbBCwq258q0h3OBYw2WqOCSfHWKZDRedKHNTpw=; b=B6Gqq4EnNmubnVVcCVi9ljHQ/lwPZfvy1O047h+PbyPgeQiwwsCON95n5GfzPfR3x1Ic2IY2uRqNkwqqrHektON052d4kWNnuU8PNS10mwiU0tQZxfa3DXLM/iFxIFqWtJnsKTakbYekPBJ6abFhk1+XrkwrRNNhawNkgwfAwVeTMmaMnm08TpnMpjhB97jYcOpiaaagiw7wQrqw2gzhCoteY41EoOc/ih7ZyTMlgvAEmYUQn5FAKUlLFOj1UHQDkgIEH5yOSKyiaGO/+Wqa71fU1lKcO+epDQ1nztQ+YR9Fv0e/K56onWGG0SlPtJ0JoptbXrK5A0wh7E72WBM9VA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.ubuntu.com 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 (0) Received: from SA1P222CA0002.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::9) by CH0PR12MB5089.namprd12.prod.outlook.com (2603:10b6:610:bc::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27; Fri, 8 Dec 2023 00:28:53 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::ca) by SA1P222CA0002.outlook.office365.com (2603:10b6:806:22c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.25 via Frontend Transport; Fri, 8 Dec 2023 00:28:53 +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 SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 00:28:53 +0000 Received: from AUS-P9-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.2507.34; Thu, 7 Dec 2023 18:28:50 -0600 From: Mario Limonciello To: Subject: [PATCH 2/3] s3: Add support for checking last sleep cycle residency Date: Thu, 7 Dec 2023 04:19:26 -0600 Message-ID: <20231207101927.9378-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231207101927.9378-1-mario.limonciello@amd.com> References: <20231207101927.9378-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001509:EE_|CH0PR12MB5089:EE_ X-MS-Office365-Filtering-Correlation-Id: 76482ab5-4d24-4509-f04a-08dbf784a85d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eX80cWpyn1jN9/067NihdEpmnkygL+j085zyLaecGWyKrMtmJ/ifmlkmstv1mIB2qb6PigoKV2gddoHWR5icDjc2hC/HFjl36ReYk4UTQy4s5NMDrQtc708MXEqP0DsHCFMbhRiU5cKgqYj9xmYhxS4R+adNb99lKrGK1lAWyc+SG5Tat/PB/W5uPhL6fWHGH7yf2g/DB36nZW/i3WAtK5lBcigKX5GlCjR3OMjkTAlfAKE3lDDbzyebNonffCD+V7Vp9WikfKWp3mPbSbDGLDwz5ksI6R3a//I6Vq+/tbpNDSpxx6B1x3SnahKxik0Mg8q8lKKAxDp3y3OFXkRRO7NDes5DMiccA1Hfl198NjUgHc5wUFdIgw8pD0shqkaYiZwhQRdzqINDM+Kx5EdJkrab8DiL2zThes0Kh9ZRzw+P/juvVZ4BaekBg5q5Ec1Ee6OHsZjLr+HzNSosmFkYPFqGh2itXKFllw+4G8M6VToFUhjjcg0D9rZE0/UVDIIax4/xF6kEFiyKj35OQGFCdmhvWJqS0oyU5Pz6DjCsKE7j0rGEOCItvxyVpj15/1mPWoKCzO8gKHuwoiD8zn4zM7HzW/SQf+yRzE1FFA/ZyQfi820rMplYdEAxsjkkgz3PcvA6VNvSgWYnZKXgIThO+G+Q9fkX3LOCJ9pFnfSw0n7aXiox1hYZofKNq4E9eeehv3DxsJ/DmtbV0NHJbe0WsEK9ZNwPa8Uch/8Tqtm8RvkxC+umox10SGm45GfnAbwlzU+gkSv6ZryxwkE4y+/6aA== 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:(13230031)(4636009)(376002)(346002)(136003)(39860400002)(396003)(230922051799003)(64100799003)(82310400011)(186009)(1800799012)(451199024)(36840700001)(40470700004)(46966006)(81166007)(356005)(41300700001)(44832011)(4326008)(2906002)(6666004)(83380400001)(336012)(7696005)(426003)(8936002)(82740400003)(40480700001)(40460700003)(5660300002)(86362001)(36756003)(36860700001)(316002)(478600001)(6916009)(70206006)(966005)(47076005)(26005)(16526019)(1076003)(2616005)(70586007)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 00:28:53.4904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76482ab5-4d24-4509-f04a-08dbf784a85d 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: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5089 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mario Limonciello Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" A good system will spend at least 70% of an s2idle sleep cycle in a hardware sleep state. Check for this. Link: https://bugs.launchpad.net/fwts/+bug/2019728 Signed-off-by: Mario Limonciello Acked-by: Ivan Hu --- src/acpi/s3/s3.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c index ba705441..222d9f57 100644 --- a/src/acpi/s3/s3.c +++ b/src/acpi/s3/s3.c @@ -33,6 +33,7 @@ #define PM_SUSPEND_PMUTILS "pm-suspend" #define PM_SUSPEND_HYBRID_PMUTILS "pm-suspend-hybrid" #define PM_SUSPEND_PATH "/sys/power/mem_sleep" +#define PM_SUSPEND_LAST_HW_SLEEP "/sys/power/suspend_stats/last_hw_sleep" #define PM_SUSPEND_TOTAL_HW_SLEEP "/sys/power/suspend_stats/total_hw_sleep" #define WAKEUP_SOURCE_PATH "/sys/kernel/debug/wakeup_sources" #define INTEL_PM_S2IDLE_SLP_S0 "/sys/kernel/debug/pmc_core/slp_s0_residency_usec" @@ -377,6 +378,22 @@ static uint64_t get_uint64_sysfs(const char *path) return val; } +/* + * get_last_s2idle_residency() + * + * Returns: + * - Hardware sleep residency from the last sleep cycle + * - 0 if it is not available + * + */ +static uint64_t get_last_s2idle_residency(void) +{ + if (access(PM_SUSPEND_LAST_HW_SLEEP, F_OK) != 0) + return 0; + + return get_uint64_sysfs(PM_SUSPEND_LAST_HW_SLEEP); +} + /* * get_total_s2idle_residency() * @fname: Optional parameter to set the filename used to check residency @@ -562,6 +579,18 @@ static int s3_do_suspend_resume(fwts_framework *fw, fname, *total_s2idle_residency, residency); } *total_s2idle_residency = residency; + + residency = get_last_s2idle_residency(); + if (duration > 10 && residency) { + float pct = (float)residency / ((float)duration * 1000000) * 100.0; + if (pct < 70) { + (*s2idle_errors)++; + fwts_failed(fw, LOG_LEVEL_HIGH, "S2idleNotDeepest", + "Expected %s to be at least 70%% of the last sleep cycle, got %.2f%%.", + PM_SUSPEND_LAST_HW_SLEEP, pct); + } else + fwts_log_info(fw, "Spent %.2f%% of %ds in hardware sleep state", pct, duration); + } } if (duration < delay) { From patchwork Thu Dec 7 10:19:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 1873561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmX7p6xg9z23nS for ; Fri, 8 Dec 2023 11:29:10 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rBOjp-0003MT-Rx; Fri, 08 Dec 2023 00:29:06 +0000 Received: from mail-dm6nam04on2051.outbound.protection.outlook.com ([40.107.102.51] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rBOjk-0003Jl-Cd for fwts-devel@lists.ubuntu.com; Fri, 08 Dec 2023 00:29:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=litGABct8tQ1dVZCt+TzDsfNO1dnBwLIcO8QY5cYcmiW748MgI8lqSXdB1nsJtjP2e2qMHQtNanckB5Kw3BGcGvnK6hFCyxbwUO7A4PveqUHug0jfcpA+YTZphp2SVzW74Zf3KChaVc+j7ItM84Lcbw/Tm3sp+t1qY/EHsJ0f/PWg8cRvAecmLSr61Ig9IZ3kz73rDDWr3I73vqdKp6DuksLY/LY8oZd9EvMRSwlyDFzZ9atDUbA0rFHEOH3+zsp73OFXaTrOdpyXf88qcOO8gdr3y3IqAtiGyiYKrFWNwfZKZsvs5qB3NPB+COT+mbmDLUwAp4FuOC/NLinhNS+QQ== 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=bfB8xMV9Gi8rlG6dFP8Yhg5yUsDClBtFWmwLsp6pCm0=; b=Wqf9watisPoRcmmMXcMmWoCO5B72Qc/9fh1JP5JUHyqadXSe2DuDp/F42enk7eQ0aPguRSleX/hbF7as1sD5Lt62zZ6MCmcwEipJqkZ5nY2vL/b4h0cPF2O/7tjEuG12OGQYJpqtrxLUW1m6PS53R3x0Mj/X5nbRpVnXse3lDv9e7323BWCoCgpAHFOeyGUsGuUbBPBrzbPuIehwIMYq+n7ta81HFQkdkDNFHiVyMIf3b0wfZnJ3tSIG5P4rTUx5Rdig7QzayM9YfG2xC0fm8i0o3Y1mspAWXZy68atXZX0XphYGGqhMOgm/x3LJr1cWJcHBB0HHOAekw4FkFcKz2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.ubuntu.com 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 (0) Received: from SA1P222CA0020.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::21) by PH7PR12MB6785.namprd12.prod.outlook.com (2603:10b6:510:1ab::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.25; Fri, 8 Dec 2023 00:28:54 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::70) by SA1P222CA0020.outlook.office365.com (2603:10b6:806:22c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27 via Frontend Transport; Fri, 8 Dec 2023 00:28:54 +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 SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 00:28:54 +0000 Received: from AUS-P9-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.2507.34; Thu, 7 Dec 2023 18:28:50 -0600 From: Mario Limonciello To: Subject: [PATCH 3/3] Drop support for pm-utils Date: Thu, 7 Dec 2023 04:19:27 -0600 Message-ID: <20231207101927.9378-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231207101927.9378-1-mario.limonciello@amd.com> References: <20231207101927.9378-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001509:EE_|PH7PR12MB6785:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e83e7ed-3191-4def-61a2-08dbf784a8d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WxN/4GkjcvCSnVBUxIQ8agmM4rWSFxoStdHZtz7f7GAKH2b+YUSH8zpb2NidlJnwVbTqcVmi8NWv0Q+T5ZT2qh+XUHezIwPeaFBEQL8Tyn1H3wV8RfYVCsjkCJDQsSjnQ4JScvzxSp9ve976mRG7fczdpcNP5/Gel8nboV8JLnKBCMBAb3UcebZD6hNwUXt6a6vVbGnMJiEsyLaXNjPAT2Se2/2nO+5oddRSe4SM39O3Dp1ig/KDkSwiJpSmIYXhrTMFGnN5or8YDP+6EF/RZNAW7/uGaIRLprxy7zThxEfiWoLluv9yVxX0FgVr/eF+NJCNDtTbBeRFm6FTBFi+g14IcBgIOC/Eb0T+VRdNE2BwWOnYxdv4StuZ4b51YyKawpGfelMNqw4GuwM7dHmC/wWuxlqSscKlzlwVS1xwTjFiECYtZdGpvaRu10lLZbzT4kPWvy6mU7d/tXXt4Yh6lQvj4FdNC06uTGTtxsI8m3U31PhOqBCFDhDFnpoYDd5VkJnoTub33fyHCNfKo0aVqYgTqC9SSYzoTFdu4t3xP3UQOnq4/RPl2da41Amwm1QZTc8UjOt40PjeppmT9w3qThwNxqV8sKyXYjRqxdVi929ieEAcY2KRthGzc8YlHG+BmXI1sXIkL+lRpjXXoltKehx08FLbJpA2NV22qM/b7qQyX/wekyxU7OdSZo/xO4MUxHdsu+VPhJbD+pHJsmEwOKliaKawGh0tBmu0QYsaSnKg1QueK3iu8yP2WudRCRi0SafhWJBE+CoEPYJ6WcI5WQ== 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:(13230031)(4636009)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(64100799003)(186009)(82310400011)(451199024)(1800799012)(36840700001)(46966006)(40470700004)(41300700001)(83380400001)(336012)(36860700001)(2616005)(5660300002)(86362001)(1076003)(40480700001)(426003)(16526019)(30864003)(2906002)(26005)(44832011)(47076005)(40460700003)(356005)(7696005)(81166007)(4326008)(8936002)(6666004)(8676002)(6916009)(70206006)(70586007)(478600001)(316002)(36756003)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 00:28:54.2560 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e83e7ed-3191-4def-61a2-08dbf784a8d0 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: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6785 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mario Limonciello Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" This has been long deprecated and isn't used in any distros anymore. Signed-off-by: Mario Limonciello --- doc/fwts.1 | 5 -- fwts-test/arg-help-0001/arg-help-0001.log | 6 +- fwts-test/arg-help-0001/arg-help-0002.log | 6 +- scripts/bash-completion/fwts | 2 +- src/acpi/s3/s3.c | 82 ++--------------------- src/acpi/s3power/s3power.c | 47 ++----------- src/acpi/s4/s4.c | 52 -------------- src/lib/include/fwts_types.h | 1 - src/lib/src/fwts_framework.c | 10 ++- 9 files changed, 18 insertions(+), 193 deletions(-) diff --git a/doc/fwts.1 b/doc/fwts.1 index b8217271..173e6ede 100644 --- a/doc/fwts.1 +++ b/doc/fwts.1 @@ -239,8 +239,6 @@ specify the power method to use to enter S3 or S4 (or autodetection will be used .br logind \- the default method, where available (requires dbus and logind). .br -pm-utils \- the previous default method, now deprecated. -.br sysfs \- the fallback, used when logind is not available. .br e.g. \-\-pm\-method=sysfs @@ -275,9 +273,6 @@ specifies a script or program to run after each S3 resume. The hookscript must return 0 to indicate success, or non-zero to indicate failure. Failures will abort subsequent S3 test iterations. .TP -.B \-\-s3\-quirks=--quirk[,--quirk] -specify a comma separated list of quirk arguments to pass to pm-suspend, for example: \-\-s3\-quirks=\-\-quirk\-s3\-bios,\-\-quirk\-save\-pci -.TP .B \-\-s3\-sleep\-delay=N sleep N seconds from the start of the suspend to the wakeup time. Note that this time MUST be longer than the time it takes to suspend the machine otherwise the diff --git a/fwts-test/arg-help-0001/arg-help-0001.log b/fwts-test/arg-help-0001/arg-help-0001.log index 54bdd001..0f38f6b4 100644 --- a/fwts-test/arg-help-0001/arg-help-0001.log +++ b/fwts-test/arg-help-0001/arg-help-0001.log @@ -110,8 +110,7 @@ --pm-method Select the power method to use. Accepted values are - "logind", "pm-utils", - "sysfs" + "logind", "sysfs" -P, --power-states Test S3, S4 power states. -q, --quiet Run quietly. @@ -169,9 +168,6 @@ --s3-multiple Run S3 tests multiple times, e.g. --s3-multiple=10. ---s3-quirks Comma separated list - of quirk arguments to - pass to pm-suspend. --s3-resume-hook hook Run a hook script after each S3 resume, 0 exit indicates diff --git a/fwts-test/arg-help-0001/arg-help-0002.log b/fwts-test/arg-help-0001/arg-help-0002.log index 54bdd001..0f38f6b4 100644 --- a/fwts-test/arg-help-0001/arg-help-0002.log +++ b/fwts-test/arg-help-0001/arg-help-0002.log @@ -110,8 +110,7 @@ --pm-method Select the power method to use. Accepted values are - "logind", "pm-utils", - "sysfs" + "logind", "sysfs" -P, --power-states Test S3, S4 power states. -q, --quiet Run quietly. @@ -169,9 +168,6 @@ --s3-multiple Run S3 tests multiple times, e.g. --s3-multiple=10. ---s3-quirks Comma separated list - of quirk arguments to - pass to pm-suspend. --s3-resume-hook hook Run a hook script after each S3 resume, 0 exit indicates diff --git a/scripts/bash-completion/fwts b/scripts/bash-completion/fwts index 3632fd45..eecf8144 100644 --- a/scripts/bash-completion/fwts +++ b/scripts/bash-completion/fwts @@ -51,7 +51,7 @@ _fwts() return 0 ;; '--pm-method') - COMPREPLY=( $(compgen -W "logind pm-utils sysfs" -- $cur) ) + COMPREPLY=( $(compgen -W "logind sysfs" -- $cur) ) return 0 ;; '--log-filter'|'--log-format'|'-w'|'--log-width'|'-R'|'-rsdp'|\ diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c index 222d9f57..5983f83d 100644 --- a/src/acpi/s3/s3.c +++ b/src/acpi/s3/s3.c @@ -30,8 +30,6 @@ #include #include -#define PM_SUSPEND_PMUTILS "pm-suspend" -#define PM_SUSPEND_HYBRID_PMUTILS "pm-suspend-hybrid" #define PM_SUSPEND_PATH "/sys/power/mem_sleep" #define PM_SUSPEND_LAST_HW_SLEEP "/sys/power/suspend_stats/last_hw_sleep" #define PM_SUSPEND_TOTAL_HW_SLEEP "/sys/power/suspend_stats/total_hw_sleep" @@ -47,7 +45,6 @@ static int s3_max_delay = 30; /* max time between resume and next suspend */ static float s3_delay_delta = 0.5; /* amount to add to delay between each S3 tests */ static int s3_sleep_delay = 30; /* time between start of suspend and wakeup */ static bool s3_device_check = false; /* check for device config changes */ -static char *s3_quirks = NULL; /* Quirks to be passed to pm-suspend */ static int s3_device_check_delay = 15; /* Time to sleep after waking up and then running device check */ static bool s3_min_max_delay = false; static float s3_suspend_time = 15.0; /* Maximum allowed suspend time */ @@ -292,17 +289,13 @@ static void detect_pm_method(fwts_pm_method_vars *fwts_settings) fwts_sysfs_can_hybrid_suspend(fwts_settings) : fwts_sysfs_can_suspend(fwts_settings)) fwts_settings->fw->pm_method = FWTS_PM_SYSFS; - else - fwts_settings->fw->pm_method = FWTS_PM_PMUTILS; } #if FWTS_ENABLE_LOGIND static int wrap_logind_do_suspend(fwts_pm_method_vars *fwts_settings, const int percent, - int *duration, - const char *str) + int *duration) { - FWTS_UNUSED(str); char *action = s3_hybrid ? PM_SUSPEND_HYBRID_LOGIND : PM_SUSPEND_LOGIND; fwts_progress_message(fwts_settings->fw, percent, "(Suspending)"); @@ -317,12 +310,10 @@ static int wrap_logind_do_suspend(fwts_pm_method_vars *fwts_settings, static int wrap_sysfs_do_suspend(fwts_pm_method_vars *fwts_settings, const int percent, - int *duration, - const char *str) + int *duration) { int status; - FWTS_UNUSED(str); (void)fwts_klog_write(fwts_settings->fw, FWTS_SUSPEND "\n"); fwts_progress_message(fwts_settings->fw, percent, "(Suspending)"); (void)fwts_klog_write(fwts_settings->fw, FWTS_SUSPEND "\n"); @@ -339,30 +330,6 @@ static int wrap_sysfs_do_suspend(fwts_pm_method_vars *fwts_settings, return status; } -static int wrap_pmutils_do_suspend(fwts_pm_method_vars *fwts_settings, - const int percent, - int *duration, - const char *command) -{ - int status = 0; - - (void)fwts_klog_write(fwts_settings->fw, FWTS_SUSPEND "\n"); - fwts_progress_message(fwts_settings->fw, percent, "(Suspending)"); - (void)fwts_klog_write(fwts_settings->fw, FWTS_SUSPEND "\n"); - (void)fwts_klog_write(fwts_settings->fw, "Starting fwts suspend\n"); - (void)fwts_klog_write(fwts_settings->fw, FWTS_SUSPEND "\n"); - time(&(fwts_settings->t_start)); - (void)fwts_exec(command, &status); - (void)fwts_klog_write(fwts_settings->fw, FWTS_RESUME "\n"); - (void)fwts_klog_write(fwts_settings->fw, "Finished fwts resume\n"); - time(&(fwts_settings->t_end)); - fwts_progress_message(fwts_settings->fw, percent, "(Resumed)"); - - *duration = (int)(fwts_settings->t_end - fwts_settings->t_start); - - return status; -} - static uint64_t get_uint64_sysfs(const char *path) { uint64_t val; @@ -442,7 +409,7 @@ static int s3_do_suspend_resume(fwts_framework *fw, fwts_list resume_wakeup_soure; bool wk_src_found = false; - int (*do_suspend)(fwts_pm_method_vars *, const int, int*, const char*); + int (*do_suspend)(fwts_pm_method_vars *, const int, int*); fwts_settings = calloc(1, sizeof(fwts_pm_method_vars)); if (fwts_settings == NULL) @@ -467,10 +434,6 @@ static int s3_do_suspend_resume(fwts_framework *fw, do_suspend = &wrap_logind_do_suspend; break; #endif - case FWTS_PM_PMUTILS: - fwts_log_info(fw, "Using pm-utils as the default power method."); - do_suspend = &wrap_pmutils_do_suspend; - break; case FWTS_PM_SYSFS: fwts_log_info(fw, "Using sysfs as the default power method."); do_suspend = &wrap_sysfs_do_suspend; @@ -485,37 +448,6 @@ static int s3_do_suspend_resume(fwts_framework *fw, if (s3_device_check) fwts_hwinfo_get(fw, &hwinfo1); - /* Format up pm-suspend command with optional quirking arguments */ - if (fw->pm_method == FWTS_PM_PMUTILS) { - if (s3_hybrid) { - if ((command = fwts_realloc_strcat(NULL, PM_SUSPEND_HYBRID_PMUTILS)) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - } else { - if ((command = fwts_realloc_strcat(NULL, PM_SUSPEND_PMUTILS)) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - } - - /* For now we only support quirks with pm-utils */ - if (s3_quirks) { - if ((command = fwts_realloc_strcat(command, " ")) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - if ((quirks = fwts_args_comma_list(s3_quirks)) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - if ((command = fwts_realloc_strcat(command, quirks)) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - } - } - fwts_wakealarm_trigger(fw, delay); if (read_wakeup_source(&suspend_wakeup_soure) != FWTS_ERROR) { @@ -523,7 +455,7 @@ static int s3_do_suspend_resume(fwts_framework *fw, } /* Do S3 / S2idle here */ - status = do_suspend(fwts_settings, percent, &duration, command); + status = do_suspend(fwts_settings, percent, &duration); if (wk_src_found) { if (read_wakeup_source(&resume_wakeup_soure) != FWTS_ERROR) { @@ -617,7 +549,7 @@ static int s3_do_suspend_resume(fwts_framework *fw, "Alternatively, re-test with the kernel parameter \"idle=mwait\". "); } - /* Add in error check for pm-suspend status */ + /* Add in error check for suspend status */ if ((status > 0) && (status < 128)) { (*pm_errors)++; fwts_failed(fw, LOG_LEVEL_HIGH, "PMActionFailedPreSleep", @@ -1019,9 +951,6 @@ static int s3_options_handler(fwts_framework *fw, int argc, char * const argv[], case 5: s3_device_check = true; break; - case 6: - s3_quirks = optarg; - break; case 7: s3_device_check_delay = atoi(optarg); s3_device_check = true; @@ -1056,7 +985,6 @@ static fwts_option s3_options[] = { { "s3-delay-delta", "", 1, "Time to be added to delay between S3 iterations. Used in conjunction with --s3-min-delay and --s3-max-delay, e.g. --s3-delay-delta=2.5" }, { "s3-sleep-delay", "", 1, "Sleep N seconds between start of suspend and wakeup, e.g. --s3-sleep-delay=60" }, { "s3-device-check", "", 0, "Check differences between device configurations over a S3 cycle. Note we add a default of 15 seconds to allow wifi to re-associate. Cannot be used with --s3-min-delay, --s3-max-delay and --s3-delay-delta." }, - { "s3-quirks", "", 1, "Comma separated list of quirk arguments to pass to pm-suspend." }, { "s3-device-check-delay", "", 1, "Sleep N seconds before we run a device check after waking up from suspend. Default is 15 seconds, e.g. --s3-device-check-delay=20" }, { "s3-suspend-time", "", 1, "Maximum expected suspend time in seconds, e.g. --s3-suspend-time=3.5" }, { "s3-resume-time", "", 1, "Maximum expected resume time in seconds, e.g. --s3-resume-time=5.1" }, diff --git a/src/acpi/s3power/s3power.c b/src/acpi/s3power/s3power.c index 46d68651..6aeeb127 100644 --- a/src/acpi/s3power/s3power.c +++ b/src/acpi/s3power/s3power.c @@ -31,8 +31,6 @@ #include #include -#define PM_SUSPEND "pm-suspend" - static int s3power_sleep_delay = 600; /* time between start of suspend and wakeup */ static uint32_t battery_capacity_mAh; static uint32_t battery_capacity_mWh; @@ -126,18 +124,13 @@ static void detect_pm_method(fwts_pm_method_vars *fwts_settings) #endif if (fwts_sysfs_can_suspend(fwts_settings)) fwts_settings->fw->pm_method = FWTS_PM_SYSFS; - else - fwts_settings->fw->pm_method = FWTS_PM_PMUTILS; } #if FWTS_ENABLE_LOGIND static int wrap_logind_do_suspend(fwts_pm_method_vars *fwts_settings, const int percent, - int *duration, - const char *str) + int *duration) { - FWTS_UNUSED(str); - fwts_progress_message(fwts_settings->fw, percent, "(Suspending)"); /* This blocks by entering a glib mainloop */ *duration = fwts_logind_wait_for_resume_from_action(fwts_settings, PM_SUSPEND_LOGIND, 0); @@ -150,12 +143,10 @@ static int wrap_logind_do_suspend(fwts_pm_method_vars *fwts_settings, static int wrap_sysfs_do_suspend(fwts_pm_method_vars *fwts_settings, const int percent, - int *duration, - const char *str) + int *duration) { int status; - FWTS_UNUSED(str); fwts_progress_message(fwts_settings->fw, percent, "(Suspending)"); time(&(fwts_settings->t_start)); (void)fwts_klog_write(fwts_settings->fw, "Starting fwts suspend\n"); @@ -171,28 +162,6 @@ static int wrap_sysfs_do_suspend(fwts_pm_method_vars *fwts_settings, return status; } -static int wrap_pmutils_do_suspend(fwts_pm_method_vars *fwts_settings, - const int percent, - int *duration, - const char *command) -{ - int status = FWTS_OK; - - fwts_progress_message(fwts_settings->fw, percent, "(Suspending)"); - time(&(fwts_settings->t_start)); - (void)fwts_klog_write(fwts_settings->fw, "Starting fwts suspend\n"); - (void)fwts_klog_write(fwts_settings->fw, FWTS_SUSPEND "\n"); - (void)fwts_exec(command, &status); - (void)fwts_klog_write(fwts_settings->fw, FWTS_RESUME "\n"); - (void)fwts_klog_write(fwts_settings->fw, "Finished fwts resume\n"); - time(&(fwts_settings->t_end)); - fwts_progress_message(fwts_settings->fw, percent, "(Resumed)"); - - *duration = (int)(fwts_settings->t_end - fwts_settings->t_start); - - return status; -} - static void s3power_difference(fwts_framework *fw, uint32_t before, uint32_t after, uint32_t battery_capacity, char *units) @@ -254,7 +223,7 @@ static int s3power_test(fwts_framework *fw) fwts_pm_method_vars *fwts_settings; - int (*do_suspend)(fwts_pm_method_vars *, const int, int*, const char*); + int (*do_suspend)(fwts_pm_method_vars *, const int, int*); #if FWTS_ENABLE_LOGIND #if !GLIB_CHECK_VERSION(2,35,0) @@ -286,10 +255,6 @@ static int s3power_test(fwts_framework *fw) do_suspend = &wrap_logind_do_suspend; break; #endif - case FWTS_PM_PMUTILS: - fwts_log_info(fw, "Using pm-utils as the default power method."); - do_suspend = &wrap_pmutils_do_suspend; - break; case FWTS_PM_SYSFS: fwts_log_info(fw, "Using sysfs as the default power method."); do_suspend = &wrap_sysfs_do_suspend; @@ -320,7 +285,7 @@ static int s3power_test(fwts_framework *fw) (void)fwts_pm_debug_set(1); /* Do S3 here */ - status = do_suspend(fwts_settings, 100, &duration, PM_SUSPEND); + status = do_suspend(fwts_settings, 100, &duration); /* Restore pm debug value */ if (pm_debug != -1) @@ -331,7 +296,7 @@ static int s3power_test(fwts_framework *fw) s3power_difference(fw, capacity_before_mAh, capacity_after_mAh, battery_capacity_mAh, "mAh"); s3power_difference(fw, capacity_before_mWh, capacity_after_mWh, battery_capacity_mWh, "mWh"); - fwts_log_info(fw, "pm-suspend returned %d after %d seconds.", status, duration); + fwts_log_info(fw, "suspend returned %d after %d seconds.", status, duration); if (duration < s3power_sleep_delay) fwts_failed(fw, LOG_LEVEL_MEDIUM, "ShortSuspend", @@ -341,7 +306,7 @@ static int s3power_test(fwts_framework *fw) fwts_failed(fw, LOG_LEVEL_HIGH, "LongSuspend", "Unexpected: S3 much longer than expected (%d seconds).", duration); - /* Add in error check for pm-suspend status */ + /* Add in error check for suspend status */ if ((status > 0) && (status < 128)) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedPreS3", "pm-action failed before trying to put the system " diff --git a/src/acpi/s4/s4.c b/src/acpi/s4/s4.c index eaba1fbd..3e16fbdf 100644 --- a/src/acpi/s4/s4.c +++ b/src/acpi/s4/s4.c @@ -97,8 +97,6 @@ static void detect_pm_method(fwts_pm_method_vars *fwts_settings) #endif if (fwts_sysfs_can_hibernate(fwts_settings)) fwts_settings->fw->pm_method = FWTS_PM_SYSFS; - else - fwts_settings->fw->pm_method = FWTS_PM_PMUTILS; } #if FWTS_ENABLE_LOGIND @@ -143,28 +141,6 @@ static int wrap_sysfs_do_s4(fwts_pm_method_vars *fwts_settings, return status; } -static int wrap_pmutils_do_s4(fwts_pm_method_vars *fwts_settings, - const int percent, - int *duration, - const char *command) -{ - int status = 0; - - fwts_progress_message(fwts_settings->fw, percent, "(Hibernating)"); - time(&(fwts_settings->t_start)); - (void)fwts_klog_write(fwts_settings->fw, "Starting fwts hibernate\n"); - (void)fwts_klog_write(fwts_settings->fw, FWTS_HIBERNATE "\n"); - (void)fwts_exec(command, &status); - (void)fwts_klog_write(fwts_settings->fw, FWTS_RESUME "\n"); - (void)fwts_klog_write(fwts_settings->fw, "Finished fwts resume\n"); - time(&(fwts_settings->t_end)); - fwts_progress_message(fwts_settings->fw, percent, "(Resumed)"); - - *duration = (int)(fwts_settings->t_end - fwts_settings->t_start); - - return status; -} - static int s4_hibernate(fwts_framework *fw, int *klog_errors, int *hw_errors, @@ -209,10 +185,6 @@ static int s4_hibernate(fwts_framework *fw, do_s4 = &wrap_logind_do_s4; break; #endif - case FWTS_PM_PMUTILS: - fwts_log_info(fw, "Using pm-utils as the default power method."); - do_s4 = &wrap_pmutils_do_s4; - break; case FWTS_PM_SYSFS: fwts_log_info(fw, "Using sysfs as the default power method."); do_s4 = &wrap_sysfs_do_s4; @@ -227,30 +199,6 @@ static int s4_hibernate(fwts_framework *fw, if (s4_device_check) fwts_hwinfo_get(fw, &hwinfo1); - if (fw->pm_method == FWTS_PM_PMUTILS) { - /* Format up pm-hibernate command with optional quirking arguments */ - if ((command = fwts_realloc_strcat(NULL, PM_HIBERNATE)) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - - /* For now we only support quirks with pm-utils */ - if (s4_quirks) { - if ((command = fwts_realloc_strcat(command, " ")) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - if ((quirks = fwts_args_comma_list(s4_quirks)) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - if ((command = fwts_realloc_strcat(command, quirks)) == NULL) { - rc = FWTS_OUT_OF_MEMORY; - goto tidy; - } - } - } - fwts_wakealarm_trigger(fw, s4_sleep_delay); /* Do s4 here */ diff --git a/src/lib/include/fwts_types.h b/src/lib/include/fwts_types.h index e30d7817..57138769 100644 --- a/src/lib/include/fwts_types.h +++ b/src/lib/include/fwts_types.h @@ -47,7 +47,6 @@ typedef enum { typedef enum { FWTS_PM_LOGIND, - FWTS_PM_PMUTILS, FWTS_PM_SYSFS, FWTS_PM_UNDEFINED } fwts_pm_method; diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index e10f8764..a0de67e5 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -130,7 +130,7 @@ static fwts_option fwts_framework_options[] = { { "acpica", "", 1, "Enable ACPICA run time options." }, { "uefitests", "", 0, "Run UEFI tests." }, { "rsdp", "R:", 1, "Specify the physical address of the ACPI RSDP." }, - { "pm-method", "", 1, "Select the power method to use. Accepted values are \"logind\", \"pm-utils\", \"sysfs\""}, + { "pm-method", "", 1, "Select the power method to use. Accepted values are \"logind\", \"sysfs\""}, { "show-tests-categories","", 0, "Show tests and associated categories." }, { "acpitests", "", 0, "Run general ACPI tests." }, { "acpicompliance", "", 0, "Run ACPI tests for spec compliance." }, @@ -1112,15 +1112,13 @@ static int fwts_framework_pm_method_parse(fwts_framework *fw, const char *arg) fw->pm_method = FWTS_PM_LOGIND; else #endif - if (strcmp(arg, "pm-utils") == 0) - fw->pm_method = FWTS_PM_PMUTILS; - else if (strcmp(arg, "sysfs") == 0) + if (strcmp(arg, "sysfs") == 0) fw->pm_method = FWTS_PM_SYSFS; else { #if FWTS_ENABLE_LOGIND - fprintf(stderr, "--pm-method only supports logind, pm-utils and sysfs methods\n"); + fprintf(stderr, "--pm-method only supports logind and sysfs methods\n"); #else - fprintf(stderr, "--pm-method only supports pm-utils and sysfs methods\n"); + fprintf(stderr, "--pm-method only supports sysfs method\n"); #endif return FWTS_ERROR; }