On Fri, Feb 2, 2018 at 2:36 PM, Vishal Verma <vishal.l.verma(a)intel.com> wrote:
The btt-pad-compat test can detect whether it is running on a
patched
kernel by checking for the two newly added debugfs files in the fix for
this bug. Use that instead of hard coding a kernel version dependency.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
test/btt-pad-compat.sh | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index d10efe3..faa773c 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -41,17 +41,6 @@ err()
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.15" || { echo "kernel $KVER may not have btt padding
compat fixes"; exit "$rc"; }
-
check_prereq()
{
if ! command -v "$1" >/dev/null; then
@@ -70,6 +59,10 @@ create()
[ $size -gt 0 ] || err "$LINENO" 2
bttdev=$(cat /sys/bus/nd/devices/$dev/holder)
[ -n "$bttdev" ] || err "$LINENO" 2
+ if [ ! -e /sys/kernel/debug/btt/$bttdev/arena0/log_index_0 ]; then
+ echo "kernel $(uname -r) seems to be missing the BTT compatibility
fixes, skipping"
+ exit 77
+ fi
}
Looks good to me. The less hard coded kernel version checks the better.