From patchwork Sat Sep 10 01:41:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9324603 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 2E72660752 for ; Sat, 10 Sep 2016 01:44:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16F9220410 for ; Sat, 10 Sep 2016 01:44:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AB9B29EBD; Sat, 10 Sep 2016 01:44:58 +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.6 required=2.0 tests=BAYES_50, RCVD_IN_DNSWL_NONE, RDNS_NONE autolearn=no version=3.3.1 Received: from ml01.01.org (unknown [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 C8B5729E73 for ; Sat, 10 Sep 2016 01:44:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A10941A1E14; Fri, 9 Sep 2016 18:44:37 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 257E41A1E14 for ; Fri, 9 Sep 2016 18:44:36 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 09 Sep 2016 18:44:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,308,1470726000"; d="scan'208";a="6651307" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.14]) by fmsmga006.fm.intel.com with ESMTP; 09 Sep 2016 18:44:35 -0700 Subject: [ndctl PATCH 1/3] test, device-dax: /proc/self/smaps From: Dan Williams To: linux-nvdimm@lists.01.org Date: Fri, 09 Sep 2016 18:41:32 -0700 Message-ID: <147347169244.15190.840534533992093250.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <147347168712.15190.17312702584906386275.stgit@dwillia2-desk3.amr.corp.intel.com> References: <147347168712.15190.17312702584906386275.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.21 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 Until recently the kernel would crash when walking smaps with pmd_devmap() entries in the page table. Signed-off-by: Dan Williams --- test/device-dax.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/test/device-dax.c b/test/device-dax.c index a14e2a95db7e..04d53da544cd 100644 --- a/test/device-dax.c +++ b/test/device-dax.c @@ -60,12 +60,12 @@ static int test_device_dax(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx) { int fd, rc, *p; - char *buf, path[100]; struct sigaction act; struct ndctl_dax *dax; struct daxctl_dev *dev; struct ndctl_namespace *ndns; struct daxctl_region *dax_region; + char *buf, path[100], data[4096]; memset (&act, 0, sizeof(act)); act.sa_sigaction = sigbus; @@ -123,14 +123,36 @@ static int test_device_dax(int loglevel, struct ndctl_test *test, p = (int *) (buf + (1UL << 20)); *p = 0; + /* + * Prior to 4.8-final these tests cause crashes, or are + * otherwise not supported. + */ if (ndctl_test_attempt(test, KERNEL_VERSION(4, 9, 0))) { - /* prior to 4.8-final this crashes */ + int fd2; + rc = test_dax_directio(fd, NULL, 0); if (rc) { fprintf(stderr, "%s: failed dax direct-i/o\n", ndctl_namespace_get_devname(ndns)); return rc; } + + fd2 = open("/proc/self/smaps", O_RDONLY); + if (fd2 < 0) { + fprintf(stderr, "%s: failed smaps open\n", + ndctl_namespace_get_devname(ndns)); + return -ENXIO; + } + + do { + rc = read(fd2, data, sizeof(data)); + } while (rc > 0); + + if (rc) { + fprintf(stderr, "%s: failed smaps retrieval\n", + ndctl_namespace_get_devname(ndns)); + return -ENXIO; + } } rc = reset_device_dax(ndns);