From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Blue Swirl <blauwirbel@gmail.com>,
khoa@us.ibm.com, Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Asias He <asias@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 03/11] dataplane: add host memory mapping code
Date: Wed, 5 Dec 2012 13:22:26 +0200 [thread overview]
Message-ID: <20121205112226.GA12619@redhat.com> (raw)
In-Reply-To: <20121205083156.GB5892@stefanha-thinkpad.hitronhub.home>
On Wed, Dec 05, 2012 at 09:31:56AM +0100, Stefan Hajnoczi wrote:
> On Thu, Nov 29, 2012 at 04:36:08PM +0200, Michael S. Tsirkin wrote:
> > On Thu, Nov 29, 2012 at 03:26:56PM +0100, Stefan Hajnoczi wrote:
> > > On Thu, Nov 29, 2012 at 03:54:25PM +0200, Michael S. Tsirkin wrote:
> > > > On Thu, Nov 22, 2012 at 04:16:44PM +0100, Stefan Hajnoczi wrote:
> > > > > 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.
> > > > >
> > > > > Note that this approach is not safe across memory hotplug because mapped
> > > > > pointers may still be in used across memory unplug. However, this is
> > > > > currently a problem for QEMU in general and needs to be addressed in the
> > > > > future.
> > > > >
> > > > > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > > >
> > > > Worth bothering with binary search?
> > > > vhost does a linear search over regions because
> > > > the number of ram regions is very small.
> > >
> > > memory.c does binary search. I did the same but in practice there are
> > > <20 regions for a simple VM. It's probably not worth it but without
> > > performance results this is speculation.
> > >
> > > I think there's no harm in using binary search to start with.
> > >
> > > > > +static void hostmem_listener_append_region(MemoryListener *listener,
> > > > > + MemoryRegionSection *section)
> > > > > +{
> > > > > + Hostmem *hostmem = container_of(listener, Hostmem, listener);
> > > > > +
> > > > > + if (memory_region_is_ram(section->mr)) {
> > > > > + hostmem_append_new_region(hostmem, section);
> > > > > + }
> > > >
> > > > I think you also need to remove VGA region since you
> > > > don't mark these pages as dirty so access there won't work.
> > >
> > > I don't understand. If memory in the VGA region returns true from
> > > memory_region_is_ram(), why would there be a problem?
> >
> > If you change this memory but you don't update the display.
> > Never happens with non buggy guests but we should catch and fail if it does.
>
> Okay, I took a look at the VGA code and I think it makes sense now. We
> have VRAM as a regular RAM region so that writes to it are cheap. To
> avoid scanning or redrawing VRAM on every update we use dirty logging.
>
> Since virtio-blk-data-plane does not mark pages dirty an I/O buffer in
> VRAM would fail to update the display correctly.
>
> I will try to put in a check to omit the VGA region.
There are many ways to do this but I guess the simplest
is to detect dirty logging and skip that region.
> It can be dropped
> in the future when we use the memory API with dirty logging from the
> data plane thread.
>
> Stefan
Or not - there's also the issue that e.g. cirrus doing tricks
with memory mapping at data path. So skipping
that region might help performance.
--
MST
next prev parent reply other threads:[~2012-12-05 11:19 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 15:16 [Qemu-devel] [PATCH v4 00/11] virtio: virtio-blk data plane Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 01/11] raw-posix: add raw_get_aio_fd() for virtio-blk-data-plane Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 02/11] configure: add CONFIG_VIRTIO_BLK_DATA_PLANE Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 03/11] dataplane: add host memory mapping code Stefan Hajnoczi
2012-11-29 12:33 ` Michael S. Tsirkin
2012-11-29 12:45 ` Stefan Hajnoczi
2012-11-29 12:54 ` Michael S. Tsirkin
2012-11-29 12:57 ` Michael S. Tsirkin
2012-12-05 8:13 ` Stefan Hajnoczi
2012-11-29 13:54 ` Michael S. Tsirkin
2012-11-29 14:26 ` Stefan Hajnoczi
2012-11-29 14:36 ` Michael S. Tsirkin
2012-11-29 15:26 ` Paolo Bonzini
2012-12-05 8:31 ` Stefan Hajnoczi
2012-12-05 11:22 ` Michael S. Tsirkin [this message]
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 04/11] dataplane: add virtqueue vring code Stefan Hajnoczi
2012-11-29 12:50 ` Michael S. Tsirkin
2012-11-29 15:17 ` Paolo Bonzini
2012-12-05 12:57 ` Stefan Hajnoczi
2012-11-29 13:48 ` Michael S. Tsirkin
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 05/11] dataplane: add event loop Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 06/11] dataplane: add Linux AIO request queue Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 07/11] iov: add iov_discard() to remove data Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 08/11] test-iov: add iov_discard() testcase Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 09/11] iov: add qemu_iovec_concat_iov() Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 10/11] dataplane: add virtio-blk data plane code Stefan Hajnoczi
2012-11-29 13:41 ` Michael S. Tsirkin
2012-11-29 14:02 ` Michael S. Tsirkin
2012-11-29 15:21 ` Paolo Bonzini
2012-11-29 15:27 ` Michael S. Tsirkin
2012-11-29 15:47 ` Paolo Bonzini
2012-11-30 13:57 ` Stefan Hajnoczi
2012-11-22 15:16 ` [Qemu-devel] [PATCH v4 11/11] virtio-blk: add x-data-plane=on|off performance feature Stefan Hajnoczi
2012-11-29 13:12 ` Michael S. Tsirkin
2012-11-29 14:45 ` Stefan Hajnoczi
2012-11-29 14:55 ` Michael S. Tsirkin
2012-12-04 11:20 ` Michael S. Tsirkin
2012-12-04 14:19 ` Stefan Hajnoczi
2012-11-29 9:18 ` [Qemu-devel] [PATCH v4 00/11] virtio: virtio-blk data plane Stefan Hajnoczi
2012-11-29 12:03 ` Paolo Bonzini
2012-11-29 14:09 ` Michael S. Tsirkin
2012-11-29 14:48 ` Stefan Hajnoczi
2012-11-29 15:19 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121205112226.GA12619@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=asias@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=khoa@us.ibm.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.