Commit 5237fe34 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

event: add new pci-allowed and pci-blocked cmd line params



These replace the pci-whitelist and pci-blacklist params
which are now deprecated.

pci-blocked will still use the -B short name.  pci-allowed
will use a new -A short name.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Icf1c46c40ad6a0f49fb539b18cdd8d0c8daac636
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5281


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 9c2b3b35
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -7,6 +7,12 @@
The pci_whitelist and pci_blacklist members of struct spdk_app_opts have been
deprecated.  The new members are named pci_allowed and pci_blocked respectively.

The --pci-blacklist command line option has been deprecated, replaced with
--pci-blocked.

The --pci-whitelist/-W command line options have been deprecated, replaced with
--pci-allowed/-A.

### env

The pci_whitelist and pci_blacklist members of struct spdk_env_opts have been
+7 −7
Original line number Diff line number Diff line
@@ -41,8 +41,8 @@ Param | Long Param | Type | Default | Descript
|        | --silence-noticelog    | flag     |                        | disable notice level logging to `stderr`
-u       | --no-pci               | flag     |                        | @ref cmd_arg_disable_pci_access.
|        | --wait-for-rpc         | flag     |                        | @ref cmd_arg_deferred_initialization
-B       | --pci-blacklist        | B:D:F    |                        | @ref cmd_arg_pci_blacklist_whitelist.
-W       | --pci-whitelist        | B:D:F    |                        | @ref cmd_arg_pci_blacklist_whitelist.
-B       | --pci-blocked          | B:D:F    |                        | @ref cmd_arg_pci_blocked_allowed.
-A       | --pci-allowed          | B:D:F    |                        | @ref cmd_arg_pci_blocked_allowed.
-R       | --huge-unlink          | flag     |                        | @ref cmd_arg_huge_unlink
|        | --huge-dir             | string   | the first discovered   | allocate hugepages from a specific mount
-L       | --logflag              | string   |                        | @ref cmd_arg_log_flags
@@ -121,12 +121,12 @@ If SPDK is run with PCI access disabled it won't detect any PCI devices. This
includes primarily NVMe and IOAT devices. Also, the VFIO and UIO kernel modules
are not required in this mode.

### PCI address blacklist and whitelist {#cmd_arg_pci_blacklist_whitelist}
### PCI address blocked and allowed lists {#cmd_arg_pci_blocked_allowed}

If blacklist is used, then all devices with the provided PCI address will be
ignored. If a whitelist is used, only whitelisted devices will be probed.
`-B` or `-W` can be used more than once, but cannot be mixed together. That is,
`-B` and `-W` cannot be used at the same time.
If blocked list is used, then all devices with the provided PCI address will be
ignored. If an allowed list is used, only allowed devices will be probed.
`-B` or `-A` can be used more than once, but cannot be mixed together. That is,
`-B` and `-A` cannot be used at the same time.

### Unlink hugepage files after initialization {#cmd_arg_huge_unlink}

+15 −9
Original line number Diff line number Diff line
@@ -107,14 +107,17 @@ static const struct option g_cmdline_options[] = {
	{"no-pci",			no_argument,		NULL, NO_PCI_OPT_IDX},
#define VERSION_OPT_IDX		'v'
	{"version",			no_argument,		NULL, VERSION_OPT_IDX},
#define PCI_BLACKLIST_OPT_IDX	'B'
	{"pci-blacklist",		required_argument,	NULL, PCI_BLACKLIST_OPT_IDX},
#define PCI_BLOCKED_OPT_IDX	'B'
	{"pci-blocked",			required_argument,	NULL, PCI_BLOCKED_OPT_IDX},
	{"pci-blacklist",		required_argument,	NULL, PCI_BLOCKED_OPT_IDX}, /* deprecated */
#define LOGFLAG_OPT_IDX		'L'
	{"logflag",			required_argument,	NULL, LOGFLAG_OPT_IDX},
#define HUGE_UNLINK_OPT_IDX	'R'
	{"huge-unlink",			no_argument,		NULL, HUGE_UNLINK_OPT_IDX},
#define PCI_ALLOWED_OPT_IDX	'A'
	{"pci-allowed",			required_argument,	NULL, PCI_ALLOWED_OPT_IDX},
#define PCI_WHITELIST_OPT_IDX	'W'
	{"pci-whitelist",		required_argument,	NULL, PCI_WHITELIST_OPT_IDX},
	{"pci-whitelist",		required_argument,	NULL, PCI_WHITELIST_OPT_IDX}, /* deprecated */
#define SILENCE_NOTICELOG_OPT_IDX 257
	{"silence-noticelog",		no_argument,		NULL, SILENCE_NOTICELOG_OPT_IDX},
#define WAIT_FOR_RPC_OPT_IDX	258
@@ -571,12 +574,12 @@ usage(void (*app_usage)(void))
	printf(" -u, --no-pci              disable PCI access\n");
	printf("     --wait-for-rpc        wait for RPCs to initialize subsystems\n");
	printf("     --max-delay <num>     maximum reactor delay (in microseconds)\n");
	printf(" -B, --pci-blacklist <bdf>\n");
	printf("                           pci addr to blacklist (can be used more than once)\n");
	printf(" -B, --pci-blocked <bdf>\n");
	printf("                           pci addr to block (can be used more than once)\n");
	printf(" -R, --huge-unlink         unlink huge files after initialization\n");
	printf(" -v, --version             print SPDK version\n");
	printf(" -W, --pci-whitelist <bdf>\n");
	printf("                           pci addr to whitelist (-B and -W cannot be used at the same time)\n");
	printf(" -A, --pci-allowed <bdf>\n");
	printf("                           pci addr to allow (-B and -A cannot be used at the same time)\n");
	printf("     --huge-dir <path>     use a specific hugetlbfs mount to reserve memory from\n");
	printf("     --iova-mode <pa/va>   set IOVA mode ('pa' for IOVA_PA and 'va' for IOVA_VA)\n");
	printf("     --base-virtaddr <addr>      the base virtual address for DPDK (default: 0x200000000000)\n");
@@ -737,11 +740,11 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
		case WAIT_FOR_RPC_OPT_IDX:
			opts->delay_subsystem_init = true;
			break;
		case PCI_BLACKLIST_OPT_IDX:
		case PCI_BLOCKED_OPT_IDX:
			if (opts->pci_allowed) {
				free(opts->pci_allowed);
				opts->pci_allowed = NULL;
				SPDK_ERRLOG("-B and -W cannot be used at the same time\n");
				SPDK_ERRLOG("-B and -A cannot be used at the same time\n");
				usage(app_usage);
				goto out;
			}
@@ -768,6 +771,9 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
			opts->unlink_hugepage = true;
			break;
		case PCI_WHITELIST_OPT_IDX:
			SPDK_WARNLOG("-W/--pci-whitelist is deprecated.  Use -A/--pci-allowed.\n");
		/* fallthrough */
		case PCI_ALLOWED_OPT_IDX:
			if (opts->pci_blocked) {
				free(opts->pci_blocked);
				opts->pci_blocked = NULL;
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ _spdk_opt_to_complete() {
	local opt=$1

	case "$opt" in
		--pci-blacklist | -B | --pci-whitelist | -W)
		--pci-blocked | -B | --pci-allowed | -A)
			local pcis
			if [[ -e /sys/bus/pci/devices ]]; then
				pcis=(/sys/bus/pci/devices/*)