From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
To: Avi Kivity <avi@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org, fernando@oss.ntt.co.jp
Subject: Re: [PATCH RFC 2/5] KVM: use a rapper function to calculate the sizes of dirty bitmaps
Date: Mon, 12 Apr 2010 10:53:54 +0900 [thread overview]
Message-ID: <4BC27D32.4020001@oss.ntt.co.jp> (raw)
In-Reply-To: <4BC202E9.6060300@redhat.com>
(2010/04/12 2:12), Avi Kivity wrote:
> On 04/09/2010 12:32 PM, Takuya Yoshikawa wrote:
>> We will use this later in other parts.
>>
>
> s/rapper/wrapper/...
Oh, my poor English, sorry.
>
>>
>> +static inline int kvm_dirty_bitmap_bytes(struct kvm_memory_slot
>> *memslot)
>> +{
>> + return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
>> +}
>> +
>
> 'int' may overflow.
Then, we have to fix a bit more.
In mark_page_dirty(), we pass unsigned long rel_gfn to __set_bit(),
but __set_bit() takes the offset as int.
We have to shift the base before using __set_bit().
I'll send this as a separate bug fix.
>
>> struct kvm_kernel_irq_routing_entry {
>> u32 gsi;
>> u32 type;
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index 9379533..5ab581e 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -645,7 +645,7 @@ skip_lpage:
>>
>> /* Allocate page dirty bitmap if needed */
>> if ((new.flags& KVM_MEM_LOG_DIRTY_PAGES)&& !new.dirty_bitmap) {
>> - unsigned dirty_bytes = ALIGN(npages, BITS_PER_LONG) / 8;
>> + int dirty_bytes = kvm_dirty_bitmap_bytes(&new);
>
> Ah, an existing bug.
>
next prev parent reply other threads:[~2010-04-12 1:50 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 [this message]
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
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=4BC27D32.4020001@oss.ntt.co.jp \
--to=yoshikawa.takuya@oss.ntt.co.jp \
--cc=avi@redhat.com \
--cc=fernando@oss.ntt.co.jp \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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