linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: nvdimm@lists.linux.dev
Cc: robert.hu@linux.intel.com, vishal.l.verma@intel.com, hch@lst.de,
	linux-acpi@vger.kernel.org
Subject: [PATCH 1/6] nvdimm/region: Fix default alignment for small regions
Date: Wed, 09 Mar 2022 19:49:21 -0800	[thread overview]
Message-ID: <164688416128.2879318.17890707310125575258.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <164688415599.2879318.17035042246954533659.stgit@dwillia2-desk3.amr.corp.intel.com>

In preparation for removing BLK aperture support the NVDIMM unit tests
discovered that the default alignment can be set higher than the
capacity of the region. Fall back to PAGE_SIZE in that case.

Given this has not been seen in the wild, elide notifying -stable.

Fixes: 2522afb86a8c ("libnvdimm/region: Introduce an 'align' attribute")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/region_devs.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index 9ccf3d608799..70ad891a76ba 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -1025,6 +1025,9 @@ static unsigned long default_align(struct nd_region *nd_region)
 		}
 	}
 
+	if (nd_region->ndr_size < MEMREMAP_COMPAT_ALIGN_MAX)
+		align = PAGE_SIZE;
+
 	mappings = max_t(u16, 1, nd_region->ndr_mappings);
 	div_u64_rem(align, mappings, &remainder);
 	if (remainder)


  reply	other threads:[~2022-03-10  3:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  3:49 [PATCH 0/6] libnvdimm: Jettison block-aperture-window support Dan Williams
2022-03-10  3:49 ` Dan Williams [this message]
2022-03-10  7:09   ` [PATCH 1/6] nvdimm/region: Fix default alignment for small regions Christoph Hellwig
2022-03-10  3:49 ` [PATCH 2/6] nvdimm/blk: Delete the block-aperture window driver Dan Williams
2022-03-10  7:10   ` Christoph Hellwig
2022-03-10  3:49 ` [PATCH 3/6] nvdimm/namespace: Delete blk namespace consideration in shared paths Dan Williams
2022-03-10  7:10   ` Christoph Hellwig
2022-03-10  3:49 ` [PATCH 4/6] nvdimm/namespace: Delete nd_namespace_blk Dan Williams
2022-03-10  7:10   ` Christoph Hellwig
2022-03-10  3:49 ` [PATCH 5/6] ACPI: NFIT: Remove block aperture support Dan Williams
2022-03-10  7:11   ` Christoph Hellwig
2022-03-10  3:49 ` [PATCH 6/6] nvdimm/region: Delete nd_blk_region infrastructure Dan Williams
2022-03-10  7:11   ` Christoph Hellwig
2022-05-03  3:43   ` Eugene Syromiatnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164688416128.2879318.17890707310125575258.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=hch@lst.de \
    --cc=linux-acpi@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=robert.hu@linux.intel.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).