Skip to contentSkip to conversation

Blktap update (RFC)

PATCH New Julian Chesterfield 1 participant 1 message Jul 8, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Blktap update (RFC)

Attached is an updated patch to the blktap kernel driver and userspace toolset. The patch incorporates comments submitted to the list regarding stylistic changes such as the use of C99 initialisation. The /proc stats have been removed and will be replaced soon with sysfs variables along the same lines as the recent blkback patch.

This patch incorporates 3 new features:

- It now allows local mounts of tap-based images within dom0 (equivalent to the loopback driver) using the xm block-attach feature. Tap disks can be attached to a virtual block device in dom0 which is then mountable. This feature is particularly useful for modifying VM images before booting them, for instance to update the in-image kernel for an HVM guest.

- Faster Qcow performance through metadata allocation optimizations. Qcow files remain backwards compatible, but headers contain additional information to indicate that allocation has been optimized for access from the xen tools.

- the blktapctrl daemon is launched automatically along with xenstored and xenconsoled through xend

Performance results indicate that blktap performs very favourably in comparison to blkback (raw partition AIO) and that with the qcow optimisation feature enabled, the CoW disk performs almost as fast as the raw loopback driver:

Bonnie results (block IO summarised):

                     READ     WRITE   (K/sec)
Tap AIO partition    52781    45072
Blkback partition    52596    45429
Loop                 52286    37672
Qcow Normal          43058    29386
Qcow Optimised       51834    37083

Full Bonnie results:

             -------Sequential Output-------- ---Sequential Input-- 
--Random--
              -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- 
--Seeks---
Machine    MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU  /sec %CPU
Tap AIO dev 2G 43805 93   45072 8   21896 0    38751 52   52781 0     121.1 0
Blkback    2G  43400 86   45429 8   22217 0    39075 53   52596 0     119.0 0
Loop       2G  31459 63   37672 9   16442 0    44122 78   52286 0     119.7 0
Qcow norm  2G  28341 56   29386 5   15908 0    36006 49   43058 0     66.9  0
Qcow Opt   2G  33568 67   37083 6   19589 0    39180 58   51834 0     123.1 0

Thanks,
Julian

Attached is an updated patch to the blktap kernel driver and userspace toolset. The patch incorporates comments submitted to the list regarding stylistic changes such as the use of C99 initialisation. The /proc stats have been removed and will be replaced soon with sysfs variables along the same lines as the recent blkback patch.

This patch incorporates 3 new features:

- It now allows local mounts of tap-based images within dom0 (equivalent to the loopback driver) using the xm block-attach feature. Tap disks can be attached to a virtual block device in dom0 which is then mountable. <fontfamily><param>Geneva</param>This feature is particularly useful for modifying VM images before booting them, for instance to update the in-image kernel for an HVM guest.</fontfamily>

- Faster Qcow performance <fontfamily><param>Geneva</param>through metadata allocation optimizations</fontfamily>. <fontfamily><param>Geneva</param>Qcow files remain backwards compatible, but headers contain additional information to indicate that allocation has been optimized for access from the xen tools.</fontfamily>

- the blktapctrl daemon is launched automatically along with xenstored and xenconsoled through xend

Performance results indicate that blktap performs very favourably in comparison to blkback (raw partition AIO) and that with the qcow optimisation feature enabled, the CoW disk performs almost as fast as the raw loopback driver:

<fixed>Bonnie results (block IO summarised):

READ WRITE (K/sec)

Tap AIO partition 52781 45072

Blkback partition 52596 45429

Loop 52286 37672

Qcow Normal 43058 29386

Qcow Optimised 51834 37083

Full Bonnie results:

             -------Sequential Output-------- ---Sequential Input--

--Random--

              -Per Char- --Block--- -Rewrite-- -Per Char- --Block---

--Seeks---

Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU
/sec %CPU

Tap AIO dev 2G 43805 93 45072 8 21896 0 38751 52 52781 0
121.1 0

Blkback 2G 43400 86 45429 8 22217 0 39075 53 52596 0
119.0 0

Loop 2G 31459 63 37672 9 16442 0 44122 78 52286 0
119.7 0

Qcow norm 2G 28341 56 29386 5 15908 0 36006 49 43058 0
66.9 0

Qcow Opt 2G 33568 67 37083 6 19589 0 39180 58 51834 0
123.1 0</fixed>

Thanks,

Julian

buildconfigs/linux-defconfig_xen0_ia64 +1 -0
diff -urN xen-unstable-pristine.hg/buildconfigs/linux-defconfig_xen0_ia64 xen-unstable-tapbuild.hg/buildconfigs/linux-defconfig_xen0_ia64
@@ -1528,6 +1528,7 @@
 CONFIG_XEN_BACKEND=y
 # CONFIG_XEN_PCIDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_BLKDEV_TAP=n
 CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
buildconfigs/linux-defconfig_xen0_x86_32 +1 -0
diff -urN xen-unstable-pristine.hg/buildconfigs/linux-defconfig_xen0_x86_32 xen-unstable-tapbuild.hg/buildconfigs/linux-defconfig_xen0_x86_32
@@ -1322,6 +1322,7 @@
 CONFIG_XEN_PCIDEV_BACKEND_PASS=y
 # CONFIG_XEN_PCIDEV_BE_DEBUG is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_BLKDEV_TAP=y
 CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
buildconfigs/linux-defconfig_xen0_x86_64 +1 -0
diff -urN xen-unstable-pristine.hg/buildconfigs/linux-defconfig_xen0_x86_64 xen-unstable-tapbuild.hg/buildconfigs/linux-defconfig_xen0_x86_64
@@ -1263,6 +1263,7 @@
 CONFIG_XEN_PCIDEV_BACKEND_PASS=y
 # CONFIG_XEN_PCIDEV_BE_DEBUG is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_BLKDEV_TAP=y
 CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
buildconfigs/linux-defconfig_xen_ia64 +1 -0
diff -urN xen-unstable-pristine.hg/buildconfigs/linux-defconfig_xen_ia64 xen-unstable-tapbuild.hg/buildconfigs/linux-defconfig_xen_ia64
@@ -1534,6 +1534,7 @@
 CONFIG_XEN_BACKEND=y
 # CONFIG_XEN_PCIDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_BLKDEV_TAP=n
 CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
buildconfigs/linux-defconfig_xen_x86_32 +1 -0
diff -urN xen-unstable-pristine.hg/buildconfigs/linux-defconfig_xen_x86_32 xen-unstable-tapbuild.hg/buildconfigs/linux-defconfig_xen_x86_32
@@ -3023,6 +3023,7 @@
 # CONFIG_XEN_PCIDEV_BACKEND_PASS is not set
 # CONFIG_XEN_PCIDEV_BE_DEBUG is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_BLKDEV_TAP=y
 CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
buildconfigs/linux-defconfig_xen_x86_64 +1 -0
diff -urN xen-unstable-pristine.hg/buildconfigs/linux-defconfig_xen_x86_64 xen-unstable-tapbuild.hg/buildconfigs/linux-defconfig_xen_x86_64
@@ -2855,6 +2855,7 @@
 CONFIG_XEN_PCIDEV_BACKEND_PASS=y
 # CONFIG_XEN_PCIDEV_BE_DEBUG is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_BLKDEV_TAP=y
 CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c +1439 -0

1,439 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/blktap/common.h +120 -0

120 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/blktap/interface.c +165 -0

165 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/blktap/Makefile +3 -0
diff -urN xen-unstable-pristine.hg/linux-2.6-xen-sparse/drivers/xen/blktap/Makefile xen-unstable-tapbuild.hg/linux-2.6-xen-sparse/drivers/xen/blktap/Makefile
@@ -0,0 +1,3 @@
+LINUXINCLUDE += -I../xen/include/public/io
+obj-y	:= xenbus.o interface.o blktap.o 
+
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c +354 -0

354 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/Kconfig +12 -0
diff -urN xen-unstable-pristine.hg/linux-2.6-xen-sparse/drivers/xen/Kconfig xen-unstable-tapbuild.hg/linux-2.6-xen-sparse/drivers/xen/Kconfig
@@ -89,6 +89,18 @@
 	  block devices to other guests via a high-performance shared-memory
 	  interface.
 
+config XEN_BLKDEV_TAP
+	tristate "Blockk device tap backend"
+	depends on XEN_BACKEND
+	default XEN_PRIVILEGED_GUEST
+	help
+	  The block tap driver is an alternative to the block back driver 
+          and allows VM block requests to be redirected to userspace through
+          a device interface.  The tap allows user-space development of 
+          high-performance block backends, where disk images may be implemented
+          as files, in memory, or on other hosts across the network.  This 
+	  driver can safely coexist with the existing blockback driver.
+
 config XEN_XENBUS_DEV
 	bool
 	depends on PROC_FS
linux-2.6-xen-sparse/drivers/xen/Makefile +1 -0
diff -urN xen-unstable-pristine.hg/linux-2.6-xen-sparse/drivers/xen/Makefile xen-unstable-tapbuild.hg/linux-2.6-xen-sparse/drivers/xen/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_XEN_BALLOON)		+= balloon/
 obj-$(CONFIG_XEN_DEVMEM)		+= char/
 obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= blkback/
+obj-$(CONFIG_XEN_BLKDEV_TAP)		+= blktap/
 obj-$(CONFIG_XEN_NETDEV_BACKEND)	+= netback/
 obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmback/
 obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= blkfront/
patches/linux-2.6.16.13/blktap-aio-16_03_06.patch +297 -0

297 lines not on this page · raw message

tools/blktap/blkif.c +185 -0

185 lines not on this page · raw message

tools/blktap/blktaplib.h +223 -0

223 lines not on this page · raw message

tools/blktap/list.h +55 -0

55 lines not on this page · raw message

tools/blktap/Makefile +77 -0

77 lines not on this page · raw message

tools/blktap/README +126 -0

15 lines not on this page · raw message

tools/blktap/tools/aes.c +1319 -0

1,319 lines not on this page · raw message

tools/blktap/tools/aes.h +26 -0
diff -urN xen-unstable-pristine.hg/tools/blktap/tools/aes.h xen-unstable-tapbuild.hg/tools/blktap/tools/aes.h

Lines of this file are not shown. View the raw message.

tools/blktap/tools/blktapctrl.c +704 -0

704 lines not on this page · raw message

tools/blktap/tools/blktapctrl.h +55 -0

55 lines not on this page · raw message

tools/blktap/tools/block-aio.c +327 -0

327 lines not on this page · raw message

tools/blktap/tools/block-qcow.c +1369 -0

1,369 lines not on this page · raw message

tools/blktap/tools/block-ram.c +296 -0

296 lines not on this page · raw message

tools/blktap/tools/block-sync.c +242 -0

242 lines not on this page · raw message

tools/blktap/tools/block-vmdk.c +415 -0

415 lines not on this page · raw message

tools/blktap/tools/bswap.h +202 -0

202 lines not on this page · raw message

tools/blktap/tools/img2qcow.c +289 -0

289 lines not on this page · raw message

tools/blktap/tools/Makefile +67 -0

67 lines not on this page · raw message

tools/blktap/tools/qcow2raw.c +346 -0

346 lines not on this page · raw message

tools/blktap/tools/qcow-create.c +80 -0

80 lines not on this page · raw message

tools/blktap/tools/tapdisk.c +671 -0

671 lines not on this page · raw message

tools/blktap/tools/tapdisk.h +211 -0

211 lines not on this page · raw message

tools/blktap/xenbus.c +387 -0

387 lines not on this page · raw message

tools/blktap/xs_api.c +364 -0

364 lines not on this page · raw message

tools/blktap/xs_api.h +50 -0

50 lines not on this page · raw message

tools/examples/blktap +16 -0
diff -urN xen-unstable-pristine.hg/tools/examples/blktap xen-unstable-tapbuild.hg/tools/examples/blktap

Lines of this file are not shown. View the raw message.

tools/examples/Makefile +1 -0
diff -urN xen-unstable-pristine.hg/tools/examples/Makefile xen-unstable-tapbuild.hg/tools/examples/Makefile

Lines of this file are not shown. View the raw message.

tools/examples/xen-backend.agent +3 -0
diff -urN xen-unstable-pristine.hg/tools/examples/xen-backend.agent xen-unstable-tapbuild.hg/tools/examples/xen-backend.agent

Lines of this file are not shown. View the raw message.

tools/examples/xen-backend.rules +1 -0
diff -urN xen-unstable-pristine.hg/tools/examples/xen-backend.rules xen-unstable-tapbuild.hg/tools/examples/xen-backend.rules

Lines of this file are not shown. View the raw message.

tools/Makefile +1 -0
diff -urN xen-unstable-pristine.hg/tools/Makefile xen-unstable-tapbuild.hg/tools/Makefile

Lines of this file are not shown. View the raw message.

tools/misc/xend +7 -0
diff -urN xen-unstable-pristine.hg/tools/misc/xend xen-unstable-tapbuild.hg/tools/misc/xend

Lines of this file are not shown. View the raw message.

tools/python/xen/xend/server/BlktapController.py +14 -0
diff -urN xen-unstable-pristine.hg/tools/python/xen/xend/server/BlktapController.py xen-unstable-tapbuild.hg/tools/python/xen/xend/server/BlktapController.py

Lines of this file are not shown. View the raw message.

tools/python/xen/xend/XendDomainInfo.py +2 -0
diff -urN xen-unstable-pristine.hg/tools/python/xen/xend/XendDomainInfo.py xen-unstable-tapbuild.hg/tools/python/xen/xend/XendDomainInfo.py

Lines of this file are not shown. View the raw message.

tools/python/xen/xm/create.py +7 -1
diff -urN xen-unstable-pristine.hg/tools/python/xen/xm/create.py xen-unstable-tapbuild.hg/tools/python/xen/xm/create.py

Lines of this file are not shown. View the raw message.

tools/python/xen/xm/main.py +7 -1
diff -urN xen-unstable-pristine.hg/tools/python/xen/xm/main.py xen-unstable-tapbuild.hg/tools/python/xen/xm/main.py

Lines of this file are not shown. View the raw message.

xen/common/grant_table.c +2 -4
diff -urN xen-unstable-pristine.hg/xen/common/grant_table.c xen-unstable-tapbuild.hg/xen/common/grant_table.c

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.