virtio infrastructure
Subsystems (6)
RFC PATCH 1/3 virtio infrastructure
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
The details of probing the device are left to hypervisor-specific
code: it simple constructs the "struct virtio_device" and hands it to the probe function (eg. virtnet_probe() or virtblk_probe()).
The virtio drivers add and detach input and output buffers; as the buffers are used up their associated "used" pointers are filled in.
I have written two virtio device drivers (net and block) and two virtio implementations (for lguest): a read-write socket-style implementation, and a more efficient descriptor-based implementation).
--- include/linux/virtio.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
include/linux/virtio.h new file +66 -0
@@ -0,0 +1,66 @@ +#ifndef _LINUX_VIRTIO_H +#define _LINUX_VIRTIO_H +#include <linux/types.h> +#include <linux/scatterlist.h> + +/** +* virtio_device - description and routines to drive a virtual device. +* @dev: the underlying struct device. +* @ops: the operations for this virtual device. +*/ +struct virtio_device { +struct device *dev; +struct virtio_ops *ops; +}; + +/** +* virtio_ops - virtio abstraction layer +* @add_outbuf: prepare to send data to the other end: +* vdev: the virtio_device +* sg: the description of the buffer(s). +* num: the size of the sg array. +* used: the length sent (set once sending is done). +* Returns an identifier or an error. +* @add_inbuf: prepare to receive data from the other end: +* vdev: the virtio_device +* sg: the description of the buffer(s). +* num: the size of the sg array. +* used: the length sent (set once data received). +* Returns an identifier or an error (eg. -ENOSPC). +* @sync: update after add_inbuf/add_outbuf +* vdev: the virtio_device we're talking about. +* Use the virtio_sync wrapper, to avoid unnecessary calls. +* @detach_outbuf: make sure sent sg can no longer be read. +* vdev: the virtio_device we're talking about. +* id: the identifier returned from add_outbuf. +* @detach_inbuf: make sure sent sg can no longer be written to. +* vdev: the virtio_device we're talking about. +* id: the identifier returned from add_inbuf. +*/ +struct virtio_ops { +unsigned long (*add_outbuf)(struct virtio_device *vdev, +const struct scatterlist sg[], +unsigned int num, +unsigned long *used); + +unsigned long (*add_inbuf)(struct virtio_device *vdev, +struct scatterlist sg[], +unsigned int num, +unsigned long *used); + +void (*sync)(struct virtio_device *vdev); + +void (*detach_outbuf)(struct virtio_device *vdev,unsigned long id); +void (*detach_inbuf)(struct virtio_device *vdev,unsigned long id); +}; + +/** +* virtio_sync - start sending/receiving data from the other end. +* @vdev: the virtio_device we're talking about. +*/ +static inline void virtio_sync (struct virtio_device *vdev) +{ +if (vdev->ops->sync) + vdev->ops->sync (vdev); +} +#endif /* _LINUX_VIRTIO_H */
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
RFC PATCH 2/3 virtio infrastructure: example net driver
In reply to a message not in the archiveExample net driver using virtio
TODO:
1) Locking (see #2).
2) NAPI.
3) GSO.
4) Checksum options.
--- drivers/net/Makefile | 2 drivers/net/virtio_net.c | 237 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/virtio_net.h | 13 ++ 3 files changed, 251 insertions(+), 1 deletion(-)
drivers/net/Makefile +1 -1
@@ -37,7 +37,7 @@ obj-$(CONFIG_CASSINI) += cassini.o obj-$(CONFIG_MACE) += mace.o obj-$(CONFIG_BMAC) += bmac.o - +obj-y += virtio_net.o obj-$(CONFIG_DGRS) += dgrs.o obj-$(CONFIG_VORTEX) += 3c59x.o obj-$(CONFIG_TYPHOON) += typhoon.o
drivers/net/virtio_net.c new file +236 -0
236 lines not on this page · raw message
include/linux/virtio_net.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _LINUX_VIRTIO_NET_H +#define _LINUX_VIRTIO_NET_H +#include <linux/types.h> +#include <linux/etherdevice.h> +struct net_device ; +struct virtio_device ; + +struct net_device *virtnet_probe (struct virtio_device *vdev, +const u8 mac[ETH_ALEN ]); +int virtnet_interrupt (struct net_device *dev); +void virtnet_remove (struct net_device *dev); + +#endif /* _LINUX_VIRTIO_NET_H */
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
RFC PATCH 2/3 virtio infrastructure: example net driver
In reply to Rusty RussellExample net driver using virtio
TODO:
1) Locking (see #2).
2) NAPI.
3) GSO.
4) Checksum options.
--- drivers/net/Makefile | 2 drivers/net/virtio_net.c | 237 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/virtio_net.h | 13 ++ 3 files changed, 251 insertions(+), 1 deletion(-)
drivers/net/Makefile +1 -1
@@ -37,7 +37,7 @@ obj-$(CONFIG_CASSINI) += cassini.o obj-$(CONFIG_MACE) += mace.o obj-$(CONFIG_BMAC) += bmac.o - +obj-y += virtio_net.o obj-$(CONFIG_DGRS) += dgrs.o obj-$(CONFIG_VORTEX) += 3c59x.o obj-$(CONFIG_TYPHOON) += typhoon.o
drivers/net/virtio_net.c new file +236 -0
236 lines not on this page · raw message
include/linux/virtio_net.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _LINUX_VIRTIO_NET_H +#define _LINUX_VIRTIO_NET_H +#include <linux/types.h> +#include <linux/etherdevice.h> +struct net_device ; +struct virtio_device ; + +struct net_device *virtnet_probe (struct virtio_device *vdev, +const u8 mac[ETH_ALEN ]); +int virtnet_interrupt (struct net_device *dev); +void virtnet_remove (struct net_device *dev); + +#endif /* _LINUX_VIRTIO_NET_H */
RFC PATCH 3/3 virtio infrastructure: example block driver
In reply to a message not in the archiveExample block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.
The first segment of the inbuf is a result code (struct virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.
TODO:
1) Ordered tag support.
--- drivers/block/Makefile | 1 drivers/block/virtio_blk.c | 269 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/virtio_blk.h | 29 ++++ 3 files changed, 299 insertions(+)
drivers/block/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss. obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o obj-$(CONFIG_BLK_DEV_DAC960) += DAC960.o obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o +obj-y += virtio_blk.o obj-$(CONFIG_BLK_DEV_UMEM) += umem.o obj-$(CONFIG_BLK_DEV_NBD) += nbd.o
drivers/block/virtio_blk.c new file +270 -0
270 lines not on this page · raw message
include/linux/virtio_blk.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _LINUX_VIRTIO_BLK_H +#define _LINUX_VIRTIO_BLK_H +#include <linux/types.h> +struct gendisk ; +struct virtio_device ; +struct hd_geometry ; + +/* This is the first element of the scatter-gather list. */ +struct virtio_blk_outhdr +{ +/* 0 == read, 1 == write */ +u32 type; +/* Sector (ie. 512 byte offset) */ +unsigned long sector; +/* Where to put reply. */ +unsigned long id; +}; + +struct virtio_blk_inhdr +{ +/* 1 = OK, 0 = not ok. */ +unsigned long status; +}; + +struct gendisk *virtblk_probe (struct virtio_device *vdev); +int virtblk_interrupt (struct gendisk *disk); +void virtblk_remove (struct gendisk *disk); + +#endif /* _LINUX_VIRTIO_BLK_H */
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
RFC PATCH 3/3 virtio infrastructure: example block driver
In reply to Rusty RussellExample block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.
The first segment of the inbuf is a result code (struct virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.
TODO:
1) Ordered tag support.
--- drivers/block/Makefile | 1 drivers/block/virtio_blk.c | 269 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/virtio_blk.h | 29 ++++ 3 files changed, 299 insertions(+)
drivers/block/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss. obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o obj-$(CONFIG_BLK_DEV_DAC960) += DAC960.o obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o +obj-y += virtio_blk.o obj-$(CONFIG_BLK_DEV_UMEM) += umem.o obj-$(CONFIG_BLK_DEV_NBD) += nbd.o
drivers/block/virtio_blk.c new file +270 -0
270 lines not on this page · raw message
include/linux/virtio_blk.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _LINUX_VIRTIO_BLK_H +#define _LINUX_VIRTIO_BLK_H +#include <linux/types.h> +struct gendisk ; +struct virtio_device ; +struct hd_geometry ; + +/* This is the first element of the scatter-gather list. */ +struct virtio_blk_outhdr +{ +/* 0 == read, 1 == write */ +u32 type; +/* Sector (ie. 512 byte offset) */ +unsigned long sector; +/* Where to put reply. */ +unsigned long id; +}; + +struct virtio_blk_inhdr +{ +/* 1 = OK, 0 = not ok. */ +unsigned long status; +}; + +struct gendisk *virtblk_probe (struct virtio_device *vdev); +int virtblk_interrupt (struct gendisk *disk); +void virtblk_remove (struct gendisk *disk); + +#endif /* _LINUX_VIRTIO_BLK_H */
Quoted 8 lines · Rusty Russell
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
The details of probing the device are left to hypervisor-specific
code: it simple constructs the "structvirtio_device" and hands it to the probe function (eg.virtnet_probe()orvirtblk_probe()).
Quoted 6 lines
The virtio drivers add and detach input and output buffers; as the buffers are used up their associated "used" pointers are filled in.
I have written two virtio device drivers (net and block) and two virtio implementations (for lguest): a read-write socket-style implementation, and a more efficient descriptor-based implementation).
These should work for s390 afaics. They seem to fit the requirements of network IO.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 8 lines · Rusty Russell
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
The details of probing the device are left to hypervisor-specific
code: it simple constructs the "structvirtio_device" and hands it to the probe function (eg.virtnet_probe()orvirtblk_probe()).
Quoted 6 lines
The virtio drivers add and detach input and output buffers; as the buffers are used up their associated "used" pointers are filled in.
I have written two virtio device drivers (net and block) and two virtio implementations (for lguest): a read-write socket-style implementation, and a more efficient descriptor-based implementation).
These should work for s390 afaics. They seem to fit the requirements of network IO.
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 6 lines · Rusty Russell
Example block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct
virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.
Quoted 6 lines
The first segment of the inbuf is a result code (struct
virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.TODO:
1) Ordered tag support.
Implementing a do_request function has quite a few disadvantages over hooking into q->make_request_fn. This way, we have the device plug (latency), request merging, and I/O scheduling inside the guest. It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Rusty RussellQuoted 6 lines · Rusty Russell
Example block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct
virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.
Quoted 6 lines
The first segment of the inbuf is a result code (struct
virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.TODO:
1) Ordered tag support.
Implementing a do_request function has quite a few disadvantages over hooking into q->make_request_fn. This way, we have the device plug (latency), request merging, and I/O scheduling inside the guest. It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
Quoted 8 lines
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
The details of probing the device are left to hypervisor-specific
code: it simple constructs the "structvirtio_device" and hands it to the probe function (eg.virtnet_probe()orvirtblk_probe()).
Quoted 8 lines
The virtio drivers add and detach input and output buffers; as the buffers are used up their associated "used" pointers are filled in.
I have written two virtio device drivers (net and block) and two virtio implementations (for lguest): a read-write socket-style implementation, and a more efficient descriptor-based implementation).
Signed-off-by Rusty Russell <rusty-8n+1lVoiYb80n/[email protected]>
That's the exact things I was planning to add to KVM/Linux. All virtual I/O devices should have common interface and share the core functionality. Since Xen PV drivers are already performance optimized and
feature rich, we were planning to generalize the hypervisor-specific backend in order to reuse them.
This is a good step toward such sharing.
Cheers, Dor.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 8 lines
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
The details of probing the device are left to hypervisor-specific
code: it simple constructs the "structvirtio_device" and hands it to the probe function (eg.virtnet_probe()orvirtblk_probe()).
Quoted 8 lines
The virtio drivers add and detach input and output buffers; as the buffers are used up their associated "used" pointers are filled in.
I have written two virtio device drivers (net and block) and two virtio implementations (for lguest): a read-write socket-style implementation, and a more efficient descriptor-based implementation).
Signed-off-by Rusty Russell <[email protected]>
That's the exact things I was planning to add to KVM/Linux. All virtual I/O devices should have common interface and share the core functionality. Since Xen PV drivers are already performance optimized and
feature rich, we were planning to generalize the hypervisor-specific backend in order to reuse them.
This is a good step toward such sharing.
Cheers, Dor.
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 11 lines · Carsten Otte
Quoted 10 lines · Rusty Russell
Example block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct
virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.The first segment of the inbuf is a result code (struct
virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.
Quoted 8 lines
Quoted 2 lines
TODO:
1) Ordered tag support.Implementing a
do_requestfunction has quite a few disadvantages over hooking intoq->make_request_fn. This way, we have the device plug (latency), request merging, and I/O scheduling inside the guest. It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
This kind of a claim needs some benchmark data to document it.
I'll make the counterclaim that you *should* be doing I/O scheduling in the guest, both to be able to test new I/O schedulers, and to provide a set of pre-scheduled I/Os so the host has to do less work.
If someone really needs the host to be doing I/O scheduling, and not the guest, then why are they using virtualization in the first place?
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Carsten OtteQuoted 11 lines · Carsten Otte
Quoted 10 lines · Rusty Russell
Example block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct
virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.The first segment of the inbuf is a result code (struct
virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.
Quoted 8 lines
Quoted 2 lines
TODO:
1) Ordered tag support.Implementing a
do_requestfunction has quite a few disadvantages over hooking intoq->make_request_fn. This way, we have the device plug (latency), request merging, and I/O scheduling inside the guest. It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
This kind of a claim needs some benchmark data to document it.
I'll make the counterclaim that you *should* be doing I/O scheduling in the guest, both to be able to test new I/O schedulers, and to provide a set of pre-scheduled I/Os so the host has to do less work.
If someone really needs the host to be doing I/O scheduling, and not the guest, then why are they using virtualization in the first place?
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 1 line · Troy Benjegerdes
This kind of a claim needs some benchmark data to document it.
We've implemented both for our vdisk driver on 390. At least on our platform, merging in the host is preferable because vmenter/vmexit is very fast and we would merge twice because we submit the result via io_submit() system call from host userland.
In the end you'd need to measure on all platforms this is gonna run on, if you want competitive benchmarks. That makes the benchmark argument somewhat fuzzy.
Quoted 3 lines
I'll make the counterclaim that you *should* be doing I/O scheduling in the guest, both to be able to test new I/O schedulers, and to provide a set of pre-scheduled I/Os so the host has to do less work.
What makes the work to merge requests less, if done in the host? Is'nt it the same code really if you run Linux in both host and guest?
Quoted 2 lines
If someone really needs the host to be doing I/O scheduling, and not the guest, then why are they using virtualization in the first place?
Just to run multiple operating systems on one box. Funny question...
so long,
Carsten
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Troy BenjegerdesQuoted 1 line · Troy Benjegerdes
This kind of a claim needs some benchmark data to document it.
We've implemented both for our vdisk driver on 390. At least on our platform, merging in the host is preferable because vmenter/vmexit is very fast and we would merge twice because we submit the result via io_submit() system call from host userland. In the end you'd need to measure on all platforms this is gonna run on, if you want competitive benchmarks. That makes the benchmark argument somewhat fuzzy.
Quoted 3 lines
I'll make the counterclaim that you *should* be doing I/O scheduling in the guest, both to be able to test new I/O schedulers, and to provide a set of pre-scheduled I/Os so the host has to do less work.
What makes the work to merge requests less, if done in the host? Is'nt it the same code really if you run Linux in both host and guest?
Quoted 2 lines
If someone really needs the host to be doing I/O scheduling, and not the guest, then why are they using virtualization in the first place?
Just to run multiple operating systems on one box. Funny question...
so long,
Carsten
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 9 lines · Carsten Otte
Quoted 2 lines · Troy Benjegerdes
This kind of a claim needs some benchmark data to document it.
We've implemented both for our vdisk driver on 390. At least on our platform, merging in the host is preferable because vmenter/vmexit is very fast and we would merge twice because we submit the result via
io_submit()system call from host userland.
If a single hypercall can submit multiple requests, then this may work well for the newcomer archs too.
Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Carsten OtteQuoted 9 lines · Carsten Otte
Quoted 2 lines · Troy Benjegerdes
This kind of a claim needs some benchmark data to document it.
We've implemented both for our vdisk driver on 390. At least on our platform, merging in the host is preferable because vmenter/vmexit is very fast and we would merge twice because we submit the result via
io_submit()system call from host userland.
If a single hypercall can submit multiple requests, then this may work well for the newcomer archs too.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 11 lines · Carsten Otte
Quoted 10 lines · Rusty Russell
Example block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct
virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.The first segment of the inbuf is a result code (struct
virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.
Quoted 5 lines
Quoted 2 lines
TODO:
1) Ordered tag support.Implementing a
do_requestfunction has quite a few disadvantages over hooking intoq->make_request_fn. This way, we have the device plug (latency), request merging, and I/O scheduling inside the guest.
Now my lack of block-layer knowledge is showing. I would have thought that if we want to do things like ionice(1) to work, we have to do some guest scheduling or pass that information down to the host.
Quoted 3 lines
It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
What's the overhead in doing both?
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Carsten OtteQuoted 11 lines · Carsten Otte
Quoted 10 lines · Rusty Russell
Example block driver using virtio.
The block driver uses outbufs with sg[0] being the request information (struct
virtio_blk_outhdr) with the type, sector and inbuf id. For a write, the rest of the sg will contain the data to be written.The first segment of the inbuf is a result code (struct
virtio_blk_inhdr). For a read, the rest of the sg points to the input buffer.
Quoted 5 lines
Quoted 2 lines
TODO:
1) Ordered tag support.Implementing a
do_requestfunction has quite a few disadvantages over hooking intoq->make_request_fn. This way, we have the device plug (latency), request merging, and I/O scheduling inside the guest.
Now my lack of block-layer knowledge is showing. I would have thought that if we want to do things like ionice(1) to work, we have to do some guest scheduling or pass that information down to the host.
Quoted 3 lines
It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
What's the overhead in doing both?
Rusty.
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 3 lines · Rusty Russell
Now my lack of block-layer knowledge is showing. I would have thought that if we want to do things like ionice(1) to work, we have to do some guest scheduling or pass that information down to the host.
Yea that would only work on the host: one can use ionice to set the io niceness of the entire guest. Individual processes inside the guest are opaque to the host, and thus are opaque to its io scheduler.
Quoted 5 lines
Quoted 3 lines
It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
What's the overhead in doing both?
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
On the other hand, if we choose to hook into q->make_request_fn, we do end up doing far more hypercalls: bios do not get merged on the guest side. We must do a hypercall per bio in this scenario, or we'll end up adding latency again. In contrast, we can submit the entire content of the queue with a single hypercall when calling at do_request().
A third way out of that situation is to do queueing between guest and
host: on the first bio, guest does a hypercall. When the next bio arrives, guest sees that the host has not finished processing the queue yet and pushes another buffer without doing a notification. We've also implemented this, with the result that our host stack was quick enough to practically always process the bio before the guest had the chance to submit another one. Performance was a nightmare, so we discontinued pursuing that idea.
so long,
Carsten
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Rusty RussellQuoted 3 lines · Rusty Russell
Now my lack of block-layer knowledge is showing. I would have thought that if we want to do things like ionice(1) to work, we have to do some guest scheduling or pass that information down to the host.
Yea that would only work on the host: one can use ionice to set the io niceness of the entire guest. Individual processes inside the guest are opaque to the host, and thus are opaque to its io scheduler.
Quoted 3 lines
Quoted 1 line
It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
What's the overhead in doing both?
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period. If we have this method both in host and guest, we have twice the penalty with no added benefit.
On the other hand, if we choose to hook into q->make_request_fn, we do end up doing far more hypercalls: bios do not get merged on the guest side. We must do a hypercall per bio in this scenario, or we'll end up adding latency again. In contrast, we can submit the entire content of the queue with a single hypercall when calling at do_request().
A third way out of that situation is to do queueing between guest and host: on the first bio, guest does a hypercall. When the next bio arrives, guest sees that the host has not finished processing the queue yet and pushes another buffer without doing a notification. We've also implemented this, with the result that our host stack was quick enough to practically always process the bio before the guest had the chance to submit another one. Performance was a nightmare, so we discontinued pursuing that idea.
so long,
Carsten
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 12 lines · Carsten Otte
Quoted 3 lines · Rusty Russell
Now my lack of block-layer knowledge is showing. I would have thought that if we want to do things like ionice(1) to work, we have to do some guest scheduling or pass that information down to the host.
Yea that would only work on the host: one can use ionice to set the io niceness of the entire guest. Individual processes inside the guest are opaque to the host, and thus are opaque to its io scheduler.
Quoted 4 lines
Quoted 3 lines
It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
Quoted 8 lines
Quoted 1 line
What's the overhead in doing both?
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
Quoted 6 lines
On the other hand, if we choose to hook into
q->make_request_fn, we do end up doing far more hypercalls: bios do not get merged on the guest side. We must do a hypercall per bio in this scenario, or we'll end up adding latency again. In contrast, we can submit the entire content of the queue with a single hypercall when calling atdo_request().
Quoted 8 lines
A third way out of that situation is to do queueing between guest and
host: on the first bio, guest does a hypercall. When the next bio arrives, guest sees that the host has not finished processing the queue yet and pushes another buffer without doing a notification. We've also implemented this, with the result that our host stack was quick enough to practically always process the bio before the guest had the chance to submit another one. Performance was a nightmare, so we discontinued pursuing that idea.
I'd greatly prefer maintaing a request_fn interface for this. The make_request_fn/request_fn call ratio is at least 1, and typically a lot larger (4kb blocks, 128kb request not uncommon -> 32).
Signature · 8 lines
Jens Axboe ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Carsten OtteQuoted 12 lines · Carsten Otte
Quoted 3 lines · Rusty Russell
Now my lack of block-layer knowledge is showing. I would have thought that if we want to do things like ionice(1) to work, we have to do some guest scheduling or pass that information down to the host.
Yea that would only work on the host: one can use ionice to set the io niceness of the entire guest. Individual processes inside the guest are opaque to the host, and thus are opaque to its io scheduler.
Quoted 4 lines
Quoted 3 lines
It seems preferable to do that in the host, especially when requests of multiple guests end up on the same physical media (shared access, or partitioned).
Quoted 8 lines
Quoted 1 line
What's the overhead in doing both?
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
Quoted 6 lines
On the other hand, if we choose to hook into
q->make_request_fn, we do end up doing far more hypercalls: bios do not get merged on the guest side. We must do a hypercall per bio in this scenario, or we'll end up adding latency again. In contrast, we can submit the entire content of the queue with a single hypercall when calling atdo_request().
Quoted 8 lines
A third way out of that situation is to do queueing between guest and
host: on the first bio, guest does a hypercall. When the next bio arrives, guest sees that the host has not finished processing the queue yet and pushes another buffer without doing a notification. We've also implemented this, with the result that our host stack was quick enough to practically always process the bio before the guest had the chance to submit another one. Performance was a nightmare, so we discontinued pursuing that idea.
I'd greatly prefer maintaing a request_fn interface for this. The make_request_fn/request_fn call ratio is at least 1, and typically a lot larger (4kb blocks, 128kb request not uncommon -> 32).
Signature · 1 line
Jens Axboe
Quoted 13 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rusty Russell
Sent: Thursday, May 31, 2007 5:19 AM
To: kvm-devel; Xen Mailing List; virtualization
Cc: Jimi Xenidis; Stephen Rothwell; [email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: [Xen-devel] [PATCH RFC 1/3] virtio infrastructure
Quoted 5 lines
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
Rusty
Could you please clarify what is the purpose of this "virtual I/O" layer?
At least for networking, why isn't the current linux net device abstraction sufficient for hiding the details of different virtual devices implementations? What am I missing?
Thanks
Renato
Quoted 13 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rusty Russell
Sent: Thursday, May 31, 2007 5:19 AM
To: kvm-devel; Xen Mailing List; virtualization
Cc: Jimi Xenidis; Stephen Rothwell; [email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: [Xen-devel] [PATCH RFC 1/3] virtio infrastructure
Quoted 5 lines
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
Rusty
Could you please clarify what is the purpose of this "virtual I/O" layer?
At least for networking, why isn't the current linux net device abstraction sufficient for hiding the details of different virtual devices implementations? What am I missing?
Thanks
Renato
Quoted 4 lines · Rusty Russell
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
Quoted 8 lines
The details of probing the device are left to hypervisor-specific
code: it simple constructs the "structvirtio_device" and hands it to the probe function (eg.virtnet_probe()orvirtblk_probe()).The virtio drivers add and detach input and output buffers; as the buffers are used up their associated "used" pointers are filled in.
Good stuff.
Quoted 6 lines
+/**
+ *virtio_ops- virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
Quoted 9 lines
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg.-ENOSPC).
Instead of 'used', how about a completion callback (with associated data pointer)? A new helper, virtio_complete(), would call the callback for all completed requests. It would eliminate all the tedious scanning used to match the identifier.
It would also be nice to support a bit of non-buffer data, like a set of bitflags.
Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Quoted 4 lines · Rusty Russell
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
Quoted 8 lines
The details of probing the device are left to hypervisor-specific
code: it simple constructs the "structvirtio_device" and hands it to the probe function (eg.virtnet_probe()orvirtblk_probe()).The virtio drivers add and detach input and output buffers; as the buffers are used up their associated "used" pointers are filled in.
Good stuff.
Quoted 6 lines
+/**
+ *virtio_ops- virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
Quoted 9 lines
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg.-ENOSPC).
Instead of 'used', how about a completion callback (with associated data pointer)? A new helper, virtio_complete(), would call the callback for all completed requests. It would eliminate all the tedious scanning used to match the identifier.
It would also be nice to support a bit of non-buffer data, like a set of bitflags.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 9 lines · Carsten Otte
Quoted 1 line · Rusty Russell
What's the overhead in doing both?
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
Indeed, but as it turns out that the draft block driver is appealingly naive in this respect: the caller can invoke "elevator_init(disk->queue, "noop")". See the extract from the lguest implementation below (which doesn't do this, but could).
Is the noop scheduler significantly worse than hooking directly into q->make_request_fn?
Quoted 8 lines
A third way out of that situation is to do queueing between guest and
host: on the first bio, guest does a hypercall. When the next bio arrives, guest sees that the host has not finished processing the queue yet and pushes another buffer without doing a notification. We've also implemented this, with the result that our host stack was quick enough to practically always process the bio before the guest had the chance to submit another one. Performance was a nightmare, so we discontinued pursuing that idea.
Interesting! This kind of implementation becomes quite natural with shared memory so the guest can see an "ack" from the host: if the previous notification hasn't been acked, it doesn't send another one.
Such a scheme has application beyond block devices and (this is what I'm really interested in): should be easy to implement under virtio_ops.
Thanks!
Rusty.
+/* Example block driver code. */
+#include <linux/virtio_blk.h>
+#include <linux/genhd.h>
+#include <linux/blkdev.h>
+static irqreturn_t lguest_virtblk_interrupt(int irq, void *_lgv) +{
+ struct lguest_virtio_device *lgv = _lgv;
+
+ return virtblk_interrupt(lgv->priv);
+}
+
+static int lguest_virtblk_probe(struct lguest_device *lgdev) +{
+ struct lguest_virtio_device *lgv;
+ struct gendisk *disk;
+ unsigned long sectors;
+ int err, irqf, i;
+
+ lgv = kmalloc(sizeof(*lgv), GFP_KERNEL);
+ if (!lgv)
+ return -ENOMEM;
+
+ memset(lgv, 0, sizeof(*lgv));
+
+ lgdev->private = lgv;
+ lgv->lg = lgdev;
+
+ /* Map is input page followed by output page */
+ lgv->in.p = lguest_map(lguest_devices[lgdev->index].pfn<<PAGE_SHIFT,2);
+ if (!lgv->in.p) {
+ err = -ENOMEM;
+ goto free_lgv;
+ }
+ lgv->out.p = lgv->in.p + 1;
+ /* Page is initially used to pass capacity. */
+ sectors = *(unsigned long *)lgv->in.p;
+ *(unsigned long *)lgv->in.p = 0;
+
+ /* Put everything in free lists. */
+ lgv->in.avail = lgv->out.avail = NUM_DESCS;
+ for (i = 0; i < NUM_DESCS-1; i++) {
+ lgv->in.p->desc[i].next = i+1;
+ lgv->out.p->desc[i].next = i+1;
+ }
+
+ lgv->vdev.ops = &lguest_virtio_ops;
+ lgv->vdev.dev = &lgdev->dev;
+
+ lgv->priv = disk = virtblk_probe(&lgv->vdev);
+ if (IS_ERR(lgv->priv)) {
+ err = PTR_ERR(lgv->priv);
+ goto unmap;
+ }
+ set_capacity(disk, sectors);
+ blk_queue_max_hw_segments(disk->queue, NUM_DESCS-1);
+
+ if (lguest_devices[lgv->lg->index].features&LGUEST_DEVICE_F_RANDOMNESS)
+ irqf = IRQF_SAMPLE_RANDOM;
+ else
+ irqf = 0;
+
+ err = request_irq(lgdev_irq(lgv->lg), lguest_virtblk_interrupt, irqf,
+ disk->disk_name, lgv);
+ if (err)
+ goto remove;
+
+ add_disk(disk);
+ printk("Virtblk device %s registered\n", disk->disk_name);
+ return 0;
+
+remove:
+ virtblk_remove(disk);
+unmap:
+ lguest_unmap(lgv->in.p);
+free_lgv:
+ kfree(lgv);
+ return err;
+}
+
+static struct lguest_driver lguest_virtblk_drv = {
+ .name = "lguestvirtblk",
+ .owner = THIS_MODULE,
+ .device_type = LGUEST_DEVICE_T_VIRTBLK,
+ .probe = lguest_virtblk_probe,
+};
+
+static __init int lguest_virtblk_init(void)
+{
+ return register_lguest_driver(&lguest_virtblk_drv);
+}
+device_initcall(lguest_virtblk_init);
+
+MODULE_LICENSE("GPL");
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Carsten OtteQuoted 9 lines · Carsten Otte
Quoted 1 line · Rusty Russell
What's the overhead in doing both?
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
Indeed, but as it turns out that the draft block driver is appealingly naive in this respect: the caller can invoke "elevator_init(disk->queue, "noop")". See the extract from the lguest implementation below (which doesn't do this, but could).
Is the noop scheduler significantly worse than hooking directly into q->make_request_fn?
Quoted 8 lines
A third way out of that situation is to do queueing between guest and
host: on the first bio, guest does a hypercall. When the next bio arrives, guest sees that the host has not finished processing the queue yet and pushes another buffer without doing a notification. We've also implemented this, with the result that our host stack was quick enough to practically always process the bio before the guest had the chance to submit another one. Performance was a nightmare, so we discontinued pursuing that idea.
Interesting! This kind of implementation becomes quite natural with shared memory so the guest can see an "ack" from the host: if the previous notification hasn't been acked, it doesn't send another one.
Such a scheme has application beyond block devices and (this is what I'm really interested in): should be easy to implement under virtio_ops.
Thanks!
Rusty.
+/* Example block driver code. */
+#include <linux/virtio_blk.h>
+#include <linux/genhd.h>
+#include <linux/blkdev.h>
+static irqreturn_t lguest_virtblk_interrupt(int irq, void *_lgv) +{
+ struct lguest_virtio_device *lgv = _lgv;
+
+ return virtblk_interrupt(lgv->priv);
+}
+
+static int lguest_virtblk_probe(struct lguest_device *lgdev) +{
+ struct lguest_virtio_device *lgv;
+ struct gendisk *disk;
+ unsigned long sectors;
+ int err, irqf, i;
+
+ lgv = kmalloc(sizeof(*lgv), GFP_KERNEL);
+ if (!lgv)
+ return -ENOMEM;
+
+ memset(lgv, 0, sizeof(*lgv));
+
+ lgdev->private = lgv;
+ lgv->lg = lgdev;
+
+ /* Map is input page followed by output page */
+ lgv->in.p = lguest_map(lguest_devices[lgdev->index].pfn<<PAGE_SHIFT,2);
+ if (!lgv->in.p) {
+ err = -ENOMEM;
+ goto free_lgv;
+ }
+ lgv->out.p = lgv->in.p + 1;
+ /* Page is initially used to pass capacity. */
+ sectors = *(unsigned long *)lgv->in.p;
+ *(unsigned long *)lgv->in.p = 0;
+
+ /* Put everything in free lists. */
+ lgv->in.avail = lgv->out.avail = NUM_DESCS;
+ for (i = 0; i < NUM_DESCS-1; i++) {
+ lgv->in.p->desc[i].next = i+1;
+ lgv->out.p->desc[i].next = i+1;
+ }
+
+ lgv->vdev.ops = &lguest_virtio_ops;
+ lgv->vdev.dev = &lgdev->dev;
+
+ lgv->priv = disk = virtblk_probe(&lgv->vdev);
+ if (IS_ERR(lgv->priv)) {
+ err = PTR_ERR(lgv->priv);
+ goto unmap;
+ }
+ set_capacity(disk, sectors);
+ blk_queue_max_hw_segments(disk->queue, NUM_DESCS-1);
+
+ if (lguest_devices[lgv->lg->index].features&LGUEST_DEVICE_F_RANDOMNESS)
+ irqf = IRQF_SAMPLE_RANDOM;
+ else
+ irqf = 0;
+
+ err = request_irq(lgdev_irq(lgv->lg), lguest_virtblk_interrupt, irqf,
+ disk->disk_name, lgv);
+ if (err)
+ goto remove;
+
+ add_disk(disk);
+ printk("Virtblk device %s registered\n", disk->disk_name);
+ return 0;
+
+remove:
+ virtblk_remove(disk);
+unmap:
+ lguest_unmap(lgv->in.p);
+free_lgv:
+ kfree(lgv);
+ return err;
+}
+
+static struct lguest_driver lguest_virtblk_drv = {
+ .name = "lguestvirtblk",
+ .owner = THIS_MODULE,
+ .device_type = LGUEST_DEVICE_T_VIRTBLK,
+ .probe = lguest_virtblk_probe,
+};
+
+static __init int lguest_virtblk_init(void)
+{
+ return register_lguest_driver(&lguest_virtblk_drv);
+}
+device_initcall(lguest_virtblk_init);
+
+MODULE_LICENSE("GPL");
Quoted 16 lines · Avi Kivity
Quoted 5 lines · Rusty Russell
+ *
virtio_ops- virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.Quoted 9 lines
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg.-ENOSPC).
Quoted 4 lines
Instead of 'used', how about a completion callback (with associated data pointer)? A new helper,
virtio_complete(), would call the callback for all completed requests. It would eliminate all the tedious scanning used to match the identifier.
Hi Avi,
There were several considerations here. My first was that the drivers
look much more like normal devices than getting a callback for every
buffer. Secondly, "used" batches much more nicely than a completion.
Finally, it's also something you really want to know, so the driver doesn't have to zero its inbufs (an untrusted other side says it sends you 1500 bytes but actually sent nothing, and now you spray kernel memory out the NIC).
I also considered some scheme like:
struct virtio_used_info
{
unsigned long len;
void *next_token;
};
...
unsigned long (*add_outbuf)(struct virtio_device *vdev,
const struct scatterlist sg[],
unsigned int num,
void *token,
struct virtio_used_info *used_info);So the "used" becomes a "used/next" pair and you can just walk the linked list. But I wasn't convinced that walking the buffers is going to be a performance issue (tho the net driver puts them in a continuous array for cache friendliness as a nod to this concern).
Quoted 2 lines
It would also be nice to support a bit of non-buffer data, like a set of bitflags.
I expect this might be necessary, but it wasn't so far. The non-buffer
data tends to go in sg[0]: the block driver works this way, and the network driver will for GSO. Of course, a specialized virtio_ops backend might well take this and put the info somewhere else.
I also considered a separate "publish"/"examine" interface for things
which aren't really messages, but again, haven't needed it yet.
Thanks!
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 16 lines · Avi Kivity
Quoted 5 lines · Rusty Russell
+ *
virtio_ops- virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.Quoted 9 lines
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg.-ENOSPC).
Quoted 4 lines
Instead of 'used', how about a completion callback (with associated data pointer)? A new helper,
virtio_complete(), would call the callback for all completed requests. It would eliminate all the tedious scanning used to match the identifier.
Hi Avi,
There were several considerations here. My first was that the drivers
look much more like normal devices than getting a callback for every
buffer. Secondly, "used" batches much more nicely than a completion.
Finally, it's also something you really want to know, so the driver doesn't have to zero its inbufs (an untrusted other side says it sends you 1500 bytes but actually sent nothing, and now you spray kernel memory out the NIC).
I also considered some scheme like:
struct virtio_used_info
{
unsigned long len;
void *next_token;
};
...
unsigned long (*add_outbuf)(struct virtio_device *vdev,
const struct scatterlist sg[],
unsigned int num,
void *token,
struct virtio_used_info *used_info);So the "used" becomes a "used/next" pair and you can just walk the linked list. But I wasn't convinced that walking the buffers is going to be a performance issue (tho the net driver puts them in a continuous array for cache friendliness as a nod to this concern).
Quoted 2 lines
It would also be nice to support a bit of non-buffer data, like a set of bitflags.
I expect this might be necessary, but it wasn't so far. The non-buffer
data tends to go in sg[0]: the block driver works this way, and the network driver will for GSO. Of course, a specialized virtio_ops backend might well take this and put the info somewhere else.
I also considered a separate "publish"/"examine" interface for things
which aren't really messages, but again, haven't needed it yet.
Thanks!
Rusty.
Quoted 16 lines · Jose Renato G
Quoted 12 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rusty Russell
Sent: Thursday, May 31, 2007 5:19 AM
To: kvm-devel; Xen Mailing List; virtualization
Cc: Jimi Xenidis; Stephen Rothwell; [email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 3 lines
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
Quoted 7 lines
Rusty
Could you please clarify what is the purpose of this "virtual I/O" layer?
At least for networking, why isn't the current linux net device abstraction sufficient for hiding the details of different virtual devices implementations? What am I missing?
Hi Renato!
This is a very good question. For currently-existing and working
devices it just seems like another layer of indirection, and not much code saving.
There are several reasons for having a common layer. The obvious is to
reduce the amount of code, but that's the least important. Slightly more important is that noone wants to maintain and tune 5 different virtual net drivers, 5 different virtual block drivers, etc. In fact, the kernel community will start to rebel at some point, especially if they want different optimization hooks deeper into the kernel.
We expect to see new device types (entropy device, anyone?), and so the
5 different drivers becomes the 5 x N different drivers. Eventually we may come up with common bus and probing which everyone loves, but until then we can at least make it simple for each virtualization technology to implement the new XYZZY device.
Finally, virtual I/O techniques are *moving*. KVM doesn't really have
one, XenSource are discussing more changes to theirs (at least for networking) and lguest is still looking for an efficient one. No doubt the others would love to use clean and optimal Linux drivers, too (UML, S/390, Power, VMWare?).
When Linux doesn't provide a model of what it expects from virtual
devices, one end of the design process is untethered: we've already seen some fairly random and gratuitously different results. If we can provide a simple interface which we like it encourages new implementations to produce Linux-friendly interfaces.
Of course, the new interface must not suck.
I hope that clarifies my thinking?
Rusty.
Quoted 16 lines · Jose Renato G
Quoted 12 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rusty Russell
Sent: Thursday, May 31, 2007 5:19 AM
To: kvm-devel; Xen Mailing List; virtualization
Cc: Jimi Xenidis; Stephen Rothwell; [email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 3 lines
This attempts to implement a "virtual I/O" layer which should allow common drivers to be efficiently used across most virtual I/O mechanisms. It will no-doubt need further enhancement.
Quoted 7 lines
Rusty
Could you please clarify what is the purpose of this "virtual I/O" layer?
At least for networking, why isn't the current linux net device abstraction sufficient for hiding the details of different virtual devices implementations? What am I missing?
Hi Renato!
This is a very good question. For currently-existing and working
devices it just seems like another layer of indirection, and not much code saving.
There are several reasons for having a common layer. The obvious is to
reduce the amount of code, but that's the least important. Slightly more important is that noone wants to maintain and tune 5 different virtual net drivers, 5 different virtual block drivers, etc. In fact, the kernel community will start to rebel at some point, especially if they want different optimization hooks deeper into the kernel.
We expect to see new device types (entropy device, anyone?), and so the
5 different drivers becomes the 5 x N different drivers. Eventually we may come up with common bus and probing which everyone loves, but until then we can at least make it simple for each virtualization technology to implement the new XYZZY device.
Finally, virtual I/O techniques are *moving*. KVM doesn't really have
one, XenSource are discussing more changes to theirs (at least for networking) and lguest is still looking for an efficient one. No doubt the others would love to use clean and optimal Linux drivers, too (UML, S/390, Power, VMWare?).
When Linux doesn't provide a model of what it expects from virtual
devices, one end of the design process is untethered: we've already seen some fairly random and gratuitously different results. If we can provide a simple interface which we like it encourages new implementations to produce Linux-friendly interfaces.
Of course, the new interface must not suck.
I hope that clarifies my thinking?
Rusty.
Quoted 27 lines · Rusty Russell
Quoted 17 lines · Avi Kivity
Quoted 5 lines · Rusty Russell
+ *
virtio_ops- virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.Quoted 10 lines
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg.-ENOSPC).Quoted 5 lines
Instead of 'used', how about a completion callback (with associated data pointer)? A new helper,
virtio_complete(), would call the callback for all completed requests. It would eliminate all the tedious scanning used to match the identifier.Hi Avi,
Quoted 8 lines
There were several considerations here. My first was that the drivers
look much more like normal devices than getting a callback for every
buffer. Secondly, "used" batches much more nicely than a completion.
Finally, it's also something you really want to know, so the driver doesn't have to zero its inbufs (an untrusted other side says it sends you 1500 bytes but actually sent nothing, and now you spray kernel memory out the NIC).
Sure, 'used' is important (how else do you get the packet size on receive?), I'm just bitching about the linear scan.
Quoted 14 lines
I also considered some scheme like:
struct virtio_used_info
{
unsigned long len;
void *next_token;
};
...
unsigned long (*add_outbuf)(struct virtio_device *vdev,
const struct scatterlist sg[],
unsigned int num,
void *token,
struct virtio_used_info *used_info);Quoted 5 lines
So the "used" becomes a "used/next" pair and you can just walk the linked list. But I wasn't convinced that walking the buffers is going to be a performance issue (tho the net driver puts them in a continuous array for cache friendliness as a nod to this concern).
Well, if you have 256 slots per direction, you will scan 4KB of memory per interrupt (256 slots x 2 directions x 8 bytes). You may need a queue length greater than 256 for a high bandwidth interface, if you want to reduce your interrupt rate, or if your guest is scheduled out for lengthy periods (say, a millisecond).
Quoted 10 lines
Quoted 4 lines
It would also be nice to support a bit of non-buffer data, like a set of bitflags.
I expect this might be necessary, but it wasn't so far. The non-buffer
data tends to go in sg[0]: the block driver works this way, and the network driver will for GSO. Of course, a specializedvirtio_opsbackend might well take this and put the info somewhere else.
Yeah. Well, it's a somewhat roundabout way of doing things.
Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Quoted 27 lines · Rusty Russell
Quoted 17 lines · Avi Kivity
Quoted 5 lines · Rusty Russell
+ *
virtio_ops- virtio abstraction layer
+ * @add_outbuf: prepare to send data to the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.Quoted 10 lines
+ * used: the length sent (set once sending is done).
+ * Returns an identifier or an error.
+ * @add_inbuf: prepare to receive data from the other end:
+ * vdev: thevirtio_device
+ * sg: the description of the buffer(s).
+ * num: the size of the sg array.
+ * used: the length sent (set once data received).
+ * Returns an identifier or an error (eg.-ENOSPC).Quoted 5 lines
Instead of 'used', how about a completion callback (with associated data pointer)? A new helper,
virtio_complete(), would call the callback for all completed requests. It would eliminate all the tedious scanning used to match the identifier.Hi Avi,
Quoted 8 lines
There were several considerations here. My first was that the drivers
look much more like normal devices than getting a callback for every
buffer. Secondly, "used" batches much more nicely than a completion.
Finally, it's also something you really want to know, so the driver doesn't have to zero its inbufs (an untrusted other side says it sends you 1500 bytes but actually sent nothing, and now you spray kernel memory out the NIC).
Sure, 'used' is important (how else do you get the packet size on receive?), I'm just bitching about the linear scan.
Quoted 14 lines
I also considered some scheme like:
struct virtio_used_info
{
unsigned long len;
void *next_token;
};
...
unsigned long (*add_outbuf)(struct virtio_device *vdev,
const struct scatterlist sg[],
unsigned int num,
void *token,
struct virtio_used_info *used_info);Quoted 5 lines
So the "used" becomes a "used/next" pair and you can just walk the linked list. But I wasn't convinced that walking the buffers is going to be a performance issue (tho the net driver puts them in a continuous array for cache friendliness as a nod to this concern).
Well, if you have 256 slots per direction, you will scan 4KB of memory per interrupt (256 slots x 2 directions x 8 bytes). You may need a queue length greater than 256 for a high bandwidth interface, if you want to reduce your interrupt rate, or if your guest is scheduled out for lengthy periods (say, a millisecond).
Quoted 10 lines
Quoted 4 lines
It would also be nice to support a bit of non-buffer data, like a set of bitflags.
I expect this might be necessary, but it wasn't so far. The non-buffer
data tends to go in sg[0]: the block driver works this way, and the network driver will for GSO. Of course, a specializedvirtio_opsbackend might well take this and put the info somewhere else.
Yeah. Well, it's a somewhat roundabout way of doing things.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 2 lines · Avi Kivity
Sure, 'used' is important (how else do you get the packet size on receive?)
Well, the sender can prepend the length, or for networking just leave Linux to trim packets. It's the trust issue which bugs me.
Quoted 1 line
, I'm just bitching about the linear scan.
If you're doing interrupt mitigation on a high-bandwidth device, I think it's optimal. And if you're not, you obviously don't care 8)
That said, thousands of descriptors may not be insane...
Quoted 5 lines
Well, if you have 256 slots per direction, you will scan 4KB of memory per interrupt (256 slots x 2 directions x 8 bytes). You may need a queue length greater than 256 for a high bandwidth interface, if you want to reduce your interrupt rate, or if your guest is scheduled out for lengthy periods (say, a millisecond).
Hmm... Perhaps I should move the used arrays into the "struct virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.
This also makes the "id" easier to use from the driver side: if we add a "max_id" field it can size its own arrays if it wants to. Gets rid of the linked-list in the block driver...
Thoughts?
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 2 lines · Avi Kivity
Sure, 'used' is important (how else do you get the packet size on receive?)
Well, the sender can prepend the length, or for networking just leave Linux to trim packets. It's the trust issue which bugs me.
Quoted 1 line
, I'm just bitching about the linear scan.
If you're doing interrupt mitigation on a high-bandwidth device, I think it's optimal. And if you're not, you obviously don't care 8)
That said, thousands of descriptors may not be insane...
Quoted 5 lines
Well, if you have 256 slots per direction, you will scan 4KB of memory per interrupt (256 slots x 2 directions x 8 bytes). You may need a queue length greater than 256 for a high bandwidth interface, if you want to reduce your interrupt rate, or if your guest is scheduled out for lengthy periods (say, a millisecond).
Hmm... Perhaps I should move the used arrays into the "struct virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.
This also makes the "id" easier to use from the driver side: if we add a "max_id" field it can size its own arrays if it wants to. Gets rid of the linked-list in the block driver...
Thoughts?
Rusty.
Quoted 5 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.
That may force the virtio backend to do things it doesn't want to.
Quoted 4 lines
This also makes the "id" easier to use from the driver side: if we add a "
max_id" field it can size its own arrays if it wants to. Gets rid of the linked-list in the block driver...
How about
struct virtio_completion {
unsigned long length;
void *data;
};
int virtio_complete(struct virtio_completion *completions, int nr);where 'data' is an opaque pointer passed by the device during add_*buf()?
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Quoted 5 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.
That may force the virtio backend to do things it doesn't want to.
Quoted 4 lines
This also makes the "id" easier to use from the driver side: if we add a "
max_id" field it can size its own arrays if it wants to. Gets rid of the linked-list in the block driver...
How about
struct virtio_completion {
unsigned long length;
void *data;
};
int virtio_complete(struct virtio_completion *completions, int nr);where 'data' is an opaque pointer passed by the device during add_*buf()?
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.That may force the virtio backend to do things it doesn't want to.
Well, I have two implementations, and both ids already fit this model so I have some confidence. I just need to add the set_bit/clear_bit to the read/write one, and use sync_clear_bit to the descriptor-based one (which I suspect will actually get a little cleaner).
So I think this constraint is a reasonable thing to add anyway.
Quoted 7 lines
Quoted 4 lines
This also makes the "id" easier to use from the driver side: if we add a "
max_id" field it can size its own arrays if it wants to. Gets rid of the linked-list in the block driver...How about
Quoted 8 lines
struct virtio_completion { unsigned long length; void *data; }; int virtio_complete(struct virtio_completion *completions, int nr);where 'data' is an opaque pointer passed by the device during add_*buf()?
Other than the fact that the driver will look less like a normal driver, it's actually harder to write the net driver if that complete call can happen off an interrupt: we can't free skbs in interrupt context, which is why the used-outbuf cleanup is currently done (inefficiently, but that's orthogonal) in the xmit routine.
I'll code up the modifications now and check if I'm right about the impact on the code. I might have to come up with something else...
Cheers,
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.That may force the virtio backend to do things it doesn't want to.
Well, I have two implementations, and both ids already fit this model so I have some confidence. I just need to add the set_bit/clear_bit to the read/write one, and use sync_clear_bit to the descriptor-based one (which I suspect will actually get a little cleaner).
So I think this constraint is a reasonable thing to add anyway.
Quoted 7 lines
Quoted 4 lines
This also makes the "id" easier to use from the driver side: if we add a "
max_id" field it can size its own arrays if it wants to. Gets rid of the linked-list in the block driver...How about
Quoted 8 lines
struct virtio_completion { unsigned long length; void *data; }; int virtio_complete(struct virtio_completion *completions, int nr);where 'data' is an opaque pointer passed by the device during add_*buf()?
Other than the fact that the driver will look less like a normal driver, it's actually harder to write the net driver if that complete call can happen off an interrupt: we can't free skbs in interrupt context, which is why the used-outbuf cleanup is currently done (inefficiently, but that's orthogonal) in the xmit routine.
I'll code up the modifications now and check if I'm right about the impact on the code. I might have to come up with something else...
Cheers,
Rusty.
Quoted 11 lines · Rusty Russell
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.That may force the virtio backend to do things it doesn't want to.
Quoted 8 lines
Well, I have two implementations, and both ids already fit this model so I have some confidence. I just need to add the set_bit/clear_bit to the read/write one, and use
sync_clear_bitto the descriptor-based one (which I suspect will actually get a little cleaner).So I think this constraint is a reasonable thing to add anyway.
Some hardware (tulip IIRC, but long time ago) allows linked list based descriptors. If a virtio implementation takes a similar approach, it may not have an array of descriptors.
Networking hardware generally services descriptors in a FIFO manner. virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
For block devices, reordering is a matter of course, and virtio needs to efficiently support that. Queues are generally shorter for block, though.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Quoted 11 lines · Rusty Russell
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.That may force the virtio backend to do things it doesn't want to.
Quoted 8 lines
Well, I have two implementations, and both ids already fit this model so I have some confidence. I just need to add the set_bit/clear_bit to the read/write one, and use
sync_clear_bitto the descriptor-based one (which I suspect will actually get a little cleaner).So I think this constraint is a reasonable thing to add anyway.
Some hardware (tulip IIRC, but long time ago) allows linked list based descriptors. If a virtio implementation takes a similar approach, it may not have an array of descriptors.
Networking hardware generally services descriptors in a FIFO manner. virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
For block devices, reordering is a matter of course, and virtio needs to efficiently support that. Queues are generally shorter for block, though.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 6 lines · Avi Kivity
Networking hardware generally services descriptors in a FIFO manner. virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
You're free to do that in the process but before your packets leave the backend you've got to make sure that they haven't been reordered.
Cheers,
Signature · 10 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/Quoted 6 lines · Avi Kivity
Networking hardware generally services descriptors in a FIFO manner. virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
You're free to do that in the process but before your packets leave the backend you've got to make sure that they haven't been reordered.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 17 lines · Avi Kivity
Quoted 16 lines · Rusty Russell
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.That may force the virtio backend to do things it doesn't want to.
Well, I have two implementations, and both ids already fit this model so I have some confidence. I just need to add the set_bit/clear_bit to the read/write one, and use
sync_clear_bitto the descriptor-based one (which I suspect will actually get a little cleaner).
Quoted 5 lines
Quoted 1 line
So I think this constraint is a reasonable thing to add anyway.
Some hardware (tulip IIRC, but long time ago) allows linked list based descriptors. If a virtio implementation takes a similar approach, it may not have an array of descriptors.
Sure, but the mapping becomes non-trivial only if you have no ceiling on the number in flight at any time. OTOH, it's a very nice property for driver authors. I'll send the diffs once debugging is done...
Quoted 1 line
Networking hardware generally services descriptors in a FIFO manner.
Well, ethernet guarantees order. Not sure about others tho...
Quoted 4 lines
virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
I think your point is that the completion bitmap (or indeed, the current approach) does not maintain order? Hmm, this is more convincing to me than cache arguments, since some devices might want ordering and want more than a single io in flight.
I shall ponder this more deeply...
Thanks!
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 17 lines · Avi Kivity
Quoted 16 lines · Rusty Russell
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Rusty Russell
Hmm... Perhaps I should move the used arrays into the "struct
virtio_device" and guarantee that the id (returned by add_*buf) is an index into that. Then we can trivially add a corresponding bit array.That may force the virtio backend to do things it doesn't want to.
Well, I have two implementations, and both ids already fit this model so I have some confidence. I just need to add the set_bit/clear_bit to the read/write one, and use
sync_clear_bitto the descriptor-based one (which I suspect will actually get a little cleaner).
Quoted 5 lines
Quoted 1 line
So I think this constraint is a reasonable thing to add anyway.
Some hardware (tulip IIRC, but long time ago) allows linked list based descriptors. If a virtio implementation takes a similar approach, it may not have an array of descriptors.
Sure, but the mapping becomes non-trivial only if you have no ceiling on the number in flight at any time. OTOH, it's a very nice property for driver authors. I'll send the diffs once debugging is done...
Quoted 1 line
Networking hardware generally services descriptors in a FIFO manner.
Well, ethernet guarantees order. Not sure about others tho...
Quoted 4 lines
virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
I think your point is that the completion bitmap (or indeed, the current approach) does not maintain order? Hmm, this is more convincing to me than cache arguments, since some devices might want ordering and want more than a single io in flight.
I shall ponder this more deeply...
Thanks!
Rusty.
Quoted 7 lines · Rusty Russell
Quoted 3 lines
Networking hardware generally services descriptors in a FIFO manner.
Well, ethernet guarantees order. Not sure about others tho...
OT: Does that hold for bonded interfaces too?
Quoted 11 lines
Quoted 5 lines
virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
I think your point is that the completion bitmap (or indeed, the current approach) does not maintain order? Hmm, this is more convincing to me than cache arguments, since some devices might want ordering and want more than a single io in flight.
Well, it wasn't really; sorry for being unclear. My point was that virtio interfaces will not match hardware exactly.
My objection is to "scan all slots, occupied or not, for completion". I think virtio should present completed descriptors without the need for scanning, even if it means looking a bit different from a typical ethernet driver.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Quoted 7 lines · Rusty Russell
Quoted 3 lines
Networking hardware generally services descriptors in a FIFO manner.
Well, ethernet guarantees order. Not sure about others tho...
OT: Does that hold for bonded interfaces too?
Quoted 8 lines
Quoted 2 lines
virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
I think your point is that the completion bitmap (or indeed, the current approach) does not maintain order? Hmm, this is more convincing to me than cache arguments, since some devices might want ordering and want more than a single io in flight.
Well, it wasn't really; sorry for being unclear. My point was that virtio interfaces will not match hardware exactly.
My objection is to "scan all slots, occupied or not, for completion". I think virtio should present completed descriptors without the need for scanning, even if it means looking a bit different from a typical ethernet driver.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 8 lines · Avi Kivity
Quoted 5 lines · Rusty Russell
Quoted 3 lines
Networking hardware generally services descriptors in a FIFO manner.
Well, ethernet guarantees order. Not sure about others tho...
OT: Does that hold for bonded interfaces too?
Sorry, I don't know. The ethernet standard promises in-order, but I'd imagine you'd need to prepend a header to get this to work with bonding in general...
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
I think your point is that the completion bitmap (or indeed, the current approach) does not maintain order? Hmm, this is more convincing to me than cache arguments, since some devices might want ordering and want more than a single io in flight.
Quoted 7 lines
Well, it wasn't really; sorry for being unclear. My point was that virtio interfaces will not match hardware exactly.
My objection is to "scan all slots, occupied or not, for completion". I think virtio should present completed descriptors without the need for scanning, even if it means looking a bit different from a typical ethernet driver.
It's not just the ethernet driver, it's virtio drivers in general. One reason the Xen drivers are viewed with such horror is that they look nothing like normal Linux drivers.
But that just means that the linked list(s) should be in the "struct virtio_device" rather than an arg to the "interrupt" handler. I think, given that the network code doesn't want to process used outbufs in the interrupt handler, this is the Right Thing anyway.
I'll send here once it's done...
Thanks,
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 8 lines · Avi Kivity
Quoted 5 lines · Rusty Russell
Quoted 3 lines
Networking hardware generally services descriptors in a FIFO manner.
Well, ethernet guarantees order. Not sure about others tho...
OT: Does that hold for bonded interfaces too?
Sorry, I don't know. The ethernet standard promises in-order, but I'd imagine you'd need to prepend a header to get this to work with bonding in general...
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
virtio may not (for example, it may offload copies of larger packets to a dma engine such as I/OAT, resulting in a delay, but copy smaller packets immediately). that means that there will be some mismatch between virtio drivers and real hardware drivers.
I think your point is that the completion bitmap (or indeed, the current approach) does not maintain order? Hmm, this is more convincing to me than cache arguments, since some devices might want ordering and want more than a single io in flight.
Quoted 7 lines
Well, it wasn't really; sorry for being unclear. My point was that virtio interfaces will not match hardware exactly.
My objection is to "scan all slots, occupied or not, for completion". I think virtio should present completed descriptors without the need for scanning, even if it means looking a bit different from a typical ethernet driver.
It's not just the ethernet driver, it's virtio drivers in general. One reason the Xen drivers are viewed with such horror is that they look nothing like normal Linux drivers.
But that just means that the linked list(s) should be in the "struct virtio_device" rather than an arg to the "interrupt" handler. I think, given that the network code doesn't want to process used outbufs in the interrupt handler, this is the Right Thing anyway.
I'll send here once it's done...
Thanks,
Rusty.
Quoted 2 lines · Avi Kivity
OT: Does that hold for bonded interfaces too?
Yes. By default traffic to the same destination MAC always stick to one interface. You could select a layer3+4 hashing policy but even that guarantees a single flow will stick to one physical interface unless it contains IP fragments which should never happen for TCP.
Cheers,
Signature · 10 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/Quoted 2 lines · Avi Kivity
OT: Does that hold for bonded interfaces too?
Yes. By default traffic to the same destination MAC always stick to one interface. You could select a layer3+4 hashing policy but even that guarantees a single flow will stick to one physical interface unless it contains IP fragments which should never happen for TCP.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtRe: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 2 lines · Rusty Russell
Is the noop scheduler significantly worse than hooking directly into
q->make_request_fn?
The noop scheduler does do request merging, and has the same device plug latency as other schedulers.
so long,
Carsten
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Rusty RussellQuoted 2 lines · Rusty Russell
Is the noop scheduler significantly worse than hooking directly into
q->make_request_fn?
The noop scheduler does do request merging, and has the same device plug latency as other schedulers.
so long,
Carsten
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 9 lines · Jens Axboe
Quoted 7 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
Quoted 3 lines
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
so long,
Carsten
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Jens AxboeQuoted 7 lines · Jens Axboe
Quoted 2 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period. If we have this method both in host and guest, we have twice the penalty with no added benefit.
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
so long,
Carsten
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 10 lines · Carsten Otte
Quoted 9 lines · Jens Axboe
Quoted 7 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
Quoted 5 lines
Quoted 3 lines
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
Right. We probably should make it sysfs configurable in any case, right now it's a (somewhat) policy decision in the kernel with the delay and unplug depth.
Signature · 8 lines
Jens Axboe ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Carsten OtteQuoted 10 lines · Carsten Otte
Quoted 9 lines · Jens Axboe
Quoted 7 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.
Quoted 5 lines
Quoted 3 lines
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
Right. We probably should make it sysfs configurable in any case, right now it's a (somewhat) policy decision in the kernel with the delay and unplug depth.
Signature · 1 line
Jens Axboe
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 14 lines · Jens Axboe
Quoted 13 lines · Carsten Otte
Quoted 12 lines · Jens Axboe
Quoted 7 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
Quoted 6 lines
Quoted 2 lines
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
Right. We probably should make it sysfs configurable in any case, right now it's a (somewhat) policy decision in the kernel with the delay and unplug depth.
The danger is that it's just another knob noone knows how to use. Perhaps simply setting it to 0 for the noop scheduler will cover all known cases?
Cheers,
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Jens AxboeQuoted 14 lines · Jens Axboe
Quoted 13 lines · Carsten Otte
Quoted 12 lines · Jens Axboe
Quoted 7 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
Quoted 6 lines
Quoted 2 lines
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
Right. We probably should make it sysfs configurable in any case, right now it's a (somewhat) policy decision in the kernel with the delay and unplug depth.
The danger is that it's just another knob noone knows how to use. Perhaps simply setting it to 0 for the noop scheduler will cover all known cases?
Cheers,
Rusty.
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 18 lines · Rusty Russell
Quoted 17 lines · Jens Axboe
Quoted 15 lines · Carsten Otte
Quoted 9 lines · Jens Axboe
Quoted 7 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.Quoted 3 lines
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
Quoted 7 lines
Quoted 3 lines
Right. We probably should make it sysfs configurable in any case, right now it's a (somewhat) policy decision in the kernel with the delay and unplug depth.
The danger is that it's just another knob noone knows how to use. Perhaps simply setting it to 0 for the noop scheduler will cover all known cases?
Most people should not fiddle with it, the defaults are there for good reason. I can provide a blk_queue_unplug_thresholds(q, depth, delay) helper that you could use for the virtualized drivers, perhaps that would be better for that use?
Signature · 8 lines
Jens Axboe ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Rusty RussellQuoted 18 lines · Rusty Russell
Quoted 17 lines · Jens Axboe
Quoted 15 lines · Carsten Otte
Quoted 9 lines · Jens Axboe
Quoted 7 lines · Carsten Otte
With regard to compute power needed, almost none. The penalty is latency, not overhead: A small request may sit on the request queue to wait for other work to arrive until the queue gets unplugged. This penality is compensated by the benefit of a good chance that more requests will be merged during this time period.
If we have this method both in host and guest, we have twice the penalty with no added benefit.Quoted 3 lines
I don't buy that argument. We can easily expose the unplug delay, so you can kill it at what ever level you want. Or you could just do it in the driver right now, but that is a bit hackish.
That would be preferable if the device driver can chose the unplug delay, or even better it could be (guest)sysfs tuneable.
Quoted 7 lines
Quoted 3 lines
Right. We probably should make it sysfs configurable in any case, right now it's a (somewhat) policy decision in the kernel with the delay and unplug depth.
The danger is that it's just another knob noone knows how to use. Perhaps simply setting it to 0 for the noop scheduler will cover all known cases?
Most people should not fiddle with it, the defaults are there for good reason. I can provide a blk_queue_unplug_thresholds(q, depth, delay) helper that you could use for the virtualized drivers, perhaps that would be better for that use?
Signature · 1 line
Jens Axboe
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 4 lines · Jens Axboe
Most people should not fiddle with it, the defaults are there for good reason. I can provide a
blk_queue_unplug_thresholds(q, depth, delay)helper that you could use for the virtualized drivers, perhaps that would be better for that use?
Yea, we should'nt change the defaults without a good reason. That would change things for all device drivers.
This interface provides all functionality we need. I think we need a knob in /sys/block/mydevice/queue/ in addition to that.
so long,
Carsten
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Jens AxboeQuoted 4 lines · Jens Axboe
Most people should not fiddle with it, the defaults are there for good reason. I can provide a
blk_queue_unplug_thresholds(q, depth, delay)helper that you could use for the virtualized drivers, perhaps that would be better for that use?
Yea, we should'nt change the defaults without a good reason. That would change things for all device drivers. This interface provides all functionality we need. I think we need a knob in /sys/block/mydevice/queue/ in addition to that.
so long,
Carsten
Re: [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to a message not in the archiveQuoted 9 lines · Carsten Otte
Quoted 4 lines · Jens Axboe
Most people should not fiddle with it, the defaults are there for good reason. I can provide a
blk_queue_unplug_thresholds(q, depth, delay)helper that you could use for the virtualized drivers, perhaps that would be better for that use?Yea, we should'nt change the defaults without a good reason. That would change things for all device drivers.
This interface provides all functionality we need. I think we need a knob in/sys/block/mydevice/queue/in addition to that.
Something like this, totally untested (but trivial, so it should work :-)
block/elevator.c +1 -1
@@ -638,7 +638,7 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)int nrq = q->rq.count[READ ] + q->rq.count[WRITE ] - q->in_flight; -if (nrq >= q->unplug_thresh) +if (nrq >= q->unplug_thresh || !q->unplug_delay)__generic_unplug_device (q); } }
block/ll_rw_blk.c +88 -1
119 lines not on this page · raw message
include/linux/blkdev.h +1 -0
@@ -747,6 +747,7 @@ extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);extern void blk_queue_merge_bvec (request_queue_t *,merge_bvec_fn *);extern void blk_queue_dma_alignment (request_queue_t *,int );extern void blk_queue_softirq_done (request_queue_t *,softirq_done_fn *); +extern void blk_queue_unplug_threshold (request_queue_t *q,unsigned int ,unsigned long );extern struct backing_dev_info *blk_get_backing_dev_info (struct block_device *bdev);extern int blk_queue_ordered (request_queue_t *,unsigned ,prepare_flush_fn *);extern void blk_queue_issue_flush_fn (request_queue_t *,issue_flush_fn *);
Signature · 8 lines
Jens Axboe ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Re: [kvm-devel] [PATCH RFC 3/3] virtio infrastructure: example block driver
In reply to Carsten OtteQuoted 9 lines · Carsten Otte
Quoted 4 lines · Jens Axboe
Most people should not fiddle with it, the defaults are there for good reason. I can provide a
blk_queue_unplug_thresholds(q, depth, delay)helper that you could use for the virtualized drivers, perhaps that would be better for that use?Yea, we should'nt change the defaults without a good reason. That would change things for all device drivers.
This interface provides all functionality we need. I think we need a knob in/sys/block/mydevice/queue/in addition to that.
Something like this, totally untested (but trivial, so it should work :-)
block/elevator.c +1 -1
@@ -638,7 +638,7 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)int nrq = q->rq.count[READ ] + q->rq.count[WRITE ] - q->in_flight; -if (nrq >= q->unplug_thresh) +if (nrq >= q->unplug_thresh || !q->unplug_delay)__generic_unplug_device (q); } }
block/ll_rw_blk.c +88 -1
119 lines not on this page · raw message
include/linux/blkdev.h +1 -0
@@ -747,6 +747,7 @@ extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);extern void blk_queue_merge_bvec (request_queue_t *,merge_bvec_fn *);extern void blk_queue_dma_alignment (request_queue_t *,int );extern void blk_queue_softirq_done (request_queue_t *,softirq_done_fn *); +extern void blk_queue_unplug_threshold (request_queue_t *q,unsigned int ,unsigned long );extern struct backing_dev_info *blk_get_backing_dev_info (struct block_device *bdev);extern int blk_queue_ordered (request_queue_t *,unsigned ,prepare_flush_fn *);extern void blk_queue_issue_flush_fn (request_queue_t *,issue_flush_fn *);
Signature · 1 line
Jens Axboe
Quoted 19 lines
-----Original Message-----
From: Rusty Russell [mailto:rusty-8n+1lVoiYb80n/[email protected]]
Sent: Saturday, June 02, 2007 3:13 AM
To: Santos, Jose Renato G
Cc: kvm-devel; Xen Mailing List; virtualization; Jimi
Xenidis; Stephen Rothwell; jmk-zzFmDc4TPjtKvsKVC3L/[email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori;
Martin Schwidefsky
Subject: RE: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureHi Renato!
This is a very good question. For currently-existing
and working devices it just seems like another layer of indirection, and not much code saving.
Quoted 8 lines
There are several reasons for having a common layer.
The obvious is to reduce the amount of code, but that's the least important. Slightly more important is that noone wants to maintain and tune 5 different virtual net drivers, 5 different virtual block drivers, etc. In fact, the kernel community will start to rebel at some point, especially if they want different optimization hooks deeper into the kernel.
Rusty,
Thanks for clarifying your thinking. This helped me understand your goals better.
I agree it would be nice to reduce the number of drivers as it improves mantainability. However I am not convinced that adding an IO virtualization layer will remove the need for having different drivers for different virtualization technologies.
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
I confess I don't know well any of the other virtualization technologies besides Xen. Maybe for some of them there is enough similarities that you could benefit from a common virtualization layer, but I just can't see it yet.
Regards
Renato
Quoted 21 lines
We expect to see new device types (entropy device,
anyone?), and so the
5 different drivers becomes the 5 x N different drivers. Eventually we may come up with common bus and probing which everyone loves, but until then we can at least make it simple for each virtualization technology to implement the new XYZZY device.Finally, virtual I/O techniques are *moving*. KVM
doesn't really have one, XenSource are discussing more changes to theirs (at least for
networking) and lguest is still looking for an efficient one.
No doubt the others would love to use clean and optimal
Linux drivers, too (UML, S/390, Power, VMWare?).When Linux doesn't provide a model of what it expects
from virtual devices, one end of the design process is
untethered: we've already seen some fairly random and gratuitously different results. If we can provide a simple interface which we like it encourages new implementations to produce Linux-friendly interfaces.
Quoted 6 lines
Of course, the new interface must not suck.
I hope that clarifies my thinking?
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 19 lines
-----Original Message-----
From: Rusty Russell [mailto:[email protected]]
Sent: Saturday, June 02, 2007 3:13 AM
To: Santos, Jose Renato G
Cc: kvm-devel; Xen Mailing List; virtualization; Jimi Xenidis; Stephen Rothwell; [email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: RE: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureHi Renato!
This is a very good question. For currently-existing
and working devices it just seems like another layer of indirection, and not much code saving.
Quoted 8 lines
There are several reasons for having a common layer.
The obvious is to reduce the amount of code, but that's the least important. Slightly more important is that noone wants to maintain and tune 5 different virtual net drivers, 5 different virtual block drivers, etc. In fact, the kernel community will start to rebel at some point, especially if they want different optimization hooks deeper into the kernel.
Rusty,
Thanks for clarifying your thinking. This helped me understand your goals better.
I agree it would be nice to reduce the number of drivers as it improves mantainability. However I am not convinced that adding an IO virtualization layer will remove the need for having different drivers for different virtualization technologies.
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
I confess I don't know well any of the other virtualization technologies besides Xen. Maybe for some of them there is enough similarities that you could benefit from a common virtualization layer, but I just can't see it yet.
Regards
Renato
Quoted 27 lines
We expect to see new device types (entropy device,
anyone?), and so the
5 different drivers becomes the 5 x N different drivers. Eventually we may come up with common bus and probing which everyone loves, but until then we can at least make it simple for each virtualization technology to implement the new XYZZY device.Finally, virtual I/O techniques are *moving*. KVM
doesn't really have one, XenSource are discussing more changes to theirs (at least for
networking) and lguest is still looking for an efficient one.
No doubt the others would love to use clean and optimal
Linux drivers, too (UML, S/390, Power, VMWare?).When Linux doesn't provide a model of what it expects
from virtual devices, one end of the design process is
untethered: we've already seen some fairly random and gratuitously different results. If we can provide a simple interface which we like it encourages new implementations to produce Linux-friendly interfaces.Of course, the new interface must not suck.
I hope that clarifies my thinking?
Rusty.
Quoted 9 lines · Jose Renato G
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
The hope is that the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be achieved and still retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a chance to look at doing any Xen-virtio glue yet, so I'm not really sure how it will work out.
J
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 9 lines · Jose Renato G
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
The hope is that the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be achieved and still retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a chance to look at doing any Xen-virtio glue yet, so I'm not really sure how it will work out.
J
Quoted 8 lines · Jose Renato G
Thanks for clarifying your thinking. This helped me understand your goals better.
I agree it would be nice to reduce the number of drivers as it improves mantainability. However I am not convinced that adding an IO virtualization layer will remove the need for having different drivers for different virtualization technologies.
Quoted 5 lines
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
Hi Renato,
That definitely should be implementable as a virtio layer; it was one
of the design points. I consulted with Herbert Xu early on in the process, and I don't think it would be too painful. The devil, of course, is in the details.
Quoted 3 lines
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
That would be silly, yes.
Quoted 4 lines
I confess I don't know well any of the other virtualization technologies besides Xen. Maybe for some of them there is enough similarities that you could benefit from a common virtualization layer, but I just can't see it yet.
Well, S/390, PowerPC and UML both have virtual I/O already in the kernel tree, as does Xen. I believe VMWare have out-of-tree drivers. KVM is in tree, but currently doesn't have paravirtualized drivers. lguest is sitting in the -mm tree for merging in 2.6.23 with its own drivers.
None of these drivers is optimal. The Xen ones are closest, and they're very Xen-specific and quite complex. This is good, and as it gives virtio drivers a target to beat 8)
Cheers,
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 8 lines · Jose Renato G
Thanks for clarifying your thinking. This helped me understand your goals better.
I agree it would be nice to reduce the number of drivers as it improves mantainability. However I am not convinced that adding an IO virtualization layer will remove the need for having different drivers for different virtualization technologies.
Quoted 5 lines
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
Hi Renato,
That definitely should be implementable as a virtio layer; it was one
of the design points. I consulted with Herbert Xu early on in the process, and I don't think it would be too painful. The devil, of course, is in the details.
Quoted 3 lines
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
That would be silly, yes.
Quoted 4 lines
I confess I don't know well any of the other virtualization technologies besides Xen. Maybe for some of them there is enough similarities that you could benefit from a common virtualization layer, but I just can't see it yet.
Well, S/390, PowerPC and UML both have virtual I/O already in the kernel tree, as does Xen. I believe VMWare have out-of-tree drivers. KVM is in tree, but currently doesn't have paravirtualized drivers. lguest is sitting in the -mm tree for merging in 2.6.23 with its own drivers.
None of these drivers is optimal. The Xen ones are closest, and they're very Xen-specific and quite complex. This is good, and as it gives virtio drivers a target to beat 8)
Cheers,
Rusty.
Quoted 32 lines
-----Original Message-----
From: Jeremy Fitzhardinge [mailto:[email protected]]
Sent: Monday, June 04, 2007 2:20 PM
To: Santos, Jose Renato G
Cc: Rusty Russell; Jimi Xenidis; Stephen Rothwell; Xen
Mailing List; jmk-zzFmDc4TPjtKvsKVC3L/[email protected]; Herbert Xu; kvm-devel; virtualization; Christian Borntraeger; Suzanne McIntosh;
Anthony Liguori; Martin Schwidefsky
Subject: Re: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 9 lines · Jose Renato G
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.The hope is that the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be achieved and still retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a chance to look at doing any Xen-virtio glue yet, so I'm not really sure how it will work out.
Quoted 2 lines
J
Ok, if you share some common code this could be beneficial, but in the specific case of Xen networking I believe most of netfront code is Xen specific. I think that a generic "virtual-IO" layer would not be beneficial in this case, but instead it would only add extra complexity to glue the layers.
I don't know if this will be the case for other virtualization technologies, but I think it would be useful to have a better understanding of exactly which code could be shared before proposing something like this to the linux mantainers.
I think it will probably not be accepted upstream if there is no clear evidence of code sharing. And if the sharing is not uniform across all virtualization technologies, we should keep an option of bypassing the virtio layer when it does not help or when it makes code more complex (which I suspect will be the case for Xen networking).
Just my 2 cents,
Regards
Renato
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 32 lines
-----Original Message-----
From: Jeremy Fitzhardinge [mailto:[email protected]]
Sent: Monday, June 04, 2007 2:20 PM
To: Santos, Jose Renato G
Cc: Rusty Russell; Jimi Xenidis; Stephen Rothwell; Xen Mailing List; [email protected]; Herbert Xu; kvm-devel; virtualization; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: Re: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 9 lines · Jose Renato G
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.The hope is that the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be achieved and still retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a chance to look at doing any Xen-virtio glue yet, so I'm not really sure how it will work out.
Quoted 2 lines
J
Ok, if you share some common code this could be beneficial, but in the specific case of Xen networking I believe most of netfront code is Xen specific. I think that a generic "virtual-IO" layer would not be beneficial in this case, but instead it would only add extra complexity to glue the layers.
I don't know if this will be the case for other virtualization technologies, but I think it would be useful to have a better understanding of exactly which code could be shared before proposing something like this to the linux mantainers.
I think it will probably not be accepted upstream if there is no clear evidence of code sharing. And if the sharing is not uniform across all virtualization technologies, we should keep an option of bypassing the virtio layer when it does not help or when it makes code more complex (which I suspect will be the case for Xen networking).
Just my 2 cents,
Regards
Renato
Quoted 10 lines · Jose Renato G
Quoted 10 lines
From: Jeremy Fitzhardinge [mailto:[email protected]] The hope is that the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be achieved and still retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a chance to look at doing any Xen-virtio glue yet, so I'm not really sure how it will work out.
Quoted 8 lines
Quoted 2 lines
J
Ok, if you share some common code this could be beneficial, but in the specific case of Xen networking I believe most of netfront code is Xen specific. I think that a generic "virtual-IO" layer would not be beneficial in this case, but instead it would only add extra complexity to glue the layers.
This is precisely the plan: to code it up and look hard at it. If performance gets hurt, it's a lose. If performance is equal and the code is clearer, it's a win, and this is my goal.
Perhaps you underestimate how much of the Xen netfront driver is actually dealing with things which *any* efficient virtio I/O netdriver will have to wrestle with.
Thanks!
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 10 lines · Jose Renato G
Quoted 10 lines
From: Jeremy Fitzhardinge [mailto:[email protected]] The hope is that the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be achieved and still retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a chance to look at doing any Xen-virtio glue yet, so I'm not really sure how it will work out.
Quoted 8 lines
Quoted 2 lines
J
Ok, if you share some common code this could be beneficial, but in the specific case of Xen networking I believe most of netfront code is Xen specific. I think that a generic "virtual-IO" layer would not be beneficial in this case, but instead it would only add extra complexity to glue the layers.
This is precisely the plan: to code it up and look hard at it. If performance gets hurt, it's a lose. If performance is equal and the code is clearer, it's a win, and this is my goal.
Perhaps you underestimate how much of the Xen netfront driver is actually dealing with things which *any* efficient virtio I/O netdriver will have to wrestle with.
Thanks!
Rusty.
Quoted 27 lines
-----Original Message-----
From: Rusty Russell [mailto:rusty-8n+1lVoiYb80n/[email protected]]
Sent: Monday, June 04, 2007 6:45 PM
To: Santos, Jose Renato G
Cc: kvm-devel; Xen Mailing List; virtualization; Jimi
Xenidis; Stephen Rothwell; jmk-zzFmDc4TPjtKvsKVC3L/[email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori;
Martin Schwidefsky
Subject: RE: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 8 lines · Jose Renato G
Thanks for clarifying your thinking. This helped me understand your goals better.
I agree it would be nice to reduce the number of drivers as it improves mantainability. However I am not convinced that adding an IO virtualization layer will remove the need for having different drivers for different virtualization technologies.Quoted 5 lines
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
Quoted 7 lines
Hi Renato,
That definitely should be implementable as a virtio
layer; it was one of the design points. I consulted with Herbert Xu early on in the process, and I don't think it would be too painful. The devil, of course, is in the details.
Hi Rusty,
Yes. I believe it should be implementable. The question is, does it achieve the desired benefits? Will the code be easier to maintain because it is sharing some generic code with other drivers?
Quoted 18 lines
Quoted 3 lines
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
That would be silly, yes.
Quoted 4 lines
I confess I don't know well any of the other virtualization technologies besides Xen. Maybe for some of them there is enough similarities that you could benefit from a common virtualization layer, but I just can't see it yet.
Well, S/390, PowerPC and UML both have virtual I/O already in the kernel tree, as does Xen. I believe VMWare have out-of-tree drivers. KVM is in tree, but currently doesn't have paravirtualized drivers.
lguest is sitting in the -mm tree for merging in 2.6.23 with its own drivers.
Quoted 4 lines
None of these drivers is optimal. The Xen ones are closest, and they're very Xen-specific and quite complex. This is good, and as it gives virtio drivers a target to beat 8)
Yes. It will be interesting to see how virtio could improve the situation. I hope you are right and we could simplify this complexity.
I apologize if I sounded negative.
Just wanted to have a reality check :)
Regards
Renato
Quoted 4 lines
Cheers,
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 27 lines
-----Original Message-----
From: Rusty Russell [mailto:[email protected]]
Sent: Monday, June 04, 2007 6:45 PM
To: Santos, Jose Renato G
Cc: kvm-devel; Xen Mailing List; virtualization; Jimi Xenidis; Stephen Rothwell; [email protected]; Herbert Xu; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: RE: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 8 lines · Jose Renato G
Thanks for clarifying your thinking. This helped me understand your goals better.
I agree it would be nice to reduce the number of drivers as it improves mantainability. However I am not convinced that adding an IO virtualization layer will remove the need for having different drivers for different virtualization technologies.Quoted 5 lines
It seems that we will still need specific devices drivers for each different virtualization flavor. For example, we will still need to have a specific Xen netfront device that talks to a backend device in dom0, using page grants, and other Xen specific mechanisms.
Quoted 7 lines
Hi Renato,
That definitely should be implementable as a virtio
layer; it was one of the design points. I consulted with Herbert Xu early on in the process, and I don't think it would be too painful. The devil, of course, is in the details.
Hi Rusty,
Yes. I believe it should be implementable. The question is, does it achieve the desired benefits? Will the code be easier to maintain because it is sharing some generic code with other drivers?
Quoted 18 lines
Quoted 3 lines
It looks like will still need to maintain all the virtual device drivers and in addition we will now have to maintain another virtualization layer.
That would be silly, yes.
Quoted 4 lines
I confess I don't know well any of the other virtualization technologies besides Xen. Maybe for some of them there is enough similarities that you could benefit from a common virtualization layer, but I just can't see it yet.
Well, S/390, PowerPC and UML both have virtual I/O already in the kernel tree, as does Xen. I believe VMWare have out-of-tree drivers. KVM is in tree, but currently doesn't have paravirtualized drivers.
lguest is sitting in the -mm tree for merging in 2.6.23 with its own drivers.
Quoted 4 lines
None of these drivers is optimal. The Xen ones are closest, and they're very Xen-specific and quite complex. This is good, and as it gives virtio drivers a target to beat 8)
Yes. It will be interesting to see how virtio could improve the situation. I hope you are right and we could simplify this complexity.
I apologize if I sounded negative.
Just wanted to have a reality check :)
Regards
Renato
Quoted 4 lines
Cheers,
Rusty.
Quoted 36 lines
-----Original Message-----
From: Rusty Russell [mailto:[email protected]]
Sent: Monday, June 04, 2007 7:27 PM
To: Santos, Jose Renato G
Cc: Jeremy Fitzhardinge; Jimi Xenidis; Stephen Rothwell; Xen Mailing List; [email protected]; Herbert Xu; kvm-devel; virtualization; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: RE: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 1 line · Jose Renato G
Quoted 1 line
From: Jeremy Fitzhardinge [mailto:[email protected]] The
hope is that
Quoted 3 lines
Quoted 3 lines
the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be
achieved and still
Quoted 2 lines
Quoted 2 lines
retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a
chance to look
Quoted 1 line
Quoted 1 line
at doing any Xen-virtio glue yet, so I'm not really sure
how it will
Quoted 10 lines
Quoted 4 lines
work out.
J
Ok, if you share some common code this could be beneficial, but in the specific case of Xen networking I believe most of netfront code is Xen specific. I think that a generic "virtual-IO" layer would not be beneficial in this case, but instead it would only add extra complexity to glue the layers.
Quoted 4 lines
This is precisely the plan: to code it up and look hard at it. If performance gets hurt, it's a lose. If performance is equal and the code is clearer, it's a win, and this is my goal.
I was not really thinking about performance. I was questioning how much code could realy be shared? I expected that just a small fraction of the code could be shared. So even if performance does not suffer, it would not be providing any benefit, or worse, it could make the code more complex due to interaction with an additional layer
Quoted 4 lines
Perhaps you underestimate how much of the Xen netfront driver is actually dealing with things which *any* efficient virtio I/O netdriver will have to wrestle with.
Perhaps, you are right.
I think we will know when you code it up.
Regards
Renato
Quoted 4 lines
Thanks!
Rusty.
Quoted 36 lines
-----Original Message-----
From: Rusty Russell [mailto:[email protected]]
Sent: Monday, June 04, 2007 7:27 PM
To: Santos, Jose Renato G
Cc: Jeremy Fitzhardinge; Jimi Xenidis; Stephen Rothwell; Xen Mailing List; [email protected]; Herbert Xu; kvm-devel; virtualization; Christian Borntraeger; Suzanne McIntosh; Anthony Liguori; Martin Schwidefsky
Subject: RE: [Xen-devel] [PATCH RFC 1/3] virtio infrastructureQuoted 1 line · Jose Renato G
Quoted 1 line
From: Jeremy Fitzhardinge [mailto:[email protected]] The
hope is that
Quoted 3 lines
Quoted 3 lines
the Xen-specific elements of the driver will be restricted to Xen-specific things like grant tables, and the bulk of the driver and its logic can be common. Whether that can be
achieved and still
Quoted 2 lines
Quoted 2 lines
retain the full performance/features of the entirely Xen-specific netfront driver remains to be seen. I haven't had a
chance to look
Quoted 1 line
Quoted 1 line
at doing any Xen-virtio glue yet, so I'm not really sure
how it will
Quoted 10 lines
Quoted 4 lines
work out.
J
Ok, if you share some common code this could be beneficial, but in the specific case of Xen networking I believe most of netfront code is Xen specific. I think that a generic "virtual-IO" layer would not be beneficial in this case, but instead it would only add extra complexity to glue the layers.
Quoted 4 lines
This is precisely the plan: to code it up and look hard at it. If performance gets hurt, it's a lose. If performance is equal and the code is clearer, it's a win, and this is my goal.
I was not really thinking about performance. I was questioning how much code could realy be shared? I expected that just a small fraction of the code could be shared. So even if performance does not suffer, it would not be providing any benefit, or worse, it could make the code more complex due to interaction with an additional layer
Quoted 4 lines
Perhaps you underestimate how much of the Xen netfront driver is actually dealing with things which *any* efficient virtio I/O netdriver will have to wrestle with.
Perhaps, you are right.
I think we will know when you code it up.
Regards
Renato
Quoted 4 lines
Thanks!
Rusty.