Commit 41c16a6d authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Jim Harris
Browse files

env_dpdk: clean up DPDK args print during init



When initializing SPDK, the used DPDK args are printed.
Unfortunately before each argument a timestamp is added.
Rather than use SPDK_PRINTF for each argument, bunch
up whole line to be printed and then print it in one go.

Please see before:
[2022-12-20 13:52:05.647131] [ DPDK EAL parameters: [2022-12-20
13:52:05.647145] spdk_tgt [2022-12-20 13:52:05.647159] --no-shconf
[2022-12-20 13:52:05.647170] -c 0x1 [2022-12-20 13:52:05.647185]
--huge-unlink [2022-12-20 13:52:05.647199] --log-level=lib.eal:6
[2022-12-20 13:52:05.647221] --log-level=lib.cryptodev:5 [2022-12-20
13:52:05.647232] --log-level=user1:6 [2022-12-20 13:52:05.647251]
--iova-mode=pa [2022-12-20 13:52:05.647261] --base-virtaddr=0x200000000000
[2022-12-20 13:52:05.647275] --match-allocations [2022-12-20
13:52:05.647286] --file-prefix=spdk_pid1352179 [2022-12-20 13:52:05.647307]
]

And after:
[2022-12-20 13:52:29.038353] [ DPDK EAL parameters: spdk_tgt --no-shconf -c
0x1 --huge-unlink --log-level=lib.eal:6 --log-level=lib.cryptodev:5
--log-level=user1:6 --iova-mode=pa --base-virtaddr=0x200000000000
--match-allocations --file-prefix=spdk_pid1358716 ]

Change-Id: I4c6c25818ae99bad942bf61ab590f971d339ffc6
Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16031


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent c22b052b
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -519,6 +519,7 @@ int
spdk_env_init(const struct spdk_env_opts *opts)
{
	char **dpdk_args = NULL;
	char *args_print = NULL, *args_tmp = NULL;
	int i, rc;
	int orig_optind;
	bool legacy_mem;
@@ -550,11 +551,22 @@ spdk_env_init(const struct spdk_env_opts *opts)
	}

	SPDK_PRINTF("Starting %s / %s initialization...\n", SPDK_VERSION_STRING, rte_version());
	SPDK_PRINTF("[ DPDK EAL parameters: ");

	args_print = _sprintf_alloc("[ DPDK EAL parameters: ");
	if (args_print == NULL) {
		return -ENOMEM;
	}
	for (i = 0; i < g_eal_cmdline_argcount; i++) {
		SPDK_PRINTF("%s ", g_eal_cmdline[i]);
		args_tmp = args_print;
		args_print = _sprintf_alloc("%s%s ", args_tmp, g_eal_cmdline[i]);
		if (args_print == NULL) {
			free(args_tmp);
			return -ENOMEM;
		}
		free(args_tmp);
	}
	SPDK_PRINTF("]\n");
	SPDK_PRINTF("%s]\n", args_print);
	free(args_print);

	/* DPDK rearranges the array we pass to it, so make a copy
	 * before passing so we can still free the individual strings