Commit Graph

60 Commits

Author SHA1 Message Date
Pawel Wodkowski
c778e3e54f setup.sh: add PCI_BLACKLIST
Add PCI blacklist so we can skip only some devices.

Change-Id: I8600307dd53f32acb4dfeb3f57845e0b9d29fdb9
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442977
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-02-04 20:47:30 +00:00
Pawel Wodkowski
8b9ec6e33b setup.sh: remove usless '= "0"' part from if statements
Bash interprets everything after command as additional
function arguments. To not confuse user just remove this part
and replace by '!'.

Change-Id: I44228003a1f96324271e726df4f5033f3258523c
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442976
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-02-04 20:47:30 +00:00
Lance Hartmann
fe34909871 setup.sh: Fix cleanup in matching files
The original mechanism to identify files to cleanup
relied on glob matching from the output of 'echo'
piped to a grep.  This yields a case where some
objects can appear and picked up as matching because
other items on the same line matched the grep
string.   Changing this to use 'ls -1' which will
restrict the grep string matching to individual lines
thereby only picking up the entities the script
intended to do.

Change-Id: I020c80236fa68bcabeca0299fe7a27f3320de97b
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/437380
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2018-12-18 08:40:14 +00:00
Darek Stojaczyk
1045dab06f setup.sh: don't unbind devices with LVM on top
Grepping `mount` output for /dev/sdX does not guarantee
the device has no mountpoints. If /dev/sdX happens to
have an LVM built on top, then it could be
/dev/mapper/something that appears in `mount`.

Fix this by checking mountpoints of /dev/sdX and all its
children as reported by `lsblk`.

Change-Id: Id2fa6939645584d009bc87c7341a97f6948ebde9
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/434209
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-11-29 19:17:46 +00:00
tone.zhang
e93d56b1ed setup.sh: Enable users select kernel driver for identified PCI deivces
The PCI devices used for SPDK are bound with vfio-pci or
uio_pci_generic kernel drivers. In setup.sh, if the path /sys/kernel
/iommu_groups is not empty, vfio-pci kernel driver is the only choice;
otherwise uio_pci_generic is selected.

In system, IOMMU can be enabled but set to pass through. It means
IOMMU will not affect the DMA transmission although IOMMU groups has
been configured. In this case both two kernel drivers are workable. The
script cannot deal with the case now.

The new option DRIVER_OVERRIDE is introduced in the patch and allow
user selects the kernel driver for PCI devices. With the patch the above
case can be handled correctly.

Change-Id: I540d8750bf837ce67b8bc8b516a1a3acb72c502c
Signed-off-by: tone.zhang <tone.zhang@arm.com>
Reviewed-on: https://review.gerrithub.io/427297
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-11-08 23:33:59 +00:00
Darek Stojaczyk
a17d17de3e setup.sh: cleanup bdevperf trace files
A recent patch changed bdevperf app name from 'bdevtest' to 'bdevperf'.

Change-Id: I6f89cb20560b819f8c451b34ee5afbf5fca68939
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/430343
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-10-23 08:08:25 +00:00
Karol Latecki
c7917f2252 scripts/autotest: print short info for setup.sh cleanup and status
Print shorter output about unsupported option instead of
printing full "usage" text.

Change-Id: I92a98b0bdf0b2ed9ac56da644f24777f76e7df29
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/426471
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-10-02 22:10:32 +00:00
Dariusz Stojaczyk
1469679f09 setup.sh: cleanup any leftover DPDK files
SPDK deletes those files automatically for single-process
applications and the multi-process' ones can now be freed
with `./setup.sh cleanup`.

The script clears so called DPDK runtime directories, which
are defined as follows (for DPDK 18.05+):
 * If DPDK is running as root, /var/run/dpdk/<per-pid-prefix>/
 * If DPDK is not running as root:
   * If $XDG_RUNTIME_DIR is set, ${XDG_RUNTIME_DIR}/dpdk/<per-pid-prefix>/
   * Otherwise, /tmp/dpdk/<per-pid-prefix>/

Since DPDK 18.08, even the shared config file is placed in
the runtime dir, making it the only dir we have to clear.

Change-Id: I13f58a98f6a07e609b888b4e816dd45eac10f49c
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/422485
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-08-16 21:09:05 +00:00
Dariusz Stojaczyk
190e580bcb setup.sh: cleanup bdevtest /dev/shm entries
This was most likely overlooked in the original implementation.

Change-Id: Ib3efbcf4a3abcbd6ad6bf9ced7280879b73f86bf
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/422081
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-08-13 16:59:52 +00:00
Pawel Wodkowski
e47f972dff scripts/setup.sh: add cleanup command
From now on remove any SPDK artifacts just use:

./scripts/setup.sh cleanup

Fixes #302

Change-Id: I5ebe522fecfcb8a867a96ab10bacda6083c8c224
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/419575
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-07-18 17:02:50 +00:00
Jim Harris
8021da8ba6 setup.sh: do not unload/reload contigmem.ko on FreeBSD
When running "setup.sh config" (or setup.sh without
specify a mode - which defaults to config), do not
unload the contigmem driver and then reload it.  Over
time, memory can get fragmented and contigmem will fail,
crashing the system.

But still check if the requested HUGEMEM matches what was
previously specified.  If a different amount was requested,
unload contigmem as before and then reload with the new
amount.

This patch brings FreeBSD behavior in line with Linux.  On
Linux, we do not release all of the hugepages and then
reallocate them.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I18cb6fd4bdc1e1da0382423455ebce58c13bee7a

Reviewed-on: https://review.gerrithub.io/412238
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-05-23 18:24:22 +00:00
Daniel Verkamp
dbcc917d81 scripts/setup.sh: avoid clobbering $bdf variable
The get_nvme_name_from_bdf function uses the variable name $bdf, which
is also used as a loop iterator in its caller; since variables are
global by default in bash, this overwrites the original $bdf and may
cause unexpected behavior like skipping setup of some NVMe devices.

The long-term fix should be to declare all variables local in all
functions, but a minimal, targeted fix is to just rename the variable in
the inner function.

Change-Id: I53a877606a585415e8af525c6162ed7b0f67ba45
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403370
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-12 17:04:38 -04:00
Stephen Bates
e1817b60bb setup.sh: Add support for built-in modules
setup.sh uses lsmod to detect if a module is present but this does
not work when modules are built-in. We add a second check (on
/sys/module/<module>) and place the check in a function.

We also change the sense of driver_loaded so it is more sane and also
allows us to return different positive values depending on if the
driver is a module or built-in.

Change-Id: Iccc4dca212a6f04fb2ac9bd4768935f8b2bb240a
Signed-off-by: Stephen Bates <sbates@raithlin.com>
Reviewed-on: https://review.gerrithub.io/402178
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-02 14:14:51 -05:00
Dariusz Stojaczyk
17d55c9fd4 bdev/virtio: added vhost-blk initiator
Briefly tested with SPDK target via bdevio
through both vhost-user and QEMU's virtio-pci.

vhost-blk driver is not mentioned in any doc yet.
A virtio-blk bdev can be created as following:

`construct_virtio_user_blk_bdev /tmp/virtio.0 MyVirtioBlk0 --vq-count 16`
`construct_virtio_pci_blk_bdev 0000:01:00.0 MyVirtioBlk1`

or

```
[VirtioUser0]
  Path /tmp/vhost.0
  Type Blk
  Queues 16

[VirtioPci]
  Enable Yes
```

If `Type` field is not present, the VirtioUser
section will be parsed as a SCSI one, preserving
backward compatibility.

Change-Id: I3eae9f3b90570fbb0177df4951e5eed86fe07c66
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393056
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-02 13:41:38 -05:00
Dariusz Stojaczyk
55241750a6 setup.sh: print hugepage distribution status in setup.sh status
Current output looks as follows:

$ ./scripts/setup.sh status
Hugepages
node     hugesize     free /    num
node0   1048576kB        7 /      9
node0      2048kB     6144 /   6144
node1   1048576kB        0 /      0
node1      2048kB        0 /  15360
NVMe devices
BDF             Numa Node       Driver name             Device name
0000:0a:00.0    0               nvme                    nvme0
[...]

Change-Id: I8cf019f2b4eaa966633427dd8c3759c979ba456c
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/402281
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-02 13:29:34 -05:00
Dariusz Stojaczyk
252d418c40 setup.sh: do not use lsblk -o SUBSYSTEMS
It's apparently unavailable on some systems.
We used it to grep all Virtio-PCI block devices
before matching them against our desired PCI bdf
in get_virtio_names_from_bdf(). If we were unbinding
a Virtio-PCI device and lsblk failed, the script
assumed there were no block devices and hence no
active mountpoints for that Virtio device. The initial
grep is not necessary and, since it's causing us
troubles, is now being removed.

Change-Id: I5a621391dc4772b2bd67eaa832e318d9a0d25948
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/401780
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-01 13:48:54 -05:00
Dariusz Stojaczyk
8be76f8589 setup.sh: hide SKIP_PCI from public help
Instead, PCI_WHITELIST="none" can now be used.
SKIP_PCI continues to work, but is undocumented.

Change-Id: Id4a7959716f6bca92be0da761258c84f32aca8b5
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/395946
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-24 16:45:09 -05:00
Dariusz Stojaczyk
2a68832d5c setup.sh: obey PCI_WHITELIST in ./setup.sh reset
It is now possible to reset only
particular PCI devices.

Change-Id: Ic45be5e7e16cf4736c742b14fc0d709788a3b3f1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/395945
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-24 16:45:09 -05:00
Daniel Verkamp
e489ca69f6 setup.sh: add virtio device names to status output
Change-Id: I0f6e1d8df9480538e2dc39cf658396d4ecd14daa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393724
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-23 23:59:12 -05:00
Dariusz Stojaczyk
3779dda48b setup.sh: change NVME_WHITELIST to PCI_WHITELIST
NVME_WHITELIST param remains to work, but is now
undocumented. PCI_WHITELIST will apply to all PCI
devices - NVMe, IO/AT and Virtio.

Change-Id: I782f48bea68079c63e4a2794e4a4eb8f9a7226c9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/395944
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-23 23:44:06 -05:00
Dariusz Stojaczyk
f8c1c71c2e setup.sh: support multiple hugetlb mountpoints
We used to crash when `mount` returned
multiple hugetlb mountpoints.

Change-Id: I75717c2c394204bdfec730edabb9ff6386047742
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/395926
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-01-23 23:44:06 -05:00
Dariusz Stojaczyk
4b42897985 setup.sh: fix chown
Patch da7e3bb8 [1] disabled chown for vfio
groups and hugepage mountpoints. Chown code
was never being executed.

[1] da7e3bb8 ("setup.sh: replace username param with TARGET_USER env
variable")

Change-Id: Ie5c9ac42fca5b60c72ced501d4065842a5bef9cd
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/395925
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-23 23:44:06 -05:00
Dariusz Stojaczyk
5f247660d7 setup.sh: add help message
```
./scripts/setup.sh help
```

Change-Id: I4804f032861f949be3e541456f1df55b64937909
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/394807
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-19 15:52:59 -05:00
Dariusz Stojaczyk
da7e3bb880 setup.sh: replace username param with TARGET_USER env variable
Make it configurable the same way as other options.
setup.sh will configure hugepages and vfio for the
current user by default. To specify other user,
set TARGET_USER variable.

Change-Id: Ib98178a70a007bec761f7465689c2150e8844ffb
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/394806
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-19 15:52:59 -05:00
Stephen Bates
5c13f5ae6d setup.sh: Add support for NVMe whitelisting
In some cases we may not want to assign all PCIe NVMe controllers in a
system to SPDK. Add a new input to the setup.sh script called
NVME_WHITELIST which whitelists (via PCIe slot ID) the NVMe
controllers you wish to add to SPDK.

If the NVME_WHITELIST input argument is not defined then all PCIe NVMe
controllers will be added. The values in the whitelist whould be
white-space seperated and the entire list should be enclosed in double
quotes ("").

To blacklist all PCIe NVMe devices use a non-valid PCIe slot ID
(e.g. the string "none" would work very well).

Examples:

NVME_WHITELIST="0000:02:00.0" ./setup.sh
NVME_WHITELIST="0000:08:00.0 0000:06:00.1" ./setup.sh
NVME_WHITELIST="none" ./setup.sh

Change-Id: If6ebb04307180cbac11fc41cd9a70749640bc598
Signed-off-by: Stephen Bates <sbates@raithlin.com>
Reviewed-on: https://review.gerrithub.io/394303
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-17 10:09:44 -05:00
Daniel Verkamp
4393f43fbe setup.sh: fix NVMe status on older kernels
Very old kernels (e.g. 3.13 from Ubuntu 14.04) don't have the nvme
directory in /sys/bus/pci/devices/$bdf/, so check for its existence
before trying to list it.

Change-Id: I1f1ca04c71de6359de2b924fb9437ad03c56523b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393725
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-09 15:53:21 -05:00
Dariusz Stojaczyk
9c44fad7e7 setup.sh: don't bind controllers with only *some* devices mounted
This makes us iterate through all devices
on a controller and check if any of those
is mounted. Previously we only checked the
very first device, which is obviously
insufficient.

Change-Id: I776846b931480d1e0a059137950c21f057ecb710
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393749
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-05 14:33:10 -05:00
Dariusz Stojaczyk
f869082a91 setup.sh: don't bind virtio-pci devices with active mountpoints
Change-Id: I92aeb8259383fa3e207e6ab3059109f8275bc549
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393684
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-04 15:29:25 -05:00
Daniel Verkamp
f0c2093477 scripts: factor out iter_pci helper functions
Add a new file, scripts/common.sh, that can be shared between not only
autotest scripts, but also scripts/setup.sh, scripts/gen_nvme.sh, etc.,
and move the PCI iteration functions there.

The iterators are also expanded to work identically for both dev_id and
class_code on Linux and FreeBSD.

Change-Id: I98423cd06242e78535f5da4fce82166812ea96a8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393416
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-03 14:09:22 -05:00
Seth Howell
afec8f1476 setup.sh: updated to support older linux kernel
When looking up nvme devices by name in older linux kernel versions, setup.sh
was throwing errors while trying to follow a symlink on
/sys/block/. This patch adds a fallback to the proper location of this
symlink in those versions of the kernel.

Change-Id: I13b5c1ce6f7505251789b64c740aba04d67f39a9
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/391019
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-12 12:53:33 -05:00
GangCao
d9174e1e42 setup: add the SKIP_PCI parameter in setup.sh
User may only want to configure hugepage and no configure
on the PCI devices. Add the SKIP_PCI parameter to offer
this option.

If user only wants to configure hugepage, can run:
SKIP_PCI=1 ./scripts/setup.sh

The default behavior is that PCI devices will be configured.

Change-Id: I8302efd5a09f2885e00fa8ed00d398219c11dde7
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/389473
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-01 12:08:11 -05:00
GangCao
55ac2263af setup: add the configure and reset pci functions in setup.sh
Introduce several new functions configure_linux_pci, reset_linux_pci and
configure_freebsd_pci for the PCI devices relatd operations.

Change-Id: Ifdaddd314ba01fd73ff700d231a6aeae5ec7c480
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/387265
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-01 12:08:11 -05:00
Dariusz Stojaczyk
261013ad1a scripts/setup: abort on hugepage allocation failure
Change-Id: I01ba59c8bd6fb54e15e3896c7e077ec91fdb88f7
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/384087
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2017-11-09 11:32:54 -05:00
Dariusz Stojaczyk
7ef370dc8f scripts/setup: allow specifying numa node to allocate hugepages on
The setup.sh can now be invoked as following:

```
HUGENODE=0 NRHUGE=5 ./scripts/setup.sh
HUGENODE=1 NRHUGE=3 ./scripts/setup.sh
```

This will allocate 5 hugepages on node0,
and 3 hugepages on node1. If HUGENODE
param is not specified, the setup.sh will
operate just like it used to.

Change-Id: Ib198f5f32203abcc646af3c8d823f2b3e9bce362
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/384086
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2017-11-09 11:32:54 -05:00
Dariusz Stojaczyk
f03d9c574c scripts/setup: update PCI device ID defines for virtio-scsi
The previous defines have been
removed by patch 80b44ea.

Fixes: 80b44ea ("rte_virtio: remove unused PCI ID #defines")

Change-Id: I0e90e7f91a5e91efca3e5562b94cb1f6a36e7428
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382935
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-18 12:33:35 -04:00
Jim Harris
1a15ce9b46 setup.sh: do not unbind NVMe devices with active mountpoints
Use lsblk to detect if an NVMe namespace or any partition on the
namespace has an active mountpoint.  If it does, do not unbind
the NVMe device associated with that NVMe namespace.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I1ab7540d640baa201efac49bc9515fd861dd8f8c

Reviewed-on: https://review.gerrithub.io/382479
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-17 12:49:18 -04:00
Jim Harris
1028372837 setup.sh: for reset, just unbind if kernel driver is not loaded
If the user did not have the ioatdma driver loaded for example,
when running "setup.sh reset", we should not load ioatdma so that
we can bind to it.  Instead just unbind the devices from the
uio/vfio driver.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I953941eb4918105b97ad78987b47b33f4372ae01

Reviewed-on: https://review.gerrithub.io/382474
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-17 12:49:18 -04:00
Hailiang Wang
f062f79768 scripts: replace NRHUGE with HUGEMEM in setup.sh
This allows to use same command
for allocating hugepages on
systems with different hugepage
sizes.

The old NRHUGE variable can be
still set on Linux machines,
but is currently undocumented.

Change-Id: I1fba315d95e9aae8b6a8c9c445deb447fecc65dc
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/369546
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-12 18:27:21 -04:00
Seth Howell
5bdb2886f1 scripts/setup: remove leftover config files from /run
When a DPDK app closes, it leaves behing configuration files that can
cause latent failures in the build pool machines if they are not
removed.

Change-Id: I80caa1b595e6586a109c013b92dfcf306d7a0150
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/379874
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-25 16:08:39 -04:00
Jim Harris
c2175d2c51 virtio: add initial rev of virtio-scsi initiator bdev module
Supports both PCI mode (for usage in guest VMs) and
vhost-user mode (for usage in host processes).  The rte_virtio
subdirectory contains a lot of code lifted from the DPDK
virtio-net driver.  Most of the PCI and vhost-user code is
reused almost exactly as-is, but the virtio code is drastically
rewritten as the DPDK code was very network specific.

Has been lightly tested with both the bdevio and bdevperf
applications in both PCI and vhost-user modes.

Still quite a bit of work needed - a list of todo
items is included in a README in the module's directory.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I85989d3de9ea89a87b719ececdb6d2ac16b77f53
Reviewed-on: https://review.gerrithub.io/374519
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-22 11:54:15 -04:00
Pawel Wodkowski
d783ad1f29 setup.sh: fix linux_iter_pci_class_code and linux_iter_pci_dev_id
Another atempt to fix setup.sh On Ubuntu 16.04 that use GNU Awk 4.1.3. 
Eg when subsystem vendor name and subsystem name are empty:

$ lspci -mm -n -D
...
0000:00:05.0 "0880" "8086" "0e28" -r04 "8086" "3582"
0000:00:05.1 "0880" "8086" "0e29" -r04 "" ""
0000:00:05.2 "0880" "8086" "0e2a" -r04 "8086" "3582"
...

tr -d '"' part is brekaing whole awk script. So lets try to escape
vendor and device ID to comapre them as whole string.

Change-Id: Ic41e82c41347c6e0a8246b445f86eddf56780089
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/374462
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-17 12:43:29 -04:00
Jim Harris
c98e507e9f setup.sh: use ~ to compare device/vendor IDs and class codes
Device IDs starting with 0e get treated as 0 due to numerical
interpretation (0 * 10^x = 0).  So use ~ to do a string regexp
comparison instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4b5558c0127b0c4f021daf8151bf4d3f514e44da

Reviewed-on: https://review.gerrithub.io/374507
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-08-16 16:13:29 -04:00
Jim Harris
c8328f557c setup.sh: improve class code and dev/vendor ID checking
1) Create separate functions for checking the PCI class code
   vs. checking the PCI device/vendor IDs
2) Instead of a simple grep, check the specific fields to
   ensure we avoid accidental matching of a class code
   against a device ID (or vice versa)

This will make it a bit cleaner to add some new device
IDs (i.e. virtio devices) in some future commits.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I36d4e2dec2f0f15dc0d603fc2512ea03a64dd560

Reviewed-on: https://review.gerrithub.io/374014
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-14 13:14:47 -04:00
Daniel Verkamp
fc58acea51 scripts/setup.sh: match hugetlbfs by type, not device
On some systems, hugetlbfs is reported as being mounted on 'nodev'
rather than 'hugetlbfs'; use the type instead of the device to match the
hugetlbfs filesystem.

Change-Id: I56498b7cf01de9759669fe313048b43b2319b933
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368228
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-05 19:57:20 -04:00
Karol Latecki
69d3eba0f3 scripts/setup.sh: add hugepage group write permission
Adding group write permission is needed in case of using vfio
driver and using libvirtd for vm provisioning to avoid
permission errors.

Change-Id: I5348e74c65bd8639071c1a2a164f28849dde9678
Signed-off-by: Karol Latecki <karolx.latecki@intel.com>
2017-05-18 14:04:52 -07:00
Cunyin Chang
6562e95092 scripts/setup.sh: support systems where more than one domain is used
Change-Id: I38aab093f3d06797e0d69f75978df47c72d279f7
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-04-25 10:16:12 -07:00
Daniel Verkamp
0b89cff2ea scripts/setup.sh: don't fail reset if hugetlbfs is empty
Change-Id: Ib399972b82adafbab5c8437e9141a1f3083292a1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-28 14:16:10 -07:00
Daniel Verkamp
641676ad0a scripts/setup.sh: clean up SPDK hugepages on reset
Change-Id: I272e6ccdb275fdf9663db05b9b6ff9b68c78a646
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-28 13:22:08 -07:00
Daniel Verkamp
9603193f86 scripts/setup.sh: use correct hugetlbfs mount point
If we created /mnt/huge due to no hugetlbfs mount point existing, we
should also use that path in the chown step for VFIO.

Change-Id: I11614a67b16dbda6626b9adf58d8faea10205cab
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-28 13:22:08 -07:00
Piotr Pelplinski
5c42f21870 nvme_numa: add information about nvme drives to setup.sh script
This scripts adds new parameter "status", which shows extra
information about devices connected to the system:
- Numa node on which device is located
- Currently bound driver
- Device name in OS if available

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: If77d5fc20330b2492afd87bf832664c450705624
2017-02-14 13:57:04 -07:00