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: <4bf62335-2e67-43c5-b2dc-4b0bed0521ed@kernel.org>
Date: Wed, 30 Apr 2025 14:32:44 -0500
From: Mario Limonciello <superm1@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Jean Delvare <jdelvare@...e.com>, Andi Shyti <andi.shyti@...nel.org>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 Jonathan Corbet <corbet@....net>,
 Mario Limonciello <mario.limonciello@....com>,
 Yazen Ghannam <yazen.ghannam@....com>, Thomas Gleixner <tglx@...utronix.de>,
 Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>,
 "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
 "H . Peter Anvin" <hpa@...or.com>,
 Shyam Sundar S K <Shyam-sundar.S-k@....com>,
 Hans de Goede <hdegoede@...hat.com>,
 "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
 open list <linux-kernel@...r.kernel.org>,
 "open list:I2C/SMBUS CONTROLLER DRIVERS FOR PC" <linux-i2c@...r.kernel.org>,
 "open list:AMD PMC DRIVER" <platform-driver-x86@...r.kernel.org>
Subject: Re: [PATCH v5 5/5] x86/CPU/AMD: Print the reason for the last reset

On 4/30/2025 2:25 PM, Borislav Petkov wrote:
> On Wed, Apr 30, 2025 at 02:17:43PM -0500, Mario Limonciello wrote:
>> Well with that approach once you got a known bit set you broke the loop and
>> would print a message for that known bit.  But if you have two bits set you
>> either need another loop or you only get one message print.
> 
> So I gather you want to print for *each* set bit?
> 
> If so:
> 
> 	for (i = 0; i <= ARRAY_SIZE(s5_reset_reason_txt); i++) {
> 		if (!(value & BIT(i)))
> 			continue;
> 
> 		if (s5_reset_reason_txt[i])
> 			pr_info(...);
> 	}
> 
> Still a lot easier instead of calling some function and dealing with from
> which bit to start etc etc.
> 
> 

This would work, but would still need to track if "no" known bits were 
set to emit an "unknown" message.

So the loops end up being for() and check a bit or while (true) and 
find_next_bit() and otherwise identical.

At that point does it really buy much more than the while (true) 
approach and find_next_bit()?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ