From patchwork Tue Aug 8 10:31:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ivanhu X-Patchwork-Id: 1818579 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=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=VSCRcAZF; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (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 4RKqGy65B9z1yVt for ; Tue, 8 Aug 2023 20:31:22 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qTJzj-000624-DN; Tue, 08 Aug 2023 10:31:19 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qTJzh-00061m-D9 for fwts-devel@lists.ubuntu.com; Tue, 08 Aug 2023 10:31:17 +0000 Received: from canonical.com (unknown [106.104.136.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 9D5DB41536 for ; Tue, 8 Aug 2023 10:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1691490677; bh=kOnhpxg/Dh4hMcHUHgKHlrskikgtXiJGlMH9wxoAI1o=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VSCRcAZFSNq9iQ5g9Mnj+TmEPTl2l8zaci1NF2MIb3954ZGNify1wUSte24QqsoNG U5SqWxec2q3HAOHOaFJH1AUj37rQ6wGDEVZs0H6grX/1nN7oC+bxc7GLOd7B0N9N+m JTwOV8srI0VwAFS5mm7DyImFCl5372tPI1tF9miCdMJ9xqzACu23+uLkGxBjw/8/QL T+ZwfAokqK2LlAB9s5FM5q57ACYbpikM133S1ebcZ630n5qcDmDh7YDyeFcvja+NVM LnpFkv0UmptvMlB226FEBczr1ju9fZIn4C1Gq23sT1dIbocjjPs+xVy+v2SSq4D7dn T0riMrZM9GPYg== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] s3: add dumping the all devices and signed wakeup sources Date: Tue, 8 Aug 2023 18:31:09 +0800 Message-Id: <20230808103109.31376-2-ivan.hu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808103109.31376-1-ivan.hu@canonical.com> References: <20230808103109.31376-1-ivan.hu@canonical.com> MIME-Version: 1.0 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: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Add s3-dump-wakeup-src option for dumping the wakeup sources for debug. Signed-off-by: Ivan Hu --- src/acpi/s3/s3.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c index a4775cd4..93686155 100644 --- a/src/acpi/s3/s3.c +++ b/src/acpi/s3/s3.c @@ -53,6 +53,7 @@ static float s3_resume_time = 15.0; /* Maximum allowed resume time */ static bool s3_hybrid = false; static char *s3_hook = NULL; /* Hook to run after each S3 */ static char *s3_sleep_type = NULL; /* The sleep type(s3 or s2idle) */ +static bool s3_wakeup_src = false; /* dump wakeup source for debug */ typedef struct { char name[32]; @@ -124,6 +125,25 @@ static int read_wakeup_source(fwts_list *source) return FWTS_OK; } +static void dump_wakeup_source(fwts_framework *fw, fwts_list *source) +{ + if (fwts_list_len(source) > 0) { + fwts_list_link *item; + + + fwts_list_foreach(item, source) { + wakeup_source *wakeup_source_data = + fwts_list_data(wakeup_source *, item); + + fwts_log_info_verbatim(fw, "%s\t%lu\t%lu\t%lu\t%lu\t%ld\t%ld\t%ld\t%ld\t%ld\n", + wakeup_source_data->name, wakeup_source_data->active_count, wakeup_source_data->event_count, + wakeup_source_data->wakeup_count, wakeup_source_data->expire_count, wakeup_source_data->active_since, + wakeup_source_data->total_time, wakeup_source_data->max_time, wakeup_source_data->last_change, + wakeup_source_data->prevent_suspend_time); + } + } else + fwts_log_info(fw, "No wakeup source found."); +} static void wakeup_source_cmp(fwts_framework *fw, fwts_list *suspend_source, fwts_list *resume_source) { @@ -144,7 +164,19 @@ static void wakeup_source_cmp(fwts_framework *fw, fwts_list *suspend_source, fwt wakeup_source *data2 = fwts_list_data(wakeup_source *, item2); if (data1->event_count < data2->event_count) { fwts_log_info_verbatim(fw, "wakeup source name: \"%s\" wakeup event was signaled.\n", data1->name); - + if (s3_wakeup_src) { + fwts_log_info_verbatim(fw, "%s %lu %lu %lu %lu %ld %ld %ld %ld %ld\n", + data1->name, data1->active_count, data1->event_count, + data1->wakeup_count, data1->expire_count, data1->active_since, + data1->total_time, data1->max_time, data1->last_change, + data1->prevent_suspend_time); + + fwts_log_info_verbatim(fw, "%s %lu %lu %lu %lu %ld %ld %ld %ld %ld\n", + data2->name, data2->active_count, data2->event_count, + data2->wakeup_count, data2->expire_count, data2->active_since, + data2->total_time, data2->max_time, data2->last_change, + data2->prevent_suspend_time); + } } item1 = fwts_list_next(item1); item2 = fwts_list_next(item2); @@ -455,6 +487,11 @@ static int s3_do_suspend_resume(fwts_framework *fw, if (wk_src_found) { if (read_wakeup_source(&resume_wakeup_soure) != FWTS_ERROR) { (void)wakeup_source_cmp(fw, &suspend_wakeup_soure, &resume_wakeup_soure); + if (s3_wakeup_src) { + (void)dump_wakeup_source(fw, &suspend_wakeup_soure); + fwts_log_info(fw, "versus after:"); + (void)dump_wakeup_source(fw, &resume_wakeup_soure); + } } } @@ -950,6 +987,9 @@ static int s3_options_handler(fwts_framework *fw, int argc, char * const argv[], case 12: s3_sleep_type = optarg; break; + case 13: + s3_wakeup_src = true; + break; } } return FWTS_OK; @@ -968,7 +1008,8 @@ static fwts_option s3_options[] = { { "s3-resume-time", "", 1, "Maximum expected resume time in seconds, e.g. --s3-resume-time=5.1" }, { "s3-hybrid", "", 0, "Run S3 with hybrid sleep, i.e. saving system states as S4 does." }, { "s3-resume-hook hook","", 1, "Run a hook script after each S3 resume, 0 exit indicates success." }, - { "s3-sleep-type" ,"", 1, "Set the sleep type for testing S3 or s2idle." }, + { "s3-sleep-type", "", 1, "Set the sleep type for testing S3 or s2idle." }, + { "s3-dump-wakeup-src", "", 0, "dump the all device wakeup sources suspend/resume.(For debug)"}, { NULL, NULL, 0, NULL } };