[PATCH] libnvdimm, of_pmem: use dev_to_node() instead of of_node_to_nid()
by Rob Herring
Remove the direct dependency on of_node_to_nid() by using dev_to_node()
instead. Any DT platform device will have its NUMA node id set when the
device is created.
With this, commit 291717b6fbdb ("libnvdimm, of_pmem: workaround OF_NUMA=n
build error") can be reverted.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Cc: Oliver O'Halloran <oohall(a)gmail.com>
Cc: linux-nvdimm(a)lists.01.org
Signed-off-by: Rob Herring <robh(a)kernel.org>
---
drivers/nvdimm/of_pmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
index 85013bad35de..0a701837dfc0 100644
--- a/drivers/nvdimm/of_pmem.c
+++ b/drivers/nvdimm/of_pmem.c
@@ -67,7 +67,7 @@ static int of_pmem_region_probe(struct platform_device *pdev)
*/
memset(&ndr_desc, 0, sizeof(ndr_desc));
ndr_desc.attr_groups = region_attr_groups;
- ndr_desc.numa_node = of_node_to_nid(np);
+ ndr_desc.numa_node = dev_to_node(&pdev->dev);
ndr_desc.res = &pdev->resource[i];
ndr_desc.of_node = np;
set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
--
2.14.1
4 years, 2 months
[ndctl PATCH] ndctl: fix ordering of closing vs invalidating flush_fd
by Vishal Verma
Static analysis warns that we may be closing a negative 'fd'. Fix this
by closing before invalidating the flush_fd with a -1 in add_region()
Fixes: commit c64cc15 ("ndctl: add support in libndctl to provide deep flush")
Cc: Dave Jiang <dave.jiang(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
ndctl/lib/libndctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index ad5ab9a..59ea82a 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1929,8 +1929,8 @@ static void *add_region(void *parent, int id, const char *region_base)
perm = strtol(buf, NULL, 0);
if (perm == 0) {
- region->flush_fd = -1;
close(region->flush_fd);
+ region->flush_fd = -1;
}
out:
--
2.14.3
4 years, 2 months
[PATCH] drivers/of: Introduce ARCH_HAS_OWN_OF_NUMA
by Oliver O'Halloran
Some OF platforms (pseries and some SPARC systems) has their own
implementations of NUMA affinity detection rather than using the generic
OF_NUMA driver, which mainly exists for arm64. For other platforms one
of two fallbacks provided by the base OF driver are used depending on
CONFIG_NUMA.
In the CONFIG_NUMA=n case the fallback is an inline function in of.h.
In the =y case the fallback is a real function which is defined as a
weak symbol so that it may be overwritten by the architecture if desired.
The problem with this arrangement is that the real implementations all
export of_node_to_nid(). Unfortunately it's not possible to export the
fallback since it would clash with the non-weak version. As a result
we get build failures when:
a) CONFIG_NUMA=y && CONFIG_OF=y, and
b) The platform doesn't implement of_node_to_nid(), and
c) A module uses of_node_to_nid()
Given b) will be true for most platforms this is fairly easy to hit
and has been observed on ia64 and x86.
This patch remedies the problem by introducing the ARCH_HAS_OWN_OF_NUMA
Kconfig option which is selected if an architecture provides an
implementation of of_node_to_nid(). If a platform does not use it's own,
or the generic OF_NUMA, then always use the inline fallback in of.h so
we don't need to futz around with exports.
Cc: devicetree(a)vger.kernel.org
Cc: sparclinux(a)vger.kernel.org
Cc: linuxppc-dev(a)lists.ozlabs.org
Fixes: 298535c00a2c ("of, numa: Add NUMA of binding implementation.")
Signed-off-by: Oliver O'Halloran <oohall(a)gmail.com>
---
arch/powerpc/Kconfig | 1 +
arch/sparc/Kconfig | 1 +
drivers/of/Kconfig | 3 +++
drivers/of/base.c | 7 -------
include/linux/of.h | 2 +-
5 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c32a181a7cbb..74ce5f3564ae 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -625,6 +625,7 @@ config NUMA
bool "NUMA support"
depends on PPC64
default y if SMP && PPC_PSERIES
+ select ARCH_HAS_OWN_OF_NUMA
config NODES_SHIFT
int
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 8767e45f1b2b..f8071f1c3edb 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -299,6 +299,7 @@ config GENERIC_LOCKBREAK
config NUMA
bool "NUMA support"
depends on SPARC64 && SMP
+ select ARCH_HAS_OWN_OF_NUMA
config NODES_SHIFT
int "Maximum NUMA Nodes (as a power of 2)"
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index ad3fcad4d75b..01c62b747b25 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -103,4 +103,7 @@ config OF_OVERLAY
config OF_NUMA
bool
+config ARCH_HAS_OWN_OF_NUMA
+ bool
+
endif # OF
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 848f549164cd..82a9584bb0e2 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -84,13 +84,6 @@ int of_n_size_cells(struct device_node *np)
}
EXPORT_SYMBOL(of_n_size_cells);
-#ifdef CONFIG_NUMA
-int __weak of_node_to_nid(struct device_node *np)
-{
- return NUMA_NO_NODE;
-}
-#endif
-
static struct device_node **phandle_cache;
static u32 phandle_cache_mask;
diff --git a/include/linux/of.h b/include/linux/of.h
index 4d25e4f952d9..9bb42dac5e65 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -942,7 +942,7 @@ static inline int of_cpu_node_to_id(struct device_node *np)
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
#endif
-#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
+#if defined(CONFIG_OF_NUMA) || defined(CONFIG_ARCH_HAS_OWN_OF_NUMA)
extern int of_node_to_nid(struct device_node *np);
#else
static inline int of_node_to_nid(struct device_node *device)
--
2.9.5
4 years, 2 months
[PATCH v2] ndctl: fix libdaxctl memory leak
by Dave Jiang
When daxctl_unref is releasing the context, we should make sure that the
regions and devices are also being released. free_region() will free
all the devices under the region.
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
v2: Use list_for_each_safe() for region removal. (Dan)
daxctl/lib/libdaxctl.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index 9e503201..22f4210a 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -29,6 +29,8 @@
static const char *attrs = "dax_region";
+static void free_region(struct daxctl_region *region, struct list_head *head);
+
/**
* struct daxctl_ctx - library user context to find "nd" instances
*
@@ -119,11 +121,17 @@ DAXCTL_EXPORT struct daxctl_ctx *daxctl_ref(struct daxctl_ctx *ctx)
*/
DAXCTL_EXPORT void daxctl_unref(struct daxctl_ctx *ctx)
{
+ struct daxctl_region *region, *_r;
+
if (ctx == NULL)
return;
ctx->refcount--;
if (ctx->refcount > 0)
return;
+
+ list_for_each_safe(&ctx->regions, region, _r, list)
+ free_region(region, &ctx->regions);
+
info(ctx, "context %p released\n", ctx);
free(ctx);
}
4 years, 2 months
[PATCH v3 00/11] Copy Offload in NVMe Fabrics with P2P PCI Memory
by Logan Gunthorpe
Hi Everyone,
Here's v3 of our series to introduce P2P based copy offload to NVMe
fabrics. This version has been rebased onto v4.16-rc5.
Thanks,
Logan
Changes in v3:
* Many more fixes and minor cleanups that were spotted by Bjorn
* Additional explanation of the ACS change in both the commit message
and Kconfig doc. Also, the code that disables the ACS bits is surrounded
explicitly by an #ifdef
* Removed the flag we added to rdma_rw_ctx() in favour of using
is_pci_p2pdma_page(), as suggested by Sagi.
* Adjust pci_p2pmem_find() so that it prefers P2P providers that
are closest to (or the same as) the clients using them. In cases
of ties, the provider is randomly chosen.
* Modify the NVMe Target code so that the PCI device name of the provider
may be explicitly specified, bypassing the logic in pci_p2pmem_find().
(Note: it's still enforced that the provider must be behind the
same switch as the clients).
* As requested by Bjorn, added documentation for driver writers.
Changes in v2:
* Renamed everything to 'p2pdma' per the suggestion from Bjorn as well
as a bunch of cleanup and spelling fixes he pointed out in the last
series.
* To address Alex's ACS concerns, we change to a simpler method of
just disabling ACS behind switches for any kernel that has
CONFIG_PCI_P2PDMA.
* We also reject using devices that employ 'dma_virt_ops' which should
fairly simply handle Jason's concerns that this work might break with
the HFI, QIB and rxe drivers that use the virtual ops to implement
their own special DMA operations.
--
This is a continuation of our work to enable using Peer-to-Peer PCI
memory in NVMe fabrics targets. Many thanks go to Christoph Hellwig who
provided valuable feedback to get these patches to where they are today.
The concept here is to use memory that's exposed on a PCI BAR as
data buffers in the NVME target code such that data can be transferred
from an RDMA NIC to the special memory and then directly to an NVMe
device avoiding system memory entirely. The upside of this is better
QoS for applications running on the CPU utilizing memory and lower
PCI bandwidth required to the CPU (such that systems could be designed
with fewer lanes connected to the CPU). However, presently, the
trade-off is currently a reduction in overall throughput. (Largely due
to hardware issues that would certainly improve in the future).
Due to these trade-offs we've designed the system to only enable using
the PCI memory in cases where the NIC, NVMe devices and memory are all
behind the same PCI switch. This will mean many setups that could likely
work well will not be supported so that we can be more confident it
will work and not place any responsibility on the user to understand
their topology. (We chose to go this route based on feedback we
received at the last LSF). Future work may enable these transfers behind
a fabric of PCI switches or perhaps using a white list of known good
root complexes.
In order to enable this functionality, we introduce a few new PCI
functions such that a driver can register P2P memory with the system.
Struct pages are created for this memory using devm_memremap_pages()
and the PCI bus offset is stored in the corresponding pagemap structure.
Another set of functions allow a client driver to create a list of
client devices that will be used in a given P2P transactions and then
use that list to find any P2P memory that is supported by all the
client devices. This list is then also used to selectively disable the
ACS bits for the downstream ports behind these devices.
In the block layer, we also introduce a P2P request flag to indicate a
given request targets P2P memory as well as a flag for a request queue
to indicate a given queue supports targeting P2P memory. P2P requests
will only be accepted by queues that support it. Also, P2P requests
are marked to not be merged seeing a non-homogenous request would
complicate the DMA mapping requirements.
In the PCI NVMe driver, we modify the existing CMB support to utilize
the new PCI P2P memory infrastructure and also add support for P2P
memory in its request queue. When a P2P request is received it uses the
pci_p2pmem_map_sg() function which applies the necessary transformation
to get the corrent pci_bus_addr_t for the DMA transactions.
In the RDMA core, we also adjust rdma_rw_ctx_init() and
rdma_rw_ctx_destroy() to take a flags argument which indicates whether
to use the PCI P2P mapping functions or not.
Finally, in the NVMe fabrics target port we introduce a new
configuration boolean: 'allow_p2pmem'. When set, the port will attempt
to find P2P memory supported by the RDMA NIC and all namespaces. If
supported memory is found, it will be used in all IO transfers. And if
a port is using P2P memory, adding new namespaces that are not supported
by that memory will fail.
Logan Gunthorpe (11):
PCI/P2PDMA: Support peer-to-peer memory
PCI/P2PDMA: Add sysfs group to display p2pmem stats
PCI/P2PDMA: Add PCI p2pmem dma mappings to adjust the bus offset
PCI/P2PDMA: Clear ACS P2P flags for all devices behind switches
PCI/P2PDMA: Add P2P DMA driver writer's documentation
block: Introduce PCI P2P flags for request and request queue
IB/core: Ensure we map P2P memory correctly in
rdma_rw_ctx_[init|destroy]()
nvme-pci: Use PCI p2pmem subsystem to manage the CMB
nvme-pci: Add support for P2P memory in requests
nvme-pci: Add a quirk for a pseudo CMB
nvmet: Optionally use PCI P2P memory
Documentation/ABI/testing/sysfs-bus-pci | 25 +
Documentation/PCI/index.rst | 14 +
Documentation/PCI/p2pdma.rst | 164 +++++++
Documentation/index.rst | 3 +-
block/blk-core.c | 3 +
drivers/infiniband/core/rw.c | 13 +-
drivers/nvme/host/core.c | 4 +
drivers/nvme/host/nvme.h | 8 +
drivers/nvme/host/pci.c | 118 +++--
drivers/nvme/target/configfs.c | 67 +++
drivers/nvme/target/core.c | 106 +++-
drivers/nvme/target/io-cmd.c | 3 +
drivers/nvme/target/nvmet.h | 12 +
drivers/nvme/target/rdma.c | 32 +-
drivers/pci/Kconfig | 25 +
drivers/pci/Makefile | 1 +
drivers/pci/p2pdma.c | 828 ++++++++++++++++++++++++++++++++
drivers/pci/pci.c | 6 +
include/linux/blk_types.h | 18 +-
include/linux/blkdev.h | 3 +
include/linux/memremap.h | 19 +
include/linux/pci-p2pdma.h | 119 +++++
include/linux/pci.h | 4 +
23 files changed, 1543 insertions(+), 52 deletions(-)
create mode 100644 Documentation/PCI/index.rst
create mode 100644 Documentation/PCI/p2pdma.rst
create mode 100644 drivers/pci/p2pdma.c
create mode 100644 include/linux/pci-p2pdma.h
--
2.11.0
4 years, 2 months
[PATCH] MAINTAINERS: Adding backup maintainers for libnvdimm and DAX
by Dave Jiang
Adding additional maintainers to libnvdimm related code and DAX.
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
MAINTAINERS | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 73d83416d852..958f75ad4193 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4246,6 +4246,9 @@ F: include/trace/events/fs_dax.h
DEVICE DIRECT ACCESS (DAX)
M: Dan Williams <dan.j.williams(a)intel.com>
+M: Dave Jiang <dave.jiang(a)intel.com>
+M: Ross Zwisler <ross.zwisler(a)linux.intel.com>
+M: Vishal Verma <vishal.l.verma(a)intel.com>
L: linux-nvdimm(a)lists.01.org
S: Supported
F: drivers/dax/
@@ -8034,6 +8037,9 @@ F: tools/lib/lockdep/
LIBNVDIMM BLK: MMIO-APERTURE DRIVER
M: Ross Zwisler <ross.zwisler(a)linux.intel.com>
+M: Dan Williams <dan.j.williams(a)intel.com>
+M: Vishal Verma <vishal.l.verma(a)intel.com>
+M: Dave Jiang <dave.jiang(a)intel.com>
L: linux-nvdimm(a)lists.01.org
Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
S: Supported
@@ -8042,6 +8048,9 @@ F: drivers/nvdimm/region_devs.c
LIBNVDIMM BTT: BLOCK TRANSLATION TABLE
M: Vishal Verma <vishal.l.verma(a)intel.com>
+M: Dan Williams <dan.j.williams(a)intel.com>
+M: Ross Zwisler <ross.zwisler(a)linux.intel.com>
+M: Dave Jiang <dave.jiang(a)intel.com>
L: linux-nvdimm(a)lists.01.org
Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
S: Supported
@@ -8049,6 +8058,9 @@ F: drivers/nvdimm/btt*
LIBNVDIMM PMEM: PERSISTENT MEMORY DRIVER
M: Ross Zwisler <ross.zwisler(a)linux.intel.com>
+M: Dan Williams <dan.j.williams(a)intel.com>
+M: Vishal Verma <vishal.l.verma(a)intel.com>
+M: Dave Jiang <dave.jiang(a)intel.com>
L: linux-nvdimm(a)lists.01.org
Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
S: Supported
@@ -8064,6 +8076,9 @@ F: Documentation/devicetree/bindings/pmem/pmem-region.txt
LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM
M: Dan Williams <dan.j.williams(a)intel.com>
+M: Ross Zwisler <ross.zwisler(a)linux.intel.com>
+M: Vishal Verma <vishal.l.verma(a)intel.com>
+M: Dave Jiang <dave.jiang(a)intel.com>
L: linux-nvdimm(a)lists.01.org
Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
4 years, 2 months
[PATCH 0/18 v6] dax, ext4, xfs: Synchronous page faults
by Jan Kara
Hello,
here is the sixth version of my patches to implement synchronous page faults
for DAX mappings to make flushing of DAX mappings possible from userspace so
that they can be flushed on finer than page granularity and also avoid the
overhead of a syscall.
I think we are ready to get this merged - I've talked to Dan and he said he
could take the patches through his tree. It would just be nice to get final
ack from Christoph for the first patch implementing MAP_VALIDATE and someone
from XFS folks to check patch 17 (make xfs_filemap_pfn_mkwrite use
__xfs_filemap_fault()).
---
We use a new mmap flag MAP_SYNC to indicate that page faults for the mapping
should be synchronous. The guarantee provided by this flag is: While a block
is writeably mapped into page tables of this mapping, it is guaranteed to be
visible in the file at that offset also after a crash.
How I implement this is that ->iomap_begin() indicates by a flag that inode
block mapping metadata is unstable and may need flushing (use the same test as
whether fdatasync() has metadata to write). If yes, DAX fault handler refrains
from inserting / write-enabling the page table entry and returns special flag
VM_FAULT_NEEDDSYNC together with a PFN to map to the filesystem fault handler.
The handler then calls fdatasync() (vfs_fsync_range()) for the affected range
and after that calls DAX code to update the page table entry appropriately.
I did some basic performance testing on the patches over ramdisk - timed
latency of page faults when faulting 512 pages. I did several tests: with file
preallocated / with file empty, with background file copying going on / without
it, with / without MAP_SYNC (so that we get comparison). The results are
(numbers are in microseconds):
File preallocated, no background load no MAP_SYNC:
min=9 avg=10 max=46
8 - 15 us: 508
16 - 31 us: 3
32 - 63 us: 1
File preallocated, no background load, MAP_SYNC:
min=9 avg=10 max=47
8 - 15 us: 508
16 - 31 us: 2
32 - 63 us: 2
File empty, no background load, no MAP_SYNC:
min=21 avg=22 max=70
16 - 31 us: 506
32 - 63 us: 5
64 - 127 us: 1
File empty, no background load, MAP_SYNC:
min=40 avg=124 max=242
32 - 63 us: 1
64 - 127 us: 333
128 - 255 us: 178
File empty, background load, no MAP_SYNC:
min=21 avg=23 max=67
16 - 31 us: 507
32 - 63 us: 4
64 - 127 us: 1
File empty, background load, MAP_SYNC:
min=94 avg=112 max=181
64 - 127 us: 489
128 - 255 us: 23
So here we can see the difference between MAP_SYNC vs non MAP_SYNC is about
100-200 us when we need to wait for transaction commit in this setup.
Changes since v5:
* really updated the manpage
* improved comment describing IOMAP_F_DIRTY
* fixed XFS handling of VM_FAULT_NEEDSYNC in xfs_filemap_pfn_mkwrite()
Changes since v4:
* fixed couple of minor things in the manpage
* make legacy mmap flags always supported, remove them from mask declared
to be supported by ext4 and xfs
Changes since v3:
* updated some changelogs
* folded fs support for VM_SYNC flag into patches implementing the
functionality
* removed ->mmap_validate, use ->mmap_supported_flags instead
* added some Reviewed-by tags
* added manpage patch
Changes since v2:
* avoid unnecessary flushing of faulted page (Ross) - I've realized it makes no
sense to remeasure my benchmark results (after actually doing that and seeing
no difference, sigh) since I use ramdisk and not real PMEM HW and so flushes
are ignored.
* handle nojournal mode of ext4
* other smaller cleanups & fixes (Ross)
* factor larger part of finishing of synchronous fault into a helper (Christoph)
* reorder pfnp argument of dax_iomap_fault() (Christoph)
* add XFS support from Christoph
* use proper MAP_SYNC support in mmap(2)
* rebased on top of 4.14-rc4
Changes since v1:
* switched to using mmap flag MAP_SYNC
* cleaned up fault handlers to avoid passing pfn in vmf->orig_pte
* switched to not touching page tables before we are ready to insert final
entry as it was unnecessary and not really simplifying anything
* renamed fault flag to VM_FAULT_NEEDDSYNC
* other smaller fixes found by reviewers
Honza
4 years, 2 months
[PATCH ndctl 0/2] Documentation: add asciidoctor support
by Takashi Iwai
Hi,
this is a patchset to add the support for asciidoctor to generate
documents. The reason for adding this feature is that the future of
asciidoc isn't clear as it's written in python2, which is now hated by
all people out of sudden :)
The asciidoctor support is enabled via configure option, the default
is still asciidoc for now.
thanks,
Takashi
===
Takashi Iwai (2):
Documentation: fix title and section markers
Documentation: Add the support for asciidoctor
Documentation/asciidoctor-extensions.rb.in | 28 ++++++++++++++++++++++++++++
Documentation/daxctl/Makefile.am | 23 ++++++++++++++++++++---
Documentation/daxctl/daxctl-io.txt | 5 +++--
Documentation/daxctl/daxctl-list.txt | 13 +++++++------
Documentation/ndctl/Makefile.am | 23 ++++++++++++++++++++---
Documentation/ndctl/ndctl-disable-dimm.txt | 2 +-
Documentation/ndctl/ndctl-enable-region.txt | 2 +-
Documentation/ndctl/ndctl-init-labels.txt | 15 ++++++++++-----
Documentation/ndctl/ndctl-list.txt | 13 ++++++++-----
configure.ac | 14 ++++++++++++--
10 files changed, 110 insertions(+), 28 deletions(-)
4 years, 2 months
[ndctl PATCH v2] ndctl: complete move to "fsdax" and "devdax"
by Ross Zwisler
Add on to the work started by:
commit ebb4fb605e68 ("ndctl, create-namespace: introduce "fsdax" and "devdax" modes")
and change some more user visible places to use "fsdax" and "devdax" modes
instead of "memory" and "dax", respectively. Having multiple terms for the
same mode is confusing for users.
We will continue to accept "memory" and "dax" as parameters, but all output
and man pages will now use the updated terms.
Note that after the above referenced commit we still printed the old names
in the default 'ndctl list' output for backward compatibility with scripts.
This patch intentionally breaks that backward compatibility in favor of
avoiding confusion and using the new mode names everywhere.
Signed-off-by: Ross Zwisler <ross.zwisler(a)linux.intel.com>
---
Documentation/ndctl/ndctl-inject-error.txt | 2 +-
Documentation/ndctl/ndctl-list.txt | 6 +++---
ndctl/namespace.c | 16 ++++++++--------
util/json.c | 10 ++--------
4 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/Documentation/ndctl/ndctl-inject-error.txt b/Documentation/ndctl/ndctl-inject-error.txt
index 01f6c22..94c4e69 100644
--- a/Documentation/ndctl/ndctl-inject-error.txt
+++ b/Documentation/ndctl/ndctl-inject-error.txt
@@ -45,7 +45,7 @@ OPTIONS
NOTE: The offset is interpreted in different ways based on the "mode"
of the namespace. For "raw" mode, the offset is the base namespace
- offset. For "memory" mode (i.e. a "pfn" namespace), the offset is
+ offset. For "fsdax" mode (i.e. a "pfn" namespace), the offset is
relative to the user-visible part of the namespace, and the offset
introduced by the kernel's metadata will be accounted for. For a
"sector" mode namespace (i.e. a "BTT" namespace), the offset is
diff --git a/Documentation/ndctl/ndctl-list.txt b/Documentation/ndctl/ndctl-list.txt
index 04affc4..2abc572 100644
--- a/Documentation/ndctl/ndctl-list.txt
+++ b/Documentation/ndctl/ndctl-list.txt
@@ -49,7 +49,7 @@ EXAMPLE
"namespaces":[
{
"dev":"namespace0.0",
- "mode":"memory",
+ "mode":"fsdax",
"size":8589934592,
"blockdev":"pmem0"
}
@@ -132,11 +132,11 @@ include::xable-region-options.txt[]
-X::
--device-dax::
Include device-dax ("daxregion") details when a namespace is in
- "dax" mode.
+ "devdax" mode.
[verse]
{
"dev":"namespace0.0",
- "mode":"dax",
+ "mode":"devdax",
"size":4225761280,
"uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc",
"daxregion":{
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index f2c5644..fe86d82 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -103,7 +103,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, 'sector', 'memory', or 'raw'"), \
+ "specify a mode for the namespace, 'sector', 'fsdax', 'devdax' 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", \
@@ -533,7 +533,7 @@ static int validate_namespace_options(struct ndctl_region *region,
* supported a 2M default alignment when
* ndctl_pfn_has_align() returns false.
*/
- debug("%s not support 'align' for memory mode\n",
+ debug("%s not support 'align' for fsdax mode\n",
region_name);
return -EAGAIN;
} else if (p->mode == NDCTL_NS_MODE_DAX
@@ -542,7 +542,7 @@ static int validate_namespace_options(struct ndctl_region *region,
* Unlike the pfn case, we require the kernel to
* have 'align' support for device-dax.
*/
- debug("%s not support 'align' for dax mode\n",
+ debug("%s not support 'align' for devdax mode\n",
region_name);
return -EAGAIN;
} else if (!param.align_default
@@ -696,7 +696,7 @@ static int validate_namespace_options(struct ndctl_region *region,
if (ndns && p->mode != NDCTL_NS_MODE_MEMORY
&& p->mode != NDCTL_NS_MODE_DAX) {
- debug("%s: --map= only valid for memory mode namespace\n",
+ debug("%s: --map= only valid for fsdax mode namespace\n",
ndctl_namespace_get_devname(ndns));
return -EINVAL;
}
@@ -709,10 +709,10 @@ static int validate_namespace_options(struct ndctl_region *region,
struct ndctl_pfn *pfn = ndctl_region_get_pfn_seed(region);
if (!pfn && param.mode_default) {
- debug("%s memory mode not available\n", region_name);
+ debug("%s fsdax mode not available\n", region_name);
p->mode = NDCTL_NS_MODE_RAW;
} else if (!pfn) {
- error("operation failed, %s memory mode not available\n",
+ error("operation failed, %s fsdax mode not available\n",
region_name);
return -EINVAL;
}
@@ -723,7 +723,7 @@ static int validate_namespace_options(struct ndctl_region *region,
struct ndctl_dax *dax = ndctl_region_get_dax_seed(region);
if (!dax) {
- error("operation failed, %s dax mode not available\n",
+ error("operation failed, %s devdax mode not available\n",
region_name);
return -EINVAL;
}
@@ -759,7 +759,7 @@ static int namespace_create(struct ndctl_region *region)
return rc;
if (ndctl_region_get_ro(region)) {
- debug("%s: read-only, inelligible for namespace creation\n",
+ debug("%s: read-only, ineligible for namespace creation\n",
devname);
return -EAGAIN;
}
diff --git a/util/json.c b/util/json.c
index 5b4b4c3..8d65525 100644
--- a/util/json.c
+++ b/util/json.c
@@ -685,19 +685,13 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
size = ndctl_pfn_get_size(pfn);
else /* native/static memory mode */
size = ndctl_namespace_get_size(ndns);
- if (flags & UTIL_JSON_HUMAN)
- jobj = json_object_new_string("fsdax");
- else
- jobj = json_object_new_string("memory");
+ jobj = json_object_new_string("fsdax");
break;
case NDCTL_NS_MODE_DAX:
if (!dax)
goto err;
size = ndctl_dax_get_size(dax);
- if (flags & UTIL_JSON_HUMAN)
- jobj = json_object_new_string("devdax");
- else
- jobj = json_object_new_string("dax");
+ jobj = json_object_new_string("devdax");
break;
case NDCTL_NS_MODE_SAFE:
if (!btt)
--
2.14.3
4 years, 2 months
[ndctl PATCH] ndctl, read-labels: fix json reference counting
by Dan Williams
From: Steve Scargall <steve.scargall(a)intel.com>
Current versions of the json-c library abort when decrementing an object
reference past 0. Given that util_display_json_array() drops the
reference to the passed in object we do not need to drop the reference
in dimm_action(). This fixes failures with the following signature:
$ ndctl read-labels nmem0 nmem1 -j
...
ndctl: json_object.c:159: json_object_put: Assertion `jso->_ref_count > 0' failed.
Aborted (core dumped)
Signed-off-by: Steve Scargall <steve.scargall(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
ndctl/dimm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/ndctl/dimm.c b/ndctl/dimm.c
index f51f34bb28b6..1c168997105e 100644
--- a/ndctl/dimm.c
+++ b/ndctl/dimm.c
@@ -1080,11 +1080,9 @@ static int dimm_action(int argc, const char **argv, void *ctx,
rc = action(single, &actx);
}
- if (actx.jdimms) {
+ if (actx.jdimms)
util_display_json_array(actx.f_out, actx.jdimms,
JSON_C_TO_STRING_PRETTY);
- json_object_put(actx.jdimms);
- }
if (actx.f_out != stdout)
fclose(actx.f_out);
4 years, 2 months