Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp276620rdb; Mon, 22 Jan 2024 04:03:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzPK8aAobbIAWmWFTAhqihcM47R29N8nJK1oqXnjhrHVCvU+yhKVBRPTM1WfmhU79Ybeyg X-Received: by 2002:a92:c111:0:b0:361:a1b2:14bf with SMTP id p17-20020a92c111000000b00361a1b214bfmr4811037ile.51.1705925009131; Mon, 22 Jan 2024 04:03:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705925009; cv=pass; d=google.com; s=arc-20160816; b=Noe4qqNR4OjKXsvnYbNIhdf1YrfZ0MKyMGnLHtNSsSQnVsgQxWQXHubHL0rKfH2Wlz ZmWubjX6kRW8sY9wBasO2l+FQXrc6L1AXWzZ1ugE8fDlGa/1kX75UKx/MRQGE5/6xACG Oj2vovWgF+fudfBgVp2YLUp3LxLWBtEMQPITl5qINjT/6oSZWQzDfDPnczpT9lq9MHz4 lVdaTeVBcrFZBQfnJIqmabtfPDBrU8tx6wJ0uncmwiZQbFptk2oE4Tln2Mm9O5urszTQ NlaEzjxRNkdGp75MY40R7Dy9E5l7cLpOqk8TZff75FwfUqYX6IHaDt4g3s3KSlBBr1l/ FERQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=GSwKrxPG35twycfHRWyCPcl2rYghiW0zokjuOdirfus=; fh=4LIu5opAwLV7NEWuWaesW8kxXXZagKTitwg1cEZexpE=; b=IwtXUaEuLxdPyswfTkW0hfx+xl59vmRQumzDNn74FzR0uAAxo2TyCGCvXG7DDyaVp7 +zQ+/LD0Ejcb3vozI/+BxkevbFxQHC6JUKGHLg1u4oAzdvcaxsRoBJnIRMzBweajEuN3 vbOrYPJCssKad/E+vZ7HWvuPc89Lng72j2/rbtggKSTqa2ddkRS18Lty/Oi5vOws0zLJ XQfjhMvYf1TYH4t6uMNReb/YIs+LfqcAi+4IqrWP8D9+IWy4V5nu1CGLf/cSM80x5nIb ZQd8ncUUeqU3nsu5DRZCT3wryzb+DT2HVhaS3oO/77HHoUuMKojbR76D+fAnHbsH1AHN Sc0g== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-32955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32955-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bw20-20020a056a02049400b005cec914ce05si8256941pgb.373.2024.01.22.04.03.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 04:03:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-32955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32955-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DAD1A290CBE for ; Mon, 22 Jan 2024 11:47:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C87603DBB9; Mon, 22 Jan 2024 11:44:34 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFC0A3CF43; Mon, 22 Jan 2024 11:44:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705923874; cv=none; b=B5BzDkIbJMw1Ymdx211LVM2OqERCER83GPU5NQfNDnarwzarm4QEk9fxDPmqYYnEFRVyQJiycmKakARdaAzVG9EwgL+YfebbG9gnCSK/uhpFtA4iOPZenKnqba3ypsd0Ir/7koTCoEIm7cIhRPqZ0NToceNnMkvt5c2s6l8dFjo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705923874; c=relaxed/simple; bh=ViL55juQL2yZg0/fut6nXH2YChHT8Lh7HKMvuFfirfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cZvj7IZ1t23HnCjfLH513RloxQc7/1A0yeg3Gy/eg7pvEMPOEGpKHCPYb1nvdrjvWNvJw8M14SKai7Y27fyvTGa+ofbhK8zAzGJRkk1ogPboL+n6ILoEA7cQ+qkbo+8bhC8Vpc/vevXLxvXXNLHmXQsIgN6dP9wEYy7uBVNo0wE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 573e3b755b40b71a; Mon, 22 Jan 2024 12:44:26 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 28093669540; Mon, 22 Jan 2024 12:44:26 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Ulf Hansson , Stanislaw Gruszka Subject: [PATCH v1 05/12] PM: sleep: stats: Use step_failures[0] as a counter of successful cycles Date: Mon, 22 Jan 2024 12:29:11 +0100 Message-ID: <3290637.44csPzL39Z@kreacher> In-Reply-To: <5760158.DvuYhMxLoT@kreacher> References: <5760158.DvuYhMxLoT@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrvdekiedgfedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepgedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehulhhfrdhhrghnshhsohhnsehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgrnhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=4 Fuz1=4 Fuz2=4 From: Rafael J. Wysocki The first (index 0) cell of the step_failures[] array in struct suspend_stats introduced previously can be used as a counter of successful suspend-resume cycles instead of the separate "success" field in it, so do that. While at it, change the type of the "fail" field in struct suspend_stats to unsigned int, because it cannot be negative. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- include/linux/suspend.h | 3 +-- kernel/power/main.c | 9 +++++---- kernel/power/suspend.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) Index: linux-pm/include/linux/suspend.h =================================================================== --- linux-pm.orig/include/linux/suspend.h +++ linux-pm/include/linux/suspend.h @@ -55,8 +55,7 @@ enum suspend_stat_step { struct suspend_stats { unsigned int step_failures[SUSPEND_NR_STEPS]; - int success; - int fail; + unsigned int fail; #define REC_FAILED_NUM 2 int last_failed_dev; char failed_devs[REC_FAILED_NUM][40]; Index: linux-pm/kernel/power/main.c =================================================================== --- linux-pm.orig/kernel/power/main.c +++ linux-pm/kernel/power/main.c @@ -339,8 +339,7 @@ static ssize_t _name##_show(struct kobje } \ static struct kobj_attribute _name = __ATTR_RO(_name) -suspend_attr(success, "%d\n"); -suspend_attr(fail, "%d\n"); +suspend_attr(fail, "%u\n"); suspend_attr(last_hw_sleep, "%llu\n"); suspend_attr(total_hw_sleep, "%llu\n"); suspend_attr(max_hw_sleep, "%llu\n"); @@ -354,6 +353,7 @@ static ssize_t _name##_show(struct kobje } \ static struct kobj_attribute _name = __ATTR_RO(_name) +suspend_step_attr(success, SUSPEND_NONE); suspend_step_attr(failed_freeze, SUSPEND_FREEZE); suspend_step_attr(failed_prepare, SUSPEND_PREPARE); suspend_step_attr(failed_suspend, SUSPEND_SUSPEND); @@ -458,8 +458,9 @@ static int suspend_stats_show(struct seq last_step = suspend_stats.last_failed_step + REC_FAILED_NUM - 1; last_step %= REC_FAILED_NUM; - seq_printf(s, "success: %d\nfail: %d\n", - suspend_stats.success, suspend_stats.fail); + seq_printf(s, "success: %u\nfail: %u\n", + suspend_stats.step_failures[SUSPEND_NONE], + suspend_stats.fail); for (step = SUSPEND_FREEZE; step < SUSPEND_NR_STEPS; step++) seq_printf(s, "failed_%s: %u\n", suspend_step_names[step], Index: linux-pm/kernel/power/suspend.c =================================================================== --- linux-pm.orig/kernel/power/suspend.c +++ linux-pm/kernel/power/suspend.c @@ -620,7 +620,7 @@ int pm_suspend(suspend_state_t state) suspend_stats.fail++; dpm_save_failed_errno(error); } else { - suspend_stats.success++; + suspend_stats.step_failures[SUSPEND_NONE]++; } pr_info("suspend exit\n"); return error;