Patch "libnvdimm, dax: fix 1GB-aligned namespaces vs physical misalignment" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
libnvdimm, dax: fix 1GB-aligned namespaces vs physical misalignment
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
libnvdimm-dax-fix-1gb-aligned-namespaces-vs-physical-misalignment.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
41fce90f26333c4fa82e8e43b9ace86c4e8a0120Mon Sep 17 00:00:00 2001
From: Dan Williams <[email protected]>
Date: Mon, 4 Dec 2017 14:07:43 -0800
Subject: libnvdimm, dax: fix 1GB-aligned namespaces vs physical misalignment
From: Dan Williams <[email protected]>
commit 41fce90f26333c4fa82e8e43b9ace86c4e8a0120 upstream.
The following namespace configuration attempt:
# ndctl create-namespace -e namespace0.0 -m devdax -a 1G -f
libndctl: ndctl_dax_enable: dax0.1: failed to enable
Error: namespace0.0: failed to enablefailed to reconfigure namespace: No such device or address
...fails when the backing memory range is not physically aligned to 1G:
# cat /proc/iomem | grep Persistent
210000000-30fffffff : Persistent Memory (legacy)In the above example the 4G persistent memory range starts and ends on a 256MB boundary.
We handle this case correctly when needing to handle cases that violate section alignment (128MB) collisions against "System RAM", and we simply need to extend that padding/truncation for the 1GB alignment use case.
--- drivers/nvdimm/pfn_devs.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/nvdimm/pfn_devs.c +12 -3
@@ -562,6 +562,12 @@ static struct vmem_altmap *__nvdimm_setureturn altmap; } +static u64 phys_pmem_align_down (struct nd_pfn *nd_pfn,u64 phys) +{ +return min_t (u64,PHYS_SECTION_ALIGN_DOWN (phys), +ALIGN_DOWN (phys, nd_pfn->align)); +} +static int nd_pfn_init (struct nd_pfn *nd_pfn) {u32 dax_label_reserve =is_nd_dax (&nd_pfn->dev) ?SZ_128K :0 ;
@@ -617,13 +623,16 @@ static int nd_pfn_init(struct nd_pfn *nd start = nsio->res.start; size =PHYS_SECTION_ALIGN_UP (start + size) - start;if (region_intersects (start, size,IORESOURCE_SYSTEM_RAM , -IORES_DESC_NONE ) ==REGION_MIXED ) { +IORES_DESC_NONE ) ==REGION_MIXED + || !IS_ALIGNED (start +resource_size (&nsio->res), + nd_pfn->align)) { size =resource_size (&nsio->res); - end_trunc = start + size -PHYS_SECTION_ALIGN_DOWN (start + size); + end_trunc = start + size -phys_pmem_align_down (nd_pfn, + start + size); }if (start_pad + end_trunc) -dev_info (&nd_pfn->dev,"%s section collision, truncate %d bytes\n" , +dev_info (&nd_pfn->dev,"%s alignment collision, truncate %d bytes\n" ,dev_name (&ndns->dev), start_pad + end_trunc);/*
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/libnvdimm-pfn-fix-start_pad-handling-for-aligned-namespaces.patch queue-4.9/libnvdimm-dax-fix-1gb-aligned-namespaces-vs-physical-misalignment.patch queue-4.9/acpi-nfit-fix-health-event-notification.patch
Greg KH
maintainerQuoted 8 lines · On Wed, Dec 27, 2017 at 04:22:06PM +0100, [email protected] wrote:
This is a note to let you know that I've just added the patch titled
libnvdimm, dax: fix 1GB-aligned namespaces vs physical misalignment
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
Quoted 6 lines
The filename of the patch is:
libnvdimm-dax-fix-1gb-aligned-namespaces-vs-physical-misalignment.patch
and it can be found in the queue-4.9 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Breaks the build, now dropped :(