From patchwork Fri Feb 2 22:36:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 10198185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F7E160362 for ; Fri, 2 Feb 2018 22:37:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 006A228C05 for ; Fri, 2 Feb 2018 22:37:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E91D828F9C; Fri, 2 Feb 2018 22:37:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5BC6C28C05 for ; Fri, 2 Feb 2018 22:37:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E1BE42237A4EB; Fri, 2 Feb 2018 14:31:28 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 303DA2237A4CF for ; Fri, 2 Feb 2018 14:31:26 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 14:37:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,451,1511856000"; d="scan'208";a="15495508" Received: from vverma7-desk1.lm.intel.com ([10.232.112.218]) by orsmga006.jf.intel.com with ESMTP; 02 Feb 2018 14:37:03 -0800 From: Vishal Verma To: Subject: [ndctl PATCH] ndctl, test: make btt-pad-compat dynamically detect a patched kernel Date: Fri, 2 Feb 2018 15:36:59 -0700 Message-Id: <20180202223659.28413-1-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.14.3 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Vishal Verma --- 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 } reset()