engines/xnvme: add support for picking mem backend
authorAnkit Kumar <ankit.kumar@samsung.com>
Thu, 22 Dec 2022 04:39:51 +0000 (10:09 +0530)
committerVincent Fu <vincent.fu@samsung.com>
Thu, 22 Dec 2022 13:50:03 +0000 (08:50 -0500)
Add option to the xnvme fio engine for picking a
memory backend. Update the fio document.

Signed-off-by: Mads Ynddal <m.ynddal@samsung.com>
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
HOWTO.rst
engines/xnvme.c
fio.1

index 0fec38a76528145d20001ea369aa29124f986ce4..0a48a453774b574773ef8ea31b63ccb5db1598e6 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -2885,6 +2885,23 @@ with the caveat that when used on the command line, they must come after the
        Sets the subsystem NQN for fabrics. This is for xNVMe to utilize a
        fabrics target with multiple systems.
 
+.. option:: xnvme_mem=str : [xnvme]
+
+       Select the xnvme memory backend. This can take these values.
+
+       **posix**
+               This is the default posix memory backend for linux NVMe driver.
+       **hugepage**
+               Use hugepages, instead of existing posix memory backend. The
+               memory backend uses hugetlbfs. This require users to allocate
+               hugepages, mount hugetlbfs and set an enviornment variable for
+               XNVME_HUGETLB_PATH.
+       **spdk**
+               Uses SPDK's memory allocator.
+       **vfio**
+               Uses libvfn's memory allocator. This also specifies the use
+               of libvfn backend instead of SPDK.
+
 .. option:: xnvme_iovec=int : [xnvme]
 
        If this option is set. xnvme will use vectored read/write commands.
index 208d917d63663c65d52a6e7fb62f83c18ef3bc3d..bb92a121dc7f6fdaf248a8b35ac0a7251b859eb4 100644 (file)
@@ -75,6 +75,7 @@ struct xnvme_fioe_options {
        unsigned int xnvme_dev_nsid;
        unsigned int xnvme_iovec;
        char *xnvme_be;
+       char *xnvme_mem;
        char *xnvme_async;
        char *xnvme_sync;
        char *xnvme_admin;
@@ -109,6 +110,15 @@ static struct fio_option options[] = {
                .category = FIO_OPT_C_ENGINE,
                .group = FIO_OPT_G_XNVME,
        },
+       {
+               .name = "xnvme_mem",
+               .lname = "xNVMe Memory Backend",
+               .type = FIO_OPT_STR_STORE,
+               .off1 = offsetof(struct xnvme_fioe_options, xnvme_mem),
+               .help = "Select xNVMe memory backend",
+               .category = FIO_OPT_C_ENGINE,
+               .group = FIO_OPT_G_XNVME,
+       },
        {
                .name = "xnvme_async",
                .lname = "xNVMe Asynchronous command-interface",
@@ -193,6 +203,7 @@ static struct xnvme_opts xnvme_opts_from_fioe(struct thread_data *td)
        opts.nsid = o->xnvme_dev_nsid;
        opts.subnqn = o->xnvme_dev_subnqn;
        opts.be = o->xnvme_be;
+       opts.mem = o->xnvme_mem;
        opts.async = o->xnvme_async;
        opts.sync = o->xnvme_sync;
        opts.admin = o->xnvme_admin;
diff --git a/fio.1 b/fio.1
index 134aed541e112b3c5f05e20ae1d35d4ac8201eac..eb87533fc7932e979373a927b8d935a00627012f 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -2631,6 +2631,28 @@ xnvme namespace identifier for userspace NVMe driver SPDK or vfio.
 Sets the subsystem NQN for fabrics. This is for xNVMe to utilize a fabrics
 target with multiple systems.
 .TP
+.BI (xnvme)xnvme_mem\fR=\fPstr
+Select the xnvme memory backend. This can take these values.
+.RS
+.RS
+.TP
+.B posix
+This is the default posix memory backend for linux NVMe driver.
+.TP
+.BI hugepage
+Use hugepages, instead of existing posix memory backend. The memory backend
+uses hugetlbfs. This require users to allocate hugepages, mount hugetlbfs and
+set an enviornment variable for XNVME_HUGETLB_PATH.
+.TP
+.BI spdk
+Uses SPDK's memory allocator.
+.TP
+.BI vfio
+Uses libvfn's memory allocator. This also specifies the use of libvfn backend
+instead of SPDK.
+.RE
+.RE
+.TP
 .BI (xnvme)xnvme_iovec
 If this option is set, xnvme will use vectored read/write commands.
 .TP