All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: ray.kinsella@intel.com, kuralamudhan.ramakrishnan@intel.com,
	louise.m.daly@intel.com, bruce.richardson@intel.com,
	ferruh.yigit@intel.com, konstantin.ananyev@intel.com,
	thomas@monjalon.net
Subject: [PATCH 7/9] eal: add --in-memory option
Date: Fri,  1 Jun 2018 18:15:16 +0100	[thread overview]
Message-ID: <82e12ba12821abe4d5eab67fe592e86a7de92d0e.1527872626.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1527872626.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1527872626.git.anatoly.burakov@intel.com>

This command-line option will cause DPDK to operate entirely in
memory and not create any shared files at runtime, including any
shared configuration or hugetlbfs files. This is useful for debug
purposes, as well as for certain use cases like containers or
automatic memory cleanup.

Currently, this option acts as a strict superset of --no-shconf and
--huge-unlink commands.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    RFC->v1:
    - Do not deprecate old options, instead just coopt them

 lib/librte_eal/common/eal_common_options.c | 21 +++++++++++++++++++--
 lib/librte_eal/common/eal_internal_cfg.h   |  4 ++++
 lib/librte_eal/common/eal_options.h        |  2 ++
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index ecebb2923..b175b1446 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -66,6 +66,7 @@ eal_long_options[] = {
 	{OPT_NO_HUGE,           0, NULL, OPT_NO_HUGE_NUM          },
 	{OPT_NO_PCI,            0, NULL, OPT_NO_PCI_NUM           },
 	{OPT_NO_SHCONF,         0, NULL, OPT_NO_SHCONF_NUM        },
+	{OPT_IN_MEMORY,         0, NULL, OPT_IN_MEMORY_NUM        },
 	{OPT_PCI_BLACKLIST,     1, NULL, OPT_PCI_BLACKLIST_NUM    },
 	{OPT_PCI_WHITELIST,     1, NULL, OPT_PCI_WHITELIST_NUM    },
 	{OPT_PROC_TYPE,         1, NULL, OPT_PROC_TYPE_NUM        },
@@ -1165,6 +1166,13 @@ eal_parse_common_option(int opt, const char *optarg,
 		conf->no_shconf = 1;
 		break;
 
+	case OPT_IN_MEMORY_NUM:
+		conf->in_memory = 1;
+		/* in-memory is a superset of noshconf and huge-unlink */
+		conf->no_shconf = 1;
+		conf->hugepage_unlink = 1;
+		break;
+
 	case OPT_PROC_TYPE_NUM:
 		conf->process_type = eal_parse_proc_type(optarg);
 		break;
@@ -1316,12 +1324,19 @@ eal_check_common_options(struct internal_config *internal_cfg)
 			"be specified together with --"OPT_NO_HUGE"\n");
 		return -1;
 	}
-
-	if (internal_cfg->no_hugetlbfs && internal_cfg->hugepage_unlink) {
+	if (internal_cfg->no_hugetlbfs && internal_cfg->hugepage_unlink &&
+			!internal_cfg->in_memory) {
 		RTE_LOG(ERR, EAL, "Option --"OPT_HUGE_UNLINK" cannot "
 			"be specified together with --"OPT_NO_HUGE"\n");
 		return -1;
 	}
+	if (internal_cfg->single_file_segments &&
+			internal_cfg->hugepage_unlink) {
+		RTE_LOG(ERR, EAL, "Option --"OPT_SINGLE_FILE_SEGMENTS" is "
+			"not compatible with neither --"OPT_IN_MEMORY" nor "
+			"--"OPT_HUGE_UNLINK"\n");
+		return -1;
+	}
 
 	return 0;
 }
@@ -1370,6 +1385,8 @@ eal_common_usage(void)
 	       "                      Set specific log level\n"
 	       "  -v                  Display version information on startup\n"
 	       "  -h, --help          This help\n"
+	       "  --"OPT_IN_MEMORY"   Operate entirely in memory. This will \n"
+	       "                      disable secondary process support\n"
 	       "\nEAL options for DEBUG use only:\n"
 	       "  --"OPT_HUGE_UNLINK"       Unlink hugepage files after init\n"
 	       "  --"OPT_NO_HUGE"           Use malloc instead of hugetlbfs\n"
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index c4cbf3acd..f90d94206 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -41,6 +41,10 @@ struct internal_config {
 	volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping
 										* instead of native TSC */
 	volatile unsigned no_shconf;      /**< true if there is no shared config */
+	volatile unsigned in_memory;
+	/**< true if DPDK should operate entirely in-memory and not create any
+	 * shared files or runtime data.
+	 */
 	volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */
 	volatile enum rte_proc_type_t process_type; /**< multi-process proc type */
 	/** true to try allocating memory on specific sockets */
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index 211ae06ae..dcde4054e 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -45,6 +45,8 @@ enum {
 	OPT_NO_PCI_NUM,
 #define OPT_NO_SHCONF         "no-shconf"
 	OPT_NO_SHCONF_NUM,
+#define OPT_IN_MEMORY         "in-memory"
+	OPT_IN_MEMORY_NUM,
 #define OPT_SOCKET_MEM        "socket-mem"
 	OPT_SOCKET_MEM_NUM,
 #define OPT_SYSLOG            "syslog"
-- 
2.17.0

  parent reply	other threads:[~2018-06-01 17:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 17:15 [PATCH 0/9] Support running DPDK without hugetlbfs mountpoint Anatoly Burakov
2018-06-01 17:15 ` [PATCH 1/9] fbarray: support no-shconf mode Anatoly Burakov
2018-06-01 17:15 ` [PATCH 2/9] ipc: add support for " Anatoly Burakov
2018-06-01 17:15 ` [PATCH 3/9] eal: add support for no-shconf for hugepage info Anatoly Burakov
2018-06-01 17:15 ` [PATCH 4/9] eal: add support for no-shconf in hugepage data file Anatoly Burakov
2018-06-01 17:15 ` [PATCH 5/9] eal: do not create runtime dir in no-shconf mode Anatoly Burakov
2018-06-01 17:15 ` [PATCH 6/9] mem: add support for hugepage-unlink mode Anatoly Burakov
2018-06-01 17:15 ` Anatoly Burakov [this message]
2018-06-01 17:15 ` [PATCH 8/9] doc: add deprecation notice for EAL command line options Anatoly Burakov
2018-06-01 17:15 ` [PATCH 9/9] mem: support in-memory mode Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 0/9] Support running DPDK without hugetlbfs mountpoint Anatoly Burakov
2018-07-13 12:47   ` [PATCH v3 0/8] " Anatoly Burakov
2018-07-13 13:41     ` Thomas Monjalon
2018-07-13 12:47   ` [PATCH v3 1/8] fbarray: support no-shconf mode Anatoly Burakov
2018-07-13 12:47   ` [PATCH v3 2/8] ipc: add support for " Anatoly Burakov
2018-07-13 12:47   ` [PATCH v3 3/8] eal: add support for no-shconf for hugepage info Anatoly Burakov
2018-07-13 12:48   ` [PATCH v3 4/8] eal: add support for no-shconf in hugepage data file Anatoly Burakov
2018-07-13 12:48   ` [PATCH v3 5/8] eal: do not create runtime dir in no-shconf mode Anatoly Burakov
2018-07-13 12:48   ` [PATCH v3 6/8] mem: add support for hugepage-unlink mode Anatoly Burakov
2018-07-13 12:48   ` [PATCH v3 7/8] eal: add --in-memory option Anatoly Burakov
2018-07-13 12:48   ` [PATCH v3 8/8] mem: support in-memory mode Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 1/9] fbarray: support no-shconf mode Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 2/9] ipc: add support for " Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 3/9] eal: add support for no-shconf for hugepage info Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 4/9] eal: add support for no-shconf in hugepage data file Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 5/9] eal: do not create runtime dir in no-shconf mode Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 6/9] mem: add support for hugepage-unlink mode Anatoly Burakov
2018-07-13 10:27 ` [PATCH v2 7/9] eal: add --in-memory option Anatoly Burakov
2018-07-13 12:13   ` Thomas Monjalon
2018-07-13 12:27     ` Burakov, Anatoly
2018-07-13 10:27 ` [PATCH v2 8/9] doc: add deprecation notice for EAL command line options Anatoly Burakov
2018-07-13 12:13   ` Thomas Monjalon
2018-07-13 12:29     ` Burakov, Anatoly
2018-07-13 10:27 ` [PATCH v2 9/9] mem: support in-memory mode Anatoly Burakov
2018-07-13 12:15   ` Thomas Monjalon

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=82e12ba12821abe4d5eab67fe592e86a7de92d0e.1527872626.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=kuralamudhan.ramakrishnan@intel.com \
    --cc=louise.m.daly@intel.com \
    --cc=ray.kinsella@intel.com \
    --cc=thomas@monjalon.net \
    /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.