Re: [RFC 0/8] Copy Offload with Peer-to-Peer PCI Memory

2017-04-20 Thread Dan Williams
On Thu, Apr 20, 2017 at 4:07 PM, Stephen  Bates  wrote:
>>> Yes, this makes sense I think we really just want to distinguish host
>>> memory or not in terms of the dev_pagemap type.
>>
>>> I would like to see mutually exclusive flags for host memory (or not) and 
>>> persistence (or not).
>>>
>>
>> Why persistence? It has zero meaning to the mm.
>
> I like the idea of having properties of the memory in one place.

We do have memory type data in the global iomem_resource tree, see
IORES_DESC_PERSISTENT_MEMORY.

> While mm might not use persistence today it may make use certain things that
> persistence implies (like finite endurance and/or higher write latency) in 
> the future.

A persistence flag does not convey endurance or latency information.

> Also the persistence of the memory must have issues for mm security?

Not for the mm, data at rest security might be a property of the
device, but that's not the mm's concern.

>Again not addressed today but useful in the future.

Maybe, but to me "Useful for the future" == "don't add it to the
kernel until that future arrives".

> In addition I am not sure where else would be an appropriate place to put 
> something like a persistence property flag. I know the NVDIMM section of the 
> kernel uses things like NFIT to describe properties of the memory but we 
> don’t yet (to my knowledge) have something similar for IO memory.

Do the IORES_DESC flags give you what you need?
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


车间为什么忙er乱,管理不到位吗?

2017-04-20 Thread 郑��依

  Çë ²é ÔÄ ¸½ ¼þ ÄÚ ÈÝ
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 1/2] dax: prevent invalidation of mapped DAX entries

2017-04-20 Thread Ross Zwisler
dax_invalidate_mapping_entry() currently removes DAX exceptional entries
only if they are clean and unlocked.  This is done via:

invalidate_mapping_pages()
  invalidate_exceptional_entry()
dax_invalidate_mapping_entry()

However, for page cache pages removed in invalidate_mapping_pages() there
is an additional criteria which is that the page must not be mapped.  This
is noted in the comments above invalidate_mapping_pages() and is checked in
invalidate_inode_page().

For DAX entries this means that we can can end up in a situation where a
DAX exceptional entry, either a huge zero page or a regular DAX entry,
could end up mapped but without an associated radix tree entry. This is
inconsistent with the rest of the DAX code and with what happens in the
page cache case.

We aren't able to unmap the DAX exceptional entry because according to its
comments invalidate_mapping_pages() isn't allowed to block, and
unmap_mapping_range() takes a write lock on the mapping->i_mmap_rwsem.

Since we essentially never have unmapped DAX entries to evict from the
radix tree, just remove dax_invalidate_mapping_entry().

Signed-off-by: Ross Zwisler 
Fixes: c6dcf52c23d2 ("mm: Invalidate DAX radix tree entries only if 
appropriate")
Reported-by: Jan Kara 
Cc: [4.10+]
---

This series applies cleanly to the current v4.11-rc7 based linux/master,
and has passed an xfstests run with DAX on ext4 and XFS.

These patches also apply to v4.10.9 with a little work from the 3-way
merge feature.

 fs/dax.c| 29 -
 include/linux/dax.h |  1 -
 mm/truncate.c   |  9 +++--
 3 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 85abd74..166504c 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -507,35 +507,6 @@ int dax_delete_mapping_entry(struct address_space 
*mapping, pgoff_t index)
 }
 
 /*
- * Invalidate exceptional DAX entry if easily possible. This handles DAX
- * entries for invalidate_inode_pages() so we evict the entry only if we can
- * do so without blocking.
- */
-int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index)
-{
-   int ret = 0;
-   void *entry, **slot;
-   struct radix_tree_root *page_tree = >page_tree;
-
-   spin_lock_irq(>tree_lock);
-   entry = __radix_tree_lookup(page_tree, index, NULL, );
-   if (!entry || !radix_tree_exceptional_entry(entry) ||
-   slot_locked(mapping, slot))
-   goto out;
-   if (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) ||
-   radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE))
-   goto out;
-   radix_tree_delete(page_tree, index);
-   mapping->nrexceptional--;
-   ret = 1;
-out:
-   spin_unlock_irq(>tree_lock);
-   if (ret)
-   dax_wake_mapping_entry_waiter(mapping, index, entry, true);
-   return ret;
-}
-
-/*
  * Invalidate exceptional DAX entry if it is clean.
  */
 int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
diff --git a/include/linux/dax.h b/include/linux/dax.h
index d8a3dc0..f8e1833 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -41,7 +41,6 @@ ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter 
*iter,
 int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
const struct iomap_ops *ops);
 int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
-int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index);
 int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
  pgoff_t index);
 void dax_wake_mapping_entry_waiter(struct address_space *mapping,
diff --git a/mm/truncate.c b/mm/truncate.c
index 6263aff..c537184 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -67,17 +67,14 @@ static void truncate_exceptional_entry(struct address_space 
*mapping,
 
 /*
  * Invalidate exceptional entry if easily possible. This handles exceptional
- * entries for invalidate_inode_pages() so for DAX it evicts only unlocked and
- * clean entries.
+ * entries for invalidate_inode_pages().
  */
 static int invalidate_exceptional_entry(struct address_space *mapping,
pgoff_t index, void *entry)
 {
-   /* Handled by shmem itself */
-   if (shmem_mapping(mapping))
+   /* Handled by shmem itself, or for DAX we do nothing. */
+   if (shmem_mapping(mapping) || dax_mapping(mapping))
return 1;
-   if (dax_mapping(mapping))
-   return dax_invalidate_mapping_entry(mapping, index);
clear_shadow_entry(mapping, index, entry);
return 1;
 }
-- 
2.9.3

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH] acpi, nfit: fix the memory error check in nfit_handle_mce

2017-04-20 Thread kbuild test robot
Hi Vishal,

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.11-rc7 next-20170420]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Vishal-Verma/acpi-nfit-fix-the-memory-error-check-in-nfit_handle_mce/20170421-084359
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git 
linux-next
config: x86_64-randconfig-x005-201716 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/acpi/nfit/mce.c: In function 'nfit_handle_mce':
>> drivers/acpi/nfit/mce.c:29:30: warning: comparison of constant '128ul' with 
>> boolean expression is always false [-Wbool-compare]
 if (!(mce->status & 0xef80) == BIT(7))
 ^~
>> drivers/acpi/nfit/mce.c:29:30: warning: logical not is only applied to the 
>> left hand side of comparison [-Wlogical-not-parentheses]

vim +/128ul +29 drivers/acpi/nfit/mce.c

13   * General Public License for more details.
14   */
15  #include 
16  #include 
17  #include 
18  #include 
19  #include "nfit.h"
20  
21  static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
22  void *data)
23  {
24  struct mce *mce = (struct mce *)data;
25  struct acpi_nfit_desc *acpi_desc;
26  struct nfit_spa *nfit_spa;
27  
28  /* We only care about memory errors */
  > 29  if (!(mce->status & 0xef80) == BIT(7))
30  return NOTIFY_DONE;
31  
32  /*
33   * mce->addr contains the physical addr accessed that caused the
34   * machine check. We need to walk through the list of NFITs, 
and see
35   * if any of them matches that address, and only then start a 
scrub.
36   */
37  mutex_lock(_desc_lock);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH] ndctl: add clear error support for ndctl

2017-04-20 Thread Vishal Verma
On 04/17, Dave Jiang wrote:
> Adding ndctl support that will allow clearing of bad blocks for a device.
> Initial implementation will only support device dax devices. The ndctl
> takes a device path and parameters of the starting bad block, and the number
> of bad blocks to clear.
> 
> Signed-off-by: Dave Jiang 
> ---
>  test/Makefile.am  |1 +
>  test/ndctl-clear-error-dax.sh |   78 
> +
>  2 files changed, 79 insertions(+)
>  create mode 100755 test/ndctl-clear-error-dax.sh

The diffstat seems to be truncated?
The patch mostly looks fine, a few comments below.
Generally, do you think it is worth checking if what we're about to
clear is actually in the badblocks list?
Do we want to allow sending an arbitrary clear-error to a location that
may not actually be bad?

> 
> diff --git a/Documentation/Makefile.am b/Documentation/Makefile.am
> index d72085d..7bf1caa 100644
> --- a/Documentation/Makefile.am
> +++ b/Documentation/Makefile.am
> @@ -14,6 +14,7 @@ man1_MANS = \
>   ndctl-create-namespace.1 \
>   ndctl-destroy-namespace.1 \
>   ndctl-check-namespace.1 \
> + ndctl-clear-error.1 \
>   ndctl-list.1 \
>   daxctl-list.1
>  
> diff --git a/Documentation/ndctl-clear-error.txt 
> b/Documentation/ndctl-clear-error.txt
> new file mode 100644
> index 000..89a5013
> --- /dev/null
> +++ b/Documentation/ndctl-clear-error.txt
> @@ -0,0 +1,37 @@
> +ndctl-clear-error(1)
> +
> +
> +NAME
> +
> +ndctl-clear-error - clear poison for a device

I think generally everywhere, we should use 'badblocks' instead of
poison. Poison implies cache line granularity, and we only expose
badblocks to users. This patch uses 'errors', 'poison', and 'badblocks'
to refer to the same thing -- I think we can keep the command name
'clear-error', and use 'badblock(s)' everywhere else.

> +
> +SYNOPSIS
> +
> +[verse]
> +'ndctl clear-error' []
> +
> +EXAMPLES
> +
> +
> +Clear poison (bad blocks) for the provided device
> +[verse]
> +ndctl clear-error -f /dev/dax0.0 -s 0 -l 8
> +
> +Clear poison (bad blocks) at block offset 0 for 8 blocks on device 
> /dev/dax0.0
> +
> +OPTIONS
> +---
> +-f::
> +--file::
> + The device/file to be cleared of poison (bad blocks).

Instead of using the -f and file path selection for the dax node, can we
use the namespaceX.Y notation like other ndctl commands? Or is there
some other complication with dax namespaces that prevents that..

> +
> +-s::
> +--start::
> + The offset where the poison (bad block) starts for this device.
> + Typically this is acquired from the sysfs badblocks file.
> +
> +-l::
> +--len::
> + The number of badblocks to clear in size of 512 bytes increments.

Just a thought - perhaps len could default to '1'. That way, if only -s
is provided, that one block will get cleared.

> +
> +
> diff --git a/builtin.h b/builtin.h
> index a8bc848..f522d00 100644
> --- a/builtin.h
> +++ b/builtin.h
> @@ -30,4 +30,5 @@ int cmd_test(int argc, const char **argv, void *ctx);
>  #ifdef ENABLE_DESTRUCTIVE
>  int cmd_bat(int argc, const char **argv, void *ctx);
>  #endif
> +int cmd_clear_error(int argc, const char **argv, void *ctx);
>  #endif /* _NDCTL_BUILTIN_H_ */
> diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
> index d346c04..8123169 100644
> --- a/ndctl/Makefile.am
> +++ b/ndctl/Makefile.am
> @@ -11,6 +11,7 @@ ndctl_SOURCES = ndctl.c \
>../util/log.c \
>   list.c \
>   test.c \
> + clear-error.c \
>   ../util/json.c
>  
>  if ENABLE_SMART
> diff --git a/ndctl/clear-error.c b/ndctl/clear-error.c
> new file mode 100644
> index 000..52a2304
> --- /dev/null
> +++ b/ndctl/clear-error.c
> @@ -0,0 +1,212 @@
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct clear_err {
> + const char *dev_name;
> + u64 bb_start;
> + u64 bb_len;
> + struct ndctl_cmd *ars_cap;
> + struct ndctl_cmd *clear_err;
> + struct ndctl_bus *bus;
> + struct ndctl_region *region;
> + struct ndctl_dax *dax;
> + struct ndctl_ctx *ctx;
> +} clear_err;
> +
> +static int send_clear_error(struct ndctl_bus *bus, u64 start, u64 size)
> +{
> + u64 cleared;
> + int rc;
> +
> + clear_err.clear_err = ndctl_bus_cmd_new_clear_error(
> + start, size, clear_err.ars_cap);
> + if (!clear_err.clear_err) {
> + fprintf(stderr, "%s: bus: %s failed to create cmd\n",
> + __func__, ndctl_bus_get_provider(bus));
> + return -ENXIO;
> + }
> +
> + rc = ndctl_cmd_submit(clear_err.clear_err);
> + if (rc) {
> + fprintf(stderr, "%s: bus: %s failed to submit cmd: %d\n",
> + 

Re: [PATCH] acpi, nfit: fix the memory error check in nfit_handle_mce

2017-04-20 Thread Verma, Vishal L
On Thu, 2017-04-20 at 16:18 -0600, Vishal Verma wrote:
> The check for an MCE being a memory error in the NFIT mce handler was
> bogus. Fix it to check for the correct MCA status compound error code.
> 
> Reported-by: Tony Luck 
> Cc: 

Forgot to include,
Fixes: 6839a6d96f4e nfit: do an ARS scrub on hitting a latent media error

> Signed-off-by: Vishal Verma 
> ---
>  drivers/acpi/nfit/mce.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
> index 3ba1c34..23e12a0 100644
> --- a/drivers/acpi/nfit/mce.c
> +++ b/drivers/acpi/nfit/mce.c
> @@ -26,7 +26,7 @@ static int nfit_handle_mce(struct notifier_block
> *nb, unsigned long val,
>   struct nfit_spa *nfit_spa;
>  
>   /* We only care about memory errors */
> - if (!(mce->status & MCACOD))
> + if (!(mce->status & 0xef80) == BIT(7))
>   return NOTIFY_DONE;
>  
>   /*
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH] acpi, nfit: fix the memory error check in nfit_handle_mce

2017-04-20 Thread Vishal Verma
The check for an MCE being a memory error in the NFIT mce handler was
bogus. Fix it to check for the correct MCA status compound error code.

Reported-by: Tony Luck 
Cc: 
Signed-off-by: Vishal Verma 
---
 drivers/acpi/nfit/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
index 3ba1c34..23e12a0 100644
--- a/drivers/acpi/nfit/mce.c
+++ b/drivers/acpi/nfit/mce.c
@@ -26,7 +26,7 @@ static int nfit_handle_mce(struct notifier_block *nb, 
unsigned long val,
struct nfit_spa *nfit_spa;
 
/* We only care about memory errors */
-   if (!(mce->status & MCACOD))
+   if (!(mce->status & 0xef80) == BIT(7))
return NOTIFY_DONE;
 
/*
-- 
2.9.3

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[ndctl PATCH 5/5] test, create.sh: gate test on v4.5+

2017-04-20 Thread Dan Williams
The "create.sh" test depends on commit commit 0731de0dd95b "libnvdimm,
pfn: move 'memory mode' indication to sysfs".

Signed-off-by: Dan Williams 
---
 test/create.sh |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/test/create.sh b/test/create.sh
index 1a5d7d77bf25..992f2ff48ad0 100755
--- a/test/create.sh
+++ b/test/create.sh
@@ -13,6 +13,17 @@ err() {
exit $rc
 }
 
+check_min_kver()
+{
+   local ver="$1"
+   : "${KVER:=$(uname -r)}"
+
+   [ -n "$ver" ] || return 1
+   [[ "$ver" == "$(echo -e "$ver\n$KVER" | sort -V | head -1)" ]]
+}
+
+check_min_kver "4.5" || { echo "kernel $KVER may lack namespace mode 
attribute"; exit $rc; }
+
 set -e
 trap 'err $LINENO' ERR
 

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[ndctl PATCH 0/5] ndctl: fixups to run tests against 4.4-stable

2017-04-20 Thread Dan Williams
Given that some of our stability fixes are being backported to 4.4,
fixup the unit tests to either "PASS" or "SKIP" for 4.4.

---

Dan Williams (5):
  test: teach nfit_test_init to only expect device-dax on v4.7+
  test, libndctl: gate dax and pfn tests on 4.8
  test, libndctl: gate ndctl_namespace_get_mode() on v4.5+
  test, libndctl: get ndctl_btt_get_size() on v4.8+
  test, create.sh: gate test on v4.5+


 test.h |2 +-
 test/blk_namespaces.c  |2 +-
 test/core.c|   11 ++-
 test/create.sh |   11 +++
 test/dpa-alloc.c   |2 +-
 test/dsm-fail.c|2 +-
 test/libndctl.c|   36 ++--
 test/multi-pmem.c  |2 +-
 test/parent-uuid.c |2 +-
 test/pmem_namespaces.c |2 +-
 10 files changed, 54 insertions(+), 18 deletions(-)
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[ndctl PATCH 1/5] test: teach nfit_test_init to only expect device-dax on v4.7+

2017-04-20 Thread Dan Williams
Signed-off-by: Dan Williams 
---
 test.h |2 +-
 test/blk_namespaces.c  |2 +-
 test/core.c|   11 ++-
 test/dpa-alloc.c   |2 +-
 test/dsm-fail.c|2 +-
 test/multi-pmem.c  |2 +-
 test/parent-uuid.c |2 +-
 test/pmem_namespaces.c |2 +-
 8 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/test.h b/test.h
index 5d17398c02f4..8abe13dd410c 100644
--- a/test.h
+++ b/test.h
@@ -17,7 +17,7 @@ void builtin_xaction_namespace_reset(void);
 struct kmod_ctx;
 struct kmod_module;
 int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
-   int log_level);
+   int log_level, struct ndctl_test *test);
 
 struct ndctl_ctx;
 int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx 
*ctx);
diff --git a/test/blk_namespaces.c b/test/blk_namespaces.c
index 1f112744e605..178f73cacb16 100644
--- a/test/blk_namespaces.c
+++ b/test/blk_namespaces.c
@@ -244,7 +244,7 @@ int test_blk_namespaces(int log_level, struct ndctl_test 
*test,
 
if (!bus) {
fprintf(stderr, "ACPI.NFIT unavailable falling back to 
nfit_test\n");
-   rc = nfit_test_init(_ctx, , log_level);
+   rc = nfit_test_init(_ctx, , log_level, test);
ndctl_invalidate(ctx);
bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0");
if (rc < 0 || !bus) {
diff --git a/test/core.c b/test/core.c
index a2f2c76b1d29..1f6dd5966404 100644
--- a/test/core.c
+++ b/test/core.c
@@ -104,7 +104,7 @@ int ndctl_test_get_skipped(struct ndctl_test *test)
 }
 
 int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
-   int log_level)
+   int log_level, struct ndctl_test *test)
 {
int rc;
unsigned int i;
@@ -142,6 +142,15 @@ int nfit_test_init(struct kmod_ctx **ctx, struct 
kmod_module **mod,
int state;
 
name = list[i];
+
+   /*
+* Don't check for device-dax modules on kernels older
+* than 4.7.
+*/
+   if (strstr(name, "dax")
+   && !ndctl_test_attempt(test,
+   KERNEL_VERSION(4, 7, 0)))
+   continue;
 retry:
rc = kmod_module_new_from_name(*ctx, name, mod);
if (rc) {
diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c
index 53656cab1004..9c80fa3fc8c9 100644
--- a/test/dpa-alloc.c
+++ b/test/dpa-alloc.c
@@ -299,7 +299,7 @@ int test_dpa_alloc(int loglevel, struct ndctl_test *test, 
struct ndctl_ctx *ctx)
return 77;
 
ndctl_set_log_priority(ctx, loglevel);
-   err = nfit_test_init(_ctx, , loglevel);
+   err = nfit_test_init(_ctx, , loglevel, test);
if (err < 0) {
ndctl_test_skip(test);
fprintf(stderr, "nfit_test unavailable skipping tests\n");
diff --git a/test/dsm-fail.c b/test/dsm-fail.c
index 0f82e7e3c4ad..22ec94451146 100644
--- a/test/dsm-fail.c
+++ b/test/dsm-fail.c
@@ -171,7 +171,7 @@ int test_dsm_fail(int loglevel, struct ndctl_test *test, 
struct ndctl_ctx *ctx)
int result = EXIT_FAILURE, err;
 
ndctl_set_log_priority(ctx, loglevel);
-   err = nfit_test_init(_ctx, , loglevel);
+   err = nfit_test_init(_ctx, , loglevel, test);
if (err < 0) {
result = 77;
ndctl_test_skip(test);
diff --git a/test/multi-pmem.c b/test/multi-pmem.c
index a8c286cc49c7..abd5f3657eed 100644
--- a/test/multi-pmem.c
+++ b/test/multi-pmem.c
@@ -253,7 +253,7 @@ int test_multi_pmem(int loglevel, struct ndctl_test *test, 
struct ndctl_ctx *ctx
 
ndctl_set_log_priority(ctx, loglevel);
 
-   err = nfit_test_init(_ctx, , loglevel);
+   err = nfit_test_init(_ctx, , loglevel, test);
if (err < 0) {
result = 77;
ndctl_test_skip(test);
diff --git a/test/parent-uuid.c b/test/parent-uuid.c
index fbe1c5b0c8ee..87ea4d75b5a5 100644
--- a/test/parent-uuid.c
+++ b/test/parent-uuid.c
@@ -229,7 +229,7 @@ int test_parent_uuid(int loglevel, struct ndctl_test *test, 
struct ndctl_ctx *ct
return 77;
 
ndctl_set_log_priority(ctx, loglevel);
-   err = nfit_test_init(_ctx, , loglevel);
+   err = nfit_test_init(_ctx, , loglevel, test);
if (err < 0) {
ndctl_test_skip(test);
fprintf(stderr, "nfit_test unavailable skipping tests\n");
diff --git a/test/pmem_namespaces.c b/test/pmem_namespaces.c
index 2d3ad736b0bb..94a5986955b3 100644
--- a/test/pmem_namespaces.c
+++ b/test/pmem_namespaces.c
@@ -208,7 +208,7 @@ int test_pmem_namespaces(int log_level, struct ndctl_test 
*test,
 
if (!bus) {
fprintf(stderr, "ACPI.NFIT unavailable falling back to 
nfit_test\n");
-   rc = nfit_test_init(_ctx, , log_level);
+   rc = nfit_test_init(_ctx, , 

[ndctl PATCH 4/5] test, libndctl: get ndctl_btt_get_size() on v4.8+

2017-04-20 Thread Dan Williams
This support went into the kernel with commit abe8b4e3cef8 "nvdimm, btt:
add a size attribute for BTTs"

Signed-off-by: Dan Williams 
---
 test/libndctl.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/test/libndctl.c b/test/libndctl.c
index 38a0bb746905..0381ee2cdefb 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -970,6 +970,8 @@ static int check_pfn_create(struct ndctl_region *region,
 
 static int check_btt_size(struct ndctl_btt *btt)
 {
+   struct ndctl_ctx *ctx = ndctl_btt_get_ctx(btt);
+   struct ndctl_test *test = ndctl_get_private_data(ctx);
struct ndctl_namespace *ndns = ndctl_btt_get_namespace(btt);
unsigned long long ns_size = ndctl_namespace_get_size(ndns);
unsigned long sect_size = ndctl_btt_get_sector_size(btt);
@@ -1018,6 +1020,10 @@ static int check_btt_size(struct ndctl_btt *btt)
return -ENXIO;
}
 
+   /* prior to 4.8 btt devices did not have a size attribute */
+   if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 8, 0)))
+   return 0;
+
expect = expect_table[size_select][sect_select];
actual = ndctl_btt_get_size(btt);
if (expect != actual) {

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[ndctl PATCH 2/5] test, libndctl: gate dax and pfn tests on 4.8

2017-04-20 Thread Dan Williams
The current tests require the nfit_test conversion from cma to vmalloc.
Disable the tests on earlier kernels.

Signed-off-by: Dan Williams 
---
 test/libndctl.c |   17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/test/libndctl.c b/test/libndctl.c
index 39822ee71c0e..f5a6abe50edd 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2405,16 +2405,21 @@ static int do_test0(struct ndctl_ctx *ctx, struct 
ndctl_test *test)
ndctl_region_foreach(bus, region)
ndctl_region_enable(region);
 
-   if (ndctl_test_attempt(test, KERNEL_VERSION(4, 7, 0))) {
+   /* pfn and dax tests require vmalloc-enabled nfit_test */
+   if (ndctl_test_attempt(test, KERNEL_VERSION(4, 8, 0))) {
rc = check_regions(bus, regions0, ARRAY_SIZE(regions0), DAX);
if (rc)
return rc;
reset_bus(bus);
}
-   rc = check_regions(bus, regions0, ARRAY_SIZE(regions0), PFN);
-   if (rc)
-   return rc;
-   reset_bus(bus);
+
+   if (ndctl_test_attempt(test, KERNEL_VERSION(4, 8, 0))) {
+   rc = check_regions(bus, regions0, ARRAY_SIZE(regions0), PFN);
+   if (rc)
+   return rc;
+   reset_bus(bus);
+   }
+
return check_regions(bus, regions0, ARRAY_SIZE(regions0), BTT);
 }
 
@@ -2464,7 +2469,7 @@ int test_libndctl(int loglevel, struct ndctl_test *test, 
struct ndctl_ctx *ctx)
daxctl_set_log_priority(daxctl_ctx, loglevel);
ndctl_set_private_data(ctx, test);
 
-   err = nfit_test_init(_ctx, , loglevel);
+   err = nfit_test_init(_ctx, , loglevel, test);
if (err < 0) {
ndctl_test_skip(test);
fprintf(stderr, "nfit_test unavailable skipping tests\n");

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [RFC 0/8] Copy Offload with Peer-to-Peer PCI Memory

2017-04-20 Thread Dan Williams
On Thu, Apr 20, 2017 at 1:43 PM, Stephen  Bates  wrote:
>
>> Yes, this makes sense I think we really just want to distinguish host
>> memory or not in terms of the dev_pagemap type.
>
> I would like to see mutually exclusive flags for host memory (or not) and 
> persistence (or not).
>

Why persistence? It has zero meaning to the mm.
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [RFC 0/8] Copy Offload with Peer-to-Peer PCI Memory

2017-04-20 Thread Stephen Bates

> Yes, this makes sense I think we really just want to distinguish host
> memory or not in terms of the dev_pagemap type.

I would like to see mutually exclusive flags for host memory (or not) and 
persistence (or not).

Stephen

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


如何you效规避采购合同风险

2017-04-20 Thread 包矿
ID: 

Re: [PATCH v3] dcssblk: add dax_operations support

2017-04-20 Thread Gerald Schaefer
On Wed, 19 Apr 2017 15:32:38 -0700
Dan Williams  wrote:

> Setup a dax_dev to have the same lifetime as the dcssblk block device
> and add a ->direct_access() method that is equivalent to
> dcssblk_direct_access(). Once fs/dax.c has been converted to use
> dax_operations the old dcssblk_direct_access() will be removed.
> 
> Reported-by: Gerald Schaefer 
> Signed-off-by: Dan Williams 
> ---
> Changes since v2:
> * fix return code in the alloc_dax() failure case (Gerald)
> * assign dax_dev to dev_info and kill local variable (Gerald)
> 
>  drivers/s390/block/Kconfig   |1 +
>  drivers/s390/block/dcssblk.c |   55 
> +++---
>  2 files changed, 47 insertions(+), 9 deletions(-)

Acked-by: Gerald Schaefer 

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: qemu-kvm hangs with DAX

2017-04-20 Thread Dan Williams
On Thu, Apr 20, 2017 at 2:19 AM, Yigal Korman  wrote:
> Hi everyone,
>
> I have an interesting issue with DAX and KVM - I'm trying to boot a VM
> with its memory mapped to a DAX-mounted file (kernel 4.9).
>
> The use case is a bit wacky but I'm trying to recreate something
> similar to what clearlinux[1] described (although they don't use this
> method anymore).
>
> When mapping the memory to a regular ext4 file, the VM boots fine.
> But when mapping to ext4+dax, the VM won't boot or perhaps boots
> extremely slowly.
> In both cases the FS is on a memory pmem device.
>
> Here's a snippet of how I load things:
>
> mkfs.ext4 /dev/pmem0
> mount /dev/pmem0 /mnt
> fallocate -l 512M /mnt/mem

I wonder if you replace this with "dd if=/dev/zero of=/mnt/mem
bs=1024k count=512" if it changes the behavior. DAX forces synchronous
block allocations and unwritten-extent-zeroing that get skipped in the
page cache case.

> qemu-system-x86_64 -nodefconfig -nodefaults \
>  -drive if=virtio,file=centos7.qcow2,index=0,media=disk \
>  --enable-kvm -serial telnet:localhost:4443,server,nowait \
>  -device sga -m 512 -smp 1,sockets=1,cores=1,threads=1 \
>  -object 
> memory-backend-file,prealloc=yes,mem-path=/mnt/mem,share=on,size=512M,id=ram
> \
>  -numa node,nodeid=0,cpus=0,memdev=ram \
>  -net nic,model=virtio,vlan=0 \
>  -net user,vlan=0,hostname=vm,hostfwd=tcp:127.0.0.1:8001-:22 \
>  -name test -monitor telnet:localhost:,server,nowait
>
> I use a headless host so I usually connect to the VM with 'telnet
> localhost 4443'.
>
> The above works and the VM boots in seconds.
> When adding '-o dax' to the mount command, I can catch the grub menu
> during boot but it gets stuck.
> Sometimes if I wait about 20 minutes, I see some kernel boot messages
> appear, but no errors.
>
> Any thoughts?
>
> Regards,
> Yigal
>
> [1] https://lwn.net/Articles/644675/
> ___
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


qemu-kvm hangs with DAX

2017-04-20 Thread Yigal Korman
Hi everyone,

I have an interesting issue with DAX and KVM - I'm trying to boot a VM
with its memory mapped to a DAX-mounted file (kernel 4.9).

The use case is a bit wacky but I'm trying to recreate something
similar to what clearlinux[1] described (although they don't use this
method anymore).

When mapping the memory to a regular ext4 file, the VM boots fine.
But when mapping to ext4+dax, the VM won't boot or perhaps boots
extremely slowly.
In both cases the FS is on a memory pmem device.

Here's a snippet of how I load things:

mkfs.ext4 /dev/pmem0
mount /dev/pmem0 /mnt
fallocate -l 512M /mnt/mem
qemu-system-x86_64 -nodefconfig -nodefaults \
 -drive if=virtio,file=centos7.qcow2,index=0,media=disk \
 --enable-kvm -serial telnet:localhost:4443,server,nowait \
 -device sga -m 512 -smp 1,sockets=1,cores=1,threads=1 \
 -object 
memory-backend-file,prealloc=yes,mem-path=/mnt/mem,share=on,size=512M,id=ram
\
 -numa node,nodeid=0,cpus=0,memdev=ram \
 -net nic,model=virtio,vlan=0 \
 -net user,vlan=0,hostname=vm,hostfwd=tcp:127.0.0.1:8001-:22 \
 -name test -monitor telnet:localhost:,server,nowait

I use a headless host so I usually connect to the VM with 'telnet
localhost 4443'.

The above works and the VM boots in seconds.
When adding '-o dax' to the mount command, I can catch the grub menu
during boot but it gets stuck.
Sometimes if I wait about 20 minutes, I see some kernel boot messages
appear, but no errors.

Any thoughts?

Regards,
Yigal

[1] https://lwn.net/Articles/644675/
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm