From: Avi Kivity <avi@redhat.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org, fernando@oss.ntt.co.jp
Subject: Re: [PATCH RFC 5/5] KVM: This is the main part of the "moving dirty bitmaps to user space"
Date: Sun, 11 Apr 2010 20:21:31 +0300 [thread overview]
Message-ID: <4BC2051B.9090101@redhat.com> (raw)
In-Reply-To: <20100409183808.b72fc9a3.yoshikawa.takuya@oss.ntt.co.jp>
On 04/09/2010 12:38 PM, Takuya Yoshikawa wrote:
> By this patch, bitmap allocation is replaced with do_mmap() and
> bitmap manipulation is replaced with *_user() functions.
>
> Note that this does not change the APIs between kernel and user space.
> To get more advantage from this hack, we need to add a new interface
> for triggering the bitmap swith and getting the bitmap addresses: the
> addresses is in user space and we can export them to qemu.
>
>
I would like to merge the new API together with the patchset, since
without it, the improvement is insufficient.
> TODO:
> 1. We want to use copy_in_user() for 32bit case too.
>
Definitely. Why doesn't it work now?
> Note that this is only for the compatibility issue: in the future,
> we hope, qemu will not need to use this ioctl.
> 2. We have to implement test_bit_user() to avoid extra set_bit.
>
This was important in the days of shadow paging. I'm not so sure about
it with nested paging, since we'll typically only fault a page once per
iteration. Since we're very likely to actually write these days, the
extra access is wasteful.
>
> +int kvm_arch_create_dirty_bitmap(struct kvm_memory_slot *memslot)
> +{
> + unsigned long user_addr1;
> + unsigned long user_addr2;
> + int dirty_bytes = kvm_dirty_bitmap_bytes(memslot);
> +
> + down_write(¤t->mm->mmap_sem);
> + user_addr1 = do_mmap(NULL, 0, dirty_bytes,
> + PROT_READ | PROT_WRITE,
> + MAP_PRIVATE | MAP_ANONYMOUS, 0);
> + if (IS_ERR((void *)user_addr1)) {
> + up_write(¤t->mm->mmap_sem);
> + return PTR_ERR((void *)user_addr1);
> + }
> + user_addr2 = do_mmap(NULL, 0, dirty_bytes,
> + PROT_READ | PROT_WRITE,
> + MAP_PRIVATE | MAP_ANONYMOUS, 0);
> + if (IS_ERR((void *)user_addr2)) {
> + do_munmap(current->mm, user_addr1, dirty_bytes);
> + up_write(¤t->mm->mmap_sem);
> + return PTR_ERR((void *)user_addr2);
> + }
> + up_write(¤t->mm->mmap_sem);
>
I think a single do_mmap() call for both bitmaps is simpler in terms of
error handling.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
next prev parent reply other threads:[~2010-04-11 17:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-09 9:27 [PATCH RFC 0/5] KVM: Moving dirty bitmaps to userspace: double buffering approach Takuya Yoshikawa
2010-04-09 9:30 ` [PATCH RFC 1/5] KVM: introduce a set_bit function for bitmaps in user space Takuya Yoshikawa
2010-04-11 17:08 ` Avi Kivity
2010-04-12 1:29 ` Takuya Yoshikawa
2010-04-12 9:12 ` Avi Kivity
2010-04-21 4:56 ` Fernando Luis Vázquez Cao
2010-04-21 8:09 ` Avi Kivity
2010-04-09 9:32 ` [PATCH RFC 2/5] KVM: use a rapper function to calculate the sizes of dirty bitmaps Takuya Yoshikawa
2010-04-11 17:12 ` Avi Kivity
2010-04-12 1:53 ` Takuya Yoshikawa
2010-04-09 9:34 ` [PATCH RFC 3/5] KVM: Use rapper functions to create and destroy " Takuya Yoshikawa
2010-04-11 17:13 ` Avi Kivity
2010-04-12 2:07 ` Takuya Yoshikawa
2010-04-12 9:13 ` Avi Kivity
2010-04-09 9:35 ` [PATCH RFC 4/5] KVM: add new members to the memory slot for double buffering of bitmaps Takuya Yoshikawa
2010-04-11 17:15 ` Avi Kivity
2010-04-12 2:15 ` Takuya Yoshikawa
2010-04-12 9:19 ` Avi Kivity
2010-04-12 9:30 ` Takuya Yoshikawa
2010-04-09 9:38 ` [PATCH RFC 5/5] KVM: This is the main part of the "moving dirty bitmaps to user space" Takuya Yoshikawa
2010-04-11 17:21 ` Avi Kivity [this message]
2010-04-12 2:29 ` Takuya Yoshikawa
2010-04-12 9:22 ` Avi Kivity
2010-04-12 20:55 ` Fernando Luis Vazquez Cao
2010-04-12 21:00 ` Avi Kivity
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=4BC2051B.9090101@redhat.com \
--to=avi@redhat.com \
--cc=fernando@oss.ntt.co.jp \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/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