Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm fixes from Ross Zwisler:
"Two fixes:

- Fix memcpy_from_pmem() to fallback to memcpy() for architectures
where CONFIG_ARCH_HAS_PMEM_API=n.

- Add a comment explaining why we write data twice when clearing
poison in pmem_do_bvec().

This has passed a boot test on an X86_32 config, which was the
architecture where issue #1 above was first noticed"

Dan Williams adds:
"We're giving this multi-maintainer setup a shot, so expect libnvdimm
pull requests from either Ross or I going forward"

* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
libnvdimm, pmem: clarify the write+clear_poison+write flow
pmem: fix BUG() error in pmem.h:48 on X86_32

+30 -6
+14
drivers/nvdimm/pmem.c
··· 103 103 flush_dcache_page(page); 104 104 } 105 105 } else { 106 + /* 107 + * Note that we write the data both before and after 108 + * clearing poison. The write before clear poison 109 + * handles situations where the latest written data is 110 + * preserved and the clear poison operation simply marks 111 + * the address range as valid without changing the data. 112 + * In this case application software can assume that an 113 + * interrupted write will either return the new good 114 + * data or an error. 115 + * 116 + * However, if pmem_clear_poison() leaves the data in an 117 + * indeterminate state we need to perform the write 118 + * after clear poison. 119 + */ 106 120 flush_dcache_page(page); 107 121 memcpy_to_pmem(pmem_addr, mem + off, len); 108 122 if (unlikely(bad_pmem)) {
+16 -6
include/linux/pmem.h
··· 72 72 } 73 73 #endif 74 74 75 + static inline bool arch_has_pmem_api(void) 76 + { 77 + return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API); 78 + } 79 + 80 + static inline int default_memcpy_from_pmem(void *dst, void __pmem const *src, 81 + size_t size) 82 + { 83 + memcpy(dst, (void __force *) src, size); 84 + return 0; 85 + } 86 + 75 87 /* 76 88 * memcpy_from_pmem - read from persistent memory with error handling 77 89 * @dst: destination buffer ··· 95 83 static inline int memcpy_from_pmem(void *dst, void __pmem const *src, 96 84 size_t size) 97 85 { 98 - return arch_memcpy_from_pmem(dst, src, size); 99 - } 100 - 101 - static inline bool arch_has_pmem_api(void) 102 - { 103 - return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API); 86 + if (arch_has_pmem_api()) 87 + return arch_memcpy_from_pmem(dst, src, size); 88 + else 89 + return default_memcpy_from_pmem(dst, src, size); 104 90 } 105 91 106 92 /**