All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jitendra Kolhe <jitendra.kolhe@hpe.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: JBottomley@Odin.com, ehabkost@redhat.com,
	crosthwaite.peter@gmail.com, simhan@hpe.com, armbru@redhat.com,
	quintela@redhat.com, qemu-devel@nongnu.org,
	lcapitulino@redhat.com, borntraeger@de.ibm.com,
	mohan_parthasarathy@hpe.com, stefanha@redhat.com,
	amit.shah@redhat.com, den@openvz.org, dgilbert@redhat.com,
	rth@twiddle.net
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	[thread overview]
Message-ID: <56FA5D33.2020802@hpe.com> (raw)
In-Reply-To: <56FA5385.1030608@redhat.com>

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	other threads:[~2016-03-29 10:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28  4:16 [Qemu-devel] [PATCH v2] migration: skip sending ram pages released by virtio-balloon driver Jitendra Kolhe
2016-03-28  6:59 ` Michael S. Tsirkin
2016-03-29 10:05   ` Paolo Bonzini
2016-03-29 10:47     ` Jitendra Kolhe [this message]
2016-03-29 10:48       ` Paolo Bonzini
2016-04-01 11:19         ` Jitendra Kolhe
2016-03-28 10:36 ` Denis V. Lunev
2016-03-29 11:34   ` Jitendra Kolhe
2016-03-28 14:11 ` Eric Blake
2016-03-29 12:13   ` Jitendra Kolhe
2016-03-29 12:28 ` Michael S. Tsirkin
2016-04-01 11:08   ` Jitendra Kolhe
2016-04-10 16:59     ` Michael S. Tsirkin
2016-04-13 10:54       ` Jitendra Kolhe
2016-04-13 11:10         ` Michael S. Tsirkin
2016-04-13 11:15           ` Dr. David Alan Gilbert
2016-04-13 11:36             ` Michael S. Tsirkin
2016-04-29 10:31               ` Jitendra Kolhe
2016-03-31 16:39 ` Dr. David Alan Gilbert
2016-04-05 10:04   ` Jitendra Kolhe

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=56FA5D33.2020802@hpe.com \
    --to=jitendra.kolhe@hpe.com \
    --cc=JBottomley@Odin.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=den@openvz.org \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mohan_parthasarathy@hpe.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    --cc=simhan@hpe.com \
    --cc=stefanha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.