[PATCH v5 0/4] resource: Use list_head to link sibling resource
by Baoquan He
This patchset is doing:
1) Replace struct resource's sibling list from singly linked list to
list_head. Clearing out those pointer operation within singly linked
list for better code readability.
2) Based on list_head replacement, add a new function
walk_system_ram_res_rev() which can does reversed iteration on
iomem_resource's siblings.
3) Change kexec_file loading to search system RAM top down for kernel
loadin, using walk_system_ram_res_rev().
Note:
This patchset passed testing on my kvm guest, x86_64 arch with network
enabling. The thing we need pay attetion to is that a root resource's
child member need be initialized specifically with LIST_HEAD_INIT() if
statically defined or INIT_LIST_HEAD() for dynamically definition. Here
Just like we do for iomem_resource/ioport_resource, or the change in
get_pci_domain_busn_res().
Links of the old post (Boris pointed out that we should use
https://lkml.kernel.org/r/Message-ID, while it can't be opened from
my side, so paste all of them here.):
v4:
https://lkml.kernel.org/r/20180507063224.24229-1-bhe@redhat.com
https://lkml.org/lkml/2018/5/7/36
v3:
https://lkml.kernel.org/r/20180419001848.3041-1-bhe@redhat.com
https://lkml.org/lkml/2018/4/18/767
v2:
https://lkml.kernel.org/r/20180408024724.16812-1-bhe@redhat.com
https://lkml.org/lkml/2018/4/7/169
v1:
https://lkml.kernel.org/r/20180322033722.9279-1-bhe@redhat.com
https://lkml.org/lkml/2018/3/21/952
Changelog:
v4->v5:
Add new patch 0001 to move duplicated reparent_resources() to
kernel/resource.c to make it be shared by different ARCH-es.
Fix several code bugs reported by test robot on ARCH powerpc and
microblaze.
v3->v4:
Fix several bugs test robot reported. Rewrite cover letter and patch
log according to reviewer's comment.
v2->v3:
Rename resource functions first_child() and sibling() to
resource_first_chils() and resource_sibling(). Dan suggested this.
Move resource_first_chils() and resource_sibling() to linux/ioport.h
and make them as inline function. Rob suggested this. Accordingly add
linux/list.h including in linux/ioport.h, please help review if this
bring efficiency degradation or code redundancy.
The change on struct resource {} bring two pointers of size increase,
mention this in git log to make it more specifically, Rob suggested
this.
v1->v2:
Use list_head instead to link resource siblings. This is suggested by
Andrew.
Rewrite walk_system_ram_res_rev() after list_head is taken to link
resouce siblings.
Baoquan He (4):
resource: Move reparent_resources() to kernel/resource.c and make it
public
resource: Use list_head to link sibling resource
resource: add walk_system_ram_res_rev()
kexec_file: Load kernel at top of system RAM if required
arch/arm/plat-samsung/pm-check.c | 6 +-
arch/microblaze/pci/pci-common.c | 41 +----
arch/powerpc/kernel/pci-common.c | 39 +----
arch/sparc/kernel/ioport.c | 2 +-
arch/xtensa/include/asm/pci-bridge.h | 4 +-
drivers/eisa/eisa-bus.c | 2 +
drivers/gpu/drm/drm_memory.c | 3 +-
drivers/gpu/drm/gma500/gtt.c | 5 +-
drivers/hv/vmbus_drv.c | 52 +++---
drivers/input/joystick/iforce/iforce-main.c | 4 +-
drivers/nvdimm/namespace_devs.c | 6 +-
drivers/nvdimm/nd.h | 5 +-
drivers/of/address.c | 4 +-
drivers/parisc/lba_pci.c | 4 +-
drivers/pci/host/vmd.c | 8 +-
drivers/pci/probe.c | 2 +
drivers/pci/setup-bus.c | 2 +-
include/linux/ioport.h | 21 ++-
kernel/kexec_file.c | 2 +
kernel/resource.c | 259 ++++++++++++++++++----------
20 files changed, 244 insertions(+), 227 deletions(-)
--
2.13.6
2 years, 6 months
[ndctl PATCH] ndctl, test: Disable poison tests for now
by Dan Williams
Given that poison injection crashes the kernel, disable the test by
default until 4.19.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
test.h | 8 ++++----
test/Makefile.am | 4 +++-
test/dax-pmd.c | 14 ++++++++++----
test/dax-poison.c | 8 ++++++--
test/dax.sh | 19 ++++++++++++++-----
test/device-dax.c | 2 +-
6 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/test.h b/test.h
index e627785a5334..fa0c0cff9daf 100644
--- a/test.h
+++ b/test.h
@@ -39,11 +39,11 @@ int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ct
int test_multi_pmem(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx);
int test_dax_directio(int dax_fd, unsigned long align, void *dax_addr, off_t offset);
#ifdef ENABLE_POISON
-int test_dax_poison(int dax_fd, unsigned long align, void *dax_addr,
- off_t offset, bool fsdax);
+int test_dax_poison(struct ndctl_test *test, int dax_fd, unsigned long align,
+ void *dax_addr, off_t offset, bool fsdax);
#else
-static inline int test_dax_poison(int dax_fd, unsigned long align,
- void *dax_addr, off_t offset, bool fsdax)
+static inline int test_dax_poison(struct ndctl_test *test, int dax_fd,
+ unsigned long align, void *dax_addr, off_t offset, bool fsdax)
{
return 0;
}
diff --git a/test/Makefile.am b/test/Makefile.am
index a9b8b3eccbbf..92cf29d6065e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -94,7 +94,9 @@ parent_uuid_LDADD = $(LIBNDCTL_LIB) $(UUID_LIBS) $(KMOD_LIBS)
dax_dev_SOURCES = dax-dev.c $(testcore)
dax_dev_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
-dax_pmd_SOURCES = dax-pmd.c
+dax_pmd_SOURCES = dax-pmd.c \
+ $(testcore)
+
hugetlb_SOURCES = hugetlb.c \
dax-pmd.c
diff --git a/test/dax-pmd.c b/test/dax-pmd.c
index 0b4bd98edce4..8ed3e9b764f9 100644
--- a/test/dax-pmd.c
+++ b/test/dax-pmd.c
@@ -194,7 +194,7 @@ int test_dax_directio(int dax_fd, unsigned long align, void *dax_addr, off_t off
}
/* test_pmd assumes that fd references a pre-allocated + dax-capable file */
-static int test_pmd(int fd)
+static int test_pmd(struct ndctl_test *test, int fd)
{
unsigned long long m_align, p_align, pmd_off;
static const bool fsdax = true;
@@ -257,7 +257,7 @@ static int test_pmd(int fd)
if (rc)
goto err_directio;
- rc = test_dax_poison(fd, HPAGE_SIZE, pmd_addr, pmd_off, fsdax);
+ rc = test_dax_poison(test, fd, HPAGE_SIZE, pmd_addr, pmd_off, fsdax);
err_directio:
err_extent:
@@ -268,14 +268,20 @@ static int test_pmd(int fd)
int __attribute__((weak)) main(int argc, char *argv[])
{
+ struct ndctl_test *test = ndctl_test_new(0);
int fd, rc;
+ if (!test) {
+ fprintf(stderr, "failed to initialize test\n");
+ return EXIT_FAILURE;
+ }
+
if (argc < 1)
return -EINVAL;
fd = open(argv[1], O_RDWR);
- rc = test_pmd(fd);
+ rc = test_pmd(test, fd);
if (fd >= 0)
close(fd);
- return rc;
+ return ndctl_test_result(test, rc);
}
diff --git a/test/dax-poison.c b/test/dax-poison.c
index 7faa402e623c..a25bf0b17d61 100644
--- a/test/dax-poison.c
+++ b/test/dax-poison.c
@@ -15,6 +15,7 @@
#include <test.h>
#include <util/size.h>
#include <stdbool.h>
+#include <linux/version.h>
#define fail() fprintf(stderr, "%s: failed at: %d (%s)\n", \
__func__, __LINE__, strerror(errno))
@@ -43,8 +44,8 @@ static void sigbus_hdl(int sig, siginfo_t *si, void *ptr)
siglongjmp(sj_env, 1);
}
-int test_dax_poison(int dax_fd, unsigned long align, void *dax_addr,
- off_t offset, bool fsdax)
+int test_dax_poison(struct ndctl_test *test, int dax_fd, unsigned long align,
+ void *dax_addr, off_t offset, bool fsdax)
{
unsigned char *addr = MAP_FAILED;
struct sigaction act;
@@ -52,6 +53,9 @@ int test_dax_poison(int dax_fd, unsigned long align, void *dax_addr,
void *buf;
int rc;
+ if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 19, 0)))
+ return 77;
+
/*
* MADV_HWPOISON must be page aligned, and this routine assumes
* align is >= 8K
diff --git a/test/dax.sh b/test/dax.sh
index e35f914a6425..30fe16721935 100755
--- a/test/dax.sh
+++ b/test/dax.sh
@@ -28,6 +28,15 @@ err() {
exit $rc
}
+run_test() {
+ if ! ./dax-pmd $MNT/$FILE; then
+ rc=$?
+ if [ $rc -ne 77 -a $rc -ne 0 ]; then
+ err
+ fi
+ fi
+}
+
set -e
mkdir -p $MNT
trap 'err $LINENO' ERR
@@ -40,7 +49,7 @@ rc=1
mkfs.ext4 /dev/$blockdev
mount /dev/$blockdev $MNT -o dax
fallocate -l 1GiB $MNT/$FILE
-./dax-pmd $MNT/$FILE
+run_test
umount $MNT
# convert pmem to put the memmap on the device
@@ -52,7 +61,7 @@ eval $(echo $json | sed -e "$json2var")
mkfs.ext4 /dev/$blockdev
mount /dev/$blockdev $MNT -o dax
fallocate -l 1GiB $MNT/$FILE
-./dax-pmd $MNT/$FILE
+run_test
umount $MNT
json=$($NDCTL create-namespace -m raw -f -e $dev)
@@ -62,7 +71,7 @@ eval $(echo $json | sed -e "$json2var")
mkfs.xfs -f /dev/$blockdev
mount /dev/$blockdev $MNT -o dax
fallocate -l 1GiB $MNT/$FILE
-./dax-pmd $MNT/$FILE
+run_test
umount $MNT
# convert pmem to put the memmap on the device
@@ -73,7 +82,7 @@ eval $(echo $json | sed -e "$json2var")
mkfs.xfs -f /dev/$blockdev
mount /dev/$blockdev $MNT -o dax
fallocate -l 1GiB $MNT/$FILE
-./dax-pmd $MNT/$FILE
+run_test
umount $MNT
# revert namespace to raw mode
@@ -81,4 +90,4 @@ json=$($NDCTL create-namespace -m raw -f -e $dev)
eval $(echo $json | sed -e "$json2var")
[ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1
-exit 0
+exit $rc
diff --git a/test/device-dax.c b/test/device-dax.c
index 712c247adfb2..dd92f9a9d2c5 100644
--- a/test/device-dax.c
+++ b/test/device-dax.c
@@ -279,7 +279,7 @@ static int __test_device_dax(unsigned long align, int loglevel,
fprintf(stderr, "%s: test dax poison\n",
ndctl_namespace_get_devname(ndns));
- rc = test_dax_poison(fd, align, NULL, 0, devdax);
+ rc = test_dax_poison(test, fd, align, NULL, 0, devdax);
if (rc) {
fprintf(stderr, "%s: failed dax poison\n",
ndctl_namespace_get_devname(ndns));
2 years, 6 months
Question about ndctl unit tests
by Qi, Fuli
Hi,
When I ran the unit tests, I found "libndctl" and "dsm-fail" cannot pass the test.
Here is the test log.
# less test/libndctl.log
libkmod: kmod_module_remove_module: could not remove 'nfit_test': No such file or directory
check_set_config_data: dimm: 0 read2 data miscompare: 0
check_set_config_data: dimm: 0x1 read2 data miscompare: 0
check_set_config_data: dimm: 0x100 read2 data miscompare: 0
check_set_config_data: dimm: 0x101 read2 data miscompare: 0
check_dax_autodetect: dax_ndns: 0x1049f10 ndns: 0x1049f10
namespace1.0: expected write_cache enabled
check_namespaces: namespace1.0 validate_write_cache failed
ndctl-test0 failed: -6
libkmod: kmod_module_remove_module: could not remove 'nfit_test': Resource temporarily unavailable
libdaxctl: daxctl_unref: context 0x1038170 released
libndctl: ndctl_unref: context 0x1039290 released
FAIL libndctl (exit status: 1)
# less test/dsm-fail.log
victim: nmem0
validate_namespace_options:571: region1: falling back to a 4K alignment
validate_namespace_options:571: region1: falling back to a 4K alignment
do_test:294
libndctl: ndctl_dimm_enable: nmem0: failed to enable
fail expected nmem0 enable success victim: nmem0 rc: -6
libkmod: kmod_module_remove_module: could not remove 'nfit_test': Resource temporarily unavailable
libdaxctl: daxctl_unref: context 0x89f170 released
libndctl: ndctl_unref: context 0x8a0290 released
{
"dev":"namespace1.0",
"mode":"raw",
"size":4194304,
"uuid":"9a07ca1d-54cd-4252-b87e-475b24af8a1c",
"sector_size":512,
"blockdev":"pmem1"
}
{
"dev":"namespace1.1",
"mode":"raw",
"size":4194304,
"uuid":"2eb40a75-5c5f-4ed9-b36e-4fd0abba7783",
"sector_size":512,
"blockdev":"pmem1.1"
}
FAIL dsm-fail (exit status: 250)
And my kernel version:
$ uname -a
Linux 4.18.0-rc2+ #25 SMP
I guess the reason is that the nfit_test module cannot be removed.
# modprobe -r nfit_test
modprobe: FATAL: Module nfit_test is in use.
# lsmod | grep nfit_test
nfit_test 40960 8
nd_pmem 20480 1 nfit_test
nfit 65536 1 nfit_test
device_dax 20480 2 dax_pmem,nfit_test
libnvdimm 163840 7 dax_pmem,nfit_test,nd_btt,nd_pmem,nd_e820,nd_blk,nfit
nfit_test_iomap 20480 6 dax_pmem,nfit_test,device_dax,nd_pmem,libnvdimm,nfit
Does anyone know how to fix it?
Thank you very much.
QI
2 years, 6 months
re: memremap: change devm_memremap_pages interface to use struct dev_pagemap
by Colin Ian King
Hi,
static analysis with CoverityScan detected an issue with the following
commit:
commit e8d5134833006a46fcbefc5f4a84d0b62bd520e7
Author: Christoph Hellwig <hch(a)lst.de>
Date: Fri Dec 29 08:54:05 2017 +0100
memremap: change devm_memremap_pages interface to use struct dev_pagemap
247 }
248
CID 1464431 (#1 of 1): Unchecked return value (CHECKED_RETURN)
check_return: Calling devm_add_action without checking return value (as
is done elsewhere 33 out of 35 times).
249 devm_add_action(dev, devm_memremap_pages_release, pgmap);
250
251 return __va(res->start);
devm_add_action can fail and return -ENOMEM because it calls
devres_alloc which can fail in an out of memory situation. So I believe
it may be pertinent to add a -ENOMEM check and clean up appropriately.
I'm not sure of the correct way to perform the error clean up, so I'm
sending this report instead of a fix.
Colin
2 years, 6 months
[ndctl PATCH] ndctl, test: add start/wait scrub to injection tests
by Vishal Verma
A number of tests that perform error injection were missing the
start/wait scrub workaround needed for nfit_test namespaces, causing
these tests to ocassionally fail. Fix it by starting and waiting for a
scrub after injection in these remaining places.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
test/btt-errors.sh | 2 ++
test/clear.sh | 1 +
test/inject-error.sh | 1 +
3 files changed, 4 insertions(+)
diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index e9cc209..cb35865 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -115,6 +115,7 @@ bb_inj=$((dataoff/512))
# inject badblocks for one page at the start of the file
$NDCTL inject-error --block="$bb_inj" --count=8 $dev
+$NDCTL start-scrub && $NDCTL wait-scrub
force_raw 0
mount -o nodelalloc "/dev/$blockdev" $MNT
@@ -148,6 +149,7 @@ map=$(hexdump -s 96 -n 4 "/dev/$raw_bdev" | head -1 | cut -d' ' -f2-)
map=$(tr -d ' ' <<< "0x${map#* }${map%% *}")
bb_inj=$((map/512))
$NDCTL inject-error --block="$bb_inj" --count=1 $dev
+$NDCTL start-scrub && $NDCTL wait-scrub
force_raw 0
# make sure reading the first block of the namespace fails
diff --git a/test/clear.sh b/test/clear.sh
index 6cc43db..17d5bed 100755
--- a/test/clear.sh
+++ b/test/clear.sh
@@ -41,6 +41,7 @@ err_sector="$(((size/512) / 2))"
err_count=8
if ! read sector len < /sys/block/$blockdev/badblocks; then
$NDCTL inject-error --block="$err_sector" --count=$err_count $dev
+ $NDCTL start-scrub && $NDCTL wait-scrub
fi
read sector len < /sys/block/$blockdev/badblocks
[ $((sector * 2)) -ne $((size /512)) ] && echo "fail: $LINENO" && exit 1
diff --git a/test/inject-error.sh b/test/inject-error.sh
index 7bda35b..49e68b3 100755
--- a/test/inject-error.sh
+++ b/test/inject-error.sh
@@ -77,6 +77,7 @@ do_tests()
# inject normally
$NDCTL inject-error --block=$err_block --count=$err_count $dev
+ $NDCTL start-scrub && $NDCTL wait-scrub
check_status "$err_block" "$err_count"
if read -r sector len < /sys/block/$blockdev/badblocks; then
test "$sector" -eq "$err_block"
--
2.14.4
2 years, 6 months
[ndctl PATCH v2 0/2] always output array without --human
by Ross Zwisler
If "ndctl list" is only printing a single object it currently does not
print it in an array. When printing multiple objects, though, an array is
used. This simplifies the output for single objects when a human is
looking at it but it creates complications for parsers like jq. jq
wants to know whether it is trying to parse an object or an array of
objects.
The first patch in this series is cleanup I noticed while fixing the
above issue with the second patch.
---
Changes since v1:
* Dropped patch 2 that dealt with cleaning up the way flags are handled
in ndctl/list.c. (Dan)
* Added Dan's Ack to patch 1.
Ross Zwisler (2):
ndctl: simplify JSON print flag handling
ndctl list: always output array without --human
daxctl/list.c | 12 +++++++-----
ndctl/bus.c | 3 +--
ndctl/dimm.c | 3 +--
ndctl/inject-smart.c | 3 +--
ndctl/list.c | 11 +++++------
util/json.c | 6 ++++--
util/json.h | 3 ++-
7 files changed, 21 insertions(+), 20 deletions(-)
--
2.14.4
2 years, 6 months
[ndctl PATCH 1/3] ndctl: simplify JSON print flag handling
by Ross Zwisler
json_object_to_json_string_ext()'s second argument is a flags field which
we always want to be JSON_C_TO_STRING_PRETTY. We were going to a lot of
trouble for this, though. We had multiple variables set to be this one
flag and util_display_json_array() took it as an argument, even though it
never varied.
Instead, just pass in the necessary flag when calling
json_object_to_json_string_ext(), removing the local variables and the extra
argument to util_display_json_array().
Signed-off-by: Ross Zwisler <ross.zwisler(a)linux.intel.com>
---
daxctl/list.c | 5 ++---
ndctl/bus.c | 3 +--
ndctl/dimm.c | 3 +--
ndctl/inject-smart.c | 3 +--
ndctl/list.c | 11 +++++------
util/json.c | 3 ++-
util/json.h | 2 +-
7 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/daxctl/list.c b/daxctl/list.c
index 254f0ac..ed9e76c 100644
--- a/daxctl/list.c
+++ b/daxctl/list.c
@@ -50,7 +50,6 @@ static struct {
};
static int did_fail;
-static int jflag = JSON_C_TO_STRING_PRETTY;
#define fail(fmt, ...) \
do { \
@@ -130,9 +129,9 @@ int cmd_list(int argc, const char **argv, void *ctx)
}
if (jregions)
- util_display_json_array(stdout, jregions, jflag);
+ util_display_json_array(stdout, jregions);
else if (jdevs)
- util_display_json_array(stdout, jdevs, jflag);
+ util_display_json_array(stdout, jdevs);
if (did_fail)
return -ENOMEM;
diff --git a/ndctl/bus.c b/ndctl/bus.c
index fc31d06..b7b7d65 100644
--- a/ndctl/bus.c
+++ b/ndctl/bus.c
@@ -88,8 +88,7 @@ static int bus_action(int argc, const char **argv, const char *usage,
}
if (success)
- util_display_json_array(stdout, jbuses,
- JSON_C_TO_STRING_PRETTY);
+ util_display_json_array(stdout, jbuses);
else
json_object_put(jbuses);
diff --git a/ndctl/dimm.c b/ndctl/dimm.c
index 1c16899..6964c5e 100644
--- a/ndctl/dimm.c
+++ b/ndctl/dimm.c
@@ -1081,8 +1081,7 @@ static int dimm_action(int argc, const char **argv, void *ctx,
}
if (actx.jdimms)
- util_display_json_array(actx.f_out, actx.jdimms,
- JSON_C_TO_STRING_PRETTY);
+ util_display_json_array(actx.f_out, actx.jdimms);
if (actx.f_out != stdout)
fclose(actx.f_out);
diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c
index 60de9fe..2e62c89 100644
--- a/ndctl/inject-smart.c
+++ b/ndctl/inject-smart.c
@@ -375,8 +375,7 @@ static int dimm_inject_smart(struct ndctl_dimm *dimm)
jhealth = util_dimm_health_to_json(dimm);
if (jhealth) {
json_object_object_add(jdimm, "health", jhealth);
- util_display_json_array(stdout, jdimms,
- JSON_C_TO_STRING_PRETTY);
+ util_display_json_array(stdout, jdimms);
}
}
out:
diff --git a/ndctl/list.c b/ndctl/list.c
index 6cf7c39..030d73f 100644
--- a/ndctl/list.c
+++ b/ndctl/list.c
@@ -56,7 +56,6 @@ static unsigned long listopts_to_flags(void)
struct util_filter_params param;
static int did_fail;
-static int jflag = JSON_C_TO_STRING_PRETTY;
#define fail(fmt, ...) \
do { \
@@ -380,7 +379,7 @@ static int list_display(struct list_filter_arg *lfa)
struct json_object *jbuses = lfa->jbuses;
if (jbuses)
- util_display_json_array(stdout, jbuses, jflag);
+ util_display_json_array(stdout, jbuses);
else if ((!!jdimms + !!jregions + !!jnamespaces) > 1) {
struct json_object *jplatform = json_object_new_object();
@@ -397,14 +396,14 @@ static int list_display(struct list_filter_arg *lfa)
json_object_object_add(jplatform, "namespaces",
jnamespaces);
printf("%s\n", json_object_to_json_string_ext(jplatform,
- jflag));
+ JSON_C_TO_STRING_PRETTY));
json_object_put(jplatform);
} else if (jdimms)
- util_display_json_array(stdout, jdimms, jflag);
+ util_display_json_array(stdout, jdimms);
else if (jregions)
- util_display_json_array(stdout, jregions, jflag);
+ util_display_json_array(stdout, jregions);
else if (jnamespaces)
- util_display_json_array(stdout, jnamespaces, jflag);
+ util_display_json_array(stdout, jnamespaces);
return 0;
}
diff --git a/util/json.c b/util/json.c
index 94ed948..ff894c7 100644
--- a/util/json.c
+++ b/util/json.c
@@ -105,9 +105,10 @@ struct json_object *util_json_object_hex(unsigned long long val,
return jobj;
}
-void util_display_json_array(FILE *f_out, struct json_object *jarray, int jflag)
+void util_display_json_array(FILE *f_out, struct json_object *jarray)
{
int len = json_object_array_length(jarray);
+ int jflag = JSON_C_TO_STRING_PRETTY;
if (json_object_array_length(jarray) > 1)
fprintf(f_out, "%s\n", json_object_to_json_string_ext(jarray, jflag));
diff --git a/util/json.h b/util/json.h
index c5d1603..d0167cf 100644
--- a/util/json.h
+++ b/util/json.h
@@ -26,7 +26,7 @@ enum util_json_flags {
};
struct json_object;
-void util_display_json_array(FILE *f_out, struct json_object *jarray, int jflag);
+void util_display_json_array(FILE *f_out, struct json_object *jarray);
struct json_object *util_bus_to_json(struct ndctl_bus *bus);
struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm,
unsigned long flags);
--
2.14.4
2 years, 6 months
Re: Detecting NUMA per pmem
by Oren Berman
Hi Ross
Thanks for the speedy reply. I am also adding the public list to this
thread as you suggested.
We have tried to dump the SPA table and this is what we get:
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20160108-64
* Copyright (c) 2000 - 2016 Intel Corporation
*
* Disassembly of NFIT, Sun Oct 22 10:46:19 2017
*
* ACPI Data Table [NFIT]
*
* Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue
*/
[000h 0000 4] Signature : "NFIT" [NVDIMM Firmware
Interface Table]
[004h 0004 4] Table Length : 00000028
[008h 0008 1] Revision : 01
[009h 0009 1] Checksum : B2
[00Ah 0010 6] Oem ID : "SUPERM"
[010h 0016 8] Oem Table ID : "SMCI--MB"
[018h 0024 4] Oem Revision : 00000001
[01Ch 0028 4] Asl Compiler ID : " "
[020h 0032 4] Asl Compiler Revision : 00000001
[024h 0036 4] Reserved : 00000000
Raw Table Data: Length 40 (0x28)
0000: 4E 46 49 54 28 00 00 00 01 B2 53 55 50 45 52 4D // NFIT(.....SUPERM
0010: 53 4D 43 49 2D 2D 4D 42 01 00 00 00 01 00 00 00 // SMCI--MB........
0020: 01 00 00 00 00 00 00 00
As you can see the memory region info is missing.
This specific check was done on a supermicro server.
We also performed a bios update but the results were the same.
As said before ,the pmem devices are detected correctly and we verified
that they correspond to different numa nodes using the PCM utility.However,
linux still reports both pmem devices to be on the same numa - Numa 0.
If this information is missing, why pmem devices and address ranges are
still detected correctly?
Is there another table that we need to check?
I also ran dmidecode and the NVDIMMs are being listed (we tested with
netlist NVDIMMs). I can also see the bank locator showing P0 and P1 which I
think indicates the numa. Here is an example:
Handle 0x002D, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x002A
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 16384 MB
Form Factor: DIMM
Set: None
Locator: P1-DIMMA3
Bank Locator: P0_Node0_Channel0_Dimm2
Type: DDR4
Type Detail: Synchronous
Speed: 2400 MHz
Manufacturer: Netlist
Serial Number: 66F50006
Asset Tag: P1-DIMMA3_AssetTag (date:16/42)
Part Number: NV3A74SBT20-000
Rank: 1
Configured Clock Speed: 1600 MHz
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Handle 0x003B, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x0038
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 16384 MB
Form Factor: DIMM
Set: None
Locator: P2-DIMME3
Bank Locator: P1_Node1_Channel0_Dimm2
Type: DDR4
Type Detail: Synchronous
Speed: 2400 MHz
Manufacturer: Netlist
Serial Number: 66B50010
Asset Tag: P2-DIMME3_AssetTag (date:16/42)
Part Number: NV3A74SBT20-000
Rank: 1
Configured Clock Speed: 1600 MHz
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Did you encounter such a a case? We would appreciate any insight you might
have.
BR
Oren Berman
On 20 October 2017 at 19:22, Ross Zwisler <ross.zwisler(a)linux.intel.com>
wrote:
> On Thu, Oct 19, 2017 at 06:12:24PM +0300, Oren Berman wrote:
> > Hi Ross
> > My name is Oren Berman and I am a senior developer at lightbitslabs.
> > We are working with NDIMMs but we encountered a problem that the
> kernel
> > does not seem to detect the numa id per PMEM device.
> > It always reports numa 0 although we have NVDIMM devices on both
> nodes.
> > We checked that it always returns 0 from sysfs and also from
> retrieving
> > the device of pmem in the kernel and calling dev_to_node.
> > The result is always 0 for both pmem0 and pmem1.
> > In order to make sure that indeed both numa sockets are used we ran
> > intel's pcm utlity. We verified that writing to pmem 0 increases
> socket 0
> > utilization and writing to pmem1 increases socket 1 utilization so
> the hw
> > works properly.
> > Only the detection seems to be invalid.
> > Did you encounter such a problem?
> > We are using kernel version 4.9 - are you aware of any fix for this
> issue
> > or workaround that we can use.
> > Are we missing something?
> > Thanks for any help you can give us.
> > BR
> > Oren Berman
>
> Hi Oren,
>
> My first guess is that your platform isn't properly filling out the
> "proximity
> domain" field in the NFIT SPA table.
>
> See section 5.2.25.2 in ACPI 6.2:
> http://uefi.org/sites/default/files/resources/ACPI_6_2.pdf
>
> Here's how to check that:
>
> # cd /tmp
> # cp /sys/firmware/acpi/tables/NFIT .
> # iasl NFIT
>
> Intel ACPI Component Architecture
> ASL+ Optimizing Compiler version 20160831-64
> Copyright (c) 2000 - 2016 Intel Corporation
>
> Binary file appears to be a valid ACPI table, disassembling
> Input file NFIT, Length 0xE0 (224) bytes
> ACPI: NFIT 0x0000000000000000 0000E0 (v01 BOCHS BXPCNFIT 00000001 BXPC
> 00000001)
> Acpi Data Table [NFIT] decoded
> Formatted output: NFIT.dsl - 5191 bytes
>
> This will give you an NFIT.dsl file which you can look at. Here is what my
> SPA table looks like for an emulated QEMU NVDIMM:
>
> [028h 0040 2] Subtable Type : 0000 [System Physical
> Address Range]
> [02Ah 0042 2] Length : 0038
>
> [02Ch 0044 2] Range Index : 0002
> [02Eh 0046 2] Flags (decoded below) : 0003
> Add/Online Operation Only : 1
> Proximity Domain Valid : 1
> [030h 0048 4] Reserved : 00000000
> [034h 0052 4] Proximity Domain : 00000000
> [038h 0056 16] Address Range GUID :
> 66F0D379-B4F3-4074-AC43-0D3318B78CDB
> [048h 0072 8] Address Range Base : 0000000240000000
> [050h 0080 8] Address Range Length : 0000000440000000
> [058h 0088 8] Memory Map Attribute : 0000000000008008
>
> So, the "Proximity Domain" field is 0, and this lets the system know which
> NUMA node to associate with this memory region.
>
> BTW, in the future it's best to CC our public list,
> linux-nvdimm(a)lists.01.org,
> as a) someone else might have the same question and b) someone else might
> know
> the answer.
>
> Thanks,
> - Ross
>
2 years, 6 months
回复:如-何-提-升-业-绩
by 陆经理
=?{RAND_LETTER_2}2418?B?b20=?=
To: linux-nvdimm(a)lists.01.org
Content-Type: text/plain;charset="ll7825"
Date: Fri, 25 May 2018-6-29 9:41:02+0800
X-Priority: 6
X-Mailer: FoxMail 3.11 Release [cn] 详=情=请=阅=读=附=件
2 years, 6 months
[ndctl PATCH v2] ndctl: Add CONTRIBUTING.md
by Vishal Verma
We were missing a CONTRIBUTING file to help new contributors follow the
expected guidelines. Add one that refers to the Linux Kernel for most of
these things, such as Coding style, Submitting Patches, and the DCO.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Reviewed-by: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
CONTRIBUTING.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 CONTRIBUTING.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..811a8c0
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,48 @@
+# Contributing to ndctl
+
+Thank you for taking the time to contribute to ndctl.
+
+The following is a set of guidelines that we adhere to, and request that
+contributors follow.
+
+1. The libnvdimm (kernel subsystem) and ndctl developers primarily use
+ the [linux-nvdimm](https://lists.01.org/mailman/listinfo/linux-nvdimm)
+ mailing list for everything. It is recommended to send patches to
+ **```linux-nvdimm(a)lists.01.org```**
+
+1. Github [issues](https://github.com/pmem/ndctl/issues) are an acceptable
+ way to report a problem, but if you just have a question,
+ [email](mailto:linux-nvdimm@lists.01.org) the above list.
+
+1. We follow the Linux Kernel [Coding Style Guide][cs] as applicable.
+
+ [cs]: https://www.kernel.org/doc/html/latest/process/coding-style.html
+
+1. We follow the Linux Kernel [Submitting Patches Guide][sp] as applicable.
+
+ [sp]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html
+
+1. We follow the Linux Kernel [DCO][dco] (Developer Certificate of Origin).
+ The DCO is an attestation attached to every contribution made by every
+ developer. In the commit message of the contribution, the developer simply
+ adds a Signed-off-by statement and thereby agrees to the DCO.
+
+ [dco]: https://developercertificate.org/
+
+1. Github Pull Requests are acceptable mainly for smaller, more obvious fixups,
+ but won't be merged directly, as Github doesn't allow for the kernel style
+ flow of patches where a maintainer also signs off on the patches they apply.
+ Larger changes may need to be sent to the mailing list so that everyone gets
+ an opportunity to review them.
+
+1. **Misc Best Practices:**
+ 1. Use a subject prefix of "ndctl PATCH" (or "ndctl PATCH vN" for a new
+ revision). This can be automated for a ```git format-patch``` command
+ by setting a repo-local git config setting:
+ ```git config format.subjectprefix "ndctl PATCH"```
+
+ 1. For commit messages: Describe the change and why it was needed. Use a
+ concise subject line, and a blank line between the subject and the body,
+ as well as between paragraphs. Use present tense and the imperative mood
+ (e.g. "Add support for.." instead of "Added support.." or "Adding
+ support"). Word-wrap to 72 columns.
--
2.14.4
2 years, 6 months