daxctl: Add device align and range mapping allocation
cover daxctl: Add device align and range mapping allocation
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.
3) Allow creating devices from selecting ranges. This allows to keep the same GPA->HPA mapping as before we kexec the hypervisor with running guests:
daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.json
The JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>
But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/
The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
Joao
Joao Martins (8):
daxctl: add daxctl_dev_{get,set}_align() util/json: Print device align
daxctl: add align support in reconfigure-device
daxctl: add align support in create-device
libdaxctl: add mapping iterator APIs
daxctl: include mappings when listing
libdaxctl: add daxctl_dev_set_mapping()
daxctl: Allow restore devices from JSON metadata
daxctl/device.c | 154 +++++++++++++++++++++++++++++++++++++++-- daxctl/lib/libdaxctl-private.h | 9 +++ daxctl/lib/libdaxctl.c | 152 +++++++++++++++++++++++++++++++++++++++- daxctl/lib/libdaxctl.sym | 9 +++ daxctl/libdaxctl.h | 16 +++++ util/json.c | 63 ++++++++++++++++- util/json.h | 3 + 7 files changed, 396 insertions(+), 10 deletions(-)
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 1/8 daxctl: add daxctl_dev_{get,set}_align()
Add support for changing devices alignment.
--- daxctl/lib/libdaxctl-private.h | 1 + daxctl/lib/libdaxctl.c | 34 ++++++++++++++++++++++++++++++++++ daxctl/lib/libdaxctl.sym | 2 ++ daxctl/libdaxctl.h | 2 ++ 4 files changed, 39 insertions(+)
daxctl/lib/libdaxctl-private.h +1 -0
@@ -99,6 +99,7 @@ struct daxctl_dev {struct list_node list;unsigned long long resource;unsigned long long size; +unsigned long align;struct kmod_module *module;struct daxctl_region *region;struct daxctl_memory *mem;
daxctl/lib/libdaxctl.c +34 -0
@@ -498,6 +498,11 @@ static void *add_dax_dev(void *parent, int id, const char *daxdev_base) goto err_read; dev->size =strtoull (buf,NULL ,0 ); +sprintf (path,"%s/align" , daxdev_base); +if (sysfs_read_attr (ctx, path, buf) <0 ) + goto err_read; + dev->align =strtoull (buf,NULL ,0 ); + dev->dev_path =strdup (daxdev_base);if (!dev->dev_path) goto err_read;
@@ -1086,6 +1091,35 @@ DAXCTL_EXPORT int daxctl_dev_set_size(struct daxctl_dev *dev, unsigned long longreturn 0 ; } +DAXCTL_EXPORT unsigned long daxctl_dev_get_align (struct daxctl_dev *dev) +{ +return dev->align; +} + +DAXCTL_EXPORT int daxctl_dev_set_align(struct daxctl_dev *dev, unsigned long align) +{ +struct daxctl_ctx *ctx =daxctl_dev_get_ctx (dev); +char buf[SYSFS_ATTR_SIZE ]; +char *path = dev->dev_buf; +int len = dev->buf_len; + +if (snprintf (path, len,"%s/align" , dev->dev_path) >= len) { +err (ctx,"%s: buffer too small!\n" , +daxctl_dev_get_devname (dev)); +return -ENXIO ; + } + +sprintf (buf,"%#lx\n" , align); +if (sysfs_write_attr (ctx, path, buf) <0 ) { +err (ctx,"%s: failed to set align\n" , +daxctl_dev_get_devname (dev)); +return -ENXIO ; + } + + dev->align = align; +return 0 ; +} + DAXCTL_EXPORT int daxctl_dev_get_target_node(struct daxctl_dev *dev) {return dev->target_node;
daxctl/lib/libdaxctl.sym +2 -0
@@ -81,4 +81,6 @@ global: daxctl_dev_set_size; daxctl_region_create_dev; daxctl_region_destroy_dev; + daxctl_dev_get_align; + daxctl_dev_set_align; } LIBDAXCTL_7;
daxctl/libdaxctl.h +2 -0
@@ -71,6 +71,8 @@ int daxctl_dev_get_minor(struct daxctl_dev *dev);unsigned long long daxctl_dev_get_resource (struct daxctl_dev *dev);unsigned long long daxctl_dev_get_size (struct daxctl_dev *dev);int daxctl_dev_set_size (struct daxctl_dev *dev,unsigned long long size); +unsigned long daxctl_dev_get_align (struct daxctl_dev *dev); +int daxctl_dev_set_align (struct daxctl_dev *dev,unsigned long align);struct daxctl_ctx *daxctl_dev_get_ctx (struct daxctl_dev *dev);int daxctl_dev_is_enabled (struct daxctl_dev *dev);int daxctl_dev_disable (struct daxctl_dev *dev);
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 2/8 util/json: Print device align
In reply to Joao MartinsFetch device align and include it on listings.
--- util/json.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
util/json.c +8 -1
@@ -278,7 +278,7 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,struct daxctl_memory *mem =daxctl_dev_get_memory (dev);const char *devname =daxctl_dev_get_devname (dev);struct json_object *jdev, *jobj; -int node, movable; +int node, movable, align; jdev =json_object_new_object ();if (!devname || !jdev)
@@ -299,6 +299,13 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,json_object_object_add (jdev,"target_node" , jobj); } + align =daxctl_dev_get_align (dev); +if (align >0 ) { + jobj =util_json_object_size (daxctl_dev_get_align (dev), flags); +if (jobj) +json_object_object_add (jdev,"align" , jobj); + } +if (mem) jobj =json_object_new_string ("system-ram" );else
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 3/8 daxctl: add align support in reconfigure-device
In reply to Joao MartinsAdd an alignment option to reconfigure-device and use the newly added libdaxctl API to set the alignment of the device prior to setting size.
--- daxctl/device.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
daxctl/device.c +16 -3
@@ -22,6 +22,7 @@ static struct {const char *mode;const char *region;const char *size; +const char *align;bool no_online;bool no_movable;bool force;
@@ -36,6 +37,7 @@ enum dev_mode { };static enum dev_mode reconfig_mode =DAXCTL_DEV_MODE_UNKNOWN ; +static long long align =-1 ;static long long size =-1 ;static unsigned long flags;
@@ -68,7 +70,8 @@ OPT_BOOLEAN('f', "force", ¶m.force, \ "attempt to offline memory sections before reconfiguration")#define CREATE_OPTIONS () \ -OPT_STRING('s', "size", ¶m.size, "size", "size to switch the device to") +OPT_STRING('s', "size", ¶m.size, "size", "size to switch the device to"), \ +OPT_STRING('a', "align", ¶m.align, "align", "alignment to switch the device to")#define DESTROY_OPTIONS () \ OPT_BOOLEAN('f', "force", ¶m.force, \
@@ -185,8 +188,10 @@ static const char *parse_device_options(int argc, const char **argv,/* Handle action-specific options */ switch (action) {case ACTION_RECONFIG : -if (!param.size && !param.mode) { -fprintf (stderr,"error: a 'mode' or 'size' option is required\n" ); +if (!param.size && + !param.align && + !param.mode) { +fprintf (stderr,"error: a 'align', 'mode' or 'size' option is required\n" );usage_with_options (u, reconfig_options); rc = -EINVAL ; }
@@ -204,6 +209,8 @@ static const char *parse_device_options(int argc, const char **argv, rc = -EINVAL ; } } +if (param.align) + align =__parse_size64 (param.align, &units);break ;case ACTION_CREATE :if (param.size)
@@ -558,6 +565,12 @@ static int do_reconfig(struct daxctl_dev *dev, enum dev_mode mode,struct json_object *jdev;int rc =0 ; +if (align >0 ) { + rc =daxctl_dev_set_align (dev, align); +if (rc <0 ) +return rc; + } +if (size >=0 ) { rc =dev_resize (dev, size);return rc;
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 4/8 daxctl: add align support in create-device
In reply to Joao MartinsAnd thus allow changing devices alignment when creating a new child device.
--- daxctl/device.c | 8 ++++++++ 1 file changed, 8 insertions(+)
daxctl/device.c +8 -0
@@ -215,6 +215,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)
@@ -537,6 +539,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;
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 5/8 libdaxctl: add mapping iterator APIs
In reply to Joao MartinsAdd the following APIs to be able to iterate over a dynamic device-dax mapping list, as well as fetching each of the mapping attributes.
--- daxctl/lib/libdaxctl-private.h | 8 ++++ daxctl/lib/libdaxctl.c | 91 +++++++++++++++++++++++++++++++++++++++++- daxctl/lib/libdaxctl.sym | 6 +++ daxctl/libdaxctl.h | 12 ++++++ 4 files changed, 116 insertions(+), 1 deletion(-)
daxctl/lib/libdaxctl-private.h +8 -0
@@ -91,6 +91,12 @@ struct daxctl_region {struct list_head devices; }; +struct daxctl_mapping { +struct daxctl_dev *dev; +unsigned long long pgoff, start, end; +struct list_node list; +}; +struct daxctl_dev {int id, major, minor;void *dev_buf;
@@ -104,6 +110,8 @@ struct daxctl_dev {struct daxctl_region *region;struct daxctl_memory *mem;int target_node; +int num_mappings; +struct list_head mappings; };struct daxctl_memory {
daxctl/lib/libdaxctl.c +90 -1
103 lines not on this page · raw message
daxctl/lib/libdaxctl.sym +6 -0
@@ -83,4 +83,10 @@ global: daxctl_region_destroy_dev; daxctl_dev_get_align; daxctl_dev_set_align; + daxctl_mapping_get_first; + daxctl_mapping_get_next; + daxctl_mapping_get_start; + daxctl_mapping_get_end; + daxctl_mapping_get_offset; + daxctl_mapping_get_size; } LIBDAXCTL_7;
daxctl/libdaxctl.h +12 -0
@@ -103,6 +103,18 @@ int daxctl_memory_online_no_movable(struct daxctl_memory *mem); region !=NULL ; \ region = daxctl_region_get_next(region)) +struct daxctl_mapping ; +struct daxctl_mapping *daxctl_mapping_get_first (struct daxctl_dev *dev); +struct daxctl_mapping *daxctl_mapping_get_next (struct daxctl_mapping *mapping); +#define daxctl_mapping_foreach (dev, mapping) \ + for (mapping = daxctl_mapping_get_first(dev); \ + mapping != NULL; \ + mapping = daxctl_mapping_get_next(mapping)) +unsigned long long daxctl_mapping_get_start (struct daxctl_mapping *mapping); +unsigned long long daxctl_mapping_get_end (struct daxctl_mapping *mapping); +unsigned long long daxctl_mapping_get_offset (struct daxctl_mapping *mapping); +unsigned long long daxctl_mapping_get_size (struct daxctl_mapping *mapping); + #ifdef __cplusplus }/* extern "C" */ #endif
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 6/8 daxctl: include mappings when listing
In reply to Joao MartinsIterate over the device mappings and print @page_offset,
@start, @end and a computed size.
---
Perhaps hiding it behind a -v|--verbose?
--- util/json.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- util/json.h | 3 +++ 2 files changed, 56 insertions(+), 1 deletion(-)
util/json.c +53 -1
@@ -277,7 +277,8 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev, {struct daxctl_memory *mem =daxctl_dev_get_memory (dev);const char *devname =daxctl_dev_get_devname (dev); -struct json_object *jdev, *jobj; +struct json_object *jdev, *jobj, *jmappings =NULL ; +struct daxctl_mapping *mapping =NULL ;int node, movable, align; jdev =json_object_new_object ();
@@ -331,6 +332,22 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,json_object_object_add (jdev,"state" , jobj); } + daxctl_mapping_foreach(dev, mapping) { +struct json_object *jmapping; + +if (!jmappings) { + jmappings =json_object_new_array (); +if (!jmappings) +continue ; + +json_object_object_add (jdev,"mappings" , jmappings); + } + + jmapping =util_daxctl_mapping_to_json (mapping, flags); +if (!jmapping) +continue ; +json_object_array_add (jmappings, jmapping); + }return jdev; }
@@ -1180,6 +1197,41 @@ struct json_object *util_mapping_to_json(struct ndctl_mapping *mapping,return NULL ; } +struct json_object *util_daxctl_mapping_to_json (struct daxctl_mapping *mapping, +unsigned long flags) +{ +struct json_object *jmapping =json_object_new_object (); +struct json_object *jobj; + +if (!jmapping) +return NULL ; + + jobj =util_json_object_hex (daxctl_mapping_get_offset (mapping), flags); +if (!jobj) + goto err; +json_object_object_add (jmapping,"page_offset" , jobj); + + jobj =util_json_object_hex (daxctl_mapping_get_start (mapping), flags); +if (!jobj) + goto err; +json_object_object_add (jmapping,"start" , jobj); + + jobj =util_json_object_hex (daxctl_mapping_get_end (mapping), flags); +if (!jobj) + goto err; +json_object_object_add (jmapping,"end" , jobj); + + jobj =util_json_object_size (daxctl_mapping_get_size (mapping), flags); +if (!jobj) + goto err; +json_object_object_add (jmapping,"size" , jobj); + +return jmapping; + err: +json_object_put (jmapping); +return NULL ; +} +struct json_object *util_badblock_rec_to_json (u64 block,u64 count,unsigned long flags) {
util/json.h +3 -0
@@ -15,6 +15,7 @@#include <stdio.h> #include <stdbool.h> #include <ndctl/libndctl.h> +#include <daxctl/libdaxctl.h> #include <ccan/short_types/short_types.h> enum util_json_flags {
@@ -36,6 +37,8 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm, unsigned long flags);struct json_object *util_mapping_to_json (struct ndctl_mapping *mapping,unsigned long flags); +struct json_object *util_daxctl_mapping_to_json (struct daxctl_mapping *mapping, +unsigned long flags);struct json_object *util_namespace_to_json (struct ndctl_namespace *ndns,unsigned long flags); struct json_object *util_badblock_rec_to_json(u64 block, u64 count,
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 7/8 libdaxctl: add daxctl_dev_set_mapping()
In reply to Joao MartinsThis API adds the ability to manually pick a range within the region device. Such routine allows for a admin to restore the mappings of a device after kexec. This is specially useful for hmem dynamic devdax which do not persistent ranges allocation through say a e.g. namespace label storage area. It also allows an userspace application to pick it's own ranges, should it want to avoid relying on kernel's policy.
--- daxctl/lib/libdaxctl.c | 27 +++++++++++++++++++++++++++ daxctl/lib/libdaxctl.sym | 1 + daxctl/libdaxctl.h | 2 ++ 3 files changed, 30 insertions(+)
daxctl/lib/libdaxctl.c +27 -0
@@ -1121,6 +1121,33 @@ DAXCTL_EXPORT int daxctl_dev_set_align(struct daxctl_dev *dev, unsigned long alireturn 0 ; } +DAXCTL_EXPORT int daxctl_dev_set_mapping(struct daxctl_dev *dev, +unsigned long long start, +unsigned long long end) +{ +struct daxctl_ctx *ctx =daxctl_dev_get_ctx (dev); +unsigned long long size = end - start +1 ; +char buf[SYSFS_ATTR_SIZE ]; +char *path = dev->dev_buf; +int len = dev->buf_len; + +if (snprintf (path, len,"%s/mapping" , dev->dev_path) >= len) { +err (ctx,"%s: buffer too small!\n" , +daxctl_dev_get_devname (dev)); +return -ENXIO ; + } + +sprintf (buf,"%#llx-%#llx\n" , start, end); +if (sysfs_write_attr (ctx, path, buf) <0 ) { +err (ctx,"%s: failed to set mapping\n" , +daxctl_dev_get_devname (dev)); +return -ENXIO ; + } + dev->size += size; + +return 0 ; +} + DAXCTL_EXPORT int daxctl_dev_get_target_node(struct daxctl_dev *dev) {return dev->target_node;
daxctl/lib/libdaxctl.sym +1 -0
@@ -89,4 +89,5 @@ global: daxctl_mapping_get_end; daxctl_mapping_get_offset; daxctl_mapping_get_size; + daxctl_dev_set_mapping; } LIBDAXCTL_7;
daxctl/libdaxctl.h +2 -0
@@ -73,6 +73,8 @@ unsigned long long daxctl_dev_get_size(struct daxctl_dev *dev);int daxctl_dev_set_size (struct daxctl_dev *dev,unsigned long long size);unsigned long daxctl_dev_get_align (struct daxctl_dev *dev);int daxctl_dev_set_align (struct daxctl_dev *dev,unsigned long align); +int daxctl_dev_set_mapping (struct daxctl_dev *dev,unsigned long long start, +unsigned long long end);struct daxctl_ctx *daxctl_dev_get_ctx (struct daxctl_dev *dev);int daxctl_dev_is_enabled (struct daxctl_dev *dev);int daxctl_dev_disable (struct daxctl_dev *dev);
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
PATCH 8/8 daxctl: Allow restore devices from JSON metadata
In reply to Joao MartinsAdd an option namely --restore which passes a parameter which is a JSON file path. The JSON file contains the data usually returned by:
$ daxctl list -d dax0.1
{
"chardev":"dax0.1",
"size":34359738368,
"target_node":0,
"align":1073741824,
"mode":"devdax",
"mappings":[
{
"page_offset":4194304,
"start":25769803776,
"end":42949672959,
"size":17179869184
},
{
"page_offset":0,
"start":8589934592,
"end":25769803775,
"size":17179869184
}
]
}For purposes of RFC, the input values in the mapping json are decimal for now. A device can then be created by specifying this same data to restore it e.g.
daxctl create-device -u --restore device.json
{
"chardev":"dax0.1",
"size":"32.00 GiB (34.36 GB)",
"target_node":0,
"align":"1024.00 MiB (1073.74 MB)",
"mode":"devdax",
"mappings":[
{
"page_offset":"0x400000",
"start":"0x600000000",
"end":"0x9ffffffff",
"size":"16.00 GiB (17.18 GB)"
},
{
"page_offset":"0",
"start":"0x200000000",
"end":"0x5ffffffff",
"size":"16.00 GiB (17.18 GB)"
}
]
}
created 1 deviceThis is handy as we are able to kexec and restore previously mappings that we had established.
--- daxctl/device.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 124 insertions(+), 5 deletions(-)
daxctl/device.c +124 -5
@@ -13,6 +13,7 @@#include <util/json.h> #include <util/filter.h> #include <json-c/json.h> +#include <json-c/json_util.h> #include <daxctl/libdaxctl.h> #include <util/parse-options.h> #include <ccan/array_size/array_size.h>
@@ -23,6 +24,7 @@ static struct {const char *region;const char *size;const char *align; +const char *restore;bool no_online;bool no_movable;bool force;
@@ -36,10 +38,16 @@ enum dev_mode { DAXCTL_DEV_MODE_RAM, }; +struct mapping { +unsigned long long start, end, pgoff; +}; +static enum dev_mode reconfig_mode =DAXCTL_DEV_MODE_UNKNOWN ;static long long align =-1 ;static long long size =-1 ;static unsigned long flags; +static struct mapping *maps =NULL ; +static long long nmaps =-1 ;enum memory_zone {MEM_ZONE_MOVABLE ,
@@ -71,7 +79,9 @@ OPT_BOOLEAN('f', "force", ¶m.force, \#define CREATE_OPTIONS () \ OPT_STRING('s', "size", ¶m.size, "size", "size to switch the device to"), \ -OPT_STRING('a', "align", ¶m.align, "align", "alignment to switch the device to") +OPT_STRING('a', "align", ¶m.align, "align", "alignment to switch the device to"), \ +OPT_STRING('\0', "restore", ¶m.restore, "restore", \ + "restore the device from device JSON")#define DESTROY_OPTIONS () \ OPT_BOOLEAN('f', "force", ¶m.force, \
@@ -124,6 +134,94 @@ static const struct option destroy_options[] = { OPT_END(), }; +static int sort_mappings (const void *a,const void *b) +{ +json_object **jsoa, **jsob; +struct json_object *va, *vb; +unsigned long long pga, pgb; + + jsoa = (json_object **)a; + jsob = (json_object **)b; +if (!*jsoa && !*jsob) +return 0 ; + +if (!json_object_object_get_ex (*jsoa,"page_offset" , &va) || + !json_object_object_get_ex (*jsob,"page_offset" , &vb)) +return 0 ; + + pga =json_object_get_int64 (va); + pgb =json_object_get_int64 (vb); + +return pga > pgb; +} + +static int parse_device_file (const char *filename) +{ +struct json_object *jobj, *jval =NULL , *jmappings =NULL ; +int i, len, rc = -EINVAL , region_id, id; +const char *chardev; +char *region =NULL ; +struct mapping *m; + + jobj =json_object_from_file (filename); +if (!jobj) +return rc; + +if (!json_object_object_get_ex (jobj,"align" , &jval)) +return rc; + param.align =json_object_get_string (jval); + +if (!json_object_object_get_ex (jobj,"size" , &jval)) +return rc; + param.size =json_object_get_string (jval); + +if (!json_object_object_get_ex (jobj,"chardev" , &jval)) +return rc; + chardev =json_object_get_string (jval); +if (sscanf (chardev,"dax%u.%u" , ®ion_id, &id) !=2 ) +return rc; +if (asprintf (®ion,"%u" , region_id) <0 ) +return rc; + param.region = region; + +if (!json_object_object_get_ex (jobj,"mappings" , &jmappings)) +return rc; +json_object_array_sort (jmappings, sort_mappings); + + len =json_object_array_length (jmappings); + m =calloc (len,sizeof (*m)); +if (!m) +return -ENOMEM ; + +for (i =0 ; i < len; i++) { +struct json_object *j, *val; + + j =json_object_array_get_idx (jmappings, i); +if (!j) + goto err; + +if (!json_object_object_get_ex (j,"start" , &val)) + goto err; + m[i].start =json_object_get_int64 (val); + +if (!json_object_object_get_ex (j,"end" , &val)) + goto err; + m[i].end =json_object_get_int64 (val); + +if (!json_object_object_get_ex (j,"page_offset" , &val)) + goto err; + m[i].pgoff =json_object_get_int64 (val); + } + maps = m; + nmaps = len; + rc =0 ; + +err: +if (!maps) +free (m); +return rc; +} +static const char *parse_device_options (int argc,const char **argv,enum device_action action,const struct option *options,const char *usage,struct daxctl_ctx *ctx)
@@ -213,6 +311,13 @@ static const char *parse_device_options(int argc, const char **argv, align =__parse_size64 (param.align, &units);break ;case ACTION_CREATE : +if (param.restore && + (rc =parse_device_file (param.restore)) !=0 ) { +fprintf (stderr, +"error: failed to parse device file: %s\n" , +strerror (-rc)); +break ; + }if (param.size) size =__parse_size64 (param.size, &units);if (param.align)
@@ -524,7 +629,8 @@ static int do_create(struct daxctl_region *region, long long val, {struct json_object *jdev;struct daxctl_dev *dev; -int rc =0 ; +int i, rc =0 ; +long long alloc =0 ;if (daxctl_region_create_dev (region))return -ENOSPC ;
@@ -545,9 +651,22 @@ static int do_create(struct daxctl_region *region, long long val,return rc; } - rc =daxctl_dev_set_size (dev, val); -if (rc <0 ) -return rc; +/* @maps is ordered by page_offset */ +for (i =0 ; i < nmaps; i++) { + rc =daxctl_dev_set_mapping (dev, maps[i].start, maps[i].end); +if (rc <0 ) +return rc; + alloc += (maps[i].end - maps[i].start +1 ); + } + +if (nmaps >0 && val >0 && alloc != val) { +fprintf (stderr,"%s: allocated %lld but specified size %lld\n" , +daxctl_dev_get_devname (dev), alloc, val); + }else { + rc =daxctl_dev_set_size (dev, val); +if (rc <0 ) +return rc; + } rc =daxctl_dev_enable_devdax (dev);if (rc) {
Signature · 4 lines
1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 30 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
Quoted 8 lines
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing daxctl-create.sh unit test for @align.
I will fix those and respin, and probably take out the last patch as it's more RFC-ish and in need of feedback.
Joao
Quoted 10 lines
Joao Martins (8):
daxctl: add daxctl_dev_{get,set}_align() util/json: Print device align
daxctl: add align support in reconfigure-device
daxctl: add align support in create-device
libdaxctl: add mapping iterator APIs
daxctl: include mappings when listing
libdaxctl: adddaxctl_dev_set_mapping()
daxctl: Allow restore devices from JSON metadata
Quoted 9 lines
daxctl/device.c | 154 +++++++++++++++++++++++++++++++++++++++-- daxctl/lib/libdaxctl-private.h | 9 +++ daxctl/lib/libdaxctl.c | 152 +++++++++++++++++++++++++++++++++++++++- daxctl/lib/libdaxctl.sym | 9 +++ daxctl/libdaxctl.h | 16 +++++ util/json.c | 63 ++++++++++++++++- util/json.h | 3 + 7 files changed, 396 insertions(+), 10 deletions(-)
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Verma, Vishal L
maintainerQuoted 37 lines · Joao Martins
Quoted 36 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Quoted 8 lines
Quoted 2 lines
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.I will fix those and respin, and probably take out the last patch as it's more RFC-ish and in need of feedback.
Sounds good. Any objections to releasing v70 with the initial support, and then adding this series on for the next one? I'm thinking I'll do a much quicker v72 release say in early January with this and anything else that missed v71.
Quoted 22 lines
Joao
Quoted 19 lines
Joao Martins (8):
daxctl: add daxctl_dev_{get,set}_align() util/json: Print device align
daxctl: add align support in reconfigure-device
daxctl: add align support in create-device
libdaxctl: add mapping iterator APIs
daxctl: include mappings when listing
libdaxctl: adddaxctl_dev_set_mapping()
daxctl: Allow restore devices from JSON metadatadaxctl/device.c | 154 +++++++++++++++++++++++++++++++++++++++-- daxctl/lib/libdaxctl-private.h | 9 +++ daxctl/lib/libdaxctl.c | 152 +++++++++++++++++++++++++++++++++++++++- daxctl/lib/libdaxctl.sym | 9 +++ daxctl/libdaxctl.h | 16 +++++ util/json.c | 63 ++++++++++++++++- util/json.h | 3 + 7 files changed, 396 insertions(+), 10 deletions(-)
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 44 lines · Vishal L
Quoted 43 lines · Joao Martins
Quoted 30 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
Quoted 8 lines
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.
Quoted 7 lines
Quoted 2 lines
I will fix those and respin, and probably take out the last patch as it's more RFC-ish and in need of feedback.
Sounds good. Any objections to releasing v70 with the initial support, and then adding this series on for the next one? I'm thinking I'll do a much quicker v72 release say in early January with this and anything else that missed v71.
If we're able to wait until tomorrow, I could respin these first four patches with the fixes and include the align support in the initial set. Otherwise, I am also good if you prefer defering it to v72.
Joao
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 49 lines · Joao Martins
Quoted 47 lines · Vishal L
Quoted 45 lines · Joao Martins
Quoted 30 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
Quoted 8 lines
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.I will fix those and respin, and probably take out the last patch as it's more RFC-ish and in need of feedback.
Quoted 9 lines
Quoted 4 lines
Sounds good. Any objections to releasing v70 with the initial support, and then adding this series on for the next one? I'm thinking I'll do a much quicker v72 release say in early January with this and anything else that missed v71.
If we're able to wait until tomorrow, I could respin these first four patches with the fixes and include the align support in the initial set. Otherwise, I am also good if you prefer defering it to v72.
Does this change the JSON output? Might be nice to keep that all in one update rather than invalidate some testing with the old format betweem v71 and v72.
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 55 lines · Dan Williams
Quoted 54 lines · Joao Martins
Quoted 51 lines · Vishal L
Quoted 37 lines · Joao Martins
Quoted 36 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Quoted 8 lines
Quoted 2 lines
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.I will fix those and respin, and probably take out the last patch as it's more RFC-ish and in need of feedback.
Sounds good. Any objections to releasing v70 with the initial support, and then adding this series on for the next one? I'm thinking I'll do a much quicker v72 release say in early January with this and anything else that missed v71.
Quoted 9 lines
Quoted 4 lines
If we're able to wait until tomorrow, I could respin these first four patches with the fixes and include the align support in the initial set. Otherwise, I am also good if you prefer defering it to v72.
Does this change the JSON output? Might be nice to keep that all in one update rather than invalidate some testing with the old format betweem v71 and v72.
Ugh, sent the v2 too early before seeing this.
The only change to the output is on daxctl when listing devices for 5.10+. It starts displaying an "align" key/value.
Joao
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 62 lines · Joao Martins
Quoted 60 lines · Dan Williams
Quoted 58 lines · Joao Martins
Quoted 44 lines · Vishal L
Quoted 43 lines · Joao Martins
Quoted 30 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
Quoted 8 lines
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.Quoted 7 lines
Quoted 2 lines
I will fix those and respin, and probably take out the last patch as it's more RFC-ish and in need of feedback.
Sounds good. Any objections to releasing v70 with the initial support, and then adding this series on for the next one? I'm thinking I'll do a much quicker v72 release say in early January with this and anything else that missed v71.
If we're able to wait until tomorrow, I could respin these first four patches with the fixes and include the align support in the initial set. Otherwise, I am also good if you prefer defering it to v72.
Quoted 8 lines
Quoted 4 lines
Does this change the JSON output? Might be nice to keep that all in one update rather than invalidate some testing with the old format betweem v71 and v72.
Ugh, sent the v2 too early before seeing this.
The only change to the output is on daxctl when listing devices for 5.10+. It starts displaying an "align" key/value.
No worries. Vishal and I chatted and it looks to me like your improvements to the provisioning flow are worthwhile to sneak into the v71 release if you want to include those changes as well.
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Quoted 64 lines · Dan Williams
Quoted 63 lines · Joao Martins
Quoted 62 lines · Dan Williams
Quoted 48 lines · Joao Martins
Quoted 47 lines · Vishal L
Quoted 45 lines · Joao Martins
Quoted 30 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
Quoted 8 lines
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.I will fix those and respin, and probably take out the last patch as it's more RFC-ish and in need of feedback.
Quoted 8 lines
Quoted 4 lines
Sounds good. Any objections to releasing v70 with the initial support, and then adding this series on for the next one? I'm thinking I'll do a much quicker v72 release say in early January with this and anything else that missed v71.
If we're able to wait until tomorrow, I could respin these first four patches with the fixes and include the align support in the initial set. Otherwise, I am also good if you prefer defering it to v72.
Does this change the JSON output? Might be nice to keep that all in one update rather than invalidate some testing with the old format betweem v71 and v72.
Quoted 8 lines
Quoted 4 lines
Ugh, sent the v2 too early before seeing this.
The only change to the output is on daxctl when listing devices for 5.10+. It starts displaying an "align" key/value.
No worries. Vishal and I chatted and it looks to me like your improvements to the provisioning flow are worthwhile to sneak into the v71 release if you want to include those changes as well.
The provisioning flow additions has some questions open about the daxctl user interface. To summarize:
1) Should we always list mappings, or only list them with a -v option? Or maybe instead of -v to use instead a new -M option which enables the listing of mappings?
The reason being that it can get quite verbose with a device picks a lot of mappings, hence I would imagine this info isn't necessary for the casual daxctl listing.
2) Does the '--restore <file.json>' should instead be called it instead '--device'? I feel the name '--restore' is too tied to one specific way of using it when the feature can be used by a tool which wants to manage its own range mappings. Additionally, I was thinking that if one wants to manually add/fixup ranges more easily that we would add
a --mapping <pgoff>:<start>-<end> sort of syntax. But I suppose this could be added later if its really desired.
And with these clarified, I could respin it over. Oh and I'm missing a mappings test as well.
It's worth mentioning that kexec will need fixing, as dax_hmem regions created with HMAT or manually assigned with efi_fake_mem= get lost on kexec because we do not pass the EFI_MEMMAP conventional memory ranges to the second kernel (only runtime code/boot services). I have a RFC patch for x86 efi handling, but should get that conversation started after holidays.
Joao
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Verma, Vishal L
maintainerQuoted 11 lines · Joao Martins
The provisioning flow additions has some questions open about the daxctl user interface. To summarize:
1) Should we always list mappings, or only list them with a -v option? Or maybe instead of -v to use instead a new -M option which enables the listing of mappings?
The reason being that it can get quite verbose with a device picks a lot of mappings, hence I would imagine this info isn't necessary for the casual daxctl listing.
I think hiding them behind a new option is probably best. And then we can have different verbosity levels turn on or off. The verbosity levels stuff is implemented in ndctl, but I don't think it is in daxctl yet, so we can just do the specific option to display mappings for now, and then revisit verbosity levels in the future if we feel like the number of options is getting out of hand.
Quoted 4 lines
2) Does the '--restore <file.json>' should instead be called it instead '--device'? I feel the name '--restore' is too tied to one specific way of using it when the feature can be used by a tool which wants to manage
Hm, I looked at other commands that take an input file - write labels just calls it --input, so there might be value in staying consistent with that. But write-infoblock just uses stdin - so that could be another option. I'd be fine with either of those.
Quoted 4 lines
its own range mappings. Additionally, I was thinking that if one wants to manually add/fixup ranges more easily that we would add
a --mapping <pgoff>:<start>-<end> sort of syntax. But I suppose this could be added later if its really desired.
Agreed with adding this later if needed.
Quoted 3 lines
And with these clarified, I could respin it over. Oh and I'm missing a mappings test as well.
Sounds good I'll wait to get these in.
Quoted 9 lines
It's worth mentioning that kexec will need fixing, as
dax_hmemregions created with HMAT or manually assigned with efi_fake_mem= get lost on kexec because we do not pass theEFI_MEMMAPconventional memory ranges to the second kernel (only runtime code/boot services). I have a RFC patch for x86 efi handling, but should get that conversation started after holidays.Joao
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 35 lines · Joao Martins
Quoted 33 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/
Quoted 8 lines
Quoted 5 lines
The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.
What's the breakage with older kernels, is it the kernel regressing old daxctl, or is it new daxctl being incompatible with old kernels? If it's the latter, it needs a fixup, if it's the former it needs a kernel compat change.
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Quoted 41 lines · Dan Williams
Quoted 40 lines · Joao Martins
Quoted 38 lines · Joao Martins
Hey,
This series builds on top of this one[0] and does the following improvements to the Soft-Reserved subdivision:
1) Support for {create,reconfigure}-device for selecting @align (hugepage size). Here we add a '-a|--align 4K|2M|1G' option to the existing commands;
2) Listing improvements for device alignment and mappings;
Note: Perhaps it is better to hide the mappings by default, and only
print with -v|--verbose. This would align with ndctl, as the mappings info can be quite large.3) Allow creating devices from selecting ranges. This allows to keep the same
GPA->HPAmapping as before we kexec the hypervisor with running guests:daxctl list -d dax0.1 > /var/log/dax0.1.json kexec -d -l bzImage systemctl kexec daxctl create -u --restore /var/log/dax0.1.jsonThe JSON was what I though it would be easier for an user, given that it is the data format daxctl outputs. Alternatives could be adding multiple:
--mapping <pgoff>:<start>-<end>But that could end up in a gigantic line and a little more unmanageable I think.
This series requires this series[0] on top of Dan's patches[1]:
[0] https://lore.kernel.org/linux-nvdimm/[email protected]/
[1] https://lore.kernel.org/linux-nvdimm/159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com/The only TODO here is docs and improving tests to validate mappings, and test the restore path.
Suggestions/comments are welcome.
Quoted 8 lines
Quoted 3 lines
There's a couple of issues in this series regarding daxctl-reconfigure options and breakage of ndctl with kernels (<5.10) that do not supply a device @align upon testing with NVDIMMs. Plus it is missing
daxctl-create.shunit test for @align.What's the breakage with older kernels, is it the kernel regressing old daxctl, or is it new daxctl being incompatible with old kernels? If it's the latter, it needs a fixup, if it's the former it needs a kernel compat change.
It's the latter i.e. new daxctl being incompatible with old kernels, because of a change in the first patch. Essentially a wrong assumption of device align being always available in add_dax_dev().
The fixup would be this snip below to the first patch. But I will respin the first four patches today or my morning tomorrow, with a test.
daxctl/lib/libdaxctl.c +5 -3
@@ -498,10 +498,12 @@ static void *add_dax_dev(void *parent, int id, const char *daxdev_base) goto err_read; dev->size =strtoull (buf,NULL ,0 ); +/* Device align attribute is only available in v5.10 or up */ sprintf (path,"%s/align" , daxdev_base); -if (sysfs_read_attr (ctx, path, buf) <0 ) - goto err_read; - dev->align =strtoull (buf,NULL ,0 ); +if (!sysfs_read_attr (ctx, path, buf)) + dev->align =strtoull (buf,NULL ,0 ); +else + dev->align =0 ; dev->dev_path =strdup (daxdev_base);if (!dev->dev_path)
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]