Re: [PATCH RFC 4/5] KVM: add new members to the memory slot for double buffering of bitmaps

Avi Kivity
2010-04-11T17:15:58Z

On 04/09/2010 12:35 PM, Takuya Yoshikawa wrote:
> Currently, x86 vmalloc()s a dirty bitmap every time when we swich
> to the next dirty bitmap. To avoid this, we use the double buffering
> technique: we also move the bitmaps to userspace, so that extra
> bitmaps will not use the precious kernel resource.
>
> This idea is based on Avi's suggestion.
>
>

Please fold this into the next patch. Introducing new data members
without their users is hard to follow.

> #define KVM_MAX_VCPUS 64
> #define KVM_MEMORY_SLOTS 32
> /* memory slots that does not exposed to userspace */
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index dd6bcf4..07092d6 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -110,7 +110,13 @@ struct kvm_memory_slot {
> unsigned long npages;
> unsigned long flags;
> unsigned long *rmap;
> +#ifndef __KVM_HAVE_USER_DIRTYBITMAP
> unsigned long *dirty_bitmap;
> +#else
> + unsigned long __user *dirty_bitmap;
> + unsigned long __user *dirty_bitmap_old;
> + bool is_dirty;
> +#endif
>

And, if we make set_user_bit() generic, we don't need the ifdefs.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.