Skip to contentSkip to conversation

nvme: Fix error code and log to indicate busy

PATCH RESEND In review Moritz Fischer 3 participants 6 messages Jan 10, 2024 – Jan 19, 2024

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/2 nvme: Fix error code and log to indicate busy

Return -EBUSY if controller is found busy rather than -ENOMEM and update the error message accordingly.

Fixes 982388eaa991 ("nvme: Add NVM Express driver support")
---
 drivers/nvme/nvme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/nvme.c +2 -2
index c39cd41aa3..ec45f831a3 100644
@@ -835,8 +835,8 @@ int nvme_init(struct udevice *udev)
 	ndev->udev = udev;
 	INIT_LIST_HEAD(&ndev->namespaces);
 	if (readl(&ndev->bar->csts) == -1) {
-		ret = -ENODEV;
-		printf("Error: %s: Out of memory!\n", udev->name);
+		ret = -EBUSY;
+		printf("Error: %s: Controller not ready!\n", udev->name);
 		goto free_nvme;
 	}
 
Signature · 1 line
2.43.0.472.g3155946c3a-goog
#1 lore raw

PATCH RESEND v2 2/2 nvme: Update nvme_scan_namespace to keep trying on busy

A busy controller shouldn't be game-over for all controllers, so keep trying on hitting -EBUSY.

This change brings the actual behavior of the routine in line with what the descriptions says.

Fixes 982388eaa991 ("nvme: Add NVM Express driver support")
---
 drivers/nvme/nvme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/nvme.c +3 -1
index ec45f831a3..59a139baa0 100644
@@ -695,7 +695,9 @@ int nvme_scan_namespace(void)
 		if (ret) {
 			log_err("Failed to probe '%s': err=%dE\n", dev->name,
 				ret);
-			return ret;
+			/* Bail if we ran out of memory, else keep trying */
+			if (ret != -EBUSY)
+				return ret;
 		}
 	}
 
Signature · 1 line
2.43.0.472.g3155946c3a-goog
#2 lore raw

Re: [PATCH v2 RESEND 2/2] nvme: Update nvme_scan_namespace to keep trying on busy

Quoted 30 lines · Moritz Fischer

A busy controller shouldn't be game-over for all controllers, so keep trying on hitting -EBUSY.

This change brings the actual behavior of the routine in line with what the descriptions says.

Fixes 982388eaa991 ("nvme: Add NVM Express driver support")
---
 drivers/nvme/nvme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/nvme.c +3 -2
index ec45f831a3..59a139baa0 100644
@@ -695,7 +695,9 @@ int nvme_scan_namespace(void)
                if (ret) {
                        log_err("Failed to probe '%s': err=%dE\n", dev->name,
                                ret);
-                       return ret;
+                       /* Bail if we ran out of memory, else keep trying */
+                       if (ret != -EBUSY)
+                               return ret;
                }
        }
 
--
Quoted 2 lines

2.43.0.472.g3155946c3a-goog

Gently ping on this. Is anything wrong with this series or why does it keep falling through the cracks?

- Moritz

#3 lore raw

Re: [PATCH v2 RESEND 2/2] nvme: Update nvme_scan_namespace to keep trying on busy

Quoted 30 lines · Moritz Fischer
Quoted 29 lines · Moritz Fischer

A busy controller shouldn't be game-over for all controllers, so keep trying on hitting -EBUSY.

This change brings the actual behavior of the routine in line with what the descriptions says.

Fixes 982388eaa991 ("nvme: Add NVM Express driver support")
---
 drivers/nvme/nvme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/nvme.c +3 -1
index ec45f831a3..59a139baa0 100644
@@ -695,7 +695,9 @@ int nvme_scan_namespace(void)
                if (ret) {
                        log_err("Failed to probe '%s': err=%dE\n", dev->name,
                                ret);
-                       return ret;
+                       /* Bail if we ran out of memory, else keep trying */
+                       if (ret != -EBUSY)
+                               return ret;
                }
        }
 
Quoted 6 lines
Quoted 3 lines

--
2.43.0.472.g3155946c3a-goog

Gently ping on this. Is anything wrong with this series or why does it keep falling through the cracks?

Randomly, I'm testing this (and your other patches, and some others) at the moment. Sorry for the delay.

Signature · 1 line
Tom
#4 lore raw

Re: [PATCH v2 RESEND 2/2] nvme: Update nvme_scan_namespace to keep trying on busy

In reply to Moritz Fischer
Quoted 9 lines · Moritz Fischer

A busy controller shouldn't be game-over for all controllers, so keep trying on hitting -EBUSY.

This change brings the actual behavior of the routine in line with what the descriptions says.

Fixes 982388eaa991 ("nvme: Add NVM Express driver support")

Applied to u-boot/master, thanks!

Signature · 1 line
Tom