Skip to content

Instantly share code, notes, and snippets.

@sgzerolc
Last active October 31, 2022 10:06
Show Gist options
  • Save sgzerolc/9a142bcc544fa13819db523397898685 to your computer and use it in GitHub Desktop.
Save sgzerolc/9a142bcc544fa13819db523397898685 to your computer and use it in GitHub Desktop.
qemu
x86_64-softmmu/qemu-system-x86_64 \
-kernel path/to/arch/x86_64/boot/bzImage \
-nographic \
-append "console=ttyS0 nokaslr" \
-initrd test.qcow2\
-m 512\
--enable-kvm \
-cpu host \
-drive if=virtio,file=test.img,format=raw,aio=io_uring,cache=none
@sgzerolc
Copy link
Author

sgzerolc commented Apr 5, 2022

default setting:

x86_64-softmmu/qemu-system-x86_64 -m 512 --enable-kvm

create img:
./qemu-img create -f qcow2 test.qcow2 16G

./qemu-img create test.img 2G

add test

path/to/qemu-system-x86_64 -m 1024 -enable-kvm -drive if=virtio,file=path/to/test.img,format=raw,aio=io_uring,cache=none

trace

want to trace: ioq_*, luring_*, qemu_luring_* and write into txt files.

./configure --target-list=x86_64-softmmu --enable-kvm --enable-debug --enable-trace-backends=simple

./configure --target-list=x86_64-softmmu --enable-kvm --enable-slirp --enable-trace-backends=simple,dtrace >config

in qemu dir:
path/to/qemu-system-x86_64 -m 1024 -enable-kvm -drive if=virtio,file=path/to/test.img,format=raw,aio=io_uring,cache=none --trace events=reach.txt

after running: there is no trace-events-all file in qemu repo.

gdb

gdb -q --args path/to/qemu-system-x86_64 -drive file=test.img,if=virtio,aio=io_uring --enable-kvm -smp 2 -m 1G

@sgzerolc
Copy link
Author

sgzerolc commented Apr 14, 2022

build rpm(shoud not do)

  1. delete line in liburing.spec:
    Source1: https://brick.kernel.dk/snaps/%{name}-%{version}.tar.gz.asc
make srpm
rpmbuild --rebuild -bb liburing-2.2-1.fc35.src.rpm
RPM build errors:Bad exit status from /var/tmp/rpm-tmp.AiAAj7 (%build)
cat ~/rpmbuild/BUILD/liburing-2.2/config.log
/usr/bin/ld: /tmp/ccO6Exo6.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
  1. add -no-pie to CFLAG in congiguration file and rebuild rpm,
    same error.

@sgzerolc
Copy link
Author

sgzerolc commented Apr 14, 2022

install liburing

./configure --libdir=/usr/lib64 --libdevdir=/usr/lib64
make && sudo make install

@sgzerolc
Copy link
Author

sgzerolc commented Apr 14, 2022

liburing: undefined reference to collect2: error: ld returned 1 exit status

make V=1 
/usr/bin/ld: libblock.fa(block_io_uring.c.o): in function `luring_cleanup':
/home/olc/Desktop/qemu/build/../block/io_uring.c:444: undefined reference to `io_uring_unregister_ring_fd'
collect2: err:ld return 1

@sgzerolc
Copy link
Author

sgzerolc commented Apr 15, 2022

./build/qemu-system-x86_64 -m 1024 -enable-kvm -drive if=virtio,file=test.img,format=raw,aio=io_uring,cache=none --trace events=reach.txt
./build/qemu-img create test.img 2G

@sgzerolc
Copy link
Author

sgzerolc commented Oct 3, 2022

qemu-img create -f zoned loop.img
dd if=/dev/zero of=loop.img bs=1M count=10000
losetup /dev/loop0 loop.img

test:
./build/qemu-io --image-opts -n driver=zoned,filename=/dev/loop0,cache.direct=on -c "zrp 0 1"

@sgzerolc
Copy link
Author

sgzerolc commented Oct 3, 2022

-blockdev node-name=q1,driver=raw,file.driver=host_device,file.filename=/dev/loop0 \
-device virtio-blk,drive=q1

@sgzerolc
Copy link
Author

sgzerolc commented Oct 10, 2022

./build/qemu-img create -f zoned test.zoned -o size=64M  -o zoned=1 -o zone_nr_conv=0 -o zone_nr_seq=12 -o max_append_sectors=4 -o max_open_zones=8 -o max_active_zones=12
./build/qemu-io --image-opts -n driver=zoned,file.driver=file,file.filename=test.zoned -c "zrp 0 1"

@sgzerolc
Copy link
Author

strace -o uring.txt ../qemu/build/qemu-system-x86_64 -m 1024 -enable-kvm -drive if=virtio,file=uring.raw,format=raw,aio=io_uring,cache=none

@sgzerolc
Copy link
Author

sgzerolc commented Oct 31, 2022

./build/qemu-img create -f zoned test.zoned -o size=64M -o zoned=1 -o zone_size=131072 -o zone_nr_conv=4 -o zone_nr_seq=8 -o max_append_sectors=4 -o max_open_zones=8 -o max_active_zones=8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment