From patchwork Tue Sep 19 19:56:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9960111 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 31AFB6038F for ; Tue, 19 Sep 2017 20:03:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22B3C28E18 for ; Tue, 19 Sep 2017 20:03:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 176AD28EB2; Tue, 19 Sep 2017 20:03: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 98D7028E18 for ; Tue, 19 Sep 2017 20:03:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7E9AD21E87976; Tue, 19 Sep 2017 13:00:04 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 048F721CEB108 for ; Tue, 19 Sep 2017 13:00:03 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2017 13:03:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,418,1500966000"; d="scan'208"; a="1173898664" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by orsmga001.jf.intel.com with ESMTP; 19 Sep 2017 13:03:07 -0700 Subject: [ndctl PATCH 2/2] ndctl, test: regression test NVDIMM-N sector mode configuration From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 19 Sep 2017 12:56:43 -0700 Message-ID: <150585100336.18300.18006925931215154678.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <150585099801.18300.4357728197672633739.stgit@dwillia2-desk3.amr.corp.intel.com> References: <150585099801.18300.4357728197672633739.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 Regression test for the kernel fix for this crash report: Testing ndctl-58 on our NVDIMM-Ns with the latest kernel (4.13.2) causes a panic when configuring a pmem device from raw to sector mode. ndctl create-namespace -f -e namespace0.0 -m sector I was not able to reproduce this issue using ndctl-57. Below is the stack trace from configuring a pmem device from raw to sector mode. BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 IP: holder_class_store+0x253/0x2b0 [libnvdimm] This requires an NFIT test implementation that disables label support for the DIMMs on the 'nfit_test.1' bus. Cc: Vishal Verma Cc: Johannes Thumshirn Reported-by: Maurice A. Saldivar Signed-off-by: Dan Williams --- test/Makefile.am | 3 ++- test/sector-mode.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100755 test/sector-mode.sh diff --git a/test/Makefile.am b/test/Makefile.am index ac3547e22ccb..9223628b2608 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -13,7 +13,8 @@ TESTS =\ multi-dax.sh \ btt-check.sh \ label-compat.sh \ - blk-exhaust.sh + blk-exhaust.sh \ + sector-mode.sh check_PROGRAMS =\ libndctl \ diff --git a/test/sector-mode.sh b/test/sector-mode.sh new file mode 100755 index 000000000000..75bd3c1f82bb --- /dev/null +++ b/test/sector-mode.sh @@ -0,0 +1,53 @@ +#!/bin/bash -x + +# Copyright(c) 2015-2017 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +NDCTL="../ndctl/ndctl" +BUS="-b nfit_test.0" +BUS1="-b nfit_test.1" +TEST=$0 +rc=77 + +err() { + echo "$TEST: failed at line $1" + exit $rc +} + +set -e +trap 'err $LINENO' ERR + +# setup (reset nfit_test dimms) +modprobe nfit_test +$NDCTL disable-region $BUS all +$NDCTL zero-labels $BUS all +$NDCTL enable-region $BUS all + +$NDCTL disable-region $BUS1 all +if $NDCTL zero-labels $BUS1 all; then + echo "DIMMs on $BUS1 support labels, skip..." + $NDCTL enable-region $BUS1 all + false +fi +$NDCTL enable-region $BUS1 all + +rc=1 +query=". | sort_by(.size) | reverse | .[0].dev" +NAMESPACE=$($NDCTL list $BUS1 -N | jq -r "$query") +REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r ".dev") +echo 0 > /sys/bus/nd/devices/$REGION/read_only +$NDCTL create-namespace -e $NAMESPACE -m sector -f -l 4K + +$NDCTL disable-region $BUS all +$NDCTL disable-region $BUS1 all +modprobe -r nfit_test + +exit 0