]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/README.md
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / README.md
1 # Storage Performance Development Kit
2
3 [![Build Status](https://travis-ci.org/spdk/spdk.svg?branch=master)](https://travis-ci.org/spdk/spdk)
4
5 The Storage Performance Development Kit ([SPDK](http://www.spdk.io)) provides a set of tools
6 and libraries for writing high performance, scalable, user-mode storage
7 applications. It achieves high performance by moving all of the necessary
8 drivers into userspace and operating in a polled mode instead of relying on
9 interrupts, which avoids kernel context switches and eliminates interrupt
10 handling overhead.
11
12 The development kit currently includes:
13 * [NVMe driver](http://www.spdk.io/doc/nvme.html)
14 * [I/OAT (DMA engine) driver](http://www.spdk.io/doc/ioat.html)
15 * [NVMe over Fabrics target](http://www.spdk.io/doc/nvmf.html)
16 * [iSCSI target](http://www.spdk.io/doc/iscsi.html)
17 * [vhost target](http://www.spdk.io/doc/vhost.html)
18 * [Virtio-SCSI driver](http://www.spdk.io/doc/virtio.html)
19
20 # In this readme:
21
22 * [Documentation](#documentation)
23 * [Prerequisites](#prerequisites)
24 * [Source Code](#source)
25 * [Build](#libraries)
26 * [Unit Tests](#tests)
27 * [Vagrant](#vagrant)
28 * [Advanced Build Options](#advanced)
29 * [Hugepages and Device Binding](#huge)
30 * [Example Code](#examples)
31 * [Contributing](#contributing)
32
33 <a id="documentation"></a>
34 ## Documentation
35
36 [Doxygen API documentation](http://www.spdk.io/doc/) is available, as
37 well as a [Porting Guide](http://www.spdk.io/doc/porting.html) for porting SPDK to different frameworks
38 and operating systems.
39
40 <a id="source"></a>
41 ## Source Code
42
43 ~~~{.sh}
44 git clone https://github.com/spdk/spdk
45 cd spdk
46 git submodule update --init
47 ~~~
48
49 <a id="prerequisites"></a>
50 ## Prerequisites
51
52 The dependencies can be installed automatically by `scripts/pkgdep.sh`.
53
54 ~~~{.sh}
55 ./scripts/pkgdep.sh
56 ~~~
57
58 <a id="libraries"></a>
59 ## Build
60
61 Linux:
62
63 ~~~{.sh}
64 ./configure
65 make
66 ~~~
67
68 FreeBSD:
69 Note: Make sure you have the matching kernel source in /usr/src/ and
70 also note that CONFIG_COVERAGE option is not available right now
71 for FreeBSD builds.
72
73 ~~~{.sh}
74 ./configure
75 gmake
76 ~~~
77
78 <a id="tests"></a>
79 ## Unit Tests
80
81 ~~~{.sh}
82 ./test/unit/unittest.sh
83 ~~~
84
85 You will see several error messages when running the unit tests, but they are
86 part of the test suite. The final message at the end of the script indicates
87 success or failure.
88
89 <a id="vagrant"></a>
90 ## Vagrant
91
92 A [Vagrant](https://www.vagrantup.com/downloads.html) setup is also provided
93 to create a Linux VM with a virtual NVMe controller to get up and running
94 quickly. Currently this has only been tested on MacOS and Ubuntu 16.04.2 LTS
95 with the [VirtualBox](https://www.virtualbox.org/wiki/Downloads) provider. The
96 [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads) must
97 also be installed in order to get the required NVMe support.
98
99 Details on the Vagrant setup can be found in the
100 [SPDK Vagrant documentation](http://spdk.io/doc/vagrant.html).
101
102 <a id="advanced"></a>
103 ## Advanced Build Options
104
105 Optional components and other build-time configuration are controlled by
106 settings in the Makefile configuration file in the root of the repository. `CONFIG`
107 contains the base settings for the `configure` script. This script generates a new
108 file, `mk/config.mk`, that contains final build settings. For advanced configuration,
109 there are a number of additional options to `configure` that may be used, or
110 `mk/config.mk` can simply be created and edited by hand. A description of all
111 possible options is located in `CONFIG`.
112
113 Boolean (on/off) options are configured with a 'y' (yes) or 'n' (no). For
114 example, this line of `CONFIG` controls whether the optional RDMA (libibverbs)
115 support is enabled:
116
117 CONFIG_RDMA?=n
118
119 To enable RDMA, this line may be added to `mk/config.mk` with a 'y' instead of
120 'n'. For the majority of options this can be done using the `configure` script.
121 For example:
122
123 ~~~{.sh}
124 ./configure --with-rdma
125 ~~~
126
127 Additionally, `CONFIG` options may also be overridden on the `make` command
128 line:
129
130 ~~~{.sh}
131 make CONFIG_RDMA=y
132 ~~~
133
134 Users may wish to use a version of DPDK different from the submodule included
135 in the SPDK repository. Note, this includes the ability to build not only
136 from DPDK sources, but also just with the includes and libraries
137 installed via the dpdk and dpdk-devel packages. To specify an alternate DPDK
138 installation, run configure with the --with-dpdk option. For example:
139
140 Linux:
141
142 ~~~{.sh}
143 ./configure --with-dpdk=/path/to/dpdk/x86_64-native-linuxapp-gcc
144 make
145 ~~~
146
147 FreeBSD:
148
149 ~~~{.sh}
150 ./configure --with-dpdk=/path/to/dpdk/x86_64-native-bsdapp-clang
151 gmake
152 ~~~
153
154 The options specified on the `make` command line take precedence over the
155 values in `mk/config.mk`. This can be useful if you, for example, generate
156 a `mk/config.mk` using the `configure` script and then have one or two
157 options (i.e. debug builds) that you wish to turn on and off frequently.
158
159 <a id="huge"></a>
160 ## Hugepages and Device Binding
161
162 Before running an SPDK application, some hugepages must be allocated and
163 any NVMe and I/OAT devices must be unbound from the native kernel drivers.
164 SPDK includes a script to automate this process on both Linux and FreeBSD.
165 This script should be run as root.
166
167 ~~~{.sh}
168 sudo scripts/setup.sh
169 ~~~
170
171 Users may wish to configure a specific memory size. Below is an example of
172 configuring 8192MB memory.
173
174 ~~~{.sh}
175 sudo HUGEMEM=8192 scripts/setup.sh
176 ~~~
177
178 <a id="examples"></a>
179 ## Example Code
180
181 Example code is located in the examples directory. The examples are compiled
182 automatically as part of the build process. Simply call any of the examples
183 with no arguments to see the help output. You'll likely need to run the examples
184 as a privileged user (root) unless you've done additional configuration
185 to grant your user permission to allocate huge pages and map devices through
186 vfio.
187
188 <a id="contributing"></a>
189 ## Contributing
190
191 For additional details on how to get more involved in the community, including
192 [contributing code](http://www.spdk.io/development) and participating in discussions and other activities, please
193 refer to [spdk.io](http://www.spdk.io/community)