From: Damien Le Moal <dlemoal@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Yihang Li <liyihang9@huawei.com>,
cassel@kernel.org, James.Bottomley@hansenpartnership.com,
martin.petersen@oracle.com, john.g.garry@oracle.com,
yanaijie@huawei.com, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, linuxarm@huawei.com,
chenxiang66@hisilicon.com, prime.zeng@huawei.com,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [bug report] scsi: SATA devices missing after FLR is triggered during HBA suspended
Date: Thu, 27 Jun 2024 09:56:02 +0900 [thread overview]
Message-ID: <a6e86954-4ab7-4bb0-b78d-56f44556318e@kernel.org> (raw)
In-Reply-To: <20240626151546.GA1466906@bhelgaas>
On 6/27/24 00:15, Bjorn Helgaas wrote:
>>> 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.
That is what I suspected. However, checking the code, reset_store() in
pci-sysfs.c does:
pm_runtime_get_sync(dev);
result = pci_reset_function(pdev);
pm_runtime_put(dev);
and pm_runtime_get_sync() calls __pm_runtime_resume() which will resume a
suspended device.
So while I still think it is not a good idea to reset a suspended device, things
should still work as execpected and not cause any problem with the device state,
right ?
Yihang,
I think that the issue at hand here is that once the reset finishes, the
controller goes back to suspended state, and I suspect that is because of the
"auto" setting for its power/control. That triggers because the FLR is done
after the controller resumed but *before* the revalidation of the drives
connected to it completes. So FLR makes the revalidation fail (scsi
scan/revalidation is asynchronous...).
This seems to me to be the expected behavior for what you are doing and I fail
to see how that ever worked correctly, even before 0c76106cb975 and 626b13f015e0.
Could you try this: add a call to msleep(30000) at the end of _resume_v3_hw(). I.e.:
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index feda9b54b443..54224568d749 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -5104,6 +5104,8 @@ static int _resume_v3_hw(struct device *device)
dev_warn(dev, "end of resuming controller\n");
+ msleep(30000);
+
return 0;
}
To see if it makes any difference to actually wait for the connected disks to
resume correctly before doing the FLR.
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-06-27 0:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 13:29 [bug report] scsi: SATA devices missing after FLR is triggered during HBA suspended Yihang Li
2024-06-18 23:11 ` Damien Le Moal
2024-06-22 3:31 ` Yihang Li
2024-06-22 11:25 ` Niklas Cassel
2024-06-24 0:10 ` Damien Le Moal
2024-06-24 12:10 ` Yihang Li
2024-07-01 3:03 ` Damien Le Moal
2024-07-02 11:20 ` Yihang Li
2024-06-26 15:15 ` Bjorn Helgaas
2024-06-27 0:56 ` Damien Le Moal [this message]
2024-06-27 8:19 ` Yihang Li
2024-07-01 20:39 ` Bjorn Helgaas
2024-07-02 2:38 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a6e86954-4ab7-4bb0-b78d-56f44556318e@kernel.org \
--to=dlemoal@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=chenxiang66@hisilicon.com \
--cc=helgaas@kernel.org \
--cc=john.g.garry@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liyihang9@huawei.com \
--cc=martin.petersen@oracle.com \
--cc=prime.zeng@huawei.com \
--cc=yanaijie@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox