test: regression test for a kernel panic on running ARS for BTTs
Vishal Verma
maintainerPATCH 1/1 test: regression test for a kernel panic on running ARS for BTTs
Runing an Address Range Scrub on a region with a BTT namespace would cause a kernel null pointer dereference. This tests we don't regress that.
--- test/Makefile.am | 3 +- test/btt-ars-panic.sh | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100755 test/btt-ars-panic.sh
test/Makefile.am +2 -1
@@ -12,7 +12,8 @@ TESTS =\ daxdev-errors.sh \ btt-check.sh \ label-compat.sh \ - blk-exhaust.sh + blk-exhaust.sh \ + btt-ars-panic.sh check_PROGRAMS =\ libndctl \
test/btt-ars-panic.sh new file +93 -0
93 lines not on this page · raw message
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 103 lines · Vishal Verma
Runing an Address Range Scrub on a region with a BTT namespace would cause a kernel null pointer dereference. This tests we don't regress that.
Cc Toshi Kani <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- test/Makefile.am | 3 +- test/btt-ars-panic.sh | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100755 test/btt-ars-panic.shtest/Makefile.am +2
-1@@ -12,7 +12,8 @@ TESTS =\ daxdev-errors.sh \ btt-check.sh \ label-compat.sh \ - blk-exhaust.sh + blk-exhaust.sh \ + btt-ars-panic.sh check_PROGRAMS =\ libndctl \test/btt-ars-panic.sh new file +70
-0@@ -0,0 +1,93 @@ +#!/bin/bash -E + +[ -f "../ndctl/ndctl" ] && [ -x "../ndctl/ndctl" ] && ndctl="../ndctl/ndctl" +[ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ] && ndctl="./ndctl/ndctl" +[ -z "$ndctl" ] && echo "Couldn't find an ndctl binary" && exit 1 +bus="nfit_test.0" +json2var="s/[{}\",]//g; s/:/=/g" +dev="" +mode="" +size="" +sector_size="" +blockdev="" +rc=77 + +trap 'err $LINENO' ERR + +# sample json: +# { +# "dev":"namespace5.0", +# "mode":"sector", +# "size":32440320, +# "uuid":"51805176-e124-4635-ae17-0e6a4a16671a", +# "sector_size":4096, +# "blockdev":"pmem5s" +# } + +# $1: Line number +# $2: exit code +err() +{ + [ -n "$2" ] && rc="$2" + echo "test/btt-ars-panic: failed at line $1" + exit "$rc" +} + +check_min_kver() +{ + local ver="$1" + : "${KVER:=$(uname -r)}" + + [ -n "$ver" ] || return 1 + [[ "$ver" == "$(echo -e "$ver\n$KVER" | sort -V | head -1)" ]] +} + +check_min_kver "4.12" || { echo "kernel $KVER is known to panic after an ARS"; exit "$rc"; } + +create() +{ + json=$($ndctl create-namespace -b "$bus" -t pmem -m sector) + eval "$(echo "$json" | sed -e "$json2var")" + [ -n "$dev" ] || err "$LINENO" 2 + [ "$mode" = "sector" ] || err "$LINENO" 2 + [ -n "$size" ] || err "$LINENO" 2 + [ -n "$sector_size" ] || err "$LINENO" 2 + [ -n "$blockdev" ] || err "$LINENO" 2 + [ $size -gt 0 ] || err "$LINENO" 2 +} + +reset() +{ + $ndctl disable-region -b "$bus" all + $ndctl zero-labels -b "$bus" all + $ndctl enable-region -b "$bus" all +} + +run_ars_scrub() +{ + query=".dev" + ndbus=$($ndctl list -b $bus -t pmem | jq -r "$query") + scrub_file="/sys/bus/nd/devices/$ndbus/nfit/scrub"
test/btt-ars-panic.sh line 80
Quoted 10 lines
test/btt-ars-panic.sh new file +10
-0+ echo "starting scrub: $scrub_file" + echo 1 > "$scrub_file" + sleep 3 +} + +test_pass() +{ + # If the test failed, there would have been a kernel null pointer + # dereference, and a subsequent ndctl disable-region would hang + $ndctl disable-region all &
Test looks good. This line makes me think we need something like "ndctl wait-scrub-bus".
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Verma, Vishal L
maintainerQuoted 16 lines · Dan Williams
Quoted 14 lines · Vishal Verma
Runing an Address Range Scrub on a region with a BTT namespace would cause a kernel null pointer dereference. This tests we don't regress that.
Cc Toshi Kani <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>---
test/Makefile.am | 3 +-
test/btt-ars-panic.sh | 93
+++++++++++++++++++++++++++++++++++++++++++++++++++2 files changed, 95 insertions(+), 1 deletion(-)create mode 100755
test/btt-ars-panic.sh
[..]
Quoted 10 lines
Quoted 7 lines
test/btt-ars-panic.sh new file +3
-0+test_pass() +{ + # If the test failed, there would have been a kernel nullpointer
+ # dereference, and a subsequent ndctl disable-region would hang
+ $ndctl disable-region all &Test looks good. This line makes me think we need something like "ndctl wait-scrub-bus".
Yes, perhaps also something to start a scrub..
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm