https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211852
--- Comment #2 from Ravi Pokala <rpok...@panasas.com> --- Neat, I didn't know `smartctl' had been extended to understand NVMe! :-) In any case, it the code for handling power-down looks grossly correct: sys/dev/nvme/nvme_ctrlr.c (r308431) 1184 void 1185 nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) 1186 { 1187 union cc_register cc; 1188 union csts_register csts; 1189 int ticks = 0; 1190 1191 cc.raw = nvme_mmio_read_4(ctrlr, cc); 1192 cc.bits.shn = NVME_SHN_NORMAL; 1193 nvme_mmio_write_4(ctrlr, cc, cc.raw); 1194 csts.raw = nvme_mmio_read_4(ctrlr, csts); 1195 while ((csts.bits.shst != NVME_SHST_COMPLETE) && (ticks++ < 5*hz)) { 1196 pause("nvme shn", 1); 1197 csts.raw = nvme_mmio_read_4(ctrlr, csts); 1198 } 1199 if (csts.bits.shst != NVME_SHST_COMPLETE) 1200 nvme_printf(ctrlr, "did not complete shutdown within 5 seconds " 1201 "of notification\n"); 1202 } In English, that's roughly: notify the controller about a normal shutdown (as opposed to an "abrupt" shutdown), then wait until the controller status indicates that shutdown is complete; if the controller doesn't indicate complete shutdown within 5 seconds, print a log message and continue anyway. It has been in that state since r254302 (2013-08-13). (That's in -HEAD, but the same code is in 10.3-RELEASE.) Hmmm... In NVMe-1.2.1, section 7.6.2: "It is recommended that the host wait a minimum of the RTD3 Entry Latency reported in the Identify Controller data structure for the shutdown operations to complete; if the value reported in RTD3 Entry Latency is 0h, then the host should wait for a minimum of one second." The "RTD3 Entry Latency" is described in section 5.11, Figure 90: "Bytes 91:88: RTD3 Entry Latency (RTD3E): This field indicates the typical latency in microseconds to enter Runtime D3 (RTD3). Refer to section 8.4.4 for test conditions. A value of 0h indicates RTD3 Entry Latency is not reported." So, that hard-coded 5 seconds might not be correct. It looks like (struct nvme_controller_data) treats the part of the "Identify Controller" data structure which contains RTD3E as reserved. It looks like it was in fact reserved in NVMe-1.1, but was defined later. -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"