Commit aa8e7002 authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Jim Harris
Browse files

app: add -g flag hinting dpdk to create just one hugetlbfs file



This makes use of the `--single-file-segments` DPDK param.

Change-Id: I21ddd955841748ea087c0d006875514be56f2107
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/401112


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 8d57caa1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ struct spdk_env_opts {
	int			master_core;
	int			mem_size;
	bool			no_pci;
	bool			hugepage_single_segments;

	/** Opaque context for use of the env implementation. */
	void			*env_context;
+2 −1
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ struct spdk_app_opts {
	int			master_core;
	int			mem_size;
	bool			no_pci;
	bool			hugepage_single_segments;
	enum spdk_log_level	print_level;

	/* The maximum latency allowed when passing an event
@@ -185,7 +186,7 @@ int spdk_app_parse_core_mask(const char *mask, struct spdk_cpuset *cpumask);
 */
struct spdk_cpuset *spdk_app_get_core_mask(void);

#define SPDK_APP_GETOPT_STRING "c:de:hi:m:n:p:qr:s:t:"
#define SPDK_APP_GETOPT_STRING "c:de:ghi:m:n:p:qr:s:t:"

enum spdk_app_parse_args_rvals {
	SPDK_APP_PARSE_ARGS_HELP = 0,
+11 −2
Original line number Diff line number Diff line
@@ -242,6 +242,14 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts)
		}
	}

	/* create just one hugetlbfs file */
	if (opts->hugepage_single_segments) {
		args = spdk_push_arg(args, &argcount, _sprintf_alloc("--single-file-segments"));
		if (args == NULL) {
			return -1;
		}
	}

#ifdef __linux__
	if (opts->shm_id < 0) {
		args = spdk_push_arg(args, &argcount, _sprintf_alloc("--file-prefix=spdk_pid%d",
@@ -322,12 +330,13 @@ int spdk_env_init(const struct spdk_env_opts *opts)
		return -1;
	}

	if (opts->shm_id < 0) {
	if (opts->shm_id < 0 && !opts->hugepage_single_segments) {
		/*
		 * Unlink hugepage and config info files after init.  This will ensure they get
		 *  deleted on app exit, even if the app crashes and does not exit normally.
		 *  Only do this when not in multi-process mode, since for multi-process other
		 *  apps will need to open these files.
		 *  apps will need to open these files. These files are not created for
		 *  "single file segments".
		 */
		spdk_env_unlink_shared_files();
	}
+5 −0
Original line number Diff line number Diff line
@@ -359,6 +359,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
	env_opts.master_core = opts->master_core;
	env_opts.mem_size = opts->mem_size;
	env_opts.no_pci = opts->no_pci;
	env_opts.hugepage_single_segments = opts->hugepage_single_segments;

	if (spdk_env_init(&env_opts) < 0) {
		SPDK_ERRLOG("Unable to initialize SPDK env\n");
@@ -492,6 +493,7 @@ usage(char *executable_name, struct spdk_app_opts *default_opts, void (*app_usag
	printf(" -c config  config file (default %s)\n", default_opts->config_file);
	printf(" -d         disable coredump file enabling\n");
	printf(" -e mask    tracepoint group mask for spdk trace buffers (default 0x0)\n");
	printf(" -g         force creating just one hugetlbfs file\n");
	printf(" -h         show this usage\n");
	printf(" -i shared memory ID (optional)\n");
	printf(" -m mask    core mask for DPDK\n");
@@ -543,6 +545,9 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
		case 'e':
			opts->tpoint_group_mask = optarg;
			break;
		case 'g':
			opts->hugepage_single_segments = true;
			break;
		case 'h':
			usage(argv[0], &default_opts, app_usage);
			rval = SPDK_APP_PARSE_ARGS_HELP;