[PATCH] ndctl, list: add controller temperature threshold
by QI Fuli
This patch adds controller temperature threshold to list.
When the dimm-controller-temperature event fires, users need to know
the current controller temperature threshold value.
Signed-off-by: QI Fuli <qi.fuli(a)jp.fujitsu.com>
---
ndctl/util/json-smart.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
index 9482b35..d590b0c 100644
--- a/ndctl/util/json-smart.c
+++ b/ndctl/util/json-smart.c
@@ -47,6 +47,18 @@ static void smart_threshold_to_json(struct ndctl_dimm *dimm,
"temperature_threshold", jobj);
}
+ if (alarm_control & ND_SMART_TEMP_TRIP) {
+ unsigned int temp;
+ double t;
+
+ temp = ndctl_cmd_smart_threshold_get_ctrl_temperature(cmd);
+ t = ndctl_decode_smart_temperature(temp);
+ jobj = json_object_new_double(t);
+ if (jobj)
+ json_object_object_add(jhealth,
+ "controller_temperature_threshold", jobj);
+ }
+
if (alarm_control & ND_SMART_SPARE_TRIP) {
unsigned int spares;
--
2.17.1
2 years, 8 months
[PATCH v2 0/7] Fix DM DAX handling
by Ross Zwisler
Changes from v1:
* Reworked patches 1 and 2 so that the __bdev_dax_supported() function
stays hidden behind the bdev_dax_supported() wrapper. This is needed
to prevent compilation errors in configs where CONFIG_FS_DAX isn't
defined. (0-day)
* Added Eric's Reviewed-by to patch 1. I did this in spite of the
bdev_dax_supported() changes because they were minor and I think
Eric's review was focused on the XFS parts.
---
This series fixes a few issues that I found with DM's handling of DAX
devices. Here are some of the issues I found:
* We can create a dm-stripe or dm-linear device which is made up of an
fsdax PMEM namespace and a raw PMEM namespace but which can hold a
filesystem mounted with the -o dax mount option. DAX operations to
the raw PMEM namespace part lack struct page and can fail in
interesting/unexpected ways when doing things like fork(), examining
memory with gdb, etc.
* We can create a dm-stripe or dm-linear device which is made up of an
fsdax PMEM namespace and a BRD ramdisk which can hold a filesystem
mounted with the -o dax mount option. All I/O to this filesystem
will fail.
* In DM you can't transition a dm target which could possibly support
DAX (mode DM_TYPE_DAX_BIO_BASED) to one which can't support DAX
(mode DM_TYPE_BIO_BASED), even if you never use DAX.
The first 2 patches in this series are prep work from Darrick and Dave
which improve bdev_dax_supported(). The last 5 problems fix the above
mentioned problems in DM. I feel that this series simplifies the
handling of DAX devices in DM, and the last 5 DM-related patches have a
net code reduction of 50 lines.
Darrick J. Wong (1):
fs: allow per-device dax status checking for filesystems
Dave Jiang (1):
dax: change bdev_dax_supported() to support boolean returns
Ross Zwisler (5):
dm: fix test for DAX device support
dm: prevent DAX mounts if not supported
dm: remove DM_TYPE_DAX_BIO_BASED dm_queue_mode
dm-snap: remove unnecessary direct_access() stub
dm-error: remove unnecessary direct_access() stub
drivers/dax/super.c | 40 ++++++++++++++++++++--------------------
drivers/md/dm-ioctl.c | 16 ++++++----------
drivers/md/dm-snap.c | 8 --------
drivers/md/dm-table.c | 29 +++++++++++------------------
drivers/md/dm-target.c | 7 -------
drivers/md/dm.c | 7 ++-----
fs/ext2/super.c | 3 +--
fs/ext4/super.c | 3 +--
fs/xfs/xfs_ioctl.c | 3 ++-
fs/xfs/xfs_iops.c | 30 +++++++++++++++++++++++++-----
fs/xfs/xfs_super.c | 10 ++++++++--
include/linux/dax.h | 11 ++++++-----
include/linux/device-mapper.h | 8 ++++++--
13 files changed, 88 insertions(+), 87 deletions(-)
--
2.14.3
2 years, 8 months
[ndctl PATCH] ndctl, Documentation: Add namespace 'theory of operation'
by Dan Williams
Provide more background information on namespace mechanics, the mode
types, and expected usage models.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
Documentation/ndctl/namespace-description.txt | 56 +++++++++++++++++++++---
Documentation/ndctl/ndctl-create-namespace.txt | 1
2 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/Documentation/ndctl/namespace-description.txt b/Documentation/ndctl/namespace-description.txt
index 32ab5cd83983..33d32277b885 100644
--- a/Documentation/ndctl/namespace-description.txt
+++ b/Documentation/ndctl/namespace-description.txt
@@ -1,8 +1,52 @@
// SPDX-License-Identifier: GPL-2.0
-DESCRIPTION
------------
-A REGION, after resolving DPA aliasing and LABEL specified boundaries,
-surfaces one or more "namespace" devices. The arrival of a "namespace"
-device currently triggers either the nd_blk or nd_pmem driver to load
-and register a disk/block device.
+THEORY OF OPERATION
+-------------------
+The capacity of an NVDIMM REGION (contiguous span of persistent memory)
+is accessed via one or more NAMESPACE devices. REGION is the Linux term
+for what ACPI and UEFI call a DIMM-interleave-set, or a
+system-physical-address-range that is striped (by the memory controller)
+across one or more memory modules.
+
+The UEFI specification defines the 'NVDIMM Label Protocol' as the
+combination of label area access methods and a data format for
+provisioning one or more NAMESPACE objects from a REGION. Note that
+label support is optional and if Linux does not detect the label
+capability it will automatically instantiate a "label-less" namespace
+per region. Examples of label-less namespaces are the ones created by
+the kernel's 'memmap=ss!nn' command line option (see the nvdimm wiki on
+kernel.org), or NVDIMMs without a valid 'namespace index' in their label
+area.
+
+A namespace can be provisioned to operate in one of 4 modes, 'fsdax',
+'devdax', 'sector', and 'raw'. Here are the expected usage models for
+these modes:
+ - fsdax: Filesystem-DAX mode is the default mode of a namespace
+ when specifying 'ndctl create-namespace' with no options. It creates
+ a block device (/dev/pmemX[.Y]) that supports the DAX capabilities
+ of Linux filesystems (xfs and ext4 to date). DAX removes the page
+ cache from the I/O path and allows mmap(2) to establish direct
+ mappings to persistent memory media. The DAX capability enables
+ workloads / working-sets that would exceed the capacity of the page
+ cache to scale up to the capacity of persistent memory. Workloads
+ that fit in page cache or perform bulk data transfers may not see
+ benefit from DAX. When in doubt, pick this mode.
+
+ - devdax: Device-DAX mode enables similar mmap(2) DAX mapping
+ capabilities as Filesystem-DAX. However, instead of a block-device
+ that can support a DAX-enabled filesystem, this mode emits a single
+ character device file (/dev/daxX.Y). Use this mode to assign
+ persistent memory to a virtual-machine, register persistent memory
+ for RDMA, or when gigantic mappings are needed.
+
+ - sector: Use this mode to host legacy filesystems that do
+ not checksum metadata or applications that are not prepared for torn
+ sectors after a crash. Expected usage for this mode is for small
+ boot volumes. This mode is compatible with other operating systems.
+
+ - raw: Raw mode is effectively just a memory disk that does
+ not support DAX. Typically this indicates an namespace that was
+ created by tooling or another operating system that did not know how
+ to create a Linux 'fsdax' or 'devdax' mode namespace. This mode is
+ compatible with other operating systems, but again, does not support
+ DAX operation.
diff --git a/Documentation/ndctl/ndctl-create-namespace.txt b/Documentation/ndctl/ndctl-create-namespace.txt
index 14c5409f059b..4b8b0d1c3eac 100644
--- a/Documentation/ndctl/ndctl-create-namespace.txt
+++ b/Documentation/ndctl/ndctl-create-namespace.txt
@@ -219,3 +219,4 @@ linkndctl:ndctl-init-labels[1],
linkndctl:ndctl-disable-namespace[1],
linkndctl:ndctl-enable-namespace[1],
http://www.uefi.org/sites/default/files/resources/UEFI_Spec_2_7.pdf[UEFI NVDIMM Label Protocol]
+https://nvdimm.wiki.kernel.org[Linux Persistent Memory Wiki]
2 years, 8 months
Bug on ndctl ? (failed to create namespace: No such device or address)
by Yasunori Goto
Hi,
I found a trouble when I use a box which has real NVDIMM, and tried to
configure namespaces on it with ndctl.
ndctl failed to create namespace when some namespace are created, and destroyed.
Does anyone can reproduce this problem? I hope this issue will be solved...
Here is how to reproduce...
---
1) Make some namespaces on a region.
In this case, 4 x 30GB namespaces are created in a 250GB region.
$ sudo ndctl create-namespace -n "hoge0" -m fsdax -s 30G
{
"dev":"namespace0.0",
"mode":"fsdax",
"size":"29.53 GiB (31.71 GB)",
"uuid":"06be449f-794c-4574-900c-dd1be8c8465a",
"sector_size":512,
"blockdev":"pmem0",
"name":"hoge0",
"numa_node":0
}
$ sudo ndctl create-namespace -n "hoge1" -m fsdax -s 30G
{
"dev":"namespace0.2",
"mode":"fsdax",
"size":"29.53 GiB (31.71 GB)",
"uuid":"fcce6b79-be23-4fff-a4b5-17f3154555a2",
"sector_size":512,
"blockdev":"pmem0.2",
"name":"hoge1",
"numa_node":0
}
$ sudo ndctl create-namespace -n "hoge2" -m fsdax -s 30G
{
"dev":"namespace0.1",
"mode":"fsdax",
"size":"29.53 GiB (31.71 GB)",
"uuid":"59a7e231-ad54-44a3-99d7-cb760d7e5cb6",
"sector_size":512,
"blockdev":"pmem0.1",
"name":"hoge2",
"numa_node":0
}
$ sudo ndctl create-namespace -n "hoge3" -m fsdax -s 30G
{
"dev":"namespace0.3",
"mode":"fsdax",
"size":"29.53 GiB (31.71 GB)",
"uuid":"fa8d6951-b83e-4093-872a-1a815d2d864e",
"sector_size":512,
"blockdev":"pmem0.3",
"name":"hoge3",
"numa_node":0
}
---
2) Disable and destroy -the second- namespace.
---
$ sudo ndctl disable-namespace "namespace0.1"
disabled 1 namespace
$ sudo ndctl destroy-namespace "namespace0.1"
destroyed 1 namespace
---
3) Try to create new namespace without specifying size.
---
$ sudo ndctl create-namespace -n "hoge5" -m fsdax
failed to create namespace: No such device or address <----- !!!
---
(I guess ndctl tried to allocate namespace by available size which is
the -total amount of free space- of the region, but nvdimm driver
needs a contiguous free spaces which is smaller than the available size
in this case. But I'm not sure.)
In addition, kernel shows the following warnings.
---
[ 695.183696] ------------[ cut here ]------------
[ 695.188855] nd_region region0: allocation underrun: 0x0 of 0x1400000000 bytes
[ 695.196873] WARNING: CPU: 32 PID: 1975 at drivers/nvdimm/namespace_devs.c:913 size_store+0x879/0x8d0 [libnvdimm]
[ 695.208231] Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_raw iptable_security ebtable_filter ebtables ip6table_filter ip6_tables sunrpc vfat fat ext4 mbcache jbd2 intel_rapl skx_edac x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel ipmi_ssif nd_pmem intel_cstate ipmi_si intel_uncore joydev mei_me nd_btt ioatdma dax_pmem shpchp device_dax iTCO_wdt iTCO_vendor_support ipmi_devintf
[ 695.287872] pcspkr mei nfit intel_rapl_perf ipmi_msghandler i2c_i801 lpc_ich libnvdimm xfs libcrc32c mgag200 ixgbe drm_kms_helper igb ttm mdio ptp uas pps_core drm crc32c_intel usb_storage dca i2c_algo_bit
[ 695.308355] CPU: 32 PID: 1975 Comm: ndctl Not tainted 4.17.0-rc7 #16
[ 695.315439] Hardware name: FUJITSU PRIMEQUEST 3800E/D3858-A1, BIOS V1.0.0.0 R0.2.0 for D3858-A1x 06/14/2018
[ 695.327477] RIP: 0010:size_store+0x879/0x8d0 [libnvdimm]
[ 695.333405] RSP: 0018:ffffc0a9c6d97d38 EFLAGS: 00010282
[ 695.339236] RAX: 0000000000000000 RBX: ffff9a24eef1bc08 RCX: 0000000000000000
[ 695.347201] RDX: ffff9a24fe21ca40 RSI: ffff9a24fe2165b8 RDI: ffff9a24fe2165b8
[ 695.355164] RBP: 0000000000000000 R08: 0000000000002122 R09: 0000000000000007
[ 695.363129] R10: fffff0b5a1dd66c0 R11: ffffffffaea41ccd R12: ffff9a24f7b50ff8
[ 695.371091] R13: ffff9a24f85f13c8 R14: ffffc0a9c6d97da6 R15: ffff9a24f85f1000
[ 695.379054] FS: 00007f8977650780(0000) GS:ffff9a24fe200000(0000) knlGS:0000000000000000
[ 695.388084] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 695.394496] CR2: 00007fec422c0140 CR3: 00000008333bc003 CR4: 00000000007606e0
[ 695.402460] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 695.410423] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 695.418386] PKRU: 55555554
[ 695.421405] Call Trace:
[ 695.424143] ? __kmalloc+0x5a/0x210
[ 695.428038] kernfs_fop_write+0x10f/0x190
[ 695.432517] __vfs_write+0x36/0x180
[ 695.436414] ? selinux_file_permission+0x11d/0x130
[ 695.441762] ? security_file_permission+0x2a/0xb0
[ 695.447011] vfs_write+0xad/0x1a0
[ 695.450710] ksys_write+0x52/0xc0
[ 695.454413] do_syscall_64+0x5b/0x160
[ 695.458505] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 695.464143] RIP: 0033:0x7f897693d7a4
[ 695.468131] RSP: 002b:00007fff7aa5e0a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 695.476579] RAX: ffffffffffffffda RBX: 000000000000000e RCX: 00007f897693d7a4
[ 695.484544] RDX: 000000000000000e RSI: 00007fff7aa5e0f0 RDI: 0000000000000003
[ 695.492509] RBP: 00007fff7aa5e0f0 R08: 000000000000000a R09: 0000000000000000
[ 695.500472] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
[ 695.508435] R13: 0000000000000000 R14: 00007f89776506b0 R15: 0000000000000002
[ 695.516399] Code: 50 48 29 c5 4d 85 e4 74 4c 4c 89 ff e8 01 66 12 ed 4c 8b 44 24 38 48 89 e9 4c 89 e2 48 89 c6 48 c7 c7 20 0c 41 c0 e8 07 b0 c9 ec <0f> 0b e9 8e fd ff ff e8 8b b2 c9 ec 48 c7 c6 00 f1 40 c0 48 c7
[ 695.537470] ---[ end trace 91e4a4668f52f7dc ]---
----
This warning seems to be the following line.
---
static int grow_dpa_allocation(struct nd_region *nd_region,
struct nd_label_id *label_id, resource_size_t n)
{
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(&nd_region->dev);
bool is_pmem = strncmp(label_id->id, "pmem", 4) == 0;
int i;
:
:
}
dev_WARN_ONCE(&nd_region->dev, rem, <----!!!
"allocation underrun: %#llx of %#llx bytes\n", <----!!!
(unsigned long long) n - rem, <----!!!
(unsigned long long) n); <----!!!
---
Thanks,
Yasunori Goto
2 years, 8 months
[ndctl PATCH] ndctl, test: remove an unused variable assignment
by Vishal Verma
Static analysis complains that 'rc' was overwritten immediately after
assigning to it, and therefore the assignment is useless. Remove it.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
test/dsm-fail.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/test/dsm-fail.c b/test/dsm-fail.c
index 45a6c4f..6845f81 100644
--- a/test/dsm-fail.c
+++ b/test/dsm-fail.c
@@ -339,11 +339,9 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
sprintf(path, "%s/fail_cmd", DIMM_PATH);
sprintf(buf, "0\n");
rc = __sysfs_write_attr(&log_ctx, path, buf);
- if (rc) {
+ if (rc)
fprintf(stderr, "%s: failed to clear fail_cmd mask\n",
ndctl_dimm_get_devname(victim));
- rc = -ENXIO;
- }
rc = ndctl_dimm_enable(victim);
if (rc) {
fprintf(stderr, "failed to enable victim: %s after clearing error\n",
--
2.17.0
2 years, 8 months