From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH RFC 5/5] KVM: This is the main part of the "moving dirty bitmaps to user space" Date: Mon, 12 Apr 2010 12:22:22 +0300 Message-ID: <4BC2E64E.1090202@redhat.com> References: <20100409182732.857de4db.yoshikawa.takuya@oss.ntt.co.jp> <20100409183808.b72fc9a3.yoshikawa.takuya@oss.ntt.co.jp> <4BC2051B.9090101@redhat.com> <4BC28578.4050102@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org, fernando@oss.ntt.co.jp To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35648 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752133Ab0DLJW3 (ORCPT ); Mon, 12 Apr 2010 05:22:29 -0400 In-Reply-To: <4BC28578.4050102@oss.ntt.co.jp> Sender: kvm-owner@vger.kernel.org List-ID: On 04/12/2010 05:29 AM, Takuya Yoshikawa wrote: > >> >>> TODO: >>> 1. We want to use copy_in_user() for 32bit case too. >> >> Definitely. Why doesn't it work now? > > Sadly we don't have that for 32bit. We have to implement by ourselves. > > I tested two temporary implementations for 32bit: > 1. This version using copy_from_user() and copy_to_user() with > not nice vmalloc(). > 2. Loop with __get_user() and __put_user(). > > The result was 1 is much faster than 2. What about copy_from_user()/copy_to_user() through a 512 byte buffer on the kernel stack? That should give the speed of 1 without the vmalloc() (which will fail on 32 bit if you copy large blocks). > >> >>> 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. > > Nice news for me! So all we need to ask x86(asm-generic) people to > merge are: > > set bit user and copy_in_user 32bit version. They might still want test_bit_user and clear_bit_user for completeness :) -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.