Statistics
| Branch: | Revision:

root / hw / vhost.c @ 7830cf78

History | View | Annotate | Download (31.5 kB)

# Date Author Comment
6b37a23d 02/26/2013 11:59 pm Michael S. Tsirkin

vhost: memory sync fixes

This fixes two bugs related to memory sync during
migration:
- ram address calculation was missing the chunk
address, so the wrong page was dirtied
- one after last was used instead of the
end address of a region, which might overflow to 0...

a9f98bb5 02/01/2013 07:03 pm Jason Wang

vhost: multiqueue support

This patch lets vhost support multiqueue. The idea is simple, just launching
multiple threads of vhost and let each of vhost thread processing a subset of
the virtqueues of the device. After this change each emulated device can have...

6528499f 01/30/2013 12:14 pm Markus Armbruster

g_malloc(0) and g_malloc0(0) return NULL; simplify

Once upon a time, it was decided that qemu_malloc(0) should abort.
Switching to glib retired that bright idea. Some code that was added
to cope with it (e.g. in commits 702ef63, b76b6e9) is still around....

24f4fe34 01/07/2013 07:42 pm Michael S. Tsirkin

vhost: set started flag while start is in progress

This makes it possible to use started flag for sanity checking
of callbacks that happen during start/stop.

Signed-off-by: Michael S. Tsirkin <>

f56a1247 01/07/2013 07:42 pm Michael S. Tsirkin

vhost: backend masking support

Support backend guest notifier masking in vhost-net:
create eventfd at device init, when masked,
make vhost use that as eventfd instead of
sending an interrupt.

Signed-off-by: Michael S. Tsirkin <>

2d620f59 01/07/2013 07:42 pm Michael S. Tsirkin

virtio: don't waste irqfds on control vqs

Pass nvqs to set_guest_notifiers. This makes it possible to
save on irqfds by not allocating one for the control vq
for virtio-net.

Signed-off-by: Michael S. Tsirkin <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

022c62cb 12/19/2012 09:31 am Paolo Bonzini

exec: move include files to include/exec/

Signed-off-by: Paolo Bonzini <>

a8170e5e 10/23/2012 04:58 pm Avi Kivity

Rename target_phys_addr_t to hwaddr

target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
reserved) and its purpose doesn't match the name (most target_phys_addr_t
addresses are not target specific). Replace it with a finger-friendly,...

f6790af6 10/22/2012 03:50 pm Avi Kivity

memory: use AddressSpace for MemoryListener filtering

Using the AddressSpace type reduces confusion, as you can't accidentally
supply the MemoryRegion you're interested in.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>

0fada674 10/15/2012 12:43 pm Avi Kivity

vhost: use MemoryListener filtering to only monitor RAM address space

Instead of checking manually, let the listener filter for us. This prepares
us for DMA address spaces.

Signed-off-by: Avi Kivity <>

1241ed94 09/07/2012 09:15 am Stefan Hajnoczi

vhost: Pass device path to vhost_dev_init()

The path to /dev/vhost-net is currently hardcoded in vhost_dev_init().
This needs to be changed so that /dev/vhost-scsi can be used. Pass in
the device path instead of hardcoding it.

Signed-off-by: Stefan Hajnoczi <>...

753d5e14 07/12/2012 02:08 pm Paolo Bonzini

memory: pass EventNotifier, not eventfd

Under Win32, EventNotifiers will not have event_notifier_get_fd, so we
cannot call it in common code such as hw/virtio-pci.c. Pass a pointer to
the notifier, and only retrieve the file descriptor in kvm-specific code....

e314672a 04/11/2012 01:19 pm Alex Williamson

vhost: Fix size of dirty log sync on resize

When the vhost log is resized, we want to sync up to
the size of the old log. With that end address in place,
ignore regions that start after then end rather than
hitting assert.

This also addresses the following crash report:...

fbbaf9ae 04/11/2012 01:19 pm Michael S. Tsirkin

vhost: readd assert statement

It's clear from the surrounding code that
start < end so it's enough to assert end < log_size.
However, it's better to make this explicit in case
we refactor the code again.

Signed-off-by: Michael S. Tsirkin <>

7376e582 02/29/2012 01:44 pm Avi Kivity

memory: allow MemoryListeners to observe a specific address space

Ignore any regions not belonging to a specified address space.

Signed-off-by: Avi Kivity <>

50c1e149 02/29/2012 01:44 pm Avi Kivity

memory: support stateless memory listeners

Current memory listeners are incremental; that is, they are expected to
maintain their own state, and receive callbacks for changes to that state.

This patch adds support for stateless listeners; these work by receiving...

72e22d2f 02/29/2012 01:44 pm Avi Kivity

memory: switch memory listeners to a QTAILQ

This allows reverse iteration, which in turns allows consistent ordering
among multiple listeners:

l1->add
l2->add
l2->del
l1->del

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

80a1ea37 02/29/2012 01:44 pm Avi Kivity

memory: move ioeventfd ops to MemoryListener

This way the accelerator (kvm) can handle them directly.

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

fd4aa979 01/25/2012 08:32 pm Blue Swirl

memory: change dirty setting APIs to take a size

Instead of each target knowing or guessing the guest page size,
just pass the desired size of dirtied memory area.

Signed-off-by: Blue Swirl <>

6b620ca3 01/13/2012 06:55 pm Paolo Bonzini

prepare for future GPLv2+ relicensing

All files under GPLv2 will get GPLv2+ changes starting tomorrow.
event_notifier.c and exec-obsolete.h were only ever touched by Red Hat
employees and can be relicensed now.

Signed-off-by: Paolo Bonzini <>...

c49450b9 01/09/2012 02:01 pm Avi Kivity

vhost: improve region filtering

vhost memory management doesn't care about non-memory (e.g. PIO) or non-RAM
regions. Adjust the filtering to reflect that, and move it earlier so it
applies to mem_sections too.

Signed-off-by: Avi Kivity <>...

637f7a6a 01/09/2012 01:59 pm Avi Kivity

vhost: fix mem_sections memory corruption

A memset() used to delete an entry in an array did not take into account
the array element's size.

Signed-off-by: Avi Kivity <>
Acked-by: Michael S. Tsirkin <>

d743c382 01/09/2012 01:09 pm Avi Kivity

vhost: fix incorrect userspace address

MemoryListener::region_add() gives us a slice of a MemoryRegion, not a
region. Adjust the userspace address to reflect that.

Signed-off-by: Avi Kivity <>
Acked-by: Michael S. Tsirkin <>

2817b260 01/03/2012 07:19 pm Avi Kivity

vhost: avoid cpu_get_physical_page_desc()

This reaches into the innards of the memory core, which are being
changed. Switch to a memory API version.

Signed-off-by: Avi Kivity <>

04097f7c 12/20/2011 02:14 pm Avi Kivity

vhost: convert to MemoryListener API

Drop the use of cpu_register_phys_memory_client() in favour of the new
MemoryListener API. The new API simplifies the caller, since there is no
need to deal with splitting and merging slots; however this is not exploited...

b0b3db79 08/26/2011 11:25 am Michael S. Tsirkin

vhost-net: cleanup host notifiers at last step

When the vhost notifier is disabled, the userspace handler runs
immediately: virtio_pci_set_host_notifier_internal might
call virtio_queue_notify_vq.
Since the VQ state and the tap backend state aren't
recovered yet, this causes...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

cb4b4fde 08/03/2011 06:00 pm Michael S. Tsirkin

vhost: remove an incorrect assert

The 'to' can go negative when the first region gets removed
(it gets incremented by to 0 immediately afterward), which
makes the assertion fail. Nothing breaks if
to < 0 here so just remove the assert.

Tested-by: David Ahern <>...

c1be973a 07/17/2011 06:47 pm Michael S. Tsirkin

vhost: fix double free on device stop

vhost dev stop failed to clear the log field.
Typically not an issue as dev start overwrites this field,
but if logging gets disabled before the following start,
it doesn't so this causes a double free.

Signed-off-by: Michael S. Tsirkin <>

4e789564 04/07/2011 01:30 pm Michael S. Tsirkin

vhost: optimize out no-change assignment

Cirrus VGA (at least) calls register memory region
with the same values again and again. The
registration in vhost-net slows this a lot,
optimize by checking that the same data is already registered.

Signed-off-by: Michael S. Tsirkin <>

f5a4e64f 04/06/2011 11:12 pm Michael S. Tsirkin

vhost: skip memory which needs dirty logging

vhost doesn't support write logging
(except for migration), anyway.

Signed-off-by: Michael S. Tsirkin <>

0fd542fb 04/06/2011 10:28 pm Michael S. Tsirkin

cpu: add set_memory flag to request dirty logging

Pass the flag to all cpu notifiers, doing
nothing at this point. Will be used by
follow-up patches.

Signed-off-by: Michael S. Tsirkin <>

7b67b18a 03/28/2011 07:34 pm Michael S. Tsirkin

vhost: fix dirty page handling

vhost was passing a physical address to cpu_physical_memory_set_dirty,
which is wrong: we need to translate to ram address first.

Signed-off-by: Michael S. Tsirkin <>

Note: this lead to crashes during migration, so the patch...

e5896b12 02/14/2011 04:39 pm Anthony PERARD

Introduce log_start/log_stop in CPUPhysMemoryClient

In order to use log_start/log_stop with Xen as well in the vga code,
this two operations have been put in CPUPhysMemoryClient.

The two new functions cpu_physical_log_start,cpu_physical_log_stop are
used in hw/vga.c and replace the kvm_log_start/stop. With this, vga does...

5430a28f 02/02/2011 12:50 am mst@redhat.com

vhost: force vhost off for non-MSI guests

When MSI is off, each interrupt needs to be bounced through the io
thread when it's set/cleared, so vhost-net causes more context switches and
higher CPU utilization than userspace virtio which handles networking in...

0c600ce2 12/02/2010 09:13 pm Jason Wang

vhost: Fix address calculation in vhost_dev_sync_region()

We still need advance address even we find there's no dirty pages in
current chunk.

Signed-off-by: Jason Wang <>
Signed-off-by: Michael S. Tsirkin <>

54dd9321 10/07/2010 01:19 pm Michael S. Tsirkin

virtio: change set guest notifier to per-device

When using irqfd with vhost-net to inject interrupts,
a single evenfd might inject multiple interrupts.
Implementing this is much easier with a single
per-device callback to set guest notifiers.

Signed-off-by: Michael S. Tsirkin <>

c8852121 10/07/2010 01:19 pm Michael S. Tsirkin

vhost: error code

fix up errors returned to include errno, not just -1

Signed-off-by: Michael S. Tsirkin <>

bf1b0071 09/18/2010 08:53 am Blue Swirl

Introduce range.h

Extract range functions from pci.h. These will be used by later patches
by non-PCI devices. Adjust current users.

Signed-off-by: Blue Swirl <>

708f2ada 07/31/2010 12:25 am Mike McCormack

Remove unused eventfd.h

This header is not present on my system and causes a build
failure, but is also not used in these files, so remove it.

Signed-off-by: Mike McCormack <>
Signed-off-by: Aurelien Jarno <>

d154e0ba 07/19/2010 02:20 pm Michael S. Tsirkin

vhost: fix miration during device start

We need to know ring layout to allocate log buffer.
So init rings first.

Also fixes a theoretical memory-leak-on-error.

https://bugzilla.redhat.com/show_bug.cgi?id=615228

Signed-off-by: Michael S. Tsirkin <>...

11078ae3 04/14/2010 01:12 am Marcelo Tosatti

vhost.c: include <linux/vhost.h> last

So the userspace headers define KERNEL_STRICT_NAMES and there's no
conflict on type definition for older kernels.

Signed-off-by: Marcelo Tosatti <>
Acked-by: Michael S. Tsirkin <>
Signed-off-by: Aurelien Jarno <>

2b3af999 04/02/2010 01:01 am Stefan Weil

win32: Fix compiler errors from u_int64_t

u_int64_t raises compiler error messages:

CC    libhw32/virtio.o
/qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’:
/qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function)...
d5970055 04/01/2010 09:56 pm Michael S. Tsirkin

vhost: vhost net support

This adds vhost net device support in qemu. Will be tied to tap device
and virtio by following patches. Raw backend is currently missing,
will be worked on/submitted separately.

Signed-off-by: Michael S. Tsirkin <>...