Re: memremap: change devm_memremap_pages interface to use struct dev_pagemap

2018-06-30 Thread Dan Williams
On Sat, Jun 30, 2018 at 2:11 PM, Colin Ian King
 wrote:
> Hi,
>
> static analysis with CoverityScan detected an issue with the following
> commit:
>
> commit e8d5134833006a46fcbefc5f4a84d0b62bd520e7
> Author: Christoph Hellwig 
> 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).
>
> 249devm_add_action(dev, devm_memremap_pages_release, pgmap);
> 250
> 251return __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.

Thanks for this. We have a fix pending here looking to go through Andrew's tree.

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


re: memremap: change devm_memremap_pages interface to use struct dev_pagemap

2018-06-30 Thread Colin Ian King
Hi,

static analysis with CoverityScan detected an issue with the following
commit:

commit e8d5134833006a46fcbefc5f4a84d0b62bd520e7
Author: Christoph Hellwig 
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).

249devm_add_action(dev, devm_memremap_pages_release, pgmap);
250
251return __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
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: Question about ndctl unit tests

2018-06-30 Thread Dan Williams
On Sat, Jun 30, 2018 at 1:07 AM, Qi, Fuli  wrote:
> Hi,
>
>
>
> When I ran the unit tests, I found "libndctl" and "dsm-fail" cannot pass the
> test.

Yes, sorry, we recently reworked some tests. Grab our work-in-progress
kernel branch here:

git://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm.git
libnvdimm-pending

This will move to nvdimm/nvdimm.git libnvdimm-for-next in the coming
weeks for 4.19.

You'll also want to grab:

https://patchwork.kernel.org/patch/10495297/

...for the error handling tests. This will appear on
github.com/pmem/ndctl master soon.
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH] ndctl, test: add start/wait scrub to injection tests

2018-06-30 Thread Dan Williams
On Thu, Jun 28, 2018 at 3:13 PM, Vishal Verma  wrote:
> 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 
> Signed-off-by: Vishal Verma 

Looks good.

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


Question about ndctl unit tests

2018-06-30 Thread 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_pmem20480  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_iomap20480  6 
dax_pmem,nfit_test,device_dax,nd_pmem,libnvdimm,nfit

Does anyone know how to fix it?

Thank you very much.
QI
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm