From patchwork Tue Mar 28 04:03:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9648061 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 602E260113 for ; Tue, 28 Mar 2017 04:09:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5258125EA6 for ; Tue, 28 Mar 2017 04:09:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4729826E73; Tue, 28 Mar 2017 04:09:08 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no 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 01DC125EA6 for ; Tue, 28 Mar 2017 04:09:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5532621A18AAA; Mon, 27 Mar 2017 21:09:04 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 C64ED21A18AA9 for ; Mon, 27 Mar 2017 21:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490674142; x=1522210142; h=subject:from:to:cc:date:message-id:mime-version: content-transfer-encoding; bh=Y3E1ANwjzvQP8Mmk2Ri4/fKRcQ9HNC1/LSYJq1rKHdI=; b=Oj3NgDDaUNnsPNNA2rsCDsBgB6uzrrV6pccIrLUnt22x3GNulcEcF9SN RB6i8erD3yZmaFG5UGqh0TV4Bk1MKA==; Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 21:09:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.36,235,1486454400"; d="scan'208"; a="1127872869" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2017 21:09:02 -0700 Subject: [PATCH] test: add fio test for device-dax From: Dan Williams To: linux-nvdimm@lists.01.org Date: Mon, 27 Mar 2017 21:03:52 -0700 Message-ID: <149067383236.19079.12786890634892425193.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Jeff found that device-dax was broken with respect to falling back to smaller fault granularities. Now that the fixes are upstream ([1], [2]), add a test to backstop against future regressions and validate backports. Note that kernels without device-dax pud-mapping support will always fail the alignment == 1GiB test. Kernels with the broken fallback handling will fail the first alignment == 4KiB test. The test requires an fio binary with support for the "dev-dax" ioengine. [1]: commit 70b085b06c45 ("device-dax: fix pud fault fallback handling") [2]: commit 0134ed4fb9e7 ("device-dax: fix pmd/pte fault fallback handling") Cc: Dave Jiang Reported-by: Jeff Moyer Signed-off-by: Dan Williams --- test/Makefile.am | 1 + test/device-dax-fio.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100755 test/device-dax-fio.sh diff --git a/test/Makefile.am b/test/Makefile.am index 98f444231306..969fe055b35e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -26,6 +26,7 @@ TESTS +=\ dax-dev \ dax.sh \ device-dax \ + device-dax-fio.sh \ mmap.sh check_PROGRAMS +=\ diff --git a/test/device-dax-fio.sh b/test/device-dax-fio.sh new file mode 100755 index 000000000000..ab620b67027f --- /dev/null +++ b/test/device-dax-fio.sh @@ -0,0 +1,74 @@ +#!/bin/bash +NDCTL="../ndctl/ndctl" +rc=77 + +set -e + +err() { + echo "test/device-dax-fio.sh: 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.11" || { echo "kernel $KVER may lack latest device-dax fixes"; exit $rc; } + +set -e +trap 'err $LINENO' ERR + +if ! fio --enghelp | grep -q "dev-dax"; then + echo "fio lacks dev-dax engine" + exit 77 +fi + +dev=$(./dax-dev) +for align in 4k 2m 1g +do + json=$($NDCTL create-namespace -m dax -a $align -f -e $dev) + chardev=$(echo $json | jq -r ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") + if [ align = "1g" ]; then + bs="1g" + else + bs="2m" + fi + + cat > fio.job <<- EOF + [global] + ioengine=dev-dax + direct=0 + filename=/dev/${chardev} + verify=crc32c + bs=${bs} + + [write] + rw=write + runtime=5 + + [read] + stonewall + rw=read + runtime=5 + EOF + + rc=1 + fio fio.job 2>&1 | tee fio.log + + if grep -q "fio.*got signal" fio.log; then + echo "test/device-dax-fio.sh: failed with align: $align" + exit 1 + fi + + # revert namespace to raw mode + json=$($NDCTL create-namespace -m raw -f -e $dev) + mode=$(echo $json | jq -r ".mode") + [ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 +done + +exit 0