summaryrefslogtreecommitdiff
path: root/hw/dataplane/Makefile.objs
AgeCommit message (Collapse)AuthorFilesLines
2013-03-04dataplane: remove EventPoll in favor of AioContextPaolo Bonzini1-1/+1
During the review of the dataplane code, the EventPoll API morphed itself (not concidentially) into something very very similar to an AioContext. Thus, it is trivial to convert virtio-blk-dataplane to use AioContext, and a first baby step towards letting dataplane talk directly to the QEMU block layer. The only interesting note is the value-copy of EventNotifiers. At least in my opinion this is part of the EventNotifier API and is even portable to Windows. Of course, in this case you should not close the notifier's underlying file descriptors or handle with event_notifier_cleanup. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-03dataplane: use linux-headers/ for virtio includesStefan Hajnoczi1-3/+1
The hw/dataplane/vring.c code includes linux/virtio_ring.h. Ensure that we use linux-headers/ instead of the system-wide headers, which may be out-of-date on older distros. This resolves the following build error on Debian 6: CC hw/dataplane/vring.o cc1: warnings being treated as errors hw/dataplane/vring.c: In function 'vring_enable_notification': hw/dataplane/vring.c:71: error: implicit declaration of function 'vring_avail_event' hw/dataplane/vring.c:71: error: nested extern declaration of 'vring_avail_event' hw/dataplane/vring.c:71: error: lvalue required as left operand of assignment Note that we now build dataplane/ for each target instead of only once. There is no way around this since linux-headers/ is only available for per-target objects - and it's how virtio, vfio, kvm, and friends are built. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-02dataplane: add virtio-blk data plane codeStefan Hajnoczi1-1/+1
virtio-blk-data-plane is a subset implementation of virtio-blk. It only handles read, write, and flush requests. It does this using a dedicated thread that executes an epoll(2)-based event loop and processes I/O using Linux AIO. This approach performs very well but can be used for raw image files only. The number of IOPS achieved has been reported to be several times higher than the existing virtio-blk implementation. Eventually it should be possible to unify virtio-blk-data-plane with the main body of QEMU code once the block layer and hardware emulation is able to run outside the global mutex. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-02dataplane: add Linux AIO request queueStefan Hajnoczi1-1/+1
The IOQueue has a pool of iocb structs and a function to add new read/write requests. Multiple requests can be added before calling the submit function to actually tell the host kernel to begin I/O. This allows callers to batch requests and submit them in one go. The actual I/O is performed using Linux AIO. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-02dataplane: add event loopStefan Hajnoczi1-1/+1
Outside the safety of the global mutex we need to poll on file descriptors. I found epoll(2) is a convenient way to do that, although other options could replace this module in the future (such as an AioContext-based loop or glib's GMainLoop). One important feature of this small event loop implementation is that the loop can be terminated in a thread-safe way. This allows QEMU to stop the data plane thread cleanly. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-02dataplane: add virtqueue vring codeStefan Hajnoczi1-1/+1
The virtio-blk-data-plane cannot access memory using the usual QEMU functions since it executes outside the global mutex and the memory APIs are this time are not thread-safe. This patch introduces a virtqueue module based on the kernel's vhost vring code. The trick is that we map guest memory ahead of time and access it cheaply outside the global mutex. Once the hardware emulation code can execute outside the global mutex it will be possible to drop this code. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-02dataplane: add host memory mapping codeStefan Hajnoczi1-0/+3
The data plane thread needs to map guest physical addresses to host pointers. Normally this is done with cpu_physical_memory_map() but the function assumes the global mutex is held. The data plane thread does not touch the global mutex and therefore needs a thread-safe memory mapping mechanism. Hostmem registers a MemoryListener similar to how vhost collects and pushes memory region information into the kernel. There is a fine-grained lock on the regions list which is held during lookup and when installing a new regions list. When the physical memory map changes the MemoryListener callbacks are invoked. They build up a new list of memory regions which is finally installed when the list has been completed. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>