Hello!
by jorge.garciao@assaabloy.es
Do you want to start making $5900 a day - starting today?
That’s $5900 today, tomorrow...and for LIFE.
Join this profit opportunity and by this time tomorrow,
you will have received a $5900 deposit into your private bank account.
>>>
Click here to make $5900 by this time tomorrow.
2 years, 8 months
[PATCH v5 0/4] ndctl, monitor: add ndctl monitor daemon
by QI Fuli
This is the v5 patch for ndctl monitor daemon, a tiny daemon to monitor the
smart events of nvdimm DIMMs. Users can run a monitor as a one-shot command
or a daemon in background by using the [--daemon] option. DIMMs to monitor
can be selected by [--dimm] [--bus] [--region] [--namespace] options,
these options support multiple space-seperated arguments.
When a smart event fires, monitor daemon will log the notifications which
including dimm health status to syslog or a logfile by setting
[--logfile=<file|syslog>] option. monitor also can output the notifications
to stderr when it run as one-shot command by setting [--logfile=<stderr>].
The notifications follow json format and can be consumed by log collectors
like Fluentd. Users can change the configuration of monitor by editing
the default configuration file /etc/ndctl/monitor.conf or by using
[--config-file=<file>] option to override the default one.
Users can start a monitor daemon by the following command:
# ndctl monitor --dimm nmem1 --logfile /var/log/ndctl/monitor.log --daemon
Also, a monitor daemon can be started by systemd:
# systemctl start ndctl-monitor.service
In this case, monitor daemon follows the default configuration file
/etc/ndctl/monitor.conf.
Signed-off-by: QI Fuli <qi.fuli(a)jp.fujitsu.com>
Change log since v4:
- Adding OPTION_FILENAME to make sure filename is correct
- Adding configuration file
- Adding [--config-file] option to override the default cofiguration file
- 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 dirtctory of systemd unit file to be configurable
- Changing log_file() and log_syslog to logreport()
- Changing date format in log 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
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 (4):
ndctl, util: add OPTION_FILENAME to parse_opt_type
ndctl, monitor: add ndctl monitor daemon
ndctl, monitor: add default configuration file
ndctl, monitor: add the unit file of systemd for ndctl-monitor service
Makefile.am | 3 +-
autogen.sh | 3 +-
builtin.h | 1 +
configure.ac | 22 ++
ndctl/Makefile.am | 12 +-
ndctl/monitor.c | 460 ++++++++++++++++++++++++++++++++++++
ndctl/monitor.conf | 37 +++
ndctl/ndctl-monitor.service | 7 +
ndctl/ndctl.c | 1 +
util/abspath.c | 28 +++
util/help.c | 5 -
util/parse-options.c | 47 +++-
util/parse-options.h | 11 +-
util/util.h | 7 +
14 files changed, 628 insertions(+), 16 deletions(-)
create mode 100644 ndctl/monitor.c
create mode 100644 ndctl/monitor.conf
create mode 100644 ndctl/ndctl-monitor.service
create mode 100644 util/abspath.c
--
2.17.0.140.g0b0cc9f86
2 years, 8 months
[PATCH v2] ndctl, filter: fix "keyword 'all' is ignored" in util_<obj>_filter()
by QI Fuli
This is a follow up patch for commit c70adc3cf6bf ("ndctl, filter: refactor
util_<obj>_filter() to support multiple space-seperated arguments")
refactored util_<obj>_filter() to support multiple space-seperated arguments.
But, when the keyword "all" is included in space-seperated arguments,
it will be treaded as <object>'s name. This patch fixes it.
Signed-off-by: QI Fuli <qi.fuli(a)jp.fujitsu.com>
Change log since v1:
- Removing the strcmp(__ident, "all") == 0 at the top of util_<obj>_filter()
- Changing the strcmp(ident, "all") == 0 to strcmp(name, "all") == 0
---
util/filter.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/util/filter.c b/util/filter.c
index 0d3cc02..1734bce 100644
--- a/util/filter.c
+++ b/util/filter.c
@@ -31,7 +31,7 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *__ident)
unsigned long bus_id, id;
const char *provider, *devname, *name;
- if (!__ident || strcmp(__ident, "all") == 0)
+ if (!__ident)
return bus;
ident = strdup(__ident);
@@ -40,6 +40,9 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *__ident)
for (name = strtok_r(ident, " ", &save); name;
name = strtok_r(NULL, " ", &save)) {
+ if (strcmp(name, "all") == 0)
+ break;
+
bus_id = strtoul(ident, &end, 0);
if (end == ident || end[0])
bus_id = ULONG_MAX;
@@ -69,7 +72,7 @@ struct ndctl_region *util_region_filter(struct ndctl_region *region,
const char *name, *region_name;
unsigned long region_id, id;
- if (!__ident || strcmp(__ident, "all") == 0)
+ if (!__ident)
return region;
ident = strdup(__ident);
@@ -78,6 +81,9 @@ struct ndctl_region *util_region_filter(struct ndctl_region *region,
for (name = strtok_r(ident, " ", &save); name;
name = strtok_r(NULL, " ", &save)) {
+ if (strcmp(name, "all") == 0)
+ break;
+
region_id = strtoul(ident, &end, 0);
if (end == ident || end[0])
region_id = ULONG_MAX;
@@ -106,7 +112,7 @@ struct ndctl_namespace *util_namespace_filter(struct ndctl_namespace *ndns,
const char *name;
char *ident, *save;
- if (!__ident || strcmp(__ident, "all") == 0)
+ if (!__ident)
return ndns;
ident = strdup(__ident);
@@ -115,6 +121,9 @@ struct ndctl_namespace *util_namespace_filter(struct ndctl_namespace *ndns,
for (name = strtok_r(ident, " ", &save); name;
name = strtok_r(NULL, " ", &save)) {
+ if (strcmp(name, "all") == 0)
+ break;
+
if (strcmp(name, ndctl_namespace_get_devname(ndns)) == 0)
break;
@@ -137,7 +146,7 @@ struct ndctl_dimm *util_dimm_filter(struct ndctl_dimm *dimm,
const char *name, *dimm_name;
unsigned long dimm_id, id;
- if (!__ident || strcmp(__ident, "all") == 0)
+ if (!__ident)
return dimm;
ident = strdup(__ident);
@@ -146,6 +155,9 @@ struct ndctl_dimm *util_dimm_filter(struct ndctl_dimm *dimm,
for (name = strtok_r(ident, " ", &save); name;
name = strtok_r(NULL, " ", &save)) {
+ if (strcmp(name, "all") == 0)
+ break;
+
dimm_id = strtoul(ident, &end, 0);
if (end == ident || end[0])
dimm_id = ULONG_MAX;
--
2.17.0.140.g0b0cc9f86
2 years, 8 months
[ndctl PATCH 1/4] libndctl: fix potential buffer overflow in write_cache APIs
by Vishal Verma
We used a local stack variable to hold the sysfs path, which had a
potential to overflow. Instead, switch to the 'scratch space' bdbs->buf
to store the sysfs path as it is correctly sized for it.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
ndctl/lib/libndctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 59ea82a..2a3ef0c 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -3991,10 +3991,10 @@ static int __ndctl_namespace_set_write_cache(struct ndctl_namespace *ndns,
{
struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
struct ndctl_pfn *pfn = ndctl_namespace_get_pfn(ndns);
+ char *path = ndns->ndns_buf;
char buf[SYSFS_ATTR_SIZE];
int len = ndns->buf_len;
const char *bdev;
- char path[50];
if (state != 1 && state != 0)
return -ENXIO;
@@ -4034,9 +4034,9 @@ NDCTL_EXPORT int ndctl_namespace_write_cache_is_enabled(
struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
struct ndctl_pfn *pfn = ndctl_namespace_get_pfn(ndns);
int len = ndns->buf_len, wc;
+ char *path = ndns->ndns_buf;
char buf[SYSFS_ATTR_SIZE];
const char *bdev;
- char path[50];
if (pfn)
bdev = ndctl_pfn_get_block_device(pfn);
--
2.14.3
2 years, 8 months
Re: [PATCH 1/3] nvdimm: fix typo in label-size definition
by Ross Zwisler
On Mon, Apr 30, 2018 at 12:38:58PM +0100, Stefan Hajnoczi wrote:
> On Fri, Apr 27, 2018 at 03:53:12PM -0600, Ross Zwisler wrote:
> > Signed-off-by: Ross Zwisler <ross.zwisler(a)linux.intel.com>
> > Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> > Cc: Haozhong Zhang <haozhong.zhang(a)intel.com>
> > Cc: Michael S. Tsirkin <mst(a)redhat.com>
> > Cc: Stefan Hajnoczi <stefanha(a)redhat.com>
> > ---
> > hw/mem/nvdimm.c | 2 +-
> > include/hw/mem/nvdimm.h | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
>
> Reviewed-by: Stefan Hajnoczi <stefanha(a)redhat.com>
Thank you for the review.
This is my first QEMU submission - do I need to do anything else to get this
merged (create a pull request somewhere), or do I just wait for a maintainer
to pull it in?
Thanks,
- Ross
2 years, 8 months
[PATCH v2 0/9] use memcpy_mcsafe() for copy_to_iter()
by Dan Williams
Changes since v1 [1]:
* Remove the loop unrolling in the assembly implementation since it
significantly complicates the exception handling (Linus)
* Introduce a ->copy_to_iter() dax operation for symmetry with the
existing ->copy_from_iter() operation to allow platform /
device-specific implementations.
[1]: https://lists.01.org/pipermail/linux-nvdimm/2018-May/015548.html
---
Currently memcpy_mcsafe() is only deployed in the pmem driver when
reading through a /dev/pmemX block device. However, a filesystem in dax
mode mounted on a /dev/pmemX block device will bypass the block layer
and the driver for reads. The filesystem-dax (fsdax) read case uses
dax_direct_access() and copy_to_iter() to bypass the block layer.
The result of the bypass is that the kernel treats machine checks during
read as system fatal (reboot) when they could simply be flagged as an
I/O error, similar to performing reads through the pmem driver. Prevent
this fatal condition by deploying memcpy_mcsafe() in the fsdax read
path.
The main differences between this copy_to_user_mcsafe() and
copy_user_generic_unrolled() are:
* Typical tail/residue handling after a fault retries the copy
byte-by-byte until the fault happens again. Re-triggering machine
checks is potentially fatal so the implementation uses source alignment
and poison alignment assumptions to avoid re-triggering machine
checks.
* SMAP coordination is handled external to the assembly with
__uaccess_begin() and __uaccess_end().
* ITER_KVEC and ITER_BVEC can now end prematurely with an error.
The new MCSAFE_DEBUG facility is proposed as a way to unit test the
exception handling without requiring an ACPI EINJ capable platform.
---
Dan Williams (9):
x86, memcpy_mcsafe: remove loop unrolling
x86, memcpy_mcsafe: add labels for write fault handling
x86, memcpy_mcsafe: return bytes remaining
x86, memcpy_mcsafe: add write-protection-fault handling
x86, memcpy_mcsafe: define copy_to_iter_mcsafe()
dax: introduce a ->copy_to_iter dax operation
dax: report bytes remaining in dax_iomap_actor()
pmem: switch to copy_to_iter_mcsafe()
x86, nfit_test: unit test for memcpy_mcsafe()
arch/x86/Kconfig | 1
arch/x86/Kconfig.debug | 3 +
arch/x86/include/asm/mcsafe_debug.h | 50 ++++++++++++++++
arch/x86/include/asm/string_64.h | 10 ++-
arch/x86/include/asm/uaccess_64.h | 14 ++++
arch/x86/lib/memcpy_64.S | 109 ++++++++++++++++-------------------
arch/x86/lib/usercopy_64.c | 17 +++++
drivers/dax/super.c | 10 +++
drivers/md/dm-linear.c | 16 +++++
drivers/md/dm-log-writes.c | 15 +++++
drivers/md/dm-stripe.c | 21 +++++++
drivers/md/dm.c | 25 ++++++++
drivers/nvdimm/claim.c | 3 +
drivers/nvdimm/pmem.c | 13 +++-
drivers/s390/block/dcssblk.c | 7 ++
fs/dax.c | 21 ++++---
include/linux/dax.h | 5 ++
include/linux/device-mapper.h | 5 +-
include/linux/string.h | 4 +
include/linux/uio.h | 15 +++++
lib/iov_iter.c | 61 ++++++++++++++++++++
tools/testing/nvdimm/test/nfit.c | 48 +++++++++++++++
22 files changed, 394 insertions(+), 79 deletions(-)
create mode 100644 arch/x86/include/asm/mcsafe_debug.h
2 years, 8 months
[PATCH] pmem: fix badblocks population for raw mode
by Toshi Kani
pmem_attach_disk() calls nvdimm_badblocks_populate() with resource
range uninitialized in the case of raw mode. This leads the pmem
driver to hit MCE despite of ARS reporting the range bad.
Initialize 'bb_res' for raw mode.
Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface to use struct dev_pagemap")
Signed-off-by: Toshi Kani <toshi.kani(a)hpe.com>
Cc: Christoph Hellwig <hch(a)lst.de>
Cc: Dan Williams <dan.j.williams(a)intel.com>
Cc: <stable(a)vger.kernel.org>
---
drivers/nvdimm/pmem.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 9d714926ecf5..2d7875209bce 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -367,9 +367,11 @@ static int pmem_attach_disk(struct device *dev,
addr = devm_memremap_pages(dev, &pmem->pgmap);
pmem->pfn_flags |= PFN_MAP;
memcpy(&bb_res, &pmem->pgmap.res, sizeof(bb_res));
- } else
+ } else {
addr = devm_memremap(dev, pmem->phys_addr,
pmem->size, ARCH_MEMREMAP_PMEM);
+ memcpy(&bb_res, res, sizeof(bb_res));
+ }
/*
* At release time the queue must be frozen before
2 years, 8 months