qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] migration: skip sending ram pages released b


From: Jitendra Kolhe
Subject: Re: [Qemu-devel] [PATCH v2] migration: skip sending ram pages released by virtio-balloon driver.
Date: Tue, 29 Mar 2016 16:17:15 +0530
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0

On 3/29/2016 3:35 PM, Paolo Bonzini wrote:
> 
> 
> On 28/03/2016 08:59, Michael S. Tsirkin wrote:
>>>> +    qemu_mutex_lock_balloon_bitmap();
>>>>      for (;;) {
>>>>          size_t offset = 0;
>>>>          uint32_t pfn;
>>>>          elem = virtqueue_pop(vq, sizeof(VirtQueueElement));
>>>>          if (!elem) {
>>>> +            qemu_mutex_unlock_balloon_bitmap();
>>>>              return;
>>>>          }
>>>>  
>>>> @@ -242,6 +245,7 @@ static void virtio_balloon_handle_output(VirtIODevice 
>>>> *vdev, VirtQueue *vq)
>>>>              addr = section.offset_within_region;
>>>>              balloon_page(memory_region_get_ram_ptr(section.mr) + addr,
>>>>                           !!(vq == s->dvq));
>>>> +            qemu_balloon_bitmap_update(addr, !!(vq == s->dvq));
>>>>              memory_region_unref(section.mr);
>>>>          }
>>>>  
>> So the assumption here is that offset_within_region equals
>> ram ptr if region is get_system_memory.
>>
>> And I'm not sure that's always right.
>>
>> Paolo?
> 
> Indeed.  It is correct for the main system RAM, but hot-plugged RAM
> would also have a zero-based section.offset_within_region.  You need to
> add memory_region_get_ram_addr(section.mr), just like the call to
> balloon_page adds memory_region_get_ram_ptr(section.mr).
> 
> Paolo
> 

Thanks, that's useful. 
I am only interested in the offset from memory region base. 
Would below guest PA to host offset work, as we do in
address_space_translate_internal()?
(Guest pa - section.offset_within_address_space + 
section.offset_within_region)

- Jitendra



reply via email to

[Prev in Thread] Current Thread [Next in Thread]