From patchwork Thu Jan 28 22:52:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8154831 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7791C9F38B for ; Thu, 28 Jan 2016 22:53:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E9CF20320 for ; Thu, 28 Jan 2016 22:53:03 +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 851A6202FE for ; Thu, 28 Jan 2016 22:53:02 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 79B771A2305; Thu, 28 Jan 2016 14:53:02 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ml01.01.org (Postfix) with ESMTP id 9DA661A2305 for ; Thu, 28 Jan 2016 14:53:01 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 28 Jan 2016 14:52:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,360,1449561600"; d="scan'208";a="736223298" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by orsmga003.jf.intel.com with ESMTP; 28 Jan 2016 14:52:59 -0800 Subject: [ndctl PATCH 07/13] ndctl: alias "sector" and "safe" namespace modes From: Dan Williams To: linux-nvdimm@lists.01.org Date: Thu, 28 Jan 2016 14:52:34 -0800 Message-ID: <20160128225234.17855.53100.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160128225157.17855.5190.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160128225157.17855.5190.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.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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Linda notes that the "safe" label gives the impression that the other modes are not safe, i.e. dangerous. While that is not the intent it remains true that "safe" is an accurate description especially if the use case of persistent memory is for applications that are not prepared for torn writes. However, lets de-emphasize "safe" and use "sector" mode in the example and accept it is an alias for "safe" mode. Reported-by: Linda Knippers Signed-off-by: Dan Williams --- Documentation/ndctl-create-namespace.txt | 39 +++++++++++++++--------------- builtin-xaction-namespace.c | 4 ++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Documentation/ndctl-create-namespace.txt b/Documentation/ndctl-create-namespace.txt index 3a9f911c231c..8d919255e04f 100644 --- a/Documentation/ndctl-create-namespace.txt +++ b/Documentation/ndctl-create-namespace.txt @@ -19,9 +19,9 @@ Create a maximally sized pmem namespace in 'memory' mode [verse] ndctl create-namespace -Convert namespace0.0 to 'safe' mode +Convert namespace0.0 to 'sector' mode [verse] -ndctl create-namespace -f -e namespace0.0 --mode=safe +ndctl create-namespace -f -e namespace0.0 --mode=sector OPTIONS ------- @@ -38,16 +38,24 @@ OPTIONS -m:: --mode=:: - - "safe": persistent memory, given that it is byte addressable, - does not support sector atomicity. The problematic aspect of - sector tearing is that most applications do not know they have - a atomic sector update dependency. At least a disk rarely - ever tears sectors and if it does it almost certainly returns - a checksum error on access. Persistent memory devices will - always tear and always silently. Until an application is - audited to be robust in the presence of sector-tearing "safe" - mode is recommended. This imposes some performance overhead - and disables the DAX capability. + - "raw": expose the namespace capacity directly with some + limitations. Neither a raw pmem namepace nor raw blk namespace + support sector atomicity by default (see "sector" mode below). A + raw pmem namespace may have limited support for passing a DAX + mapping to other syscalls. I.e. direct-I/O to/from a DAX buffer + may fail for a pmem namespace in raw mode. + + - "sector" or "safe": persistent memory, given that it is byte + addressable, does not support sector atomicity. The + problematic aspect of sector tearing is that most applications + do not know they have a atomic sector update dependency. At + least a disk rarely ever tears sectors and if it does it + almost certainly returns a checksum error on access. + Persistent memory devices will always tear and always + silently. Until an application is audited to be robust in the + presence of sector-tearing "safe" mode is recommended. This + imposes some performance overhead and disables the DAX + capability. - "memory": A pmem namespace in this mode supports direct I/O to/from DAX mappings. Depending on the kernel this mode may @@ -56,13 +64,6 @@ OPTIONS "System RAM" or from a reserved portion of pmem (see the --map= option). - - "raw": expose the namespace capacity directly with some - limitations. Neither a raw pmem namepace nor raw blk namespace - support sector atomicity by default (see "safe" mode below). A - raw pmem namespace may have limited support for passing a DAX - mapping to other syscalls. I.e. direct-I/O to/from a DAX buffer - may fail for a pmem namespace in raw mode. - -s:: --size=:: For NVDIMM devices that support namespace labels, set the diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c index fdf20dfc01af..1d7e460e0950 100644 --- a/builtin-xaction-namespace.c +++ b/builtin-xaction-namespace.c @@ -79,7 +79,7 @@ OPT_STRING('n', "name", ¶m.name, "name", \ OPT_STRING('s', "size", ¶m.size, "size", \ "specify the namespace size in bytes (default: available capacity)"), \ OPT_STRING('m', "mode", ¶m.mode, "operation-mode", \ - "specify a mode for the namespace, 'safe', 'memory', or 'raw'"), \ + "specify a mode for the namespace, 'sector', 'memory', or 'raw'"), \ OPT_STRING('M', "map", ¶m.map, "memmap-location", \ "specify 'mem' or 'dev' for the location of the memmap"), \ OPT_STRING('l', "sector-size", ¶m.sector_size, "lba-size", \ @@ -332,6 +332,8 @@ static int validate_namespace_options(struct ndctl_namespace *ndns, if (param.mode) { if (strcmp(param.mode, "memory") == 0) p->mode = NDCTL_NS_MODE_MEMORY; + else if (strcmp(param.mode, "sector") == 0) + p->mode = NDCTL_NS_MODE_SAFE; else if (strcmp(param.mode, "safe") == 0) p->mode = NDCTL_NS_MODE_SAFE; else