[PATCH] libnvdimm, nfit: report multiple interface codes per-dimm
by Dan Williams
Starting with ACPI 6.1 an NFIT table will report multiple 'NVDIMM
Control Region Structure' instances per-dimm, one for each supported
format interface. Report that code in the following format in sysfs:
nmemX/nfit/formats
nmemX/nfit/format
nmemX/nfit/format1
nmemX/nfit/format2
...
nmemX/nfit/formatN
Where format2 - formatN are theoretical as there are no known DIMMs with
support for more than two interface formats.
This layout is compatible with existing libndctl binaries that only
expect one code per-dimm as they will ignore nmemX/nfit/formats and
nmemX/nfit/formatN.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
drivers/acpi/nfit.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++--
drivers/acpi/nfit.h | 1 +
2 files changed, 71 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index d0f35e63640b..239556126051 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -655,6 +655,7 @@ static int nfit_mem_dcr_init(struct acpi_nfit_desc *acpi_desc,
if (!nfit_mem)
return -ENOMEM;
INIT_LIST_HEAD(&nfit_mem->list);
+ nfit_mem->acpi_desc = acpi_desc;
list_add(&nfit_mem->list, &acpi_desc->dimms);
}
@@ -838,6 +839,18 @@ static ssize_t device_show(struct device *dev,
}
static DEVICE_ATTR_RO(device);
+static int num_nvdimm_formats(struct nvdimm *nvdimm)
+{
+ struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
+ int formats = 0;
+
+ if (nfit_mem->memdev_pmem)
+ formats++;
+ if (nfit_mem->memdev_bdw)
+ formats++;
+ return formats;
+}
+
static ssize_t format_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -847,6 +860,56 @@ static ssize_t format_show(struct device *dev,
}
static DEVICE_ATTR_RO(format);
+static ssize_t format1_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ u32 handle;
+ ssize_t rc = -ENXIO;
+ struct nfit_mem *nfit_mem;
+ struct nfit_memdev *nfit_memdev;
+ struct acpi_nfit_desc *acpi_desc;
+ struct nvdimm *nvdimm = to_nvdimm(dev);
+ struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev);
+
+ nfit_mem = nvdimm_provider_data(nvdimm);
+ acpi_desc = nfit_mem->acpi_desc;
+ handle = to_nfit_memdev(dev)->device_handle;
+
+ /* assumes DIMMs have at most 2 published interface codes */
+ mutex_lock(&acpi_desc->init_mutex);
+ list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) {
+ struct acpi_nfit_memory_map *memdev = nfit_memdev->memdev;
+ struct nfit_dcr *nfit_dcr;
+
+ if (memdev->device_handle != handle)
+ continue;
+
+ dev_dbg(dev, "memdev: %d\n", memdev->region_index);
+ list_for_each_entry(nfit_dcr, &acpi_desc->dcrs, list) {
+ if (nfit_dcr->dcr->region_index != memdev->region_index)
+ continue;
+ if (nfit_dcr->dcr->code == dcr->code)
+ continue;
+ rc = sprintf(buf, "%#x\n", nfit_dcr->dcr->code);
+ break;
+ }
+ if (rc != ENXIO)
+ break;
+ }
+ mutex_unlock(&acpi_desc->init_mutex);
+ return rc;
+}
+static DEVICE_ATTR_RO(format1);
+
+static ssize_t formats_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct nvdimm *nvdimm = to_nvdimm(dev);
+
+ return sprintf(buf, "%d\n", num_nvdimm_formats(nvdimm));
+}
+static DEVICE_ATTR_RO(formats);
+
static ssize_t serial_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -876,6 +939,8 @@ static struct attribute *acpi_nfit_dimm_attributes[] = {
&dev_attr_vendor.attr,
&dev_attr_device.attr,
&dev_attr_format.attr,
+ &dev_attr_formats.attr,
+ &dev_attr_format1.attr,
&dev_attr_serial.attr,
&dev_attr_rev_id.attr,
&dev_attr_flags.attr,
@@ -886,11 +951,13 @@ static umode_t acpi_nfit_dimm_attr_visible(struct kobject *kobj,
struct attribute *a, int n)
{
struct device *dev = container_of(kobj, struct device, kobj);
+ struct nvdimm *nvdimm = to_nvdimm(dev);
- if (to_nfit_dcr(dev))
- return a->mode;
- else
+ if (!to_nfit_dcr(dev))
+ return 0;
+ if (a == &dev_attr_format1.attr && num_nvdimm_formats(nvdimm) <= 1)
return 0;
+ return a->mode;
}
static struct attribute_group acpi_nfit_dimm_attribute_group = {
diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h
index c75576b2d50e..5201840c1147 100644
--- a/drivers/acpi/nfit.h
+++ b/drivers/acpi/nfit.h
@@ -109,6 +109,7 @@ struct nfit_mem {
struct nfit_flush *nfit_flush;
struct list_head list;
struct acpi_device *adev;
+ struct acpi_nfit_desc *acpi_desc;
unsigned long dsm_mask;
};
6 years, 2 months
DDR4 NVDIMM
by Prashant Tawade
Hi,
I am testing the DDR4 NVDIMM on Debian 4.5.0-rc7. I enabled X86_PMEM_LEGACY, ACPI_NFIT and ACPI_NFIT_DEBUG with "make menuconfig". BIOS displays the following message
Just added 4G of Persistent (ADR) memory at =0x100000000
Just added 4G of Persistent (ADR) memory at =0x200000000
Just added 4G of Persistent (ADR) memory at =0x300000000
Just added 0x80000000 of Persistent (ADR) memory at =0x480000000
But, I do not see any persistent or protected memory with "dmesg | grep e820". There are no debug messages with any errors showing on screen or in the kernel log. How do I debug this?
Where does the data hand-off from BIOS/UEFI to kernel taking place? How do I trace the debug path for X86_PMEM_LEGACY and how does it work with/without ACPI_NFIT enabled?
Prashant
6 years, 2 months
[ndctl PATCH] ndctl: more rpmlint fixes
by Dan Williams
Fedora rpmlint says:
ndctl.src:2: W: mixed-use-of-spaces-and-tabs (spaces: line 1, tab: line 2)
ndctl-libs.x86_64: W: non-standard-group System/Libraries
ndctl-devel.x86_64: W: non-standard-group Development/Libraries/Other
ndctl.x86_64: W: non-standard-group Hardware/Other
ndctl.x86_64: W: incoherent-version-in-changelog an.j.williams(a)intel.com ['52-1.fc23', '52-1']
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
ndctl.spec.in | 55 ++++++++++++++++++++++++++-----------------------------
1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/ndctl.spec.in b/ndctl.spec.in
index e24b31cc54f0..0bdd2463698c 100644
--- a/ndctl.spec.in
+++ b/ndctl.spec.in
@@ -1,22 +1,22 @@
-Name: ndctl
+Name: ndctl
Version: VERSION
-Release: 1%{?dist}
+Release: 1%{?dist}
Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory)
-License: GPLv2
-Group: Hardware/Other
-Url: https://github.com/pmem/ndctl
-Source0: https://github.com/pmem/ndctl/archive/v%{version}.tar.gz
-
-BuildRequires: autoconf
-BuildRequires: asciidoc
-BuildRequires: xmlto
-BuildRequires: automake
-BuildRequires: libtool
-BuildRequires: pkgconfig
-BuildRequires: pkgconfig(libkmod)
-BuildRequires: pkgconfig(libudev)
-BuildRequires: pkgconfig(uuid)
-BuildRequires: pkgconfig(json-c)
+License: GPLv2
+Group: System Environment/Base
+Url: https://github.com/pmem/ndctl
+Source0: https://github.com/pmem/ndctl/archive/v%{version}.tar.gz
+
+BuildRequires: autoconf
+BuildRequires: asciidoc
+BuildRequires: xmlto
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: pkgconfig
+BuildRequires: pkgconfig(libkmod)
+BuildRequires: pkgconfig(libudev)
+BuildRequires: pkgconfig(uuid)
+BuildRequires: pkgconfig(json-c)
%description
Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
@@ -26,10 +26,10 @@ Firmware Interface Table).
%package -n DNAME
-Summary: Development files for libndctl
-License: LGPLv2
-Group: Development/Libraries/Other
-Requires: LNAME%{?_isa} = %{version}-%{release}
+Summary: Development files for libndctl
+License: LGPLv2
+Group: Development/Libraries
+Requires: LNAME%{?_isa} = %{version}-%{release}
%description -n DNAME
The %{name}-devel package contains libraries and header files for
@@ -37,9 +37,9 @@ developing applications that use %{name}.
%package -n LNAME
-Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory)
-License: LGPLv2
-Group: System/Libraries
+Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory)
+License: LGPLv2
+Group: System Environment/Libraries
%description -n LNAME
Libraries for %{name}.
@@ -84,8 +84,5 @@ make check
%{_libdir}/pkgconfig/libndctl.pc
%changelog
-* Wed Sep 09 2015 dan.j.williams(a)intel.com
-- Stop emitting git commit info by default
-
-* Mon Aug 03 2015 dan.j.williams(a)intel.com
-- Initial rpm release
+* Mon Apr 04 2016 Dan Williams <dan.j.williams(a)intel.com> - 52-1
+- Initial rpm submission to Fedora
6 years, 2 months
[PATCH 0/5] dax: handling of media errors
by Vishal Verma
Until now, dax has been disabled if media errors were found on
any device. This series attempts to address that.
The first three patches from Dan re-enable dax even when media
errors are present.
The fourth patch from Matthew removes the
zeroout path from dax entirely, making zeroout operations always
go through the driver (The motivation is that if a backing device
has media errors, and we create a sparse file on it, we don't
want the initial zeroing to happen via dax, we want to give the
block driver a chance to clear the errors).
The fifth patch changes the behaviour of dax_do_io by adding a
wrapper around it that is passed all the arguments also needed by
__blockdev_do_direct_IO. If (the new) __dax_do_io fails with -EIO
due to a bad block, we simply retry with the direct_IO path which
forces the IO to go through the block driver, and can attempt to
clear the error.
Dan Williams (3):
block, dax: pass blk_dax_ctl through to drivers
dax: fallback from pmd to pte on error
dax: enable dax in the presence of known media errors (badblocks)
Vishal Verma (2):
dax: use sb_issue_zerout instead of calling dax_clear_sectors
dax: handle media errors in dax_do_io
arch/powerpc/sysdev/axonram.c | 10 +++----
block/ioctl.c | 9 ------
drivers/block/brd.c | 9 +++---
drivers/nvdimm/pmem.c | 17 ++++++++---
drivers/s390/block/dcssblk.c | 12 ++++----
fs/block_dev.c | 7 +++--
fs/dax.c | 70 +++++++++++++++++++++----------------------
fs/ext2/inode.c | 12 ++++----
fs/ext4/indirect.c | 11 ++++---
fs/ext4/inode.c | 5 ++--
fs/xfs/xfs_aops.c | 7 +++--
fs/xfs/xfs_bmap_util.c | 9 ------
include/linux/blkdev.h | 3 +-
include/linux/dax.h | 7 +++--
14 files changed, 93 insertions(+), 95 deletions(-)
--
2.5.5
6 years, 2 months