public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: Sasha Levin <levinsasha928@gmail.com>,
	penberg@kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] kvm tools: Use mmap for working with disk image V2
Date: Sun, 10 Apr 2011 11:15:29 +0300	[thread overview]
Message-ID: <4DA16721.9080808@redhat.com> (raw)
In-Reply-To: <5F38320E-5F9C-4681-B5FD-3B9740AB3406@suse.de>

On 04/09/2011 03:20 PM, Alexander Graf wrote:
> On 09.04.2011, at 14:14, Sasha Levin wrote:
>
> >  Attempt to use mmap first for working with a disk image, if the attempt is failed (for example, large image on a 32bit system) fallback to using read/write.
>
> That reminds me of an idea I had quite a while back.
>
> What if we mmap'ed a raw disk image directly into the guest's address space? This could for example be done through a virtio feature addition, keeping the disk accessible through normal virtio plus the mmap'ed part. At least in writeback mode, this should perform pretty well, as we'd save all the userspace exits. It'd basically be almost like vhost-blk :).
>
> Have you thought about trying out to implement such a feature?

A creative idea, but I don't think it will work.  On EPT hosts we don't 
have accessed/dirty bits so you have to incur at least write faults to 
track dirty data and perhaps read faults to gather recency information.  
On non-EPT you have to scan page tables to find out what you have to 
write out, and flush TLBs.  Cache misses, which you'd expect there to be 
quite a few, would stall the vcpu (unless you use asynchronous page 
faults) and contribute less information to the host than virtio-blk 
(location of access but not size).  Write misses are converted to 
read-modify-write operations.

Even in userspace I think mmap() is usually not a performance win.  It's 
advantages are that it's simple to use and has low set-up time, which is 
useful for short lived processes, especially with read-only backing 
files.  For virtual machines it's much worse.

-- 
error compiling committee.c: too many arguments to function


  parent reply	other threads:[~2011-04-10  8:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 12:14 [PATCH] kvm tools: Use mmap for working with disk image V2 Sasha Levin
2011-04-09 12:20 ` Alexander Graf
2011-04-09 12:47   ` Pekka Enberg
2011-04-10  8:15   ` Avi Kivity [this message]
2011-04-10  8:23     ` Gleb Natapov
2011-04-10  8:36       ` Avi Kivity
2011-04-10  8:30     ` Alexander Graf
2011-04-10  8:34       ` Avi Kivity
2011-04-11 18:41 ` Christoph Hellwig
2011-04-11 18:49   ` Pekka Enberg

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=4DA16721.9080808@redhat.com \
    --to=avi@redhat.com \
    --cc=agraf@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=penberg@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox