All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: linux-nvdimm@lists.01.org
Cc: Joao Martins <joao.m.martins@oracle.com>
Subject: [PATCH daxctl v2 4/5] daxctl: add align support in create-device
Date: Wed, 16 Dec 2020 22:48:32 +0000	[thread overview]
Message-ID: <20201216224833.6229-5-joao.m.martins@oracle.com> (raw)
In-Reply-To: <20201216224833.6229-1-joao.m.martins@oracle.com>

Allow changing devices alignment when creating
a new child device.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 Documentation/daxctl/daxctl-create-device.txt | 8 ++++++++
 daxctl/device.c                               | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/daxctl/daxctl-create-device.txt b/Documentation/daxctl/daxctl-create-device.txt
index 648d2541f833..adc7b395125e 100644
--- a/Documentation/daxctl/daxctl-create-device.txt
+++ b/Documentation/daxctl/daxctl-create-device.txt
@@ -87,6 +87,14 @@ OPTIONS
 
 	The size must be a multiple of the region alignment.
 
+-a::
+--align::
+	Applications that want to establish dax memory mappings with
+	page table entries greater than system base page size (4K on
+	x86) need a device that is sufficiently aligned. This defaults
+	to 2M. Note that "devdax" mode enforces all mappings to be
+	aligned to this value, i.e. it fails unaligned mapping attempts.
+
 -u::
 --human::
 	By default the command will output machine-friendly raw-integer
diff --git a/daxctl/device.c b/daxctl/device.c
index a5394577908d..3c2d4e3d8b48 100644
--- a/daxctl/device.c
+++ b/daxctl/device.c
@@ -216,6 +216,8 @@ static const char *parse_device_options(int argc, const char **argv,
 	case ACTION_CREATE:
 		if (param.size)
 			size = __parse_size64(param.size, &units);
+		if (param.align)
+			align = __parse_size64(param.align, &units);
 		/* fall through */
 	case ACTION_ONLINE:
 		if (param.no_movable)
@@ -538,6 +540,12 @@ static int do_create(struct daxctl_region *region, long long val,
 	if (val <= 0)
 		return -ENOSPC;
 
+	if (align > 0) {
+		rc = daxctl_dev_set_align(dev, align);
+		if (rc < 0)
+			return rc;
+	}
+
 	rc = daxctl_dev_set_size(dev, val);
 	if (rc < 0)
 		return rc;
-- 
1.8.3.1
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

  parent reply	other threads:[~2020-12-16 22:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 22:48 [PATCH daxctl v2 0/5] daxctl: device align support Joao Martins
2020-12-16 22:48 ` [PATCH daxctl v2 1/5] daxctl: add daxctl_dev_{get,set}_align() Joao Martins
2020-12-16 22:48 ` [PATCH daxctl v2 2/5] util/json: Print device align Joao Martins
2020-12-16 22:48 ` [PATCH daxctl v2 3/5] daxctl: add align support in reconfigure-device Joao Martins
2020-12-16 22:48 ` Joao Martins [this message]
2020-12-16 22:48 ` [PATCH daxctl v2 5/5] daxctl/test: Add a test for daxctl-create with align Joao Martins
2020-12-17  0:48 ` [PATCH daxctl v2 0/5] daxctl: device align support Verma, Vishal L

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=20201216224833.6229-5-joao.m.martins@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=linux-nvdimm@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.