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

Takuya Yoshikawa
2010-04-12T02:12:49Z

(2010/04/12 2:15), Avi Kivity wrote:
> 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.

OK.

>
>
>> #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.

OK, but we have one problem: ia64. I checked all architectures' dirty bitmap
implementations and thought generalizing this work is not so hard except for
ia64. It's already too different from other parts.

#ifdef CONFIG_IA64
unsigned long *dirty_bitmap;
#else
...
#endif

is acceptable?

>