Skip to contentSkip to conversation

kvm tools: Add vhost-blk support

PATCH In review Asias He 2 participants 3 messages Jul 12, 2012 – Jul 13, 2012 KVM

lore
Share & tools
lore

Asias He

author
#0 lore raw

PATCH 1/1 kvm tools: Add vhost-blk support

vhost-blk is a in kernel virito-blk device accelerator. vhost-blk is similar with vhost-net. It handles virito-blk's request and completion in host kernel side.

How to use:
-----------------------------
Load the vhost-blk.ko module in host side and specify the vhost flag.

   $ lkvm run -d disk.img,vhost

Performance evaluation:
-----------------------------
The comparison is between kvm tool with usersapce implementation and kvm tool with vhost-blk.

1) Fio with libaio ioengine on Fusion IO device
With bio-based IO path, sequential read/write, random read/write
IOPS boost : 8.4%, 15.3%, 10.4%, 14.6%
Latency improvement: 8.5%, 15.4%, 10.4%, 15.1%

2) Fio with vsync ioengine on Fusion IO device
With bio-based IO path, sequential read/write, random read/write
IOPS boost : 10.5%, 4.8%, 5.2%, 5.6%
Latency improvement: 11.4%, 5.0%, 5.2%, 5.8%

---
 tools/kvm/builtin-run.c            |    2 +
 tools/kvm/disk/core.c              |    2 +
 tools/kvm/include/kvm/disk-image.h |    2 +
 tools/kvm/virtio/blk.c             |  134 +++++++++++++++++++++++++++++++++++-
 4 files changed, 138 insertions(+), 2 deletions(-)
tools/kvm/builtin-run.c +2 -0
index 8e1627e..0e213bf 100644
@@ -178,6 +178,8 @@ static int img_name_parser(const struct option *opt, const char *arg, int unset)
 				disk_image[image_count].readonly = true;
 			else if (strncmp(sep + 1, "direct", 6) == 0)
 				disk_image[image_count].direct = true;
+			else if (strncmp(sep + 1, "vhost", 5) == 0)
+				disk_image[image_count].use_vhost = true;
 			*sep = 0;
 			cur = sep + 1;
 		}
tools/kvm/disk/core.c +2 -0
index 621c940..8aa5091 100644
@@ -149,6 +149,8 @@ struct disk_image **disk_image__open_all(struct disk_image_params *params, int c
 			err = disks[i];
 			goto error;
 		}
+		if (params[i].use_vhost)
+			disks[i]->use_vhost = true;
 	}
 
 	return disks;
tools/kvm/include/kvm/disk-image.h +2 -0
index 7ae17f8..0a86515 100644
@@ -41,6 +41,7 @@ struct disk_image_operations {
 
 struct disk_image_params {
 	const char *filename;
+	bool use_vhost;
 	bool readonly;
 	bool direct;
 };
@@ -57,6 +58,7 @@ struct disk_image {
 #ifdef CONFIG_HAS_AIO
 	io_context_t			ctx;
 #endif
+	bool				use_vhost;
 };
 
 struct disk_image *disk_image__open(const char *filename, bool readonly, bool direct);
tools/kvm/virtio/blk.c +132 -2

187 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 19 lines · Asias He

vhost-blk is a in kernel virito-blk device accelerator. vhost-blk is similar with vhost-net. It handles virito-blk's request and completion in host kernel side.

How to use:
-----------------------------
Load the vhost-blk.ko module in host side and specify the vhost flag.

   $ lkvm run -d disk.img,vhost

Performance evaluation:
-----------------------------
The comparison is between kvm tool with usersapce implementation and kvm tool with vhost-blk.

1) Fio with libaio ioengine on Fusion IO device
With bio-based IO path, sequential read/write, random read/write
IOPS boost : 8.4%, 15.3%, 10.4%, 14.6%
Latency improvement: 8.5%, 15.4%, 10.4%, 15.1%

Quoted 6 lines

2) Fio with vsync ioengine on Fusion IO device
With bio-based IO path, sequential read/write, random read/write
IOPS boost : 10.5%, 4.8%, 5.2%, 5.6%
Latency improvement: 11.4%, 5.0%, 5.2%, 5.8%

Wow, nice! What's the status of vhost-blk? When can we except it to be merged to mainline?

Pekka

author
#2 lore raw
Quoted 25 lines · Pekka Enberg
Quoted 24 lines · Asias He

vhost-blk is a in kernel virito-blk device accelerator. vhost-blk is similar with vhost-net. It handles virito-blk's request and completion in host kernel side.

How to use:
-----------------------------
Load the vhost-blk.ko module in host side and specify the vhost flag.

   $ lkvm run -d disk.img,vhost

Performance evaluation:
-----------------------------
The comparison is between kvm tool with usersapce implementation and kvm tool with vhost-blk.

1) Fio with libaio ioengine on Fusion IO device
With bio-based IO path, sequential read/write, random read/write
IOPS boost : 8.4%, 15.3%, 10.4%, 14.6%
Latency improvement: 8.5%, 15.4%, 10.4%, 15.1%

2) Fio with vsync ioengine on Fusion IO device
With bio-based IO path, sequential read/write, random read/write
IOPS boost : 10.5%, 4.8%, 5.2%, 5.6%
Latency improvement: 11.4%, 5.0%, 5.2%, 5.8%

Quoted 4 lines
Quoted 1 line

Wow, nice! What's the status of vhost-blk? When can we except it to be merged to mainline?

I just sent out the vhost-blk kernel bits to lkml. I hope it can hit 3.6.

Signature · 1 line
Asias He