* [PATCH] nvme/pci: Log PCI_STATUS when the controller dies
@ 2016-11-30 1:18 Andy Lutomirski
2016-11-30 15:25 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Andy Lutomirski @ 2016-11-30 1:18 UTC (permalink / raw)
Signed-off-by: Andy Lutomirski <luto at kernel.org>
---
drivers/nvme/host/pci.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 0248d0e21fee..b4527e5b1364 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1292,10 +1292,16 @@ static void nvme_watchdog_timer(unsigned long data)
/* Skip controllers under certain specific conditions. */
if (nvme_should_reset(dev, csts)) {
- if (!nvme_reset(dev))
+ if (!nvme_reset(dev)) {
+ /* Read a config register to help see what died. */
+ u16 pci_status = 0xffff;
+
+ pci_read_config_word(to_pci_dev(dev->dev),
+ PCI_STATUS, &pci_status);
dev_warn(dev->dev,
- "Failed status: 0x%x, reset controller.\n",
- csts);
+ "controller is down; will reset: CSTS=0x%x, PCI_STATUS=0x%hx\n",
+ csts, pci_status);
+ }
return;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] nvme/pci: Log PCI_STATUS when the controller dies
2016-11-30 1:18 [PATCH] nvme/pci: Log PCI_STATUS when the controller dies Andy Lutomirski
@ 2016-11-30 15:25 ` Jens Axboe
2016-11-30 18:28 ` Andy Lutomirski
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2016-11-30 15:25 UTC (permalink / raw)
On 11/29/2016 06:18 PM, Andy Lutomirski wrote:
> Signed-off-by: Andy Lutomirski <luto at kernel.org>
> ---
> drivers/nvme/host/pci.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 0248d0e21fee..b4527e5b1364 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1292,10 +1292,16 @@ static void nvme_watchdog_timer(unsigned long data)
>
> /* Skip controllers under certain specific conditions. */
> if (nvme_should_reset(dev, csts)) {
> - if (!nvme_reset(dev))
> + if (!nvme_reset(dev)) {
> + /* Read a config register to help see what died. */
> + u16 pci_status = 0xffff;
> +
> + pci_read_config_word(to_pci_dev(dev->dev),
> + PCI_STATUS, &pci_status);
> dev_warn(dev->dev,
> - "Failed status: 0x%x, reset controller.\n",
> - csts);
> + "controller is down; will reset: CSTS=0x%x, PCI_STATUS=0x%hx\n",
> + csts, pci_status);
> + }
> return;
> }
Looks fine to me, but why the pci_status init to 0xffff?
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] nvme/pci: Log PCI_STATUS when the controller dies
2016-11-30 15:25 ` Jens Axboe
@ 2016-11-30 18:28 ` Andy Lutomirski
2016-12-01 18:09 ` Keith Busch
0 siblings, 1 reply; 4+ messages in thread
From: Andy Lutomirski @ 2016-11-30 18:28 UTC (permalink / raw)
On Wed, Nov 30, 2016@7:25 AM, Jens Axboe <axboe@fb.com> wrote:
> On 11/29/2016 06:18 PM, Andy Lutomirski wrote:
>> Signed-off-by: Andy Lutomirski <luto at kernel.org>
>> ---
>> drivers/nvme/host/pci.c | 12 +++++++++---
>> 1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
>> index 0248d0e21fee..b4527e5b1364 100644
>> --- a/drivers/nvme/host/pci.c
>> +++ b/drivers/nvme/host/pci.c
>> @@ -1292,10 +1292,16 @@ static void nvme_watchdog_timer(unsigned long data)
>>
>> /* Skip controllers under certain specific conditions. */
>> if (nvme_should_reset(dev, csts)) {
>> - if (!nvme_reset(dev))
>> + if (!nvme_reset(dev)) {
>> + /* Read a config register to help see what died. */
>> + u16 pci_status = 0xffff;
>> +
>> + pci_read_config_word(to_pci_dev(dev->dev),
>> + PCI_STATUS, &pci_status);
>> dev_warn(dev->dev,
>> - "Failed status: 0x%x, reset controller.\n",
>> - csts);
>> + "controller is down; will reset: CSTS=0x%x, PCI_STATUS=0x%hx\n",
>> + csts, pci_status);
>> + }
>> return;
>> }
>
> Looks fine to me, but why the pci_status init to 0xffff?
In theory, although not (AFAIK) on x86, config space reads can fail
outright. Normally a failure looks like returning 0xffff, so I
figured I'd make it consistent. I could alternatively check the
return value and print a different message if pci_read_config_word
fails.
--Andy
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] nvme/pci: Log PCI_STATUS when the controller dies
2016-11-30 18:28 ` Andy Lutomirski
@ 2016-12-01 18:09 ` Keith Busch
0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2016-12-01 18:09 UTC (permalink / raw)
On Wed, Nov 30, 2016@10:28:03AM -0800, Andy Lutomirski wrote:
> In theory, although not (AFAIK) on x86, config space reads can fail
> outright. Normally a failure looks like returning 0xffff, so I
> figured I'd make it consistent. I could alternatively check the
> return value and print a different message if pci_read_config_word
> fails.
I agree it'd be nice to know if we actually got all 1's from hardware,
or the pci config read itself returned an error without setting the
status. x86 should be returning all 1's on a failure, but don't want to
always count on that.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-01 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 1:18 [PATCH] nvme/pci: Log PCI_STATUS when the controller dies Andy Lutomirski
2016-11-30 15:25 ` Jens Axboe
2016-11-30 18:28 ` Andy Lutomirski
2016-12-01 18:09 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).