Skip to contentSkip to conversation

NVMe-CLI Fix command failures in regress script

PATCH New Jeff Lien 2 participants 8 messages Feb 2, 2018 – Feb 5, 2018 NVMe

lore
Share & tools
lore

Jeff Lien

author
#0 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Signed-off-by Jeff Lien <jeff.lien at wdc.com>
---
 regress | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
regress +4 -4
index aa7820c..0278d1d 100755
@@ -89,7 +89,7 @@ if $LIST ; then
     run_test nvme list
 fi
 run_test nvme id-ctrl ${DEVICE}
-run_test nvme id-ns -raw-binary ${DEVICE}
+run_test nvme id-ns -n 1 -raw-binary ${DEVICE}
 run_test nvme list-ns -n 1 ${DEVICE}
 run_test nvme get-ns-id ${DEVICE}
 run_test nvme get-log ${DEVICE}  --log-id=2 --log-len=512
@@ -98,13 +98,13 @@ run_test nvme fw-log ${DEVICE} -b
 run_test nvme smart-log ${DEVICE}
 run_test nvme error-log ${DEVICE}
 run_test nvme get-feature ${DEVICE} -f 7
-run_test nvme flush ${DEVICE}
+run_test nvme flush -n 1 ${DEVICE}
 
 if $WRITE ; then
     run_test dd if=/dev/urandom of=${RAND_WFILE} bs=${RAND_SIZE} count=1
-    run_test nvme write ${DEVICE} --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_WFILE}
+    run_test nvme write ${DEVICE}n1 --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_WFILE}
 fi
-run_test nvme read ${DEVICE} --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_RFILE} --latency
+run_test nvme read ${DEVICE}n1 --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_RFILE} --latency
 if $WRITE ; then
     run_test diff ${RAND_RFILE} ${RAND_WFILE}
     rm ${RAND_WFILE} > /dev/null
Signature · 1 line
2.14.2.746.g8fb8a94
#1 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Quoted 25 lines · Jeff Lien
Signed-off-by Jeff Lien <jeff.lien at wdc.com>
---
 regress | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
regress +2 -2
index aa7820c..0278d1d 100755
@@ -89,7 +89,7 @@ if $LIST ; then
     run_test nvme list
 fi
 run_test nvme id-ctrl ${DEVICE}
-run_test nvme id-ns -raw-binary ${DEVICE}
+run_test nvme id-ns -n 1 -raw-binary ${DEVICE}
 run_test nvme list-ns -n 1 ${DEVICE}
 run_test nvme get-ns-id ${DEVICE}
 run_test nvme get-log ${DEVICE}  --log-id=2 --log-len=512
@@ -98,13 +98,13 @@ run_test nvme fw-log ${DEVICE} -b
 run_test nvme smart-log ${DEVICE}
 run_test nvme error-log ${DEVICE}
 run_test nvme get-feature ${DEVICE} -f 7
-run_test nvme flush ${DEVICE}
+run_test nvme flush -n 1 ${DEVICE}
 

regress run_test nvme fw-log ${DEVICE} -b · line 110

Quoted 10 lines
regress +2 -2
 if $WRITE ; then
     run_test dd if=/dev/urandom of=${RAND_WFILE} bs=${RAND_SIZE} count=1
-    run_test nvme write ${DEVICE} --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_WFILE}
+    run_test nvme write ${DEVICE}n1 --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_WFILE}
 fi
-run_test nvme read ${DEVICE} --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_RFILE} --latency
+run_test nvme read ${DEVICE}n1 --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_RFILE} --latency
 if $WRITE ; then
     run_test diff ${RAND_RFILE} ${RAND_WFILE}
     rm ${RAND_WFILE} > /dev/null

This script is supposed to only run on an nvme block block device.

#2 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Keith,
Then should we remove the commands that require a namespace id (ie id-ns, flush, write, and read)?

Jeff Lien

-----Original Message-----
From: Keith Busch [mailto:[email protected]]
Sent: Friday, February 2, 2018 2:30 PM
To: Jeffrey Lien
Cc: linux-nvme at lists.infradead.org; David Darrington
Subject: Re: [PATCH] NVMe-CLI Fix command failures in regress script

Quoted 26 lines · Jeff Lien
Signed-off-by Jeff Lien <jeff.lien at wdc.com>
---
 regress | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
regress +2 -1
index aa7820c..0278d1d 100755
@@ -89,7 +89,7 @@ if $LIST ; then
     run_test nvme list
 fi
 run_test nvme id-ctrl ${DEVICE}
-run_test nvme id-ns -raw-binary ${DEVICE}
+run_test nvme id-ns -n 1 -raw-binary ${DEVICE}
 run_test nvme list-ns -n 1 ${DEVICE}
 run_test nvme get-ns-id ${DEVICE}
 run_test nvme get-log ${DEVICE}  --log-id=2 --log-len=512 @@ -98,13 
+98,13 @@ run_test nvme fw-log ${DEVICE} -b  run_test nvme smart-log 

${DEVICE} run_test nvme error-log ${DEVICE} run_test nvme get-feature ${DEVICE} -f 7 -run_test nvme flush ${DEVICE}

regress +1 -1
+run_test nvme flush -n 1 ${DEVICE}
 
 if $WRITE ; then
     run_test dd if=/dev/urandom of=${RAND_WFILE} bs=${RAND_SIZE} count=1
-    run_test nvme write ${DEVICE} --start-block=0 --block-count=0 --data-size=${RAND_SIZE} --data ${RAND_WFILE}

regress run_test nvme fw-log ${DEVICE} -b · line 110

Quoted 10 lines
regress +4 -2
+    run_test nvme write ${DEVICE}n1 --start-block=0 --block-count=0 
+ --data-size=${RAND_SIZE} --data ${RAND_WFILE}
 fi
-run_test nvme read ${DEVICE} --start-block=0 --block-count=0 
--data-size=${RAND_SIZE} --data ${RAND_RFILE} --latency
+run_test nvme read ${DEVICE}n1 --start-block=0 --block-count=0 
+--data-size=${RAND_SIZE} --data ${RAND_RFILE} --latency
 if $WRITE ; then
     run_test diff ${RAND_RFILE} ${RAND_WFILE}
     rm ${RAND_WFILE} > /dev/null

This script is supposed to only run on an nvme block block device.

#3 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Quoted 2 lines · Jeffrey Lien

Keith,
Then should we remove the commands that require a namespace id (ie id-ns, flush, write, and read)?

If you provide a block device, nvme-cli will automatically figure out the nsid if you didn't provide one.

#4 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Keith,
That doesn't seem to happen with our nvme device. Below is what I get when I run the regress script as is. Am I missing something on the invocation?

./regress -d /dev/nvme0 -l -w
WARNING: Write mode enabled, this might trash your drive! NVME_VERSION = 1.5.79.ga75e.dirty

  RUN   nvme list                                                            : PASSED!
  RUN   nvme id-ctrl /dev/nvme0                                              : PASSED!
  RUN   nvme id-ns -raw-binary /dev/nvme0                                    : FAILED!
Failed running command: 
   nvme id-ns -raw-binary /dev/nvme0
  RUN   nvme list-ns -n 1 /dev/nvme0                                         : PASSED!
  RUN   nvme get-ns-id /dev/nvme0                                            : PASSED!
  RUN   nvme get-log /dev/nvme0 --log-id=2 --log-len=512                     : PASSED!
  RUN   nvme fw-log /dev/nvme0                                               : PASSED!
  RUN   nvme fw-log /dev/nvme0 -b                                            : PASSED!
  RUN   nvme smart-log /dev/nvme0                                            : PASSED!
  RUN   nvme error-log /dev/nvme0                                            : PASSED!
  RUN   nvme get-feature /dev/nvme0 -f 7                                     : PASSED!
  RUN   nvme flush /dev/nvme0                                                : FAILED!
Failed running command: 
   nvme flush /dev/nvme0
  RUN   dd if=/dev/urandom of=temp.rand.write bs=4k count=1                  : PASSED!
  RUN   nvme write /dev/nvme0 --start-block=0 --block-count=0 --data-size=4  : FAILED!

Failed running command:
nvme write /dev/nvme0 --start-block=0 --block-count=0 --data-size=4k --data temp.rand.write
RUN nvme read /dev/nvme0 --start-block=0 --block-count=0 --data-size=4k : FAILED!
Failed running command:
nvme read /dev/nvme0 --start-block=0 --block-count=0 --data-size=4k --data temp.rand.read --latency
RUN diff temp.rand.read temp.rand.write : FAILED!
Failed running command:
diff temp.rand.read temp.rand.write

Jeff Lien

-----Original Message-----
From: Keith Busch [mailto:[email protected]]
Sent: Friday, February 2, 2018 3:38 PM
To: Jeffrey Lien
Cc: linux-nvme at lists.infradead.org; David Darrington
Subject: Re: [PATCH] NVMe-CLI Fix command failures in regress script

Quoted 2 lines · Jeffrey Lien

Keith,
Then should we remove the commands that require a namespace id (ie id-ns, flush, write, and read)?

If you provide a block device, nvme-cli will automatically figure out the nsid if you didn't provide one.

#5 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Quoted 4 lines · Jeffrey Lien

Keith,
That doesn't seem to happen with our nvme device. Below is what I get when I run the regress script as is. Am I missing something on the invocation?

./regress -d /dev/nvme0 -l -w

                    ^^^^^

That's a character device. You need to use a block device, like /dev/nvme0n1.

#6 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Ok, that makes sense. I should have thought to try that; sorry for the trouble.

I did find 2 other problems/failures when using the block device though:
1) The flush command has a default namespace id of All ID's (0xffffffff) which causes it to fail. So to fix that either:
* The default ns id has to change for the flush command or
* The "-n 1" parm needs to be added to the flush command in the regress script
2) The --block-count=0 setting in the read/write commands fails when the nvme drive is formatted with a lba data size of 512 bytes. Setting it to 8 seems to work for both 512 and 4k bytes lba data size.

I can recreate the patch with these fixes, just not sure which option to take with the flush command.

Jeff Lien

-----Original Message-----
From: Keith Busch [mailto:[email protected]]
Sent: Monday, February 5, 2018 10:57 AM
To: Jeffrey Lien
Cc: linux-nvme at lists.infradead.org; David Darrington
Subject: Re: [PATCH] NVMe-CLI Fix command failures in regress script

Quoted 4 lines · Jeffrey Lien

Keith,
That doesn't seem to happen with our nvme device. Below is what I get when I run the regress script as is. Am I missing something on the invocation?

./regress -d /dev/nvme0 -l -w

                    ^^^^^

That's a character device. You need to use a block device, like /dev/nvme0n1.

#7 lore raw

PATCH 1/1 NVMe-CLI Fix command failures in regress script

Quoted 6 lines · Jeffrey Lien

Ok, that makes sense. I should have thought to try that; sorry for the trouble.

I did find 2 other problems/failures when using the block device though:
1) The flush command has a default namespace id of All ID's (0xffffffff) which causes it to fail. So to fix that either:
* The default ns id has to change for the flush command or
* The "-n 1" parm needs to be added to the flush command in the regress script

I will change nvme-cli to use the block handle NSID no problem, but isn't Flush the only IO command that is required to support the broadcast NSID? I know the wording was a bit vague on using this value and there was discussion on the technical reflector about it, but I haven't had time to read into where they're going with it.

Quoted 1 line

2) The --block-count=0 setting in the read/write commands fails when the nvme drive is formatted with a lba data size of 512 bytes. Setting it to 8 seems to work for both 512 and 4k bytes lba data size.

Oops, the regress script has hard-coded an expected 4k LBA format. We need it to discover and be re-active to the format instead.