[PATCH] nfit: use devm_add_action_or_reset()
by Vikas C Sajjan
If devm_add_action() fails, we are explicitly calling the cleanup to free
the resources allocated. Lets use the helper devm_add_action_or_reset()
and return directly in case of error, since the cleanup function
has been already called by the helper if there was any error.
Signed-off-by: Vikas C Sajjan <vikas.cha.sajjan(a)hpe.com>
---
drivers/acpi/nfit.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index c2ad967..44ebe1e 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -1920,11 +1920,11 @@ static int acpi_nfit_insert_resource(struct acpi_nfit_desc *acpi_desc,
if (ret)
return ret;
- ret = devm_add_action(acpi_desc->dev, acpi_nfit_remove_resource, res);
- if (ret) {
- remove_resource(res);
+ ret = devm_add_action_or_reset(acpi_desc->dev,
+ acpi_nfit_remove_resource,
+ res);
+ if (ret)
return ret;
- }
return 0;
}
--
1.9.1
4 years, 9 months
[PATCH] dax: use devm_add_action_or_reset()
by Vikas C Sajjan
If devm_add_action() fails, we are explicitly calling the cleanup to free
the resources allocated. Use the helper devm_add_action_or_reset()
and return directly in case of error, since the cleanup function
has been already called by the helper if there was any error.
Reported-by: Sudip Mukherjee <sudipm.mukherjee(a)gmail.com>
Signed-off-by: Vikas C Sajjan <vikas.cha.sajjan(a)hpe.com>
---
drivers/dax/dax.c | 6 ++----
drivers/dax/pmem.c | 14 ++++++--------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
index b891a12..803f395 100644
--- a/drivers/dax/dax.c
+++ b/drivers/dax/dax.c
@@ -211,11 +211,9 @@ int devm_create_dax_dev(struct dax_region *dax_region, struct resource *res,
}
dax_dev->dev = dev;
- rc = devm_add_action(dax_region->dev, unregister_dax_dev, dev);
- if (rc) {
- unregister_dax_dev(dev);
+ rc = devm_add_action_or_reset(dax_region->dev, unregister_dax_dev, dev);
+ if (rc)
return rc;
- }
return 0;
diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c
index 55d510e..dfb1685 100644
--- a/drivers/dax/pmem.c
+++ b/drivers/dax/pmem.c
@@ -102,21 +102,19 @@ static int dax_pmem_probe(struct device *dev)
if (rc)
return rc;
- rc = devm_add_action(dev, dax_pmem_percpu_exit, &dax_pmem->ref);
- if (rc) {
- dax_pmem_percpu_exit(&dax_pmem->ref);
+ rc = devm_add_action_or_reset(dev, dax_pmem_percpu_exit,
+ &dax_pmem->ref);
+ if (rc)
return rc;
- }
addr = devm_memremap_pages(dev, &res, &dax_pmem->ref, altmap);
if (IS_ERR(addr))
return PTR_ERR(addr);
- rc = devm_add_action(dev, dax_pmem_percpu_kill, &dax_pmem->ref);
- if (rc) {
- dax_pmem_percpu_kill(&dax_pmem->ref);
+ rc = devm_add_action_or_reset(dev, dax_pmem_percpu_kill,
+ &dax_pmem->ref);
+ if (rc)
return rc;
- }
nd_region = to_nd_region(dev->parent);
dax_region = alloc_dax_region(dev, nd_region->id, &res,
--
1.9.1
4 years, 9 months
[PATCH v4] acpi, nfit: treat virtual ramdisk SPA as pmem region
by Lee, Chun-Yi
This patch adds logic to treat virtual ramdisk SPA as pmem region, then
ramdisk's /dev/pmem* device can be mounted with iso9660.
It's useful to work with the httpboot in EFI firmware to pull a remote
ISO file to the local memory region for booting and installation.
Wiki page of UEFI HTTPBoot with OVMF:
https://en.opensuse.org/UEFI_HTTPBoot_with_OVMF
The ramdisk function in EDK2/OVMF generates a ACPI0012 root device that
it contains empty _STA but without _DSM:
DefinitionBlock ("ssdt2.aml", "SSDT", 2, "INTEL ", "RamDisk ", 0x00001000)
{
Scope (\_SB)
{
Device (NVDR)
{
Name (_HID, "ACPI0012") // _HID: Hardware ID
Name (_STR, Unicode ("NVDIMM Root Device")) // _STR: Description String
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (0x0F)
}
}
}
}
In section 5.2.25.2 of ACPI 6.1 spec, it mentions that the "SPA Range
Structure Index" of virtual SPA shall be set to zero. That means virtual SPA
will not be associated by any NVDIMM region mapping.
The VCD's SPA Range Structure in NFIT is similar to virtual disk region
as following:
[028h 0040 2] Subtable Type : 0000 [System Physical Address Range]
[02Ah 0042 2] Length : 0038
[02Ch 0044 2] Range Index : 0000
[02Eh 0046 2] Flags (decoded below) : 0000
Add/Online Operation Only : 0
Proximity Domain Valid : 0
[030h 0048 4] Reserved : 00000000
[034h 0052 4] Proximity Domain : 00000000
[038h 0056 16] Address Range GUID : 77AB535A-45FC-624B-5560-F7B281D1F96E
[048h 0072 8] Address Range Base : 00000000B6ABD018
[050h 0080 8] Address Range Length : 0000000005500000
[058h 0088 8] Memory Map Attribute : 0000000000000000
The way to not associate a SPA range is to never reference it from a "flush hint",
"interleave", or "control region" table.
After testing on OVMF, pmem driver can support the region that it doesn't
assoicate to any NVDIMM mapping. So, treat VCD like pmem is a idea to get
a pmem block device that it contains iso.
v4:
Instoduce nfit_spa_is_virtual() to check virtual ramdisk SPA and create
pmem region.
v3:
To simplify patch, removed useless VCD region in libnvdimm.
v2:
Removed the code for setting VCD to a read-only region.
Cc: Gary Lin <GLin(a)suse.com>
Cc: Dan Williams <dan.j.williams(a)intel.com>
Cc: Ross Zwisler <ross.zwisler(a)linux.intel.com>
Cc: "Rafael J. Wysocki" <rjw(a)rjwysocki.net>
Cc: Linda Knippers <linda.knippers(a)hpe.com>
Signed-off-by: Lee, Chun-Yi <jlee(a)suse.com>
---
drivers/acpi/nfit.c | 8 +++++++-
drivers/nvdimm/region_devs.c | 26 +++++++++++++++++++++++++-
include/linux/libnvdimm.h | 2 ++
3 files changed, 34 insertions(+), 2 deletions(-)
Index: linux/drivers/acpi/nfit.c
===================================================================
--- linux.orig/drivers/acpi/nfit.c
+++ linux/drivers/acpi/nfit.c
@@ -1980,6 +1980,14 @@ static int acpi_nfit_init_mapping(struct
return 0;
}
+static bool nfit_spa_is_virtual(struct acpi_nfit_system_address *spa)
+{
+ return (nfit_spa_type(spa) == NFIT_SPA_VDISK ||
+ nfit_spa_type(spa) == NFIT_SPA_VCD ||
+ nfit_spa_type(spa) == NFIT_SPA_PDISK ||
+ nfit_spa_type(spa) == NFIT_SPA_PCD);
+}
+
static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc,
struct nfit_spa *nfit_spa)
{
@@ -1995,7 +2003,7 @@ static int acpi_nfit_register_region(str
if (nfit_spa->nd_region)
return 0;
- if (spa->range_index == 0) {
+ if (spa->range_index == 0 && !nfit_spa_is_virtual(spa)) {
dev_dbg(acpi_desc->dev, "%s: detected invalid spa index\n",
__func__);
return 0;
@@ -2059,6 +2067,11 @@ static int acpi_nfit_register_region(str
ndr_desc);
if (!nfit_spa->nd_region)
rc = -ENOMEM;
+ } else if (nfit_spa_is_virtual(spa)) {
+ nfit_spa->nd_region = nvdimm_pmem_region_create(nvdimm_bus,
+ ndr_desc);
+ if (!nfit_spa->nd_region)
+ rc = -ENOMEM;
}
out:
4 years, 9 months
Reach Millions of FB Group Members
by ALBERT
Hello,
Do you want to advertise on facebook? We're here to help.
We wil manually post your product/logo/link on Facebook Groups and will
give you a full report with links of each live post where your advertisement
was posted.
http://www.buysocial.cn/detail.php?id=12
Regards
ALBERT
�
Unsubscribe option is available on the footer of our website
4 years, 9 months
[PATCH] libnvdimm: initialize struct blk_integrity with 0
by Johannes Thumshirn
Initialize struct blk_integrity with 0 as blk_integrity_register() takes the
then unitialized struct blk_integrity::flags and ORs it to the resulting block
integrity structure.
Signed-off-by: Johannes Thumshirn <jthumshirn(a)suse.de>
---
drivers/nvdimm/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
index be89764..32e4fe2 100644
--- a/drivers/nvdimm/core.c
+++ b/drivers/nvdimm/core.c
@@ -601,7 +601,8 @@ int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
if (meta_size == 0)
return 0;
- bi.profile = NULL;
+ memset(&bi, 0, sizeof(bi));
+
bi.tuple_size = meta_size;
bi.tag_size = meta_size;
--
2.8.4
4 years, 9 months
[PATCH] [RFC] pmem: add pmem support codes on ARM64
by Kwangwoo Lee
The PMEM driver on top of NVDIMM(Non-Volatile DIMM) has already been
supported on X86_64 and there exist several ARM64 platforms which support
DIMM type memories.
This patch set enables the PMEM driver on ARM64 (AArch64) architecture
on top of NVDIMM. While developing this patch set, QEMU 2.6.50 with NVDIMM
emulation for ARM64 has also been developed and tested on it.
$ dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.6.0-rc2kw-dirty (kwangwoo@VBox15) (gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu1) ) #10 SMP Tue Jul 5 11:30:33 KST 2016
[ 0.000000] Boot CPU: AArch64 Processor [411fd070]
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] EFI v2.60 by EDK II
[ 0.000000] efi: SMBIOS 3.0=0x58710000 ACPI 2.0=0x589b0000
[ 0.000000] ACPI: Early table checksum verification disabled
[ 0.000000] ACPI: RSDP 0x00000000589B0000 000024 (v02 BOCHS )
[ 0.000000] ACPI: XSDT 0x00000000589A0000 00005C (v01 BOCHS BXPCFACP 00000001 01000013)
[ 0.000000] ACPI: FACP 0x0000000058620000 00010C (v05 BOCHS BXPCFACP 00000001 BXPC 00000001)
[ 0.000000] ACPI: DSDT 0x0000000058630000 00108F (v02 BOCHS BXPCDSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: APIC 0x0000000058610000 0000A8 (v03 BOCHS BXPCAPIC 00000001 BXPC 00000001)
[ 0.000000] ACPI: GTDT 0x0000000058600000 000060 (v02 BOCHS BXPCGTDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: MCFG 0x00000000585F0000 00003C (v01 BOCHS BXPCMCFG 00000001 BXPC 00000001)
[ 0.000000] ACPI: SPCR 0x00000000585E0000 000050 (v02 BOCHS BXPCSPCR 00000001 BXPC 00000001)
[ 0.000000] ACPI: NFIT 0x00000000585D0000 0000E0 (v01 BOCHS BXPCNFIT 00000001 BXPC 00000001)
[ 0.000000] ACPI: SSDT 0x00000000585C0000 000131 (v01 BOCHS NVDIMM 00000001 BXPC 00000001)
...
[ 5.386743] pmem0: detected capacity change from 0 to 1073741824
...
[ 531.952466] EXT4-fs (pmem0): DAX enabled. Warning: EXPERIMENTAL, use at your own risk
[ 531.961073] EXT4-fs (pmem0): mounted filesystem with ordered data mode. Opts: dax
$ mount
rootfs on / type rootfs (rw,size=206300k,nr_inodes=51575)
...
/dev/pmem0 on /mnt/mem type ext4 (rw,relatime,dax,data=ordered)
$ df -h
Filesystem Size Used Available Use% Mounted on
...
/dev/pmem0 975.9M 1.3M 907.4M 0% /mnt/mem
Signed-off-by: Kwangwoo Lee <kwangwoo.lee(a)sk.com>
---
arch/arm64/Kconfig | 2 +
arch/arm64/include/asm/cacheflush.h | 2 +
arch/arm64/include/asm/pmem.h | 149 ++++++++++++++++++++++++++++++++++++
3 files changed, 153 insertions(+)
create mode 100644 arch/arm64/include/asm/pmem.h
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 4f43622..ee1d679 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -15,6 +15,8 @@ config ARM64
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
select ARCH_WANT_FRAME_POINTERS
select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select ARCH_HAS_PMEM_API
+ select ARCH_HAS_MMIO_FLUSH
select ARM_AMBA
select ARM_ARCH_TIMER
select ARM_GIC
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
index c64268d..113bd1f 100644
--- a/arch/arm64/include/asm/cacheflush.h
+++ b/arch/arm64/include/asm/cacheflush.h
@@ -133,6 +133,8 @@ static inline void __flush_icache_all(void)
*/
#define flush_icache_page(vma,page) do { } while (0)
+#define mmio_flush_range(addr, size) __flush_dcache_area(addr, size)
+
/*
* Not required on AArch64 (PIPT or VIPT non-aliasing D-cache).
*/
diff --git a/arch/arm64/include/asm/pmem.h b/arch/arm64/include/asm/pmem.h
new file mode 100644
index 0000000..4bdf015
--- /dev/null
+++ b/arch/arm64/include/asm/pmem.h
@@ -0,0 +1,149 @@
+/*
+ * Based on arch/x86/include/asm/pmem.h
+ *
+ * Copyright(c) 2016 SK hynix Inc. Kwangwoo Lee <kwangwoo.lee(a)sk.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+#ifndef __ASM_ARM64_PMEM_H__
+#define __ASM_ARM64_PMEM_H__
+
+#include <linux/uaccess.h>
+#include <asm/cacheflush.h>
+
+#ifdef CONFIG_ARCH_HAS_PMEM_API
+/**
+ * arch_memcpy_to_pmem - copy data to persistent memory
+ * @dst: destination buffer for the copy
+ * @src: source buffer for the copy
+ * @n: length of the copy in bytes
+ *
+ * Copy data to persistent memory media via non-temporal stores so that
+ * a subsequent arch_wmb_pmem() can flush cpu and memory controller
+ * write buffers to guarantee durability.
+ */
+static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src,
+ size_t n)
+{
+ int unwritten;
+
+ /*
+ * We are copying between two kernel buffers, if
+ * __copy_from_user_inatomic_nocache() returns an error (page
+ * fault) we would have already reported a general protection fault
+ * before the WARN+BUG.
+ */
+ unwritten = __copy_from_user_inatomic_nocache((void __force *) dst,
+ (void __user *) src, n);
+ if (WARN(unwritten, "%s: fault copying %p <- %p unwritten: %d\n",
+ __func__, dst, src, unwritten))
+ BUG();
+}
+
+static inline int arch_memcpy_from_pmem(void *dst, const void __pmem *src,
+ size_t n)
+{
+ memcpy(dst, (void __force *) src, n);
+ return 0;
+}
+
+/**
+ * arch_wmb_pmem - synchronize writes to persistent memory
+ *
+ * After a series of arch_memcpy_to_pmem() operations this drains data
+ * from cpu write buffers and any platform (memory controller) buffers
+ * to ensure that written data is durable on persistent memory media.
+ */
+static inline void arch_wmb_pmem(void)
+{
+ /*
+ * PCOMMIT instruction only exists on x86. So pcommit_sfence() has been
+ * removed after wmb(). Note, that we've already arranged for pmem
+ * writes to avoid the cache via arch_memcpy_to_pmem().
+ */
+ wmb();
+}
+
+/**
+ * arch_wb_cache_pmem - write back a cache range
+ * @vaddr: virtual start address
+ * @size: number of bytes to write back
+ *
+ * Write back a cache range. This function requires explicit ordering with an
+ * arch_wmb_pmem() call.
+ */
+static inline void arch_wb_cache_pmem(void __pmem *addr, size_t size)
+{
+ __clean_dcache_area_pou(addr, size);
+}
+
+/*
+ * copy_from_iter_nocache() only uses non-temporal stores for iovec iterators,
+ * so for other types (bvec & kvec) we must do a cache write-back.
+ */
+static inline bool __iter_needs_pmem_wb(struct iov_iter *i)
+{
+ return iter_is_iovec(i) == false;
+}
+
+/**
+ * arch_copy_from_iter_pmem - copy data from an iterator to PMEM
+ * @addr: PMEM destination address
+ * @bytes: number of bytes to copy
+ * @i: iterator with source data
+ *
+ * Copy data from the iterator 'i' to the PMEM buffer starting at 'addr'.
+ * This function requires explicit ordering with an arch_wmb_pmem() call.
+ */
+static inline size_t arch_copy_from_iter_pmem(void __pmem *addr, size_t bytes,
+ struct iov_iter *i)
+{
+ void *vaddr = (void __force *)addr;
+ size_t len;
+
+ /* TODO: skip the write-back by always using non-temporal stores */
+ len = copy_from_iter_nocache(vaddr, bytes, i);
+
+ if (__iter_needs_pmem_wb(i))
+ arch_wb_cache_pmem(addr, bytes);
+
+ return len;
+}
+
+/**
+ * arch_clear_pmem - zero a PMEM memory range
+ * @addr: virtual start address
+ * @size: number of bytes to zero
+ *
+ * Write zeros into the memory range starting at 'addr' for 'size' bytes.
+ * This function requires explicit ordering with an arch_wmb_pmem() call.
+ */
+static inline void arch_clear_pmem(void __pmem *addr, size_t size)
+{
+ void *vaddr = (void __force *)addr;
+
+ memset(vaddr, 0, size);
+ arch_wb_cache_pmem(addr, size);
+}
+
+static inline void arch_invalidate_pmem(void __pmem *addr, size_t size)
+{
+ /* barrier before clean and invalidate */
+ mb();
+
+ __flush_dcache_area(addr, size);
+}
+
+static inline bool __arch_has_wmb_pmem(void)
+{
+ return true;
+}
+#endif /* CONFIG_ARCH_HAS_PMEM_API */
+#endif /* __ASM_ARM64_PMEM_H__ */
--
2.5.0
4 years, 9 months
[ndctl PATCH] test: override current kernel version with environment variable
by Dan Williams
For backport kernels where the functionality is more advanced than the base
kernel version implies, allow 'KVER' environment to override the results of
'uname -r'.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
test/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/test/core.c b/test/core.c
index b5703273fa76..c2d225d4921e 100644
--- a/test/core.c
+++ b/test/core.c
@@ -14,12 +14,16 @@ struct ndctl_test {
static unsigned int get_system_kver(void)
{
+ const char *kver = getenv("KVER");
struct utsname utsname;
int a, b, c;
- uname(&utsname);
+ if (!kver) {
+ uname(&utsname);
+ kver = utsname.release;
+ }
- if (sscanf(utsname.release, "%d.%d.%d", &a, &b, &c) != 3)
+ if (sscanf(kver, "%d.%d.%d", &a, &b, &c) != 3)
return LINUX_VERSION_CODE;
return KERNEL_VERSION(a,b,c);
4 years, 9 months
[ndctl PATCH] build: quiet warnings about missing git repository
by Dan Williams
The git-version script auto-appends the commit id, but complains if the
repository is missing. The complaint is benign, but we should also tag
builds outside of git with a '+' because who knows what changes were
made locally.
Link: https://github.com/pmem/ndctl/issues/5
Reported-by: Yi Zhang <yi.a.zhang(a)hotmail.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
git-version | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/git-version b/git-version
index 3823ee29afaf..9eb8fd654e38 100755
--- a/git-version
+++ b/git-version
@@ -38,9 +38,13 @@ elif test -d ${GIT_DIR:-.git} -o -f .git &&
VN=$(echo "$VN" | sed -e 's/-/./g');
else
read COMMIT COMMIT_SUBJECT <<EOF
- $(git log --oneline --abbrev=8 -n1 HEAD)
+ $(git log --oneline --abbrev=8 -n1 HEAD 2>/dev/null)
EOF
- VN="$(dirty ${DEF_VER}.git$COMMIT)"
+ if [ -z $COMMIT ]; then
+ VN="${DEF_VER}+"
+ else
+ VN="$(dirty ${DEF_VER}.git$COMMIT)"
+ fi
fi
echo $VN
4 years, 9 months
[GIT PULL] libnvdimm fixes for 4.7-rc6
by Williams, Dan J
Hi Linus, please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes
...to receive:
1/ Two regression fixes since v4.6: one for the byte order of a sysfs
attribute (bz121161) and another for QEMU 2.6's NVDIMM _DSM (ACPI
Device Specific Method) implementation that gets tripped up by new
auto-probing behavior in the NFIT driver.
2/ A fix tagged for -stable that stops the kernel from
clobbering/ignoring changes to the configuration of a 'pfn' instance
("struct page" driver). For example changing the alignment from 2M to
1G may silently revert to 2M if that value is currently stored on
media.
3/ A fix from Eric for an xfstests failure in dax. It is not currently
tagged for -stable since it requires an 8-exabyte file system to
trigger, and there appear to be no user visible side effects.
The following changes since commit 33688abb2802ff3a230bd2441f765477b94cc89e:
Linux 4.7-rc4 (2016-06-19 21:30:02 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes
for you to fetch changes up to 1bcbf42d2732b3fdaa8559b0dfc91567769e23c8:
nfit: fix format interface code byte order (2016-06-29 11:19:32 -0700)
----------------------------------------------------------------
Dan Williams (3):
libnvdimm, pfn, dax: fix initialization vs autodetect for mode + alignment
acpi, nfit: fix acpi_check_dsm() vs zero functions implemented
nfit: fix format interface code byte order
Eric Sandeen (1):
dax: fix offset overflow in dax_io
drivers/acpi/nfit.c | 12 +++++------
drivers/acpi/nfit.h | 10 +++++-----
drivers/acpi/utils.c | 6 +++---
drivers/nvdimm/pfn_devs.c | 51 +++++++++++++++++++++++++++++++++++++----------
fs/dax.c | 7 ++++++-
5 files changed, 60 insertions(+), 26 deletions(-)
commit 1ee6667cd8d183b2fed12f97285f184431d2caf9
Author: Dan Williams <dan.j.williams(a)intel.com>
Date: Thu Jun 23 17:50:39 2016 -0700
libnvdimm, pfn, dax: fix initialization vs autodetect for mode + alignment
The updated ndctl unit tests discovered that if a pfn configuration with
a 4K alignment is read from the namespace, that alignment will be
ignored in favor of the default 2M alignment. The result is that the
configuration will fail initialization with a message like:
dax6.1: bad offset: 0x22000 dax disabled align: 0x200000
Fix this by allowing the alignment read from the info block to override
the default which is 2M not 0 in the autodetect path. This also fixes a
similar problem with the mode and alignment settings silently being
overwritten by the kernel when userspace has changed it. We now will
either overwrite the info block if userspace changes the uuid or fail
and warn if a live setting disagrees with the info block.
Cc: <stable(a)vger.kernel.org>
Cc: Micah Parrish <micah.parrish(a)hpe.com>
Cc: Toshi Kani <toshi.kani(a)hpe.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit 4995734e973a2c2e9c6f6413cbad9913fc4df0dc
Author: Dan Williams <dan.j.williams(a)intel.com>
Date: Fri Jun 24 09:07:39 2016 -0700
acpi, nfit: fix acpi_check_dsm() vs zero functions implemented
QEMU 2.6 implements nascent support for nvdimm DSMs. Depending on
configuration it may only implement the function0 dsm to indicate that
no other DSMs are available. Commit 31eca76ba2fc "nfit, libnvdimm:
limited/whitelisted dimm command marshaling mechanism" breaks QEMU, but
QEMU is spec compliant. Per the spec the way to indicate that no
functions are supported is:
If Function Index is zero, the return is a buffer containing one bit
for each function index, starting with zero. Bit 0 indicates whether
there is support for any functions other than function 0 for the
specified UUID and Revision ID. If set to zero, no functions are
supported (other than function zero) for the specified UUID and
Revision ID.
Update the nfit driver to determine the family (interface UUID) without
requiring the implementation to define any other functions, i.e.
short-circuit acpi_check_dsm() to succeed per the spec. The nfit driver
appears to be the only user passing funcs==0 to acpi_check_dsm(), so
this behavior change of the common routine should be limited to the
probing done by the nfit driver.
Cc: Len Brown <lenb(a)kernel.org>
Cc: Jerry Hoemann <jerry.hoemann(a)hpe.com>
Acked-by: "Rafael J. Wysocki" <rafael(a)kernel.org>
Fixes: 31eca76ba2fc ("nfit, libnvdimm: limited/whitelisted dimm command marshaling mechanism")
Reported-by: Xiao Guangrong <guangrong.xiao(a)linux.intel.com>
Tested-by: Xiao Guangrong <guangrong.xiao(a)linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit 023954351fae0e34ba247cff4d798c98290b20a4
Author: Eric Sandeen <sandeen(a)redhat.com>
Date: Thu Jun 23 16:54:46 2016 -0500
dax: fix offset overflow in dax_io
This isn't functionally apparent for some reason, but
when we test io at extreme offsets at the end of the loff_t
rang, such as in fstests xfs/071, the calculation of
"max" in dax_io() can be wrong due to pos + size overflowing.
For example,
# xfs_io -c "pwrite 9223372036854771712 512" /mnt/test/file
enters dax_io with:
start 0x7ffffffffffff000
end 0x7ffffffffffff200
and the rounded up "size" variable is 0x1000. This yields:
pos + size 0x8000000000000000 (overflows loff_t)
end 0x7ffffffffffff200
Due to the overflow, the min() function picks the wrong
value for the "max" variable, and when we send (max - pos)
into i.e. copy_from_iter_pmem() it is also the wrong value.
This somehow(tm) gets magically absorbed without incident,
probably because iter->count is correct. But it seems best
to fix it up properly by comparing the two values as
unsigned.
Signed-off-by: Eric Sandeen <sandeen(a)redhat.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit 1bcbf42d2732b3fdaa8559b0dfc91567769e23c8
Author: Dan Williams <dan.j.williams(a)intel.com>
Date: Wed Jun 29 11:19:32 2016 -0700
nfit: fix format interface code byte order
Per JEDEC Annex L Release 3 the SPD data is:
Bits 9~5 00 000 = Function Undefined
00 001 = Byte addressable energy backed
00 010 = Block addressed
00 011 = Byte addressable, no energy backed
All other codes reserved
Bits 4~0 0 0000 = Proprietary interface
0 0001 = Standard interface 1
All other codes reserved; see Definitions of Functions
...and per the ACPI 6.1 spec:
byte0: Bits 4~0 (0 or 1)
byte1: Bits 9~5 (1, 2, or 3)
...so a format interface code displayed as 0x301 should be stored in the
nfit as (0x1, 0x3), little-endian.
Cc: Toshi Kani <toshi.kani(a)hpe.com>
Cc: Rafael J. Wysocki <rjw(a)rjwysocki.net>
Cc: Robert Moore <robert.moore(a)intel.com>
Cc: Robert Elliott <elliott(a)hpe.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=121161
Fixes: 30ec5fd464d5 ("nfit: fix format interface code byte order per ACPI6.1")
Fixes: 5ad9a7fde07a ("acpi/nfit: Update nfit driver to comply with ACPI 6.1")
Reported-by: Kristin Jacque <kristin.jacque(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
4 years, 9 months