Skip to contentSkip to conversation

add fio plugin

PATCH New Paolo Bonzini 1 participant 2 messages Dec 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add fio plugin

All of the infrastructure is a bit hackish, which is why I've marked this as throwaway, but perhaps someone else would like to use it (or even revive the libtool infrastructure so that it can be included in QEMU). I tested it with fio 2.8 and the master branch.

Support for driver options is minimal (only aio=native/threads :) so if you want to use the null driver remember that the size should be at most 1G (the default size of the null block device).

The plugin requires Stefan's polling patches, but it's easy to remove the poll_max_ns option if desired.

---
 configure                 |  15 +-
 contrib/fio/Makefile      |  62 +++++++
 contrib/fio/README        |  13 ++
 contrib/fio/fio.c         | 436 ++++++++++++++++++++++++++++++++++++++++++++++
 contrib/fio/qemu.fio      |  27 +++
 contrib/fio/uninclude.awk |  78 +++++++++
 6 files changed, 624 insertions(+), 7 deletions(-)
configure +8 -7
index 3770d7c..2c844bc 100755
@@ -1589,8 +1589,8 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 
 EOF
-  if compile_prog "-fPIE -DPIE" "-pie"; then
-    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
+  if compile_prog "-fPIC -DPIC" "-pie"; then
+    QEMU_CFLAGS="-fPIC -DPIC $QEMU_CFLAGS"
     LDFLAGS="-pie $LDFLAGS"
     pie="yes"
     if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
@@ -1598,15 +1598,15 @@ EOF
     fi
   else
     if test "$pie" = "yes"; then
-      error_exit "PIE not available due to missing toolchain support"
+      error_exit "PIC not available due to missing toolchain support"
     else
-      echo "Disabling PIE due to missing toolchain support"
+      echo "Disabling PIC due to missing toolchain support"
       pie="no"
     fi
   fi
 
-  if compile_prog "-Werror -fno-pie" "-nopie"; then
-    CFLAGS_NOPIE="-fno-pie"
+  if compile_prog "-Werror -fno-pic -fno-pie" "-nopie"; then
+    CFLAGS_NOPIE="-fno-pic -fno-pie"
     LDFLAGS_NOPIE="-nopie"
   fi
 fi
@@ -6183,13 +6183,14 @@ fi
 
 # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
-DIRS="$DIRS fsdev"
+DIRS="$DIRS fsdev contrib/fio"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios roms/vgabios"
 DIRS="$DIRS qapi-generated"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
+FILES="$FILES contrib/fio/Makefile"
 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
 FILES="$FILES pc-bios/spapr-rtas/Makefile"
 FILES="$FILES pc-bios/s390-ccw/Makefile"
contrib/fio/Makefile new file +62 -0

62 lines not on this page · raw message

contrib/fio/README new file +13 -0
new file mode 100644
index 0000000..4aef2a0
@@ -0,0 +1,13 @@
+This is a plugin to test the QEMU block layer with fio,
+the flexible I/O tester.
+
+To build this plugin you have to:
+
+1) hack the configure file to use -fPIC instead of -fPIE
+
+2) configure qemu with --enable-pie
+
+3) build the plugin with
+
+	make qemu-img
+	make -C contrib/fio FIO_PATH=/path/to/fio/source
contrib/fio/fio.c new file +436 -0

436 lines not on this page · raw message

contrib/fio/qemu.fio new file +27 -0
new file mode 100644
index 0000000..09241c1
@@ -0,0 +1,27 @@
+; Read 4 files with aio at different depths
+[global]
+ioengine=./qemu.so
+direct=1
+qemu_aio=native
+create_on_open=1
+rw=randread
+bs=128k
+filesize=128m
+runtime=10s
+time_based
+
+[file1]
+filename=file1
+iodepth=4
+
+[file2]
+filename=file2
+iodepth=32
+
+[file3]
+filename=file3
+iodepth=8
+
+[file4]
+filename=file4
+iodepth=16
contrib/fio/uninclude.awk new file +78 -0

78 lines not on this page · raw message

#1 lore raw

PATCH 1/1 add fio plugin

---
 configure                 |   3 +-
 contrib/fio/Makefile      |  62 +++++++
 contrib/fio/README        |  13 ++
 contrib/fio/fio.c         | 404 ++++++++++++++++++++++++++++++++++++++++++++++
 contrib/fio/qemu.fio      |  26 +++
 contrib/fio/uninclude.awk |  78 +++++++++
 6 files changed, 585 insertions(+), 1 deletion(-)
 create mode 100644 contrib/fio/Makefile
 create mode 100644 contrib/fio/README
 create mode 100644 contrib/fio/fio.c
 create mode 100644 contrib/fio/qemu.fio
 create mode 100644 contrib/fio/uninclude.awk
configure +2 -1
index 7dec6cd..8687461 100755
@@ -6181,13 +6181,14 @@ fi
 
 # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
-DIRS="$DIRS fsdev"
+DIRS="$DIRS fsdev contrib/fio"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios roms/vgabios"
 DIRS="$DIRS qapi-generated"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
+FILES="$FILES contrib/fio/Makefile"
 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
 FILES="$FILES pc-bios/spapr-rtas/Makefile"
 FILES="$FILES pc-bios/s390-ccw/Makefile"
contrib/fio/Makefile new file +62 -0

62 lines not on this page · raw message

contrib/fio/README new file +13 -0
new file mode 100644
index 0000000..4aef2a0
@@ -0,0 +1,13 @@
+This is a plugin to test the QEMU block layer with fio,
+the flexible I/O tester.
+
+To build this plugin you have to:
+
+1) hack the configure file to use -fPIC instead of -fPIE
+
+2) configure qemu with --enable-pie
+
+3) build the plugin with
+
+	make qemu-img
+	make -C contrib/fio
contrib/fio/fio.c new file +404 -0

404 lines not on this page · raw message

contrib/fio/qemu.fio new file +26 -0
new file mode 100644
index 0000000..565c015
@@ -0,0 +1,26 @@
+; Read 4 files with aio at different depths
+[global]
+ioengine=./qemu.so
+direct=1
+qemu_aio=native
+rw=randread
+bs=128k
+filesize=128m
+runtime=10s
+time_based
+
+[file1]
+filename=file1
+iodepth=4
+
+[file2]
+filename=file2
+iodepth=32
+
+[file3]
+filename=file3
+iodepth=8
+
+[file4]
+filename=file4
+iodepth=16
contrib/fio/uninclude.awk new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.9.3