Giter VIP home page Giter VIP logo

dpdk's Introduction

Storage Performance Development Kit

License Build Status Go Doc Go Report Card

NOTE: The SPDK mailing list has moved to a new location. Please visit this URL to subscribe at the new location. Subscribers from the old location will not be automatically migrated to the new location.

The Storage Performance Development Kit (SPDK) provides a set of tools and libraries for writing high performance, scalable, user-mode storage applications. It achieves high performance by moving all of the necessary drivers into userspace and operating in a polled mode instead of relying on interrupts, which avoids kernel context switches and eliminates interrupt handling overhead.

The development kit currently includes:

In this readme

Documentation

Doxygen API documentation is available, as well as a Porting Guide for porting SPDK to different frameworks and operating systems.

Source Code

git clone https://github.com/spdk/spdk
cd spdk
git submodule update --init

Prerequisites

The dependencies can be installed automatically by scripts/pkgdep.sh. The scripts/pkgdep.sh script will automatically install the bare minimum dependencies required to build SPDK. Use --help to see information on installing dependencies for optional components

./scripts/pkgdep.sh

Build

Linux:

./configure
make

FreeBSD: Note: Make sure you have the matching kernel source in /usr/src/ and also note that CONFIG_COVERAGE option is not available right now for FreeBSD builds.

./configure
gmake

Unit Tests

./test/unit/unittest.sh

You will see several error messages when running the unit tests, but they are part of the test suite. The final message at the end of the script indicates success or failure.

Vagrant

A Vagrant setup is also provided to create a Linux VM with a virtual NVMe controller to get up and running quickly. Currently this has been tested on MacOS, Ubuntu 16.04.2 LTS and Ubuntu 18.04.3 LTS with the VirtualBox and Libvirt provider. The VirtualBox Extension Pack or [Vagrant Libvirt] (https://github.com/vagrant-libvirt/vagrant-libvirt) must also be installed in order to get the required NVMe support.

Details on the Vagrant setup can be found in the SPDK Vagrant documentation.

AWS

The following setup is known to work on AWS: Image: Ubuntu 18.04 Before running setup.sh, run modprobe vfio-pci then: DRIVER_OVERRIDE=vfio-pci ./setup.sh

Advanced Build Options

Optional components and other build-time configuration are controlled by settings in the Makefile configuration file in the root of the repository. CONFIG contains the base settings for the configure script. This script generates a new file, mk/config.mk, that contains final build settings. For advanced configuration, there are a number of additional options to configure that may be used, or mk/config.mk can simply be created and edited by hand. A description of all possible options is located in CONFIG.

Boolean (on/off) options are configured with a 'y' (yes) or 'n' (no). For example, this line of CONFIG controls whether the optional RDMA (libibverbs) support is enabled:

CONFIG_RDMA?=n

To enable RDMA, this line may be added to mk/config.mk with a 'y' instead of 'n'. For the majority of options this can be done using the configure script. For example:

./configure --with-rdma

Additionally, CONFIG options may also be overridden on the make command line:

make CONFIG_RDMA=y

Users may wish to use a version of DPDK different from the submodule included in the SPDK repository. Note, this includes the ability to build not only from DPDK sources, but also just with the includes and libraries installed via the dpdk and dpdk-devel packages. To specify an alternate DPDK installation, run configure with the --with-dpdk option. For example:

Linux:

./configure --with-dpdk=/path/to/dpdk/x86_64-native-linuxapp-gcc
make

FreeBSD:

./configure --with-dpdk=/path/to/dpdk/x86_64-native-bsdapp-clang
gmake

The options specified on the make command line take precedence over the values in mk/config.mk. This can be useful if you, for example, generate a mk/config.mk using the configure script and then have one or two options (i.e. debug builds) that you wish to turn on and off frequently.

Shared libraries

By default, the build of the SPDK yields static libraries against which the SPDK applications and examples are linked. Configure option --with-shared provides the ability to produce SPDK shared libraries, in addition to the default static ones. Use of this flag also results in the SPDK executables linked to the shared versions of libraries. SPDK shared libraries by default, are located in ./build/lib. This includes the single SPDK shared lib encompassing all of the SPDK static libs (libspdk.so) as well as individual SPDK shared libs corresponding to each of the SPDK static ones.

In order to start a SPDK app linked with SPDK shared libraries, make sure to do the following steps:

  • run ldconfig specifying the directory containing SPDK shared libraries
  • provide proper LD_LIBRARY_PATH

If DPDK shared libraries are used, you may also need to add DPDK shared libraries to LD_LIBRARY_PATH

Linux:

./configure --with-shared
make
ldconfig -v -n ./build/lib
LD_LIBRARY_PATH=./build/lib/:./dpdk/build/lib/ ./build/bin/spdk_tgt

Hugepages and Device Binding

Before running an SPDK application, some hugepages must be allocated and any NVMe and I/OAT devices must be unbound from the native kernel drivers. SPDK includes a script to automate this process on both Linux and FreeBSD. This script should be run as root.

sudo scripts/setup.sh

Users may wish to configure a specific memory size. Below is an example of configuring 8192MB memory.

sudo HUGEMEM=8192 scripts/setup.sh

There are a lot of other environment variables that can be set to configure setup.sh for advanced users. To see the full list, run:

scripts/setup.sh --help

Target applications

After completing the build process, SPDK target applications can be found in spdk/build/bin directory:

  • nvmf_tgt - SPDK NVMe over Fabrics target presents block devices over a fabrics,
  • iscsi_tgt - SPDK iSCSI target runs I/O operations remotely with TCP/IP protocol,
  • vhost - A vhost target provides a local storage service as a process running on a local machine,
  • spdk_tgt - combines capabilities of all three applications.

SPDK runs in a polled mode, which means it continuously checks for operation completions. This approach assures faster response than interrupt mode, but also lessens usefulness of tools like top, which only shows 100% CPU usage for SPDK assigned cores. spdk_top is a program which simulates top application and uses SPDK's JSON RPC interface to present statistics about SPDK threads, pollers and CPU cores as an interactive list.

Example Code

Example code is located in the examples directory. The examples are compiled automatically as part of the build process. Simply call any of the examples with no arguments to see the help output. You'll likely need to run the examples as a privileged user (root) unless you've done additional configuration to grant your user permission to allocate huge pages and map devices through vfio.

Contributing

For additional details on how to get more involved in the community, including contributing code and participating in discussions and other activities, please refer to spdk.io

dpdk's People

Contributors

ajitkhaparde avatar am6 avatar anatolyburakov avatar arybchenko avatar beileix avatar bruce-richardson avatar caviumncd avatar cristian-dumitrescu avatar david-marchand avatar dekelp avatar fionatrahe avatar helin-zhang avatar hemantagr avatar jasvinderd avatar kananyev avatar mcoquelin avatar ol-ivanmal avatar olivier-matz-6wind avatar pablodelara avatar pavannikhilesh avatar qzhan16 avatar shahafsh avatar shemminger avatar tmonjalo avatar viacheslavo avatar wenzhuol avatar wujingji avatar xiaowang1772 avatar yskoh-mellanox avatar zhaowei413 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dpdk's Issues

Mention move to own git hosting

I thought this was the canonical repository until i noticed the 3-year old timestamp on the latest commit. It would save time for a lot of people if the move to the own git repo hosting was documented in the README here. I can provide a PR for that if you like?

Release 19.05?

SPDK v19.04.1 makes reference to:

DPDK
Added DPDK 19.05 support.

But I don't see any 19.05 release here. Latest seems to be v18.08. Is dpdk behind on making some releases?

Dpdk build getting failed due to issue in rpath

Getting following error while building librte_eal for dpdk -

Error: Linker flag rpath (build-time rpath) is not allowed, unless it is a placeholder for INSTALL_RPATH (:*). Please fix the build script for this package.

cc -o lib/librte_eal.so.21.0 lib/librte_eal.a.p/librte_eal_common_eal_common_bus.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_cpuflags.c.o lib/librte_eal.a.p/librte_eal_common_eal_c ommon_class.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_config.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_debug.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_devargs.c.o lib/librte_ eal.a.p/librte_eal_common_eal_common_dev.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_errno.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_fbarray.c.o lib/librte_eal.a.p/librte_eal_common_eal_ common_hexdump.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_hypervisor.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_launch.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_lcore.c.o lib/l ibrte_eal.a.p/librte_eal_common_eal_common_log.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_mcfg.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_memalloc.c.o lib/librte_eal.a.p/librte_eal_commo n_eal_common_memory.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_memzone.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_options.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_proc.c.o lib /librte_eal.a.p/librte_eal_common_eal_common_string_fns.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_tailqs.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_thread.c.o lib/librte_eal.a.p/librte_ eal_common_eal_common_timer.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_trace.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_trace_ctf.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_trac e_points.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_trace_utils.c.o lib/librte_eal.a.p/librte_eal_common_eal_common_uuid.c.o lib/librte_eal.a.p/librte_eal_common_hotplug_mp.c.o lib/librte_eal.a.p /librte_eal_common_malloc_elem.c.o lib/librte_eal.a.p/librte_eal_common_malloc_heap.c.o lib/librte_eal.a.p/librte_eal_common_malloc_mp.c.o lib/librte_eal.a.p/librte_eal_common_rte_keepalive.c.o lib/librte _eal.a.p/librte_eal_common_rte_malloc.c.o lib/librte_eal.a.p/librte_eal_common_rte_random.c.o lib/librte_eal.a.p/librte_eal_common_rte_reciprocal.c.o lib/librte_eal.a.p/librte_eal_common_rte_service.c.o l ib/librte_eal.a.p/librte_eal_common_eal_common_dynmem.c.o lib/librte_eal.a.p/librte_eal_unix_eal_file.c.o lib/librte_eal.a.p/librte_eal_unix_eal_unix_memory.c.o lib/librte_eal.a.p/librte_eal_unix_eal_unix _timer.c.o lib/librte_eal.a.p/librte_eal_linux_eal.c.o lib/librte_eal.a.p/librte_eal_linux_eal_alarm.c.o lib/librte_eal.a.p/librte_eal_linux_eal_cpuflags.c.o lib/librte_eal.a.p/librte_eal_linux_eal_debug. c.o lib/librte_eal.a.p/librte_eal_linux_eal_dev.c.o lib/librte_eal.a.p/librte_eal_linux_eal_hugepage_info.c.o lib/librte_eal.a.p/librte_eal_linux_eal_interrupts.c.o lib/librte_eal.a.p/librte_eal_linux_eal _lcore.c.o lib/librte_eal.a.p/librte_eal_linux_eal_log.c.o lib/librte_eal.a.p/librte_eal_linux_eal_memalloc.c.o lib/librte_eal.a.p/librte_eal_linux_eal_memory.c.o lib/librte_eal.a.p/librte_eal_linux_eal_t hread.c.o lib/librte_eal.a.p/librte_eal_linux_eal_timer.c.o lib/librte_eal.a.p/librte_eal_linux_eal_vfio.c.o lib/librte_eal.a.p/librte_eal_linux_eal_vfio_mp_sync.c.o lib/librte_eal.a.p/librte_eal_x86_rte_ cpuflags.c.o lib/librte_eal.a.p/librte_eal_x86_rte_cycles.c.o lib/librte_eal.a.p/librte_eal_x86_rte_hypervisor.c.o lib/librte_eal.a.p/librte_eal_x86_rte_spinlock.c.o -Wl,--as-needed -Wl,--no-undefined -Wl ,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librte_eal.so.21 -Wl,--no-as-needed -pthread -lm -ldl -Wl,-L/thirdparty/spdk-21.01.1/dpdk/config/../../../build/lib,-lnuma '-Wl,-rpath,$ORIGIN/' -Wl,-rpath -link,/thirdparty/spdk-21.01.1/dpdk/build-tmp/lib lib/librte_kvargs.so.21.0 lib/librte_telemetry.so.21.0 -Wl,--end-group -Wl,--version-script=/thirdparty/spdk-21.01.1/dpdk/lib/librte_eal/version.map Error: Linker flag rpath (build-time rpath) is not allowed, unless it is a placeholder for INSTALL_RPATH (:*). Please fix the build script for this package.

I believe this is due to an incompatibility with the linker but I couldn't find any such error on the internet. Can anyone please explain how to resolve this or even what this error means?

GCC version: 7.3.0

meson version: 0.58.1

ninja version: 1.10.0

OS version: CentOS Linux release 7.9.2009 (Core)

Dpdk often stuck in write log to /var/log/message when start VM?

1, The backtrace for vhost that it hit this issue
(gdb) info threads
Id Target Id Frame
7 Thread 0x7faa860ed700 (LWP 2179359) "eal-intr-thread" 0x00007faa86612923 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
6 Thread 0x7faa858ec700 (LWP 2179363) "reactor_4" 0x0000000000485e27 in reactor_post_process_lw_thread ()
5 Thread 0x7faa850eb700 (LWP 2179364) "reactor_5" 0x00000000004862ec in reactor_run ()
4 Thread 0x7faa848ea700 (LWP 2179365) "reactor_6" 0x00000000004b4612 in spdk_get_ticks ()
3 Thread 0x7faa840e9700 (LWP 2179366) "vhost" 0x00007faa868eb98d in accept () at ../sysdeps/unix/syscall-template.S:81
2 Thread 0x7faa7afd7700 (LWP 2179400) "vhost-events" 0x00007faa8660385d in write () at ../sysdeps/unix/syscall-template.S:81

  • 1 Thread 0x7faa87b88bc0 (LWP 2179357) "reactor_3" __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
    (gdb) bt
    #0 __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
    #1 0x00007faa8656659f in _L_lock_1030 () from /lib64/libc.so.6
    #2 0x00007faa86561344 in _IO_vfprintf_internal (s=0x1a8df80, format=0x5a0d18 "VHOST_CONFIG: vhost-user %s: socket created, fd: %d\n", ap=0x7ffc3e263808) at vfprintf.c:1313
    #3 0x00000000004bf355 in rte_vlog ()
    #4 0x0000000000405f99 in rte_log ()
    #5 0x00000000005091b2 in create_unix_socket ()
    #6 0x000000000050a1ef in rte_vhost_driver_register ()
    #7 0x00000000004833ac in vhost_register_unix_socket ()
    #8 0x000000000047d708 in vhost_dev_register ()
    #9 0x0000000000482d36 in spdk_vhost_blk_construct ()
    #10 0x000000000047eec5 in rpc_vhost_create_blk_controller ()
    #11 0x0000000000489c74 in jsonrpc_parse_request ()
    #12 0x000000000048a708 in spdk_jsonrpc_server_poll ()
    #13 0x0000000000486ca9 in rpc_subsystem_poll ()
    #14 0x00000000004a4e61 in spdk_thread_poll ()
    #15 0x0000000000486310 in reactor_run ()
    #16 0x0000000000486818 in spdk_reactors_start ()
    #17 0x000000000048440d in spdk_app_start ()
    #18 0x000000000040938f in main ()

2, Host is rehat 7.4 and kernal version is 3.10.0-693.el7.x86_64
3, spdk and dpdk version show as below.

Starting SPDK v21.01-pre git sha1 602b134 / DPDK 20.08.0 initialization...
[2021-06-30 12:45:22.064330] [ DPDK EAL parameters: [2021-06-30 12:45:22.064341] vhost [2021-06-30 12:45:22.064348] --no-shconf [2021-06-30 12:45:22.064355] -c 0x78 [2021-06-30 12:45:22.064361] --log-level=lib.eal:6 [2021-06-30 12:45:22.064367] --log-level=lib.cryptodev:5 [2021-06-30 12:45:22.064373] --log-level=user1:6 [2021-06-30 12:45:22.064380] --base-virtaddr=0x200000000000 [2021-06-30 12:45:22.064386] --match-allocations [2021-06-30 12:45:22.064393] --file-prefix=spdk_pid15246 [2021-06-30 12:45:22.064400] ]

  1. qemu thread run with parameter as below.
    -object memory-backend-file,id=mem0,size=4G,mem-path=/dev/hugepages,share=on -numa node,memdev=mem0 -chardev socket,id=spdk_vhost_blkc44a0c1e-df13-11eb-a280-525400a98761,path=/var/tmp/vhost.c44a0c1e-df13-11eb-a280-525400a98761,reconnect=1
    -device vhost-user-blk-pci,chardev=spdk_vhost_blkc44a0c1e-df13-11eb-a280-525400a98761,bootindex=1,num-queues=2 -chardev socket,id=spdk_vhost_blk12ac81ce-62ed-4b18-ae41-79ab44b34fbb,path=/var/tmp/vhost.12ac81ce-62ed-4b18-ae41-79ab44b34fbb,reconnect=1
    -device vhost-user-blk-pci,chardev=spdk_vhost_blk12ac81ce-62ed-4b18-ae41-79ab44b34fbb,num-queues=2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.