[PATCH blktests] nvme: Add passthru error logging tests to nvme/039
Shinichiro Kawasaki
shinichiro.kawasaki at wdc.com
Mon Feb 19 00:06:17 PST 2024
On Feb 16, 2024 / 15:30, Alan Adamson wrote:
> Tests the ability to enable and disable error logging for passthru admin commands issued to
> the controller and passthru IO commands issued to a namespace.
Alan, thanks for the patch. Good to get the test coverage back.
I applied the patch and ran nvme/039 for a QEMU nvme device on the kernel
v6.8-rc5. Then I observed the failure below:
---------------------------------------------------------------------
nvme/039 => nvme0n1 (test error logging) [failed]
runtime 5.308s ... 5.318s
--- tests/nvme/039.out 2024-02-19 15:59:12.143488379 +0900
+++ /home/shin/Blktests/blktests/results/nvme0n1/nvme/039.out.bad 2024-02-19 16:33:06.135840798 +0900
@@ -3,5 +3,4 @@
Read(0x2) @ LBA 0, 1 blocks, Unknown (sct 0x3 / sc 0x75) DNR
Write(0x1) @ LBA 0, 1 blocks, Write Fault (sct 0x2 / sc 0x80) DNR
Identify(0x6), Access Denied (sct 0x2 / sc 0x86) DNR cdw10=0x1 cdw11=0x0 cdw12=0x0 cdw13=0x0 cdw14=0x0 cdw15=0x0
- Read(0x2), Invalid Command Opcode (sct 0x0 / sc 0x1) DNR cdw10=0x0 cdw11=0x0 cdw12=0x1 cdw13=0x0 cdw14=0x0 cdw15=0x0
Test complete
---------------------------------------------------------------------
FYI, kernel reported messages below:
---------------------------------------------------------------------
[ 41.441042][ T1040] run blktests nvme/039 at 2024-02-19 16:33:00
[ 46.539249][ C2] nvme0n1: I/O Cmd(0x2) @ LBA 0, 1 blocks, I/O Error (sct 0x2 / sc 0x81) DNR
[ 46.539974][ C2] critical medium error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 12
[ 46.570149][ C3] nvme0n1: I/O Cmd(0x2) @ LBA 0, 1 blocks, I/O Error (sct 0x3 / sc 0x75) DNR
[ 46.571329][ C3] I/O error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 0
[ 46.597495][ C1] nvme0n1: I/O Cmd(0x1) @ LBA 0, 1 blocks, I/O Error (sct 0x2 / sc 0x80) DNR
[ 46.598334][ C1] critical medium error, dev nvme0n1, sector 0 op 0x1:(WRITE) flags 0x8800 phys_seg0
[ 46.672226][ C0] nvme0: Admin Cmd(0x6), I/O Error (sct 0x2 / sc 0x86) DNR cdw10=0x1 cdw11=0x0 cdw10
[ 46.714923][ T1137] nvme nvme0: NVME_IOCTL_IO_CMD not supported when multiple namespaces present!
[ 46.754907][ T1149] nvme nvme0: NVME_IOCTL_IO_CMD not supported when multiple namespaces present!
---------------------------------------------------------------------
Do I miss anything to make the test case pass?
I also ran nvme/039 on the kernel v6.7 and observed a different failure symptom
below. Old kernels do not have the sysfs attribute passthru_err_log_enabled,
hence the failure.
---------------------------------------------------------------------
nvme/039 => nvme0n1 (test error logging) [failed]
runtime 5.570s ... 5.308s
--- tests/nvme/039.out 2024-02-19 15:59:12.143488379 +0900
+++ /home/shin/Blktests/blktests/results/nvme0n1/nvme/039.out.bad 2024-02-19 16:23:02.669330853 +0900
@@ -1,7 +1,15 @@
Running nvme/039
+cat: /sys/class/nvme/nvme0/passthru_err_log_enabled: No such file or directory
+cat: /sys/class/nvme/nvme0/nvme0n1/passthru_err_log_enabled: No such file or directory
+tests/nvme/rc: line 1017: /sys/class/nvme/nvme0/passthru_err_log_enabled: Permission denied
+tests/nvme/rc: line 1022: /sys/class/nvme/nvme0/nvme0n1/passthru_err_log_enabled: Permission denied
Read(0x2) @ LBA 0, 1 blocks, Unrecovered Read Error (sct 0x2 / sc 0x81) DNR
Read(0x2) @ LBA 0, 1 blocks, Unknown (sct 0x3 / sc 0x75) DNR
...
(Run 'diff -u tests/nvme/039.out /home/shpin/Blktests/blktests/results/nvme0n1/nvme/039.out.bad' to see the entire diff)
---------------------------------------------------------------------
Then the added tests should be executed only when the kernel has the sysfs
attribute. If such control is introduced in the test case, the output of the
test case will have variations and can not be compared with static 039.out
file. Check for the added tests must be done by the test case in a different
way.
Another idea is to create another test case dedicated for the added tests.
It will allow comparison with static out file. It also allow to use
_require_test_dev_sysfs() helper function in device_requires() to check the
sysfs attribute (ref: block/005). On the other hand, this approach will need to
move more functions from nvme/039 to nvme/rc.
Which way looks the better for you?
More information about the Linux-nvme
mailing list