On Mon, Jun 24, 2024 at 09:10:41AM +0900, Damien Le Moal wrote: > On 6/22/24 12:31 PM, Yihang Li wrote: > > Hi Damien, > > > > Thanks for your reply. > > > > On 2024/6/19 7:11, Damien Le Moal wrote: > >> On 6/18/24 22:29, Yihang Li wrote: > >>> Hi Damien, > >>> > >>> I found out that two issues is caused by commit 0c76106cb975 ("scsi: sd: > >>> Fix TCG OPAL unlock on system resume") and 626b13f015e0 ("scsi: Do not > >>> rescan devices with a suspended queue"). > >>> > >>> The two issues as follows for the situation that there are ATA disks > >>> connected with SAS controller: > >> > >> Which controller ? What is the driver ? > > > > I'm using the hisi_sas_v3_hw driver and it supports HiSilicon's SAS controller. > > I do not have access to this HBA, but I have one that uses libsas/pm8001 driver > so I will try to test with that. > > >>> (1) FLR is triggered after all disks and controller are suspended. As a > >>> result, the number of disks is abnormal. > >> > >> I am assuming here that FLR means PCI "Function Level Reset" ? > > > > Yes, I am talking about the PCI "Function Level Reset" > > > >> FLR and disk/controller suspend execution timing are unrelated. FLR can be > >> triggered at any time through sysfs. So please give details here. Why is FLR > >> done when the system is being suspended ? > > > > Yes, it is because FLR can be triggered at any time that we are testing the > > reliability of executing FLR commands after disk/controller suspended. > > "can be triggered" ? FLR is not a random asynchronous event. It is an action > that is *issued* by a user with sys admin rights. And such users can do a lot > of things that can break a machine... > > I fail to see the point of doing a function reset while the device is > suspended. But granted, I guess the device should comeback up in such case, > though I would like to hear what the PCI guys have to say about this. > > Bjorn, > > Is reseting a suspended PCI device something that should be/is supported ? I doubt it. The PCI core should be preserving all the generic PCI state across suspend/resume. The driver should only need to save/restore device-specific things the PCI core doesn't know about. A reset will clear out most state, and the driver doesn't know the reset happened, so it will expect most device state to have been preserved. Bjorn