From patchwork Sun Nov 29 01:21:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7717711 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2866FBEEE1 for ; Sun, 29 Nov 2015 01:21:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64461205CB for ; Sun, 29 Nov 2015 01:21:50 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 9778A205C6 for ; Sun, 29 Nov 2015 01:21:48 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 71E871A1FD1; Sat, 28 Nov 2015 17:21:48 -0800 (PST) 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]) by ml01.01.org (Postfix) with ESMTP id 793CD1A1FD1 for ; Sat, 28 Nov 2015 17:21:47 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 28 Nov 2015 17:21:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,359,1444719600"; d="scan'208";a="849534038" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.136]) by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2015 17:21:46 -0800 Subject: [PATCH] ndctl: fix address increment in dax pmd test From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 28 Nov 2015 17:21:19 -0800 Message-ID: <20151129012119.14660.68896.stgit@dwillia2-desk3.jf.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.17 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-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Track the base address relative to m_align otherwise only the first iteration through the test loop attempts huge page mappings. Signed-off-by: Dan Williams --- lib/test-dax-pmd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/test-dax-pmd.c b/lib/test-dax-pmd.c index 0fee7bee8817..bf21160016fd 100644 --- a/lib/test-dax-pmd.c +++ b/lib/test-dax-pmd.c @@ -25,8 +25,8 @@ static int test_pmd(int fd) unsigned long long m_align, p_align; int fd2 = -1, rc = -ENXIO; struct fiemap_extent *ext; + void *base, *addr, *buf; struct fiemap *map; - void *addr, *buf; unsigned long i; if (fd < 0) { @@ -44,12 +44,12 @@ static int test_pmd(int fd) if (posix_memalign(&buf, 4096, 4096) != 0) goto err_memalign; - addr = mmap(NULL, 4*HPAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); - if (addr == MAP_FAILED) { + base = mmap(NULL, 4*HPAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (base == MAP_FAILED) { fail(); goto err_mmap; } - munmap(addr, 4*HPAGE_SIZE); + munmap(base, 4*HPAGE_SIZE); map->fm_start = 0; map->fm_length = -1; @@ -76,12 +76,12 @@ static int test_pmd(int fd) goto err_extent; } - m_align = ALIGN(addr, HPAGE_SIZE) - ((unsigned long) addr); + m_align = ALIGN(base, HPAGE_SIZE) - ((unsigned long) base); p_align = ALIGN(ext->fe_physical, HPAGE_SIZE) - ext->fe_physical; for (i = 0; i < 3; i++) { rc = -ENXIO; - addr = mmap((char *) addr + m_align, 2*HPAGE_SIZE, + addr = mmap((char *) base + m_align, 2*HPAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, ext->fe_logical + p_align); if (addr == MAP_FAILED) { @@ -96,6 +96,7 @@ static int test_pmd(int fd) break; } + fprintf(stderr, "%s: test: %ld\n", __func__, i); rc = 0; switch (i) { case 0: /* test O_DIRECT of unfaulted address */