[PATCH 2/2] nvme-pci: Add debug message on fail to read CSTS

Gerd Bayer posted 2 patches 3 months, 3 weeks ago
There is a newer version of this series
[PATCH 2/2] nvme-pci: Add debug message on fail to read CSTS
Posted by Gerd Bayer 3 months, 3 weeks ago
Add a debug log spelling out that reading the CSTS register failed - to
distinguish this from other reasons for ENODEV.

Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
---
 drivers/nvme/host/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 7544c4bac2c4a230d32cf729abb9e94bf93a921f..c3b0a9d56ac1f32f67ce0890becd6425eb80ebad 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2906,6 +2906,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
 	pci_set_master(pdev);
 
 	if (readl(dev->bar + NVME_REG_CSTS) == -1) {
+		dev_dbg(dev->ctrl.device, "Read CSTS register failed");
 		result = -ENODEV;
 		goto disable;
 	}

-- 
2.48.1
Re: [PATCH 2/2] nvme-pci: Add debug message on fail to read CSTS
Posted by Christoph Hellwig 3 months, 2 weeks ago
On Mon, Oct 20, 2025 at 05:29:08PM +0200, Gerd Bayer wrote:
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 7544c4bac2c4a230d32cf729abb9e94bf93a921f..c3b0a9d56ac1f32f67ce0890becd6425eb80ebad 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2906,6 +2906,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
>  	pci_set_master(pdev);
>  
>  	if (readl(dev->bar + NVME_REG_CSTS) == -1) {
> +		dev_dbg(dev->ctrl.device, "Read CSTS register failed");

Should this say "reading" instead of "read"?  Also most (but not
all) nvme errors don't start with capitalized words, like most drivers
as far as I can tell.
Re: [PATCH 2/2] nvme-pci: Add debug message on fail to read CSTS
Posted by Gerd Bayer 3 months, 2 weeks ago
On Wed, 2025-10-22 at 08:27 +0200, Christoph Hellwig wrote:
> On Mon, Oct 20, 2025 at 05:29:08PM +0200, Gerd Bayer wrote:
> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index 7544c4bac2c4a230d32cf729abb9e94bf93a921f..c3b0a9d56ac1f32f67ce0890becd6425eb80ebad 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -2906,6 +2906,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
> >  	pci_set_master(pdev);
> >  
> >  	if (readl(dev->bar + NVME_REG_CSTS) == -1) {
> > +		dev_dbg(dev->ctrl.device, "Read CSTS register failed");
> 
> Should this say "reading" instead of "read"?  Also most (but not
> all) nvme errors don't start with capitalized words, like most drivers
> as far as I can tell.

I'll change that in a v2.

Thanks,
Gerd
Re: [PATCH 2/2] nvme-pci: Add debug message on fail to read CSTS
Posted by Wilfred Mallawa 3 months, 2 weeks ago
On Mon, 2025-10-20 at 17:29 +0200, Gerd Bayer wrote:
> Add a debug log spelling out that reading the CSTS register failed -
> to
> distinguish this from other reasons for ENODEV.
> 
> Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
> ---
>  drivers/nvme/host/pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index
> 7544c4bac2c4a230d32cf729abb9e94bf93a921f..c3b0a9d56ac1f32f67ce0890bec
> d6425eb80ebad 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2906,6 +2906,7 @@ static int nvme_pci_enable(struct nvme_dev
> *dev)
>  	pci_set_master(pdev);
>  
>  	if (readl(dev->bar + NVME_REG_CSTS) == -1) {
> +		dev_dbg(dev->ctrl.device, "Read CSTS register
> failed");
>  		result = -ENODEV;
>  		goto disable;
>  	}
Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>

Wilfred
Re: [PATCH 2/2] nvme-pci: Add debug message on fail to read CSTS
Posted by Chaitanya Kulkarni 3 months, 3 weeks ago
On 10/20/25 08:29, Gerd Bayer wrote:
> Add a debug log spelling out that reading the CSTS register failed - to
> distinguish this from other reasons for ENODEV.
>
> Signed-off-by: Gerd Bayer<gbayer@linux.ibm.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck