lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZbITTlBwu390dwT5@linux.intel.com>
Date: Thu, 25 Jan 2024 08:52:46 +0100
From: Stanislaw Gruszka <stanislaw.gruszka@...ux.intel.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Linux PM <linux-pm@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Ulf Hansson <ulf.hansson@...aro.org>
Subject: Re: [PATCH v1 05/12] PM: sleep: stats: Use step_failures[0] as a
 counter of successful cycles

On Mon, Jan 22, 2024 at 12:29:11PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> 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 <rafael.j.wysocki@...el.com>
> ---
>  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;
<snip>
> -		   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]++;

This looks confusing for me. I think would be better keep
success field and just remove SUSPEND_NONE from the 
suspend_stat_step and suspend_stat_names. Actually do
not introduce it, SUSPEND_NONE does not seems to be necessary
(SUSPEND_FREEZE can be 0).

Regards
Stanislaw
 






Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ