Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153924911
D32241.id96084.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D32241.id96084.diff
View Options
diff --git a/share/man/man4/nvme.4 b/share/man/man4/nvme.4
--- a/share/man/man4/nvme.4
+++ b/share/man/man4/nvme.4
@@ -172,6 +172,14 @@
hw.nvme.verbose_cmd_dump=1
.Ed
.Pp
+Prior versions of the driver reset the card twice on boot.
+This proved to be unnecessary and inefficient, so the driver now resets drive
+controller only once.
+The old behavior may be restored in the kernel config file with
+.Bd -literal -offset indent
+.Cd options NVME_2X_RESET
+.Ed
+.Pp
.Sh SYSCTL VARIABLES
The following controller-level sysctls are currently implemented:
.Bl -tag -width indent
diff --git a/sys/conf/options b/sys/conf/options
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -1006,6 +1006,7 @@
# NVME options
NVME_USE_NVD opt_nvme.h
+NVME_2X_RESET opt_nvme.h
# amdsbwd options
AMDSBWD_DEBUG opt_amdsbwd.h
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -30,6 +30,7 @@
__FBSDID("$FreeBSD$");
#include "opt_cam.h"
+#include "opt_nvme.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -1135,12 +1136,6 @@
TSENTER();
- /*
- * Reset controller twice to ensure we do a transition from cc.en==1 to
- * cc.en==0. This is because we don't really know what status the
- * controller was left in when boot handed off to OS. Linux doesn't do
- * this, however. If we adopt that policy, see also nvme_ctrlr_resume().
- */
if (nvme_ctrlr_hw_reset(ctrlr) != 0) {
fail:
nvme_ctrlr_fail(ctrlr);
@@ -1148,8 +1143,17 @@
return;
}
+#ifdef NVME_2X_RESET
+ /*
+ * Reset controller twice to ensure we do a transition from cc.en==1 to
+ * cc.en==0. This is because we don't really know what status the
+ * controller was left in when boot handed off to OS. Linux doesn't do
+ * this, however, and when the controller is in state cc.en == 0, no
+ * I/O can happen.
+ */
if (nvme_ctrlr_hw_reset(ctrlr) != 0)
goto fail;
+#endif
nvme_qpair_reset(&ctrlr->adminq);
nvme_admin_qpair_enable(&ctrlr->adminq);
@@ -1672,14 +1676,17 @@
if (ctrlr->is_failed)
return (0);
- /*
- * Have to reset the hardware twice, just like we do on attach. See
- * nmve_attach() for why.
- */
if (nvme_ctrlr_hw_reset(ctrlr) != 0)
goto fail;
+#ifdef NVME_2X_RESET
+ /*
+ * Prior to FreeBSD 13.1, FreeBSD's nvme driver reset the hardware twice
+ * to get it into a known good state. However, the hardware's state is
+ * good and we don't need to do this for proper functioning.
+ */
if (nvme_ctrlr_hw_reset(ctrlr) != 0)
goto fail;
+#endif
/*
* Now that we've reset the hardware, we can restart the controller. Any
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 25, 8:30 PM (11 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32141308
Default Alt Text
D32241.id96084.diff (2 KB)
Attached To
Mode
D32241: nvme: Only reset once on attach.
Attached
Detach File
Event Timeline
Log In to Comment