14a91adb8SSeth Howell 2fb5e59bdSBen Walker# An Overview of SPDK Applications {#app_overview} 3fb5e59bdSBen Walker 4fb5e59bdSBen WalkerSPDK is primarily a development kit that delivers libraries and header files for 5fb5e59bdSBen Walkeruse in other applications. However, SPDK also contains a number of applications. 6fb5e59bdSBen WalkerThese applications are primarily used to test the libraries, but many are full 7fb5e59bdSBen Walkerfeatured and high quality. The major applications in SPDK are: 8fb5e59bdSBen Walker 9fb5e59bdSBen Walker- @ref iscsi 10fb5e59bdSBen Walker- @ref nvmf 11fb5e59bdSBen Walker- @ref vhost 12fb5e59bdSBen Walker- SPDK Target (a unified application combining the above three) 13fb5e59bdSBen Walker 14fb5e59bdSBen WalkerThere are also a number of tools and examples in the `examples` directory. 15fb5e59bdSBen Walker 16fb5e59bdSBen WalkerThe SPDK targets are all based on a common framework so they have much in 17fb5e59bdSBen Walkercommon. The framework defines a concept called a `subsystem` and all 18fb5e59bdSBen Walkerfunctionality is implemented in various subsystems. Subsystems have a unified 19fb5e59bdSBen Walkerinitialization and teardown path. 20fb5e59bdSBen Walker 21fb5e59bdSBen Walker# Configuring SPDK Applications {#app_config} 22fb5e59bdSBen Walker 23fb5e59bdSBen Walker## Command Line Parameters {#app_cmd_line_args} 24fb5e59bdSBen Walker 25fb5e59bdSBen WalkerThe SPDK application framework defines a set of base command line flags for all 26fb5e59bdSBen Walkerapplications that use it. Specific applications may implement additional flags. 27fb5e59bdSBen Walker 288f186a81SDariusz StojaczykParam | Long Param | Type | Default | Description 298f186a81SDariusz Stojaczyk-------- | ---------------------- | -------- | ---------------------- | ----------- 308f186a81SDariusz Stojaczyk-c | --config | string | | @ref cmd_arg_config_file 313dfad903SJim Harris-d | --limit-coredump | flag | false | @ref cmd_arg_limit_coredump 32*19c1d632SKrzysztof Karas-e | --tpoint-group | integer | | @ref cmd_arg_limit_tpoint_group_mask 338f186a81SDariusz Stojaczyk-g | --single-file-segments | flag | | @ref cmd_arg_single_file_segments 348f186a81SDariusz Stojaczyk-h | --help | flag | | show all available parameters and exit 358f186a81SDariusz Stojaczyk-i | --shm-id | integer | | @ref cmd_arg_multi_process 368f186a81SDariusz Stojaczyk-m | --cpumask | CPU mask | 0x1 | application @ref cpu_mask 378f186a81SDariusz Stojaczyk-n | --mem-channels | integer | all channels | number of memory channels used for DPDK 38fe137c89SJim Harris-p | --main-core | integer | first core in CPU mask | main (primary) core for DPDK 398f186a81SDariusz Stojaczyk-r | --rpc-socket | string | /var/tmp/spdk.sock | RPC listen address 408f186a81SDariusz Stojaczyk-s | --mem-size | integer | all hugepage memory | @ref cmd_arg_memory_size 414a91adb8SSeth Howell| | --silence-noticelog | flag | | disable notice level logging to `stderr` 428f186a81SDariusz Stojaczyk-u | --no-pci | flag | | @ref cmd_arg_disable_pci_access. 434a91adb8SSeth Howell| | --wait-for-rpc | flag | | @ref cmd_arg_deferred_initialization 445237fe34SJim Harris-B | --pci-blocked | B:D:F | | @ref cmd_arg_pci_blocked_allowed. 455237fe34SJim Harris-A | --pci-allowed | B:D:F | | @ref cmd_arg_pci_blocked_allowed. 468f186a81SDariusz Stojaczyk-R | --huge-unlink | flag | | @ref cmd_arg_huge_unlink 473e75e90aSDarek Stojaczyk| | --huge-dir | string | the first discovered | allocate hugepages from a specific mount 488a76c248STomasz Zawadzki-L | --logflag | string | | @ref cmd_arg_log_flags 498f186a81SDariusz Stojaczyk 50fb5e59bdSBen Walker### Configuration file {#cmd_arg_config_file} 51fb5e59bdSBen Walker 522903c655STomasz ZawadzkiSPDK applications are configured using a JSON RPC configuration file. 532903c655STomasz ZawadzkiSee @ref jsonrpc for details. 54fb5e59bdSBen Walker 553dfad903SJim Harris### Limit coredump {#cmd_arg_limit_coredump} 563dfad903SJim Harris 573dfad903SJim HarrisBy default, an SPDK application will set resource limits for core file sizes 583dfad903SJim Harristo RLIM_INFINITY. Specifying `--limit-coredump` will not set the resource limits. 593dfad903SJim Harris 603dfad903SJim Harris### Tracepoint group mask {#cmd_arg_limit_tpoint_group_mask} 613dfad903SJim Harris 623dfad903SJim HarrisSPDK has an experimental low overhead tracing framework. Tracepoints in this 633dfad903SJim Harrisframework are organized into tracepoint groups. By default, all tracepoint 64*19c1d632SKrzysztof Karasgroups are disabled. `--tpoint-group` can be used to enable a specific 653dfad903SJim Harrissubset of tracepoint groups in the application. 663dfad903SJim Harris 673dfad903SJim HarrisNote: Additional documentation on the tracepoint framework is in progress. 683dfad903SJim Harris 69fb5e59bdSBen Walker### Deferred initialization {#cmd_arg_deferred_initialization} 70fb5e59bdSBen Walker 71fb5e59bdSBen WalkerSPDK applications progress through a set of states beginning with `STARTUP` and 72fb5e59bdSBen Walkerending with `RUNTIME`. 73fb5e59bdSBen Walker 748f186a81SDariusz StojaczykIf the `--wait-for-rpc` parameter is provided SPDK will pause just before starting 75e85d4712SMaciej Wawrykframework initialization. This state is called `STARTUP`. The JSON RPC server is 76e85d4712SMaciej Wawrykready but only a small subset of commands are available to set up initialization 77fb5e59bdSBen Walkerparameters. Those parameters can't be changed after the SPDK application enters 78fb5e59bdSBen Walker`RUNTIME` state. When the client finishes configuring the SPDK subsystems it 79e85d4712SMaciej Wawrykneeds to issue the @ref rpc_framework_start_init RPC command to begin the 80e85d4712SMaciej Wawrykinitialization process. After `rpc_framework_start_init` returns `true` SPDK 81fb5e59bdSBen Walkerwill enter the `RUNTIME` state and the list of available commands becomes much 82fb5e59bdSBen Walkerlarger. 83fb5e59bdSBen Walker 84fb5e59bdSBen WalkerTo see which RPC methods are available in the current state, issue the 856ee44c69SJim Harris`rpc_get_methods` with the parameter `current` set to `true`. 86fb5e59bdSBen Walker 87fb5e59bdSBen WalkerFor more details see @ref jsonrpc documentation. 88fb5e59bdSBen Walker 898f186a81SDariusz Stojaczyk### Create just one hugetlbfs file {#cmd_arg_single_file_segments} 908f186a81SDariusz Stojaczyk 918f186a81SDariusz StojaczykInstead of creating one hugetlbfs file per page, this option makes SPDK create 921f813ec3SChen Wangone file per hugepages per socket. This is needed for @ref virtio to be used 938f186a81SDariusz Stojaczykwith more than 8 hugepages. See @ref virtio_2mb. 948f186a81SDariusz Stojaczyk 958f186a81SDariusz Stojaczyk### Multi process mode {#cmd_arg_multi_process} 968f186a81SDariusz Stojaczyk 978f186a81SDariusz StojaczykWhen `--shm-id` is specified, the application is started in multi-process mode. 988f186a81SDariusz StojaczykApplications using the same shm-id share their memory and 998f186a81SDariusz Stojaczyk[NVMe devices](@ref nvme_multi_process). The first app to start with a given id 1008f186a81SDariusz Stojaczykbecomes a primary process, with the rest, called secondary processes, only 1018f186a81SDariusz Stojaczykattaching to it. When the primary process exits, the secondary ones continue to 1028f186a81SDariusz Stojaczykoperate, but no new processes can be attached at this point. All processes within 1038f186a81SDariusz Stojaczykthe same shm-id group must use the same 1048f186a81SDariusz Stojaczyk[--single-file-segments setting](@ref cmd_arg_single_file_segments). 1058f186a81SDariusz Stojaczyk 1068f186a81SDariusz Stojaczyk### Memory size {#cmd_arg_memory_size} 1078f186a81SDariusz Stojaczyk 1088f186a81SDariusz StojaczykTotal size of the hugepage memory to reserve. If DPDK env layer is used, it will 1098f186a81SDariusz Stojaczykreserve memory from all available hugetlbfs mounts, starting with the one with 1108f186a81SDariusz Stojaczykthe highest page size. This option accepts a number of bytes with a possible 1118f186a81SDariusz Stojaczykbinary prefix, e.g. 1024, 1024M, 1G. The default unit is megabyte. 1128f186a81SDariusz Stojaczyk 1133e229714SDarek StojaczykStarting with DPDK 18.05.1, it's possible to reserve hugepages at runtime, meaning 1143e229714SDarek Stojaczykthat SPDK application can be started with 0 pre-reserved memory. Unlike hugepages 1153e229714SDarek Stojaczykpre-reserved at the application startup, the hugepages reserved at runtime will be 1163e229714SDarek Stojaczykreleased to the system as soon as they're no longer used. 1173e229714SDarek Stojaczyk 118fb5e59bdSBen Walker### Disable PCI access {#cmd_arg_disable_pci_access} 119fb5e59bdSBen Walker 120fb5e59bdSBen WalkerIf SPDK is run with PCI access disabled it won't detect any PCI devices. This 121fb5e59bdSBen Walkerincludes primarily NVMe and IOAT devices. Also, the VFIO and UIO kernel modules 122fb5e59bdSBen Walkerare not required in this mode. 123fb5e59bdSBen Walker 1245237fe34SJim Harris### PCI address blocked and allowed lists {#cmd_arg_pci_blocked_allowed} 125fb5e59bdSBen Walker 1265237fe34SJim HarrisIf blocked list is used, then all devices with the provided PCI address will be 1275237fe34SJim Harrisignored. If an allowed list is used, only allowed devices will be probed. 1285237fe34SJim Harris`-B` or `-A` can be used more than once, but cannot be mixed together. That is, 1295237fe34SJim Harris`-B` and `-A` cannot be used at the same time. 130fb5e59bdSBen Walker 1318f186a81SDariusz Stojaczyk### Unlink hugepage files after initialization {#cmd_arg_huge_unlink} 132fb5e59bdSBen Walker 1338f186a81SDariusz StojaczykBy default, each DPDK-based application tries to remove any orphaned hugetlbfs 1348f186a81SDariusz Stojaczykfiles during its initialization. This option removes hugetlbfs files of the current 1358f186a81SDariusz Stojaczykprocess as soon as they're created, but is not compatible with `--shm-id`. 136fb5e59bdSBen Walker 1378a76c248STomasz Zawadzki### Log flag {#cmd_arg_log_flags} 1388f186a81SDariusz Stojaczyk 1398a76c248STomasz ZawadzkiEnable a specific log type. This option can be used more than once. A list of 140799aa686SJim Harrisall available types is provided in the `--help` output, with `--logflag all` 1418a76c248STomasz Zawadzkienabling all of them. Additionally enables debug print level in debug builds of SPDK. 142fb5e59bdSBen Walker 143fb5e59bdSBen Walker## CPU mask {#cpu_mask} 144fb5e59bdSBen Walker 145fb5e59bdSBen WalkerWhenever the `CPU mask` is mentioned it is a string in one of the following formats: 146fb5e59bdSBen Walker 147fb5e59bdSBen Walker- Case insensitive hexadecimal string with or without "0x" prefix. 148fb5e59bdSBen Walker- Comma separated list of CPUs or list of CPU ranges. Use '-' to define range. 149fb5e59bdSBen Walker 150fb5e59bdSBen Walker### Example 151fb5e59bdSBen Walker 152fb5e59bdSBen WalkerThe following CPU masks are equal and correspond to CPUs 0, 1, 2, 8, 9, 10, 11 and 12: 153fb5e59bdSBen Walker 15463ee471bSMaciej Wawryk~~~bash 155fb5e59bdSBen Walker0x1f07 156fb5e59bdSBen Walker0x1F07 157fb5e59bdSBen Walker1f07 158fb5e59bdSBen Walker[0,1,2,8-12] 159fb5e59bdSBen Walker[0, 1, 2, 8, 9, 10, 11, 12] 160fb5e59bdSBen Walker~~~ 161