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: <6d33dbf2-d514-4a45-aa50-861c5f06f747@grabatoulnz.fr>
Date: Sat, 8 Mar 2025 11:05:36 +0100
From: Eric <eric.4.debian@...batoulnz.fr>
To: Niklas Cassel <cassel@...nel.org>
Cc: Salvatore Bonaccorso <carnil@...ian.org>,
 Mario Limonciello <mario.limonciello@....com>,
 Christoph Hellwig <hch@...radead.org>,
 Mika Westerberg <mika.westerberg@...ux.intel.com>,
 Damien Le Moal <dlemoal@...nel.org>, Jian-Hong Pan <jhp@...lessos.org>,
 regressions@...ts.linux.dev, linux-kernel@...r.kernel.org,
 stable@...r.kernel.org, linux-ide@...r.kernel.org,
 Dieter Mummenschanz <dmummenschanz@....de>
Subject: Re: Regression from 7627a0edef54 ("ata: ahci: Drop low power policy
 board type") on reboot (but not cold boot)

Hello Niklas,

I'll begin with the quick parts, changing kernel will take more time, 
this box is fit for family use but takes a bit of time to compile.

Le 07/03/2025 à 10:53, Niklas Cassel a écrit :
> Hello Eric,
>
> On Thu, Mar 06, 2025 at 01:27:17PM +0100, Eric wrote:
>> I installed the same system on a USB stick, on which I also installed grub,
>> so that the reboot is made independent of weather the UEFI sees the SSD disk
>> or not. I'll attach dmesg extracts (grep on ata or ahci) to this mail.
>> [...]
>>
>> I hope this is useful for diagnosing the problem.
> It is indeed!
>
> Wow.
>
> The problem does not appear to be with the SSD firmware.
>
> The problem appears to be that your AHCI controller reports different
> values in the PI (Ports Implemented) register.
>
> This is supposed to be a read-only register :)
Hmm ... puzzled, but weird things roam in the wild ;)
>
> At cold boot the print is:
> 4/4 ports implemented (port mask 0x3c)
> meaning ports 1,2 are not implemented (DUMMY ports).
>
> At reboot the print is:
> 3/3 ports implemented (port mask 0x38)
> meaning ports 1,2,3 are not implemented (DUMMY ports).
>
> So, the problem is that your AHCI controller appears to report different
> values in the PI register.
>
> Most likely, if the AHCI controller reported the same register values the
> second boot, libata would be able to scan and detect the drive correctly.
>
> What AHCI controller is this?
>
> $ sudo lspci -nns 0000:00:11.0
00:11.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD/ATI] 
SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] [1002:4391] (rev 40)
>
>
> Which kernel version are you using?
This is trixie's last, 6.12.12.
>
> Please test with v6.14-rc5 as there was a bug in v6.14-rc4 where
OK, I think I'll try directly with the patch, as it will save me a 
kernel build.
> mask_port_map would get incorrecly set. (Although, this bug should only
> affect device tree based platforms. Most often when using UEFI, you do
> not use device tree.)
>
> I do see that your AHCI controller is < AHCI 1.3, so we do take this path:
> https://github.com/torvalds/linux/blob/v6.14-rc5/drivers/ata/libahci.c#L571-L578
>
> Could you please provide a full dmesg?
Of course, full reboot dmesg attached to this message.
>
>
> Also, it would be helpful if you could print every time we read/write the
> PI register. (Don't ask me why libata writes a read-only register...
> we were not always the maintainers for this driver...)
>
> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
> index e7ace4b10f15..dd837834245b 100644
> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -533,6 +533,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
>   
>   	/* Override the HBA ports mapping if the platform needs it */
>   	port_map = readl(mmio + HOST_PORTS_IMPL);
> +	dev_err(dev, "%s:%d PI: read: %#lx\n", __func__, __LINE__, port_map);
>   	if (hpriv->saved_port_map && port_map != hpriv->saved_port_map) {
>   		dev_info(dev, "forcing port_map 0x%lx -> 0x%x\n",
>   			port_map, hpriv->saved_port_map);
> @@ -629,6 +630,7 @@ static void ahci_restore_initial_config(struct ata_host *host)
>   	if (hpriv->saved_cap2)
>   		writel(hpriv->saved_cap2, mmio + HOST_CAP2);
>   	writel(hpriv->saved_port_map, mmio + HOST_PORTS_IMPL);
> +	dev_err(host->dev, "%s:%d PI: wrote: %#x\n", __func__, __LINE__, hpriv->saved_port_map);
>   	(void) readl(mmio + HOST_PORTS_IMPL);	/* flush */
>   
>   	for_each_set_bit(i, &port_map, AHCI_MAX_PORTS) {
>
>
>
>
> Kind regards,
> Niklas

Kind regards,

Eric

View attachment "dmesg-full-reboot.txt" of type "text/plain" (82365 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ