linux-stable/drivers/nvdimm
Dan Williams 2522afb86a libnvdimm/region: Introduce an 'align' attribute
The align attribute applies an alignment constraint for namespace
creation in a region. Whereas the 'align' attribute of a namespace
applied alignment padding via an info block, the 'align' attribute
applies alignment constraints to the free space allocation.

The default for 'align' is the maximum known memremap_compat_align()
across all archs (16MiB from PowerPC at time of writing) multiplied by
the number of interleave ways if there is blk-aliasing. The minimum is
PAGE_SIZE and allows for the creation of cross-arch incompatible
namespaces, just as previous kernels allowed, but the expectation is
cross-arch and mode-independent compatibility by default.

The regression risk with this change is limited to cases that were
dependent on the ability to create unaligned namespaces, *and* for some
reason are unable to opt-out of aligned namespaces by writing to
'regionX/align'. If such a scenario arises the default can be flipped
from opt-out to opt-in of compat-aligned namespace creation, but that is
a last resort. The kernel will otherwise continue to support existing
defined misaligned namespaces.

Unfortunately this change needs to touch several parts of the
implementation at once:

- region/available_size: expand busy extents to current align
- region/max_available_extent: expand busy extents to current align
- namespace/size: trim free space to current align

...to keep the free space accounting conforming to the dynamic align
setting.

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reported-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Link: https://lore.kernel.org/r/158041478371.3889308.14542630147672668068.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2020-03-17 12:23:21 -07:00
..
badrange.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
blk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
btt.c libnvdimm/btt: fix variable 'rc' set but not used 2019-11-17 09:17:38 -08:00
btt.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
btt_devs.c libnvdimm: Move attribute groups to device type 2019-11-17 09:17:38 -08:00
bus.c libnvdimm for 5.5 2019-12-01 18:43:25 -08:00
claim.c libnvdimm/namespace: Differentiate between probe mapping and runtime mapping 2019-11-14 19:08:47 -08:00
core.c libnvdimm for 5.5 2019-12-01 18:43:25 -08:00
dax_devs.c libnvdimm: Move attribute groups to device type 2019-11-17 09:17:38 -08:00
dimm.c libnvdimm/region: Introduce NDD_LABELING 2020-03-17 12:23:21 -07:00
dimm_devs.c libnvdimm/region: Introduce an 'align' attribute 2020-03-17 12:23:21 -07:00
e820.c libnvdimm: Move nvdimm_bus_attribute_group to device_type 2019-11-19 09:52:12 -08:00
Kconfig lib: Uplevel the pmem "region" ida to a global allocator 2019-11-07 15:44:29 +01:00
label.c libnvdimm/label: Remove the dpa align check 2019-09-05 16:11:14 -07:00
label.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
Makefile libnvdimm: Enable unit test infrastructure compile checks 2019-09-07 04:28:05 -03:00
namespace_devs.c libnvdimm/region: Introduce an 'align' attribute 2020-03-17 12:23:21 -07:00
nd-core.h libnvdimm for 5.5 2019-12-01 18:43:25 -08:00
nd.h libnvdimm/region: Introduce an 'align' attribute 2020-03-17 12:23:21 -07:00
nd_virtio.c virtio_pmem: fix sparse warning 2019-07-16 19:44:26 -07:00
of_pmem.c libnvdimm: Move nvdimm_bus_attribute_group to device_type 2019-11-19 09:52:12 -08:00
pfn.h libnvdimm/namespace: Enforce memremap_compat_align() 2020-03-17 12:23:21 -07:00
pfn_devs.c libnvdimm/namespace: Enforce memremap_compat_align() 2020-03-17 12:23:21 -07:00
pmem.c mm: Cleanup __put_devmap_managed_page() vs ->page_free() 2020-01-31 10:30:37 -08:00
pmem.h libnvdimm, pmem: Restore page attributes when clearing errors 2018-08-20 09:22:45 -07:00
region.c libnvdimm/region: Initialize bad block for volatile namespaces 2019-09-24 10:27:51 -07:00
region_devs.c libnvdimm/region: Introduce an 'align' attribute 2020-03-17 12:23:21 -07:00
security.c libnvdimm: prevent nvdimm from requesting key when security is disabled 2019-09-24 10:30:10 -07:00
virtio_pmem.c virtio-pmem: Add virtio pmem driver 2019-07-05 15:19:10 -07:00
virtio_pmem.h virtio-pmem: Add virtio pmem driver 2019-07-05 15:19:10 -07:00