qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lei Li <lilei@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: aarcange@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org,
	mrhines@linux.vnet.ibm.com,
	Anthony Liguori <anthony@codemonkey.ws>,
	lagarcia@br.ibm.com, rcj@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 13/18] arch_init: adjust ram_save_setup() for migrate_is_localhost
Date: Fri, 23 Aug 2013 14:25:36 +0800	[thread overview]
Message-ID: <52170060.4050104@linux.vnet.ibm.com> (raw)
In-Reply-To: <52149B09.705@redhat.com>

On 08/21/2013 06:48 PM, Paolo Bonzini wrote:
> Il 21/08/2013 09:18, Lei Li ha scritto:
>> Send all the ram blocks hooked by save_page, which will copy
>> ram page and MADV_DONTNEED the page just copied.
> You should implement this entirely in the hook.
>
> It will be a little less efficient because of the dirty bitmap overhead,
> but you should aim at having *zero* changes in arch_init.c and migration.c.

Yes, the reason I modify the migration_thread() to have new process that send all
the ram pages in adjusted qemu_savevm_state_begin stage and send device states in
qemu_savevm_device_state stage for localhost migration is to avoid the bitmap thing,
which is a little less efficient just like you mentioned above.

The performance assurance is very important to this feature, our goal is 100ms
of downtime for a 1TB guest.

>
> Paolo
>
>> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
>> ---
>>   arch_init.c |   19 +++++++++++++------
>>   1 files changed, 13 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch_init.c b/arch_init.c
>> index 434a4ca..cbbb4db 100644
>> --- a/arch_init.c
>> +++ b/arch_init.c
>> @@ -474,7 +474,7 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
>>               /* In doubt sent page as normal */
>>               bytes_sent = -1;
>>               ret = ram_control_save_page(f, block->offset,
>> -                               offset, TARGET_PAGE_SIZE, &bytes_sent);
>> +                                        offset, TARGET_PAGE_SIZE, &bytes_sent);
>>   
>>               if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
>>                   if (ret != RAM_SAVE_CONTROL_DELAYED) {
>> @@ -613,11 +613,13 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>>       RAMBlock *block;
>>       int64_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS;
>>   
>> -    migration_bitmap = bitmap_new(ram_pages);
>> -    bitmap_set(migration_bitmap, 0, ram_pages);
>> -    migration_dirty_pages = ram_pages;
>> -    mig_throttle_on = false;
>> -    dirty_rate_high_cnt = 0;
>> +    if (!migrate_is_localhost()) {
>> +        migration_bitmap = bitmap_new(ram_pages);
>> +        bitmap_set(migration_bitmap, 0, ram_pages);
>> +        migration_dirty_pages = ram_pages;
>> +        mig_throttle_on = false;
>> +        dirty_rate_high_cnt = 0;
>> +    }
>>   
>>       if (migrate_use_xbzrle()) {
>>           XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() /
>> @@ -641,6 +643,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>>       migration_bitmap_sync();
>>       qemu_mutex_unlock_iothread();
>>   
>> +    if (migrate_is_localhost()) {
>> +        ram_save_blocks(f);
>> +        return 0;
>> +    }
>> +
>>       qemu_put_be64(f, ram_bytes_total() | RAM_SAVE_FLAG_MEM_SIZE);
>>   
>>       QTAILQ_FOREACH(block, &ram_list.blocks, next) {
>>
>


-- 
Lei

  reply	other threads:[~2013-08-23  6:27 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21  7:18 [Qemu-devel] [PATCH 0/18 RFC v3] Localhost migration Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 01/18] migration: export MIG_STATE_xxx flags Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 02/18] savevm: export qemu_save_device_state() Lei Li
2013-08-21 11:13   ` Paolo Bonzini
2013-08-21  7:18 ` [Qemu-devel] [PATCH 03/18] rename is_active to is_block_active Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 04/18] savevm: set right return value for qemu_file_rate_limit Lei Li
2013-08-21 10:42   ` Paolo Bonzini
2013-08-23  3:18     ` Lei Li
2013-08-23  5:34       ` Paolo Bonzini
2013-08-23  9:11         ` Lei Li
2013-08-23  9:14           ` Paolo Bonzini
2013-08-23  9:18             ` Lei Li
2013-08-23  9:22               ` Paolo Bonzini
2013-08-23  9:25                 ` Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 05/18] savevm: add comments for qemu_file_get_error() Lei Li
2013-08-21 10:43   ` Paolo Bonzini
2013-08-21  7:18 ` [Qemu-devel] [PATCH 06/18] bugfix: wrong error set by ram_control_load_hook() Lei Li
2013-08-21 10:40   ` Paolo Bonzini
2013-08-23  3:22     ` Lei Li
2013-08-23  5:34       ` Paolo Bonzini
2013-08-23  6:31         ` Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 07/18] arch_init: export RAM_SAVE_xxx flags Lei Li
2013-08-21 10:49   ` Paolo Bonzini
2013-08-22 20:14     ` Michael R. Hines
2013-08-23  7:36       ` Paolo Bonzini
2013-08-21  7:18 ` [Qemu-devel] [PATCH 08/18] migration-local: introduce qemu_fopen_local() Lei Li
2013-08-22 20:42   ` Michael R. Hines
2013-08-23  7:44     ` Lei Li
2013-08-28  3:26       ` Lei Li
2013-08-28  6:37         ` Paolo Bonzini
2013-08-29  8:28           ` Lei Li
2013-08-29 14:05           ` Michael R. Hines
2013-08-21  7:18 ` [Qemu-devel] [PATCH 09/18] exec: export qemu_get_ram_block() Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 10/18] migration-local: implementation of outgoing part Lei Li
2013-08-21 10:44   ` Paolo Bonzini
2013-08-22 20:49   ` Michael R. Hines
2013-08-21  7:18 ` [Qemu-devel] [PATCH 11/18] migration: introduce capability localhost Lei Li
2013-08-21 15:08   ` Eric Blake
2013-08-28  4:22     ` Lei Li
2013-08-21 15:18   ` Paolo Bonzini
2013-08-22 20:50     ` Michael R. Hines
2013-08-23  7:40       ` Paolo Bonzini
2013-08-23  7:51         ` Lei Li
2013-08-23  8:01           ` Paolo Bonzini
2013-08-23  9:21             ` Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 12/18] arch_init: factor out ram_save_blocks() Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 13/18] arch_init: adjust ram_save_setup() for migrate_is_localhost Lei Li
2013-08-21 10:48   ` Paolo Bonzini
2013-08-23  6:25     ` Lei Li [this message]
2013-08-23  7:48       ` Paolo Bonzini
2013-08-23  7:57         ` Alex Bligh
2013-08-23  8:06           ` Paolo Bonzini
2013-08-23  9:00         ` Lei Li
2013-08-23  9:12           ` Paolo Bonzini
2013-08-21  7:18 ` [Qemu-devel] [PATCH 14/18] arch_init: skip migration_bitmap_sync for local migration Lei Li
2013-08-21 10:50   ` Paolo Bonzini
2013-08-21  7:18 ` [Qemu-devel] [PATCH 15/18] migration: adjust migration_thread " Lei Li
2013-08-21 10:47   ` Paolo Bonzini
2013-08-21  7:18 ` [Qemu-devel] [PATCH 16/18] migration-local: implementation of incoming part Lei Li
2013-08-21  7:18 ` Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 17/18] migration: add prefix for local migration to incoming migration Lei Li
2013-08-21 10:52   ` Paolo Bonzini
2013-08-23 14:02     ` Lei Li
2013-08-21  7:18 ` [Qemu-devel] [PATCH 18/18] hmp: better fomat for info migrate_capabilities Lei Li

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=52170060.4050104@linux.vnet.ibm.com \
    --to=lilei@linux.vnet.ibm.com \
    --cc=aarcange@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=lagarcia@br.ibm.com \
    --cc=mrhines@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rcj@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).