Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] Test action #32

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
f20847c
Move spdk submodule
IsaacKhor May 13, 2024
2e2e2b2
Cleanup meson scripts
IsaacKhor May 13, 2024
dd91d69
Add skeleton for spdk bdev support
IsaacKhor May 13, 2024
38daba3
Update GH actions to llvm18
IsaacKhor May 13, 2024
964f7f0
Convince spdk to link properly
IsaacKhor May 14, 2024
4bf2a3f
Remove spdk_rpc interface
IsaacKhor May 14, 2024
3f5c6e4
Remove spdk submodule
IsaacKhor May 14, 2024
d71c7ab
Fix spdk wrap
IsaacKhor May 14, 2024
f99fe41
Add spdk dependencies
IsaacKhor May 14, 2024
8ca5e55
Fix github actions spdk config
IsaacKhor May 14, 2024
8980581
Fix meson logs location
IsaacKhor May 14, 2024
5c27fc4
Implement more of the bdev api
IsaacKhor May 16, 2024
418cf52
Add pyelftools as a dep
IsaacKhor May 16, 2024
b204d2b
Add cunit to deps
IsaacKhor May 16, 2024
1257ce6
Clean up spdk meson
IsaacKhor May 16, 2024
cfdd9ba
Add sanitizers to debug build
IsaacKhor May 16, 2024
b648757
Update to c++23
IsaacKhor May 20, 2024
bd983b5
Update bdev management
IsaacKhor May 20, 2024
bbe3f45
Move wlog init code into write_cache
IsaacKhor May 20, 2024
5be5953
Add new backend functions
IsaacKhor May 20, 2024
a099ea3
Update utils headers
IsaacKhor May 20, 2024
d12b18a
Add seqnum definition
IsaacKhor May 20, 2024
b4b11f7
Overhaul backend parsing code
IsaacKhor May 20, 2024
85340f3
Change config option names
IsaacKhor May 20, 2024
678430f
Rename rbd wrapper to better reflect its usage
IsaacKhor May 21, 2024
beffbb9
Remove mkcache from meson
IsaacKhor May 21, 2024
255e478
Update tools to use new definitions
IsaacKhor May 21, 2024
2d74573
Fully remove file backend
IsaacKhor May 21, 2024
0a60460
Rewrite image open/recovery and initialisation path
IsaacKhor May 21, 2024
3ecf3cb
Update names
IsaacKhor May 21, 2024
c102f0d
Update error messages
IsaacKhor May 21, 2024
ccae1dc
Improve serialisation and fix xlate threads
IsaacKhor May 21, 2024
d794a72
Add libfolly and switch to jemalloc
IsaacKhor May 22, 2024
9fc3078
Reshuffle headers
IsaacKhor May 22, 2024
f867619
Add stacktrace on exit
IsaacKhor May 22, 2024
2d301ba
Get fully working spdk build
IsaacKhor May 22, 2024
9709365
Pass in pool from cmdline
IsaacKhor May 22, 2024
8e56da9
Make CI happy
IsaacKhor May 22, 2024
e90edfa
Revert to clang for CI
IsaacKhor May 22, 2024
f15a03b
Fix offbyone in seqnums and add logging statements
IsaacKhor May 22, 2024
05e512e
Fix CI meson version
IsaacKhor May 22, 2024
074cfce
Fix CI folly build
IsaacKhor May 22, 2024
924e2a4
Add folly boost deps
IsaacKhor May 22, 2024
079b96e
Add more folly deps
IsaacKhor May 22, 2024
cf139d1
Fix deps typo
IsaacKhor May 22, 2024
3022693
Add libaio back
IsaacKhor May 22, 2024
3a90482
Fix wlog header init issues
IsaacKhor May 22, 2024
6b1442d
Link uring statically
IsaacKhor May 22, 2024
ec94677
Link folly and prepare to switch to fbvector
IsaacKhor May 22, 2024
a133a72
Fix config UAF
IsaacKhor May 22, 2024
f35560f
Fix memory leaks
IsaacKhor May 22, 2024
74bda81
Add vendored liburing
IsaacKhor May 23, 2024
29b9ef1
Change test-seq cfg options
IsaacKhor May 23, 2024
c621a4d
Add some nvmf config to spdk fe
IsaacKhor May 23, 2024
e702951
Transcribe rpc fns
IsaacKhor May 28, 2024
f739508
Fix missing pollgroup
IsaacKhor May 29, 2024
e62035e
Fix partially-initialised spdk bdev config
IsaacKhor May 29, 2024
b5855d2
Downgrade logging lvs and wait for ss start
IsaacKhor May 29, 2024
5ca6a8f
Fix wraps to depth1 and use cmake for folly
IsaacKhor May 29, 2024
d773251
Add thinlto cache
IsaacKhor May 29, 2024
f733fc9
Fix incorrect thread for completion path
IsaacKhor May 29, 2024
ea29fe3
Build debug only for CI
IsaacKhor May 29, 2024
8b4dd7d
Remove subproject dirs
IsaacKhor May 29, 2024
461abe5
Rewrite imgtool to use new apis
IsaacKhor May 30, 2024
8c117bc
Remove trace prints
IsaacKhor May 30, 2024
f0b9d6d
Migrate image manip fns to image.cc
IsaacKhor May 30, 2024
86c45f1
Add option for thick to imgtool (not implemented)
IsaacKhor May 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Clang 17
- name: Setup Clang 18
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo ./llvm.sh 18

- name: Install dependencies
run: |
sudo apt update
make install-deps
pip3 install --upgrade meson

- name: Build
run: |
Expand All @@ -45,4 +46,4 @@ jobs:
- name: Logs
if: always()
run: |
cat build-dbg/meson-logs/testlog.txt
cat build-rel/meson-logs/meson-log.txt
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ __pycache__/
venv/
.ipynb_checkpoints/

subprojects/

builddir
build
qemu/*.img
qemu/*.iso
qemu/bzImage

subprojects/liburing-*
subprojects/packagecache
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "spdk"]
path = spdk
url = https://github.com/spdk/spdk
[submodule "lsvd-atc24"]
path = atc2024
url = git@github.com:CCI-MOC/lsvd-atc24.git
Expand Down
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
.PHONY: setup setup-debug release debug paper clean

setup:
meson setup --native-file meson.ini build-rel --buildtype=release
meson setup --native-file meson.ini build-dbg --buildtype=debug
meson setup --native-file meson.ini build-rel --buildtype=release -Db_sanitize=none
meson setup --native-file meson.ini build-dbg --buildtype=debug
ln -s build-dbg builddir

debug: setup
debug:
meson setup --native-file meson.ini build-dbg --buildtype=debug
cd build-dbg; meson compile

paper:
Expand All @@ -17,6 +18,14 @@ clean:
cd build-dbg; meson compile --clean

install-deps:
sudo apt install -y meson libfmt-dev libaio-dev librados-dev mold \
libtcmalloc-minimal4 libboost-dev libradospp-dev \
liburing-dev pkg-config uuid-dev
# Folly deps
sudo apt install libboost-all-dev libdouble-conversion-dev libevent-dev \
libgflags-dev libgmock-dev libgoogle-glog-dev libgtest-dev \
liblz4-dev liblzma-dev libsnappy-dev libsodium-dev libunwind-dev \
libzstd-dev ninja-build zlib1g-dev
# SPDK deps
sudo apt install libnuma-dev libarchive-dev libibverbs-dev librdmacm-dev \
python3-pyelftools libcunit1-dev libaio-dev
# LSVD deps
sudo apt install -y meson mold libfmt-dev librados-dev \
libjemalloc-dev libradospp-dev liburing-dev pkg-config uuid-dev
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Parameters are:
- `batch_size`, `LSVD_BATCH_SIZE`: size of objects written to the backend, in bytes (K/M recognized as 1024, 1024\*1024). Default: 8MiB
- `wcache_batch`: write cache batching (see below)
- `wcache_chunk': maximum size of atomic write, in bytes - larger writes will be split and may be non-atomic.
- `rcache_dir` - directory used for read cache file and GC temporary files. Note that `lsvd_imgtool` can format a partition for cache and symlink it into this directory, although the performance improvement seems limited.
- `rcache_dir` - directory used for read cache file and GC temporary files. Note that `imgtool` can format a partition for cache and symlink it into this directory, although the performance improvement seems limited.
- `wcache_dir` - directory used for write cache file
- `xlate_window`: max writes (i.e. objects) in flight to the backend. Note that this value is coupled to the size of the write cache, which must be big enough to hold all outstanding writes in case of a crash.
- `hard_sync` (untested): "flush" forces all batched writes to the backend.
Expand All @@ -70,7 +70,7 @@ figure out how to optimize at runtime instead of bothering the user for a value.

First create a volume:
```
build$ sudo bin/lsvd_imgtool --create --rados --size=20g pool/imgname
build$ sudo imgtool create poolname imgname --size=20g
```

Then you can start a SPDK NVMe-oF gateway:
Expand Down Expand Up @@ -158,21 +158,17 @@ The read cache typically fetches 64K blocks, so there may be a bit of extra load
Most of the testing to date has been with an 8,3 code with 64K stripe size.

## Tools
`lsvd_imgtool` mostly just calls the LSVD versions of `rbd_create` and `rbd_remove`, although it can also format a cache file (e.g. if you're using a raw partition)
```
build$ bin/lsvd_imgtool --help
Usage: lsvd_imgtool [OPTION...]
IMAGE

-C, --create create image
-d, --cache-dir=DIR cache directory
-D, --delete delete image
-I, --info show image information
-k, --mkcache=DEV use DEV as cache
-O, --rados use RADOS
-z, --size=SIZE size in bytes (M/G=2^20,2^30)
-?, --help Give this help list
--usage Give a short usage message
```
build$ ./imgtool --help
❯ ./imgtool --help
Allowed options:
--help produce help message
--cmd arg subcommand: create, clone, delete, info
--img arg name of the iname
--pool arg pool where the image resides
--size arg (=1G) size in bytes (M=2^20,G=2^30)
--dest arg destination (for clone)
```

Other tools live in the `tools` subdirectory - see the README there for more details.
Expand Down
2 changes: 1 addition & 1 deletion docs/qemu-launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ install config, run QEMU with
`-drive format=raw,file=seed.iso,cache=none,if=virtio`.

1. Create a lsvd image if you don't already have one:
`./imgtool --create --rados --size 10g $pool_name/$img_name`
`./imgtool create --size 10g $pool_name $img_name`
2. Launch LSVD as a NVMF target `qemu-gateway.bash $pool_name $img_name`
3. Lanuch QEMU with the NVMF target `qemu-client.bash`. This does the following:
- `nvme connect` to the nvmf target on the gateway
Expand Down
2 changes: 1 addition & 1 deletion experiments/multigw/gateway-1.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ scripts/rpc.py nvmf_create_subsystem nqn.2016-06.io.spdk:lsvd-gw1 -a -s SPDKMULT
scripts/rpc.py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:lsvd-gw1 -t tcp -a $gw_ip -s 9922

function add_rbd_img {
cd $lsvd_dir/spdk
cd $lsvd_dir/subprojects/spdk
local pool=$1
local img=$2
local bdev="bdev_$img"
Expand Down
2 changes: 1 addition & 1 deletion experiments/multigw/gateway-2.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ scripts/rpc.py nvmf_create_subsystem nqn.2016-06.io.spdk:lsvd-gw2 -a -s SPDKMULT
scripts/rpc.py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:lsvd-gw2 -t tcp -a $gw_ip -s 9922

function add_rbd_img {
cd $lsvd_dir/spdk
cd $lsvd_dir/subprojects/spdk
local pool=$1
local img=$2
local bdev="bdev_$img"
Expand Down
2 changes: 1 addition & 1 deletion experiments/multigw/rbd-gateway-1.bash
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ scripts/rpc.py nvmf_create_subsystem nqn.2016-06.io.spdk:lsvd-gw1 -a -s SPDKMULT
scripts/rpc.py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:lsvd-gw1 -t tcp -a $gw_ip -s 9922

function add_rbd_img {
cd $lsvd_dir/spdk
cd $lsvd_dir/subprojects/spdk
local pool=$1
local img=$2
local bdev="bdev_$img"
Expand Down
2 changes: 1 addition & 1 deletion experiments/multigw/rbd-gateway-2.bash
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ scripts/rpc.py nvmf_create_subsystem nqn.2016-06.io.spdk:lsvd-gw2 -a -s SPDKMULT
scripts/rpc.py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:lsvd-gw2 -t tcp -a $gw_ip -s 9922

function add_rbd_img {
cd $lsvd_dir/spdk
cd $lsvd_dir/subprojects/spdk
local pool=$1
local img=$2
local bdev="bdev_$img"
Expand Down
38 changes: 18 additions & 20 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
project(
'lsvd-rbd',
'cpp',
['c', 'cpp'],
version: '0.1',
default_options: [
'cpp_std=c++20',
'cpp_std=c++23',
'warning_level=2',
'b_colorout=always',
'b_sanitize=address,undefined',
'b_lto=true',
'b_thinlto_cache=true',
],
)

Expand All @@ -14,34 +17,29 @@ add_project_arguments('-Wno-unused-parameter', language: 'cpp')

if get_option('buildtype') == 'debug'
add_project_arguments('-fno-inline', language: 'cpp')
add_project_arguments('-DLOGLV=1', language: 'cpp')

# add sanitizers for debug builds
add_project_arguments(
'-fsanitize=address,undefined,nullability,implicit-conversion',
language: 'cpp',
)
add_project_link_arguments(
'-fsanitize=address,undefined',
'-Wl,--unresolved-symbols=ignore-in-object-files',
language: 'cpp',
)
add_project_arguments('-DLOGLV=0', language: 'cpp')
endif

subdir('src')
liblsvd = library('lsvd', lsvd_src, dependencies: lsvd_deps, install: false)
lsvd_ar = static_library('lsvd', lsvd_src, dependencies: lsvd_deps)

executable(
'lsvd',
spdk_fe,
dependencies: lsvd_deps + [dependency('_spdk')],
)

executable(
'imgtool',
'src/imgtool.cc',
link_with: liblsvd,
['src/imgtool.cc'],
link_whole: lsvd_ar,
dependencies: lsvd_deps,
)
executable(
'thick-image',
'src/thick-image.cc',
link_with: liblsvd,
['src/thick-image.cc'],
link_whole: lsvd_ar,
dependencies: lsvd_deps,
)

subdir('test')
subdir('test')
8 changes: 4 additions & 4 deletions meson.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[binaries]
c = 'clang-17'
c_ld = 'lld-17'
cpp = 'clang++-17'
cpp_ld = 'lld-17'
c = 'clang-18'
c_ld = 'lld-18'
cpp = 'clang++-18'
cpp_ld = 'lld-18'
1 change: 0 additions & 1 deletion spdk
Submodule spdk deleted from fb13ee
17 changes: 6 additions & 11 deletions src/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <rados/librados.h>
#include <sys/uio.h>

#include "config.h"
#include "request.h"
#include "smartiov.h"
#include "utils.h"

class backend
{
Expand Down Expand Up @@ -45,16 +45,11 @@ class backend
smartiov iov((char *)buf, len);
return aio_read(name, offset, iov);
}

virtual opt<u64> get_size(std::string name) = 0;
virtual opt<vec<byte>> read_whole_obj(std::string name) = 0;
virtual bool exists(std::string name) = 0;
};

extern std::shared_ptr<backend> make_file_backend(const char *prefix);
extern std::shared_ptr<backend> make_rados_backend(rados_ioctx_t io);

inline std::shared_ptr<backend> get_backend(lsvd_config *cfg, rados_ioctx_t io,
const char *name)
{
if (cfg->backend == BACKEND_RADOS)
return make_rados_backend(io);

throw std::runtime_error("Unknown backend");
}
rados_ioctx_t connect_to_pool(str pool_name);
Loading
Loading