[patch] dev-dax: ratelimit unaligned vma warning
by Jeff Moyer
This is easily triggered from userspace, so let's ratelimit the warning.
Signed-off-by: Jeff Moyer <jmoyer(a)redhat.com>
diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index de2f8297a210..16ea90615aac 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -196,7 +196,8 @@ static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma,
mask = dax_region->align - 1;
if (vma->vm_start & mask || vma->vm_end & mask) {
- dev_info(dev, "%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n",
+ dev_info_ratelimited(dev,
+ "%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n",
current->comm, func, vma->vm_start, vma->vm_end,
mask);
return -EINVAL;
3 years, 12 months
[PATCH] x86: optimize memcpy_flushcache
by Mikulas Patocka
Hi Mike
Could you please push this patch to the kernel 4.18-rc? Dan Williams said
that he will submit it, but he forgot about it.
Without this patch, dm-writecache is suffering 2% penalty because of
memcpy_flushcache overhead.
Mikulas
From: Mikulas Patocka <mpatocka(a)redhat.com>
I use memcpy_flushcache in my persistent memory driver for metadata
updates and it turns out that the overhead of memcpy_flushcache causes 2%
performance degradation compared to "movnti" instruction explicitly coded
using inline assembler.
This patch recognizes memcpy_flushcache calls with constant short length
and turns them into inline assembler - so that I don't have to use inline
assembler in the driver.
Signed-off-by: Mikulas Patocka <mpatocka(a)redhat.com>
---
arch/x86/include/asm/string_64.h | 20 +++++++++++++++++++-
arch/x86/lib/usercopy_64.c | 4 ++--
2 files changed, 21 insertions(+), 3 deletions(-)
Index: linux-2.6/arch/x86/include/asm/string_64.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/string_64.h
+++ linux-2.6/arch/x86/include/asm/string_64.h
@@ -149,7 +149,25 @@ memcpy_mcsafe(void *dst, const void *src
#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE
#define __HAVE_ARCH_MEMCPY_FLUSHCACHE 1
-void memcpy_flushcache(void *dst, const void *src, size_t cnt);
+void __memcpy_flushcache(void *dst, const void *src, size_t cnt);
+static __always_inline void memcpy_flushcache(void *dst, const void *src, size_t cnt)
+{
+ if (__builtin_constant_p(cnt)) {
+ switch (cnt) {
+ case 4:
+ asm ("movntil %1, %0" : "=m"(*(u32 *)dst) : "r"(*(u32 *)src));
+ return;
+ case 8:
+ asm ("movntiq %1, %0" : "=m"(*(u64 *)dst) : "r"(*(u64 *)src));
+ return;
+ case 16:
+ asm ("movntiq %1, %0" : "=m"(*(u64 *)dst) : "r"(*(u64 *)src));
+ asm ("movntiq %1, %0" : "=m"(*(u64 *)(dst + 8)) : "r"(*(u64 *)(src + 8)));
+ return;
+ }
+ }
+ __memcpy_flushcache(dst, src, cnt);
+}
#endif
#endif /* __KERNEL__ */
Index: linux-2.6/arch/x86/lib/usercopy_64.c
===================================================================
--- linux-2.6.orig/arch/x86/lib/usercopy_64.c
+++ linux-2.6/arch/x86/lib/usercopy_64.c
@@ -153,7 +153,7 @@ long __copy_user_flushcache(void *dst, c
return rc;
}
-void memcpy_flushcache(void *_dst, const void *_src, size_t size)
+void __memcpy_flushcache(void *_dst, const void *_src, size_t size)
{
unsigned long dest = (unsigned long) _dst;
unsigned long source = (unsigned long) _src;
@@ -216,7 +216,7 @@ void memcpy_flushcache(void *_dst, const
clean_cache_range((void *) dest, size);
}
}
-EXPORT_SYMBOL_GPL(memcpy_flushcache);
+EXPORT_SYMBOL_GPL(__memcpy_flushcache);
void memcpy_page_flushcache(char *to, struct page *page, size_t offset,
size_t len)
3 years, 12 months
[ndctl PATCH 1/2] ndctl: Add 'list' verbose options
by Keith Busch
The informational and miscellaneous flag options are becoming more
numerous, and can be difficult to remember what can be listed. Rather
than add more flags to suppress and show some of the less pertinent
information, this patch adds a 'verbose' option that increases the detail
of information displayed.
The verbose option can be repeated multiple times to increase the
detail. There are currently three levels of verbose, and repeating more
than that has the same behavior as level three.
Signed-off-by: Keith Busch <keith.busch(a)intel.com>
---
ndctl/list.c | 25 ++++++++++++++++++++++++-
util/json.c | 33 +++++++++++++++++++--------------
util/json.h | 1 +
3 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/ndctl/list.c b/ndctl/list.c
index 6cf7c39..98e5b3d 100644
--- a/ndctl/list.c
+++ b/ndctl/list.c
@@ -36,6 +36,7 @@ static struct {
bool media_errors;
bool human;
bool firmware;
+ int verbose;
} list;
static unsigned long listopts_to_flags(void)
@@ -50,6 +51,8 @@ static unsigned long listopts_to_flags(void)
flags |= UTIL_JSON_DAX | UTIL_JSON_DAX_DEVS;
if (list.human)
flags |= UTIL_JSON_HUMAN;
+ if (list.verbose)
+ flags |= UTIL_JSON_VERBOSE;
return flags;
}
@@ -112,7 +115,7 @@ static struct json_object *region_to_json(struct ndctl_region *region,
numa = ndctl_region_get_numa_node(region);
if (numa >= 0) {
jobj = json_object_new_int(numa);
- if (jobj)
+ if (jobj && flags & UTIL_JSON_VERBOSE)
json_object_object_add(jregion, "numa_node", jobj);
}
@@ -444,6 +447,8 @@ int cmd_list(int argc, const char **argv, void *ctx)
"include media errors"),
OPT_BOOLEAN('u', "human", &list.human,
"use human friendly number formats "),
+ OPT_INCR('v', "verbose", &list.verbose,
+ "increase output detail"),
OPT_END(),
};
const char * const u[] = {
@@ -468,6 +473,24 @@ int cmd_list(int argc, const char **argv, void *ctx)
param.mode = "dax";
}
+ switch (list.verbose) {
+ default:
+ case 3:
+ list.idle = true;
+ list.firmware = true;
+ case 2:
+ list.buses = true;
+ list.regions = true;
+ case 1:
+ list.dimms = true;
+ list.health = true;
+ list.media_errors = true;
+ list.namespaces = true;
+ list.dax = true;
+ case 0:
+ break;
+ }
+
if (num_list_flags() == 0)
list.namespaces = true;
diff --git a/util/json.c b/util/json.c
index 1772177..a9f028b 100644
--- a/util/json.c
+++ b/util/json.c
@@ -660,6 +660,21 @@ static struct json_object *util_raw_uuid(struct ndctl_namespace *ndns)
return json_object_new_string(buf);
}
+static void util_raw_uuid_to_json(struct ndctl_namespace *ndns,
+ unsigned long flags,
+ struct json_object *jndns)
+{
+ struct json_object *jobj;
+
+ if (!(flags & UTIL_JSON_VERBOSE))
+ return;
+
+ jobj = util_raw_uuid(ndns);
+ if (!jobj)
+ return;
+ json_object_object_add(jndns, "raw_uuid", jobj);
+}
+
struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
unsigned long flags)
{
@@ -732,11 +747,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
if (!jobj)
goto err;
json_object_object_add(jndns, "uuid", jobj);
-
- jobj = util_raw_uuid(ndns);
- if (!jobj)
- goto err;
- json_object_object_add(jndns, "raw_uuid", jobj);
+ util_raw_uuid_to_json(ndns, flags, jndns);
bdev = ndctl_btt_get_block_device(btt);
} else if (pfn) {
ndctl_pfn_get_uuid(pfn, uuid);
@@ -745,10 +756,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
if (!jobj)
goto err;
json_object_object_add(jndns, "uuid", jobj);
- jobj = util_raw_uuid(ndns);
- if (!jobj)
- goto err;
- json_object_object_add(jndns, "raw_uuid", jobj);
+ util_raw_uuid_to_json(ndns, flags, jndns);
bdev = ndctl_pfn_get_block_device(pfn);
} else if (dax) {
struct daxctl_region *dax_region;
@@ -760,10 +768,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
if (!jobj)
goto err;
json_object_object_add(jndns, "uuid", jobj);
- jobj = util_raw_uuid(ndns);
- if (!jobj)
- goto err;
- json_object_object_add(jndns, "raw_uuid", jobj);
+ util_raw_uuid_to_json(ndns, flags, jndns);
if ((flags & UTIL_JSON_DAX) && dax_region) {
jobj = util_daxctl_region_to_json(dax_region, NULL,
flags);
@@ -810,7 +815,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
* happens because they use pre-v1.2 labels or because they
* don't have a label space (devtype=nd_namespace_io).
*/
- if (sector_size < UINT_MAX) {
+ if (sector_size < UINT_MAX && flags & UTIL_JSON_VERBOSE) {
jobj = json_object_new_int(sector_size);
if (!jobj)
goto err;
diff --git a/util/json.h b/util/json.h
index c5d1603..17e9320 100644
--- a/util/json.h
+++ b/util/json.h
@@ -23,6 +23,7 @@ enum util_json_flags {
UTIL_JSON_DAX = (1 << 2),
UTIL_JSON_DAX_DEVS = (1 << 3),
UTIL_JSON_HUMAN = (1 << 4),
+ UTIL_JSON_VERBOSE = (1 << 5),
};
struct json_object;
--
2.14.3
3 years, 12 months
[ndctl PATCH] ndctl, test: check availability of MAP_SYNC for poison test
by Dan Williams
The poison handling test requires the systems that have both MAP_SYNC
and BUS_MCEERR_AR definitions. Add the missing MAP_SYNC gate for this
test to detect this functionality at build time.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
configure.ac | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 17b5a657149c..cf4426076c65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,10 +102,13 @@ AS_IF([test "x$enable_test" = "xyes"],
[AC_DEFINE([ENABLE_TEST], [1], [ndctl test support])])
AM_CONDITIONAL([ENABLE_TEST], [test "x$enable_test" = "xyes"])
-AC_CHECK_DECLS([BUS_MCEERR_AR], [enable_poison=yes], [], [[#include <signal.h>]])
-AS_IF([test "x$enable_poison" = "xyes"],
+AC_CHECK_DECLS([BUS_MCEERR_AR], [enable_bus_mc_err=yes], [], [[#include <signal.h>]])
+AC_CHECK_DECLS([MAP_SYNC], [enable_map_sync=yes], [], [[#include <linux/mman.h>]])
+
+AS_IF([test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes"],
[AC_DEFINE([ENABLE_POISON], [1], [ndctl test poison support])])
-AM_CONDITIONAL([ENABLE_POISON], [test "x$enable_poison" = "xyes"])
+AM_CONDITIONAL([ENABLE_POISON],
+ [test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes"])
PKG_CHECK_MODULES([KMOD], [libkmod])
PKG_CHECK_MODULES([UDEV], [libudev])
3 years, 12 months
[ndctl PATCH] ndctl, test: check availability of MAP_SYNC for poison test
by Dan Williams
The poison handling test requires the systems that have both MAP_SYNC
and BUS_MCEERR_AR definitions. Add the missing MAP_SYNC gate for this
test to detect this functionality at build time.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
configure.ac | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 17b5a657149c..cf4426076c65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,10 +102,13 @@ AS_IF([test "x$enable_test" = "xyes"],
[AC_DEFINE([ENABLE_TEST], [1], [ndctl test support])])
AM_CONDITIONAL([ENABLE_TEST], [test "x$enable_test" = "xyes"])
-AC_CHECK_DECLS([BUS_MCEERR_AR], [enable_poison=yes], [], [[#include <signal.h>]])
-AS_IF([test "x$enable_poison" = "xyes"],
+AC_CHECK_DECLS([BUS_MCEERR_AR], [enable_bus_mc_err=yes], [], [[#include <signal.h>]])
+AC_CHECK_DECLS([MAP_SYNC], [enable_map_sync=yes], [], [[#include <linux/mman.h>]])
+
+AS_IF([test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes"],
[AC_DEFINE([ENABLE_POISON], [1], [ndctl test poison support])])
-AM_CONDITIONAL([ENABLE_POISON], [test "x$enable_poison" = "xyes"])
+AM_CONDITIONAL([ENABLE_POISON],
+ [test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes"])
PKG_CHECK_MODULES([KMOD], [libkmod])
PKG_CHECK_MODULES([UDEV], [libudev])
3 years, 12 months
[PATCH v5 0/3] Fix DM DAX handling
by Ross Zwisler
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.
---
Changes since v4:
* No code changes.
* Updated the changelogs for patches 1 and 3.
* Removed the Cc: stable from patch 1.
* Added a Fixes: tag to patch 2.
Ross Zwisler (3):
pmem: only set QUEUE_FLAG_DAX for fsdax mode
dax: bdev_dax_supported() check for QUEUE_FLAG_DAX
dm: prevent DAX mounts if not supported
drivers/dax/super.c | 8 ++++++++
drivers/md/dm-table.c | 7 ++++---
drivers/md/dm.c | 3 +--
drivers/nvdimm/pmem.c | 3 ++-
4 files changed, 15 insertions(+), 6 deletions(-)
--
2.14.4
3 years, 12 months
[ANNOUNCE] ndctl v61
by Verma, Vishal L
https://github.com/pmem/ndctl/releases/tag/v61
This release incorporates functionality up to the 4.18 kernel, and
a number of bug fixes and improvements.
Highlights include a fix to the error injection APIs to inject fewer
bytes of errors per sector, support for building documentation with
asciidoctor in addition to asciidoc, multi-arrgument support for
util_<obj>_filter, and a new OPTION_FILENAME in option parsing. Unit
test updates include cleanups to unit test scripts refactoring out a
lot of common boilerplate, MADV_HWPOISON tests, and a new test for
capacity vs label locking.
Shortlog:
Dan Williams (10):
ndctl: warn on variables declared after statement
ndctl: hide null uuids
test: add a MADV_HWPOISON test
test: Add device-dax MADV_HWPOISON test
ndctl: autoconf detect BUS_MCEERR_AR
ndctl, list: Add controller temperature
ndctl, test: Update libndctl test for controller temperature valid
ndctl, test: Disable poison tests for now
ndctl, test: Update tests for capacity vs namespace-label locking
ndctl, Documentation: Add namespace 'theory of operation'
Dave Jiang (1):
ndctl: remove warnings when -O0 is used with -D_FORTIFY_SOURCE=2
Masayoshi Mizuma (5):
ndctl, test: add common helper functions for test scripts
ndctl, test: cleanup test scripts
ndctl, test: Add NFIT_TEST_BUS[01] variable and some helper funtions
to common
ndctl, test: cleanup test scripts
ndctl: add a test file to .gitignore
QI Fuli (4):
ndctl, filter: refacor util_<obj>_filter() to support multiple space-
seperated arguments
ndctl, filter: fix "keyword 'all' is ignored" in util_<obj>_filter()
ndctl, util: add OPTION_FILENAME to parse_opt_type
ndctl, list: add controller temperature threshold and alarm
Takashi Iwai (3):
Documentation: fix title and section markers
Documentation: Add the support for asciidoctor
Documentation: add asciidoctor-extensions.rb to .gitignore
Vishal Verma (19):
ndctl, documentation: add inject-smart to the Makefile
ndctl: fix ABI breakage due to rename of fw_info_get_updated_version
libndctl, ars: add an API to retrieve clear_err_unit
libndctl, inject: inject fewer bytes per block by default
libndctl, inject: add 'v2' APIs for inject and uninject
ndctl, inject-error: add a --saturate option
libndctl: fix potential buffer overflow in write_cache APIs
libndctl: improve debug prints in wait_for_scrub_completion
libndctl, test: fix a couple of unchecked returns
configure: add -Wunused-result and -D_FORTIFY_SOURCE=2 to cflags
ndctl: fix libtool versioning
ndctl, test: fix sector-mode.sh to work with label support
ndctl, list: display the 'map' location in listings
ndctl: refactor validation of the ars_status command
ndctl, ars: don't invalidate the user-provided command
ndctl: add an api for getting the ars_status overflow flag
ndctl: Update README.md for code blocks
ndctl, contrib: Add helper scripts for new release
ndctl, test: remove an unused variable assignment
3 years, 12 months
[ndctl PATCHv2] ndctl: Use max_available_extent for namespaces
by Keith Busch
The available_size attribute returns all the unused regions, but a
namespace has to use contiguous free regions. This patch uses the
attribute returning the largest capacity that can be created for
determining if the namespace can be created.
If this is used on a kernel that predates the new attribute, ndctl will
fall back to the previous behavior using available_size. While that may
still fail, it is more likely to succeed than returning a hard-coded
value.
Signed-off-by: Keith Busch <keith.busch(a)intel.com>
---
v1 -> v2:
Appropriate subject-prefex for ndctl.
Added the fallback to the previous behavior if the attribute is not
found, and noted this behavior in the changelog.
ndctl/lib/libndctl.c | 31 +++++++++++++++++++++++++++++++
ndctl/lib/libndctl.sym | 1 +
ndctl/libndctl.h | 2 ++
ndctl/namespace.c | 2 +-
4 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 47e005e..8ff1fa6 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -2025,6 +2025,37 @@ NDCTL_EXPORT unsigned long long ndctl_region_get_available_size(
return strtoull(buf, NULL, 0);
}
+NDCTL_EXPORT unsigned long long ndctl_region_get_max_available_extent(
+ struct ndctl_region *region)
+{
+ unsigned int nstype = ndctl_region_get_nstype(region);
+ struct ndctl_ctx *ctx = ndctl_region_get_ctx(region);
+ char *path = region->region_buf;
+ int len = region->buf_len;
+ char buf[SYSFS_ATTR_SIZE];
+
+ switch (nstype) {
+ case ND_DEVICE_NAMESPACE_PMEM:
+ case ND_DEVICE_NAMESPACE_BLK:
+ break;
+ default:
+ return 0;
+ }
+
+ if (snprintf(path, len,
+ "%s/max_available_extent", region->region_path) >= len) {
+ err(ctx, "%s: buffer too small!\n",
+ ndctl_region_get_devname(region));
+ return ULLONG_MAX;
+ }
+
+ /* fall back to legacy behavior if max extents is not exported */
+ if (sysfs_read_attr(ctx, path, buf) < 0)
+ return ndctl_region_get_available_size(region);
+
+ return strtoull(buf, NULL, 0);
+}
+
NDCTL_EXPORT unsigned int ndctl_region_get_range_index(struct ndctl_region *region)
{
return region->range_index;
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index c1228e5..22fd026 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -123,6 +123,7 @@ global:
ndctl_region_get_mappings;
ndctl_region_get_size;
ndctl_region_get_available_size;
+ ndctl_region_get_max_available_extent;
ndctl_region_get_type;
ndctl_region_get_namespace_seed;
ndctl_region_get_btt_seed;
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index be997ac..624115d 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -338,6 +338,8 @@ unsigned int ndctl_region_get_interleave_ways(struct ndctl_region *region);
unsigned int ndctl_region_get_mappings(struct ndctl_region *region);
unsigned long long ndctl_region_get_size(struct ndctl_region *region);
unsigned long long ndctl_region_get_available_size(struct ndctl_region *region);
+unsigned long long ndctl_region_get_max_available_extent(
+ struct ndctl_region *region);
unsigned int ndctl_region_get_range_index(struct ndctl_region *region);
unsigned int ndctl_region_get_type(struct ndctl_region *region);
struct ndctl_namespace *ndctl_region_get_namespace_seed(
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index fe86d82..4a562a2 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -764,7 +764,7 @@ static int namespace_create(struct ndctl_region *region)
return -EAGAIN;
}
- available = ndctl_region_get_available_size(region);
+ available = ndctl_region_get_max_available_extent(region);
if (!available || p.size > available) {
debug("%s: insufficient capacity size: %llx avail: %llx\n",
devname, p.size, available);
--
2.14.3
3 years, 12 months
[PATCH v7 0/3] ndctl, monitor: add ndctl monitor daemon
by QI Fuli
This is the v7 patch for ndctl monitor, a tiny daemon to monitor
the smart events of nvdimm DIMMs. Since NVDIMM does not have a
feature like mirroring, if it breaks down, the data will be
impossible to restore. Ndctl monitor daemon will catch the smart
events notify from firmware and outputs notification to logfile,
therefore users can replace NVDIMM before it is completely broken.
Signed-off-by: QI Fuli <qi.fuli(a)jp.fujitsu.com>
---
Change log since v6:
- Changing License to GPL-2.0
- Adding event object to output notification
- Adding [--dimm-event] option to filter notification by event type
- Rewriting read_config_file()
- Replacing monitor_dimm_event() with monitor_event()
- Renaming some variables
Change log since v5:
- Fixing systemd unit file cannot be installed bug
- Adding license to ./util/abspath.c
Change log since v4:
- Adding OPTION_FILENAME to make sure filename is correct
- Adding configuration file
- Adding [--config-file] option to override the default configuration
- Making some options support multiple space-seperated arguments
- Making systemctl enable ndctl-monitor.service command work
- Making systemctl restart ndctl-monitor.service command work
- Making the directory of systemd unit file to be configurable
- Changing log_file() and log_syslog() to logreport()
- Changing date format in notification to nanoseconds since epoch
- Changing select() to epoll()
- Adding filter_bus() and filter_region()
Change log since v3:
- Removing create-monitor, show-monitor, list-monitor, destroy-monitor
- Adding [--daemon] option to run ndctl monitor as a daemon
- Using systemd to manage ndctl monitor daemon
- Replacing filter_monitor_dimm() with filter_dimm()
Change log since v2:
- Changing the interface of daemon to the ndctl command line
- Changing the name of daemon form "nvdimmd" to "monitor"
- Removing the config file, unit_file, nvdimmd dir
- Removing nvdimmd_test program
- Adding ndctl/monitor.c
Change log since v1:
- Adding a config file(/etc/nvdimmd/nvdimmd.conf)
- Using struct log_ctx instead of syslog()
- Using log_syslog() to save the notify messages to syslog
- Using log_file() to save the notify messages to special file
- Adding LOG_NOTICE level to log_priority
- Using automake instead of Makefile
- Adding a new util file(nvdimmd/util.c) including helper functions
needed for nvdimm daemon
- Adding nvdimmd_test program
QI Fuli (3):
ndctl, monitor: add ndctl monitor
ndctl, monitor: add main ndctl monitor configuration file
ndctl, monitor: add the unit file of systemd for ndctl-monitor service
autogen.sh | 3 +-
builtin.h | 1 +
configure.ac | 22 ++
ndctl/Makefile.am | 12 +-
ndctl/monitor.c | 647 ++++++++++++++++++++++++++++++++++++
ndctl/monitor.conf | 42 +++
ndctl/ndctl-monitor.service | 7 +
ndctl/ndctl.c | 1 +
8 files changed, 733 insertions(+), 2 deletions(-)
create mode 100644 ndctl/monitor.c
create mode 100644 ndctl/monitor.conf
create mode 100644 ndctl/ndctl-monitor.service
--
2.17.1
3 years, 12 months
[PATCH v2] ndctl, list: add controller temperature threshold
by QI Fuli
This patch is used for adding controller_temperature_threshold and
alarm_controller_temperature to list. When a 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 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
index 9482b35..6a1f294 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_CTEMP_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;
@@ -130,12 +142,17 @@ struct json_object *util_dimm_health_to_json(struct ndctl_dimm *dimm)
if (flags & ND_SMART_ALARM_VALID) {
unsigned int alarm_flags = ndctl_cmd_smart_get_alarm_flags(cmd);
bool temp_flag = !!(alarm_flags & ND_SMART_TEMP_TRIP);
+ bool ctrl_temp_flag = !!(alarm_flags & ND_SMART_CTEMP_TRIP);
bool spares_flag = !!(alarm_flags & ND_SMART_SPARE_TRIP);
jobj = json_object_new_boolean(temp_flag);
if (jobj)
json_object_object_add(jhealth, "alarm_temperature", jobj);
+ jobj = json_object_new_boolean(ctrl_temp_flag);
+ if (jobj)
+ json_object_object_add(jhealth, "alarm_controller_temperature", jobj);
+
jobj = json_object_new_boolean(spares_flag);
if (jobj)
json_object_object_add(jhealth, "alarm_spares", jobj);
--
2.17.1
3 years, 12 months