From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493890979091257.65846209353856; Thu, 4 May 2017 02:42:59 -0700 (PDT) Received: from localhost ([::1]:40719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DHl-0001QC-MR for importer@patchew.org; Thu, 04 May 2017 05:42:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DFz-0008F7-Rn for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DFs-0000br-EP for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DFs-0000bM-3u for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:00 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1709EC04B941 for ; Thu, 4 May 2017 09:40:59 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 882D31715B; Thu, 4 May 2017 09:40:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1709EC04B941 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1709EC04B941 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:44 +0200 Message-Id: <20170504094053.2329-2-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 04 May 2017 09:40:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/10] ram: Split dirty bitmap by RAMBlock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Both the ram bitmap and the unsent bitmap are split by RAMBlock. Signed-off-by: Juan Quintela Reviewed-by: zhanghailiang Reviewed-by: Peter Xu -- Fix compilation when DEBUG_POSTCOPY is enabled (thanks Hailiang) --- include/exec/ram_addr.h | 13 +- include/migration/migration.h | 3 +- include/migration/postcopy-ram.h | 3 - migration/postcopy-ram.c | 5 +- migration/ram.c | 271 +++++++++++++++--------------------= ---- 5 files changed, 118 insertions(+), 177 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index dbe2f08..140efa8 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -39,6 +39,14 @@ struct RAMBlock { QLIST_HEAD(, RAMBlockNotifier) ramblock_notifiers; int fd; size_t page_size; + /* dirty bitmap used during migration */ + unsigned long *bmap; + /* bitmap of pages that haven't been sent even once + * only maintained and used in postcopy at the moment + * where it's used to send the dirtymap at the start + * of the postcopy phase + */ + unsigned long *unsentmap; }; =20 static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset) @@ -360,16 +368,15 @@ static inline void cpu_physical_memory_clear_dirty_ra= nge(ram_addr_t start, =20 =20 static inline -uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned long *dest, - RAMBlock *rb, +uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb, ram_addr_t start, ram_addr_t length, uint64_t *real_dirty_pages) { ram_addr_t addr; - start =3D rb->offset + start; unsigned long page =3D BIT_WORD(start >> TARGET_PAGE_BITS); uint64_t num_dirty =3D 0; + unsigned long *dest =3D rb->bmap; =20 /* start address is aligned at the start of a word? */ if (((page * BITS_PER_LONG) << TARGET_PAGE_BITS) =3D=3D start) { diff --git a/include/migration/migration.h b/include/migration/migration.h index ba1a16c..e29cb01 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -266,7 +266,8 @@ uint64_t xbzrle_mig_pages_cache_miss(void); double xbzrle_mig_cache_miss_rate(void); =20 void ram_handle_compressed(void *host, uint8_t ch, uint64_t size); -void ram_debug_dump_bitmap(unsigned long *todump, bool expected); +void ram_debug_dump_bitmap(unsigned long *todump, bool expected, + unsigned long pages); /* For outgoing discard bitmap */ int ram_postcopy_send_discard_bitmap(MigrationState *ms); /* For incoming postcopy discard */ diff --git a/include/migration/postcopy-ram.h b/include/migration/postcopy-= ram.h index 8e036b9..4c25f03 100644 --- a/include/migration/postcopy-ram.h +++ b/include/migration/postcopy-ram.h @@ -43,12 +43,9 @@ int postcopy_ram_prepare_discard(MigrationIncomingState = *mis); =20 /* * Called at the start of each RAMBlock by the bitmap code. - * 'offset' is the bitmap offset of the named RAMBlock in the migration - * bitmap. * Returns a new PDS */ PostcopyDiscardState *postcopy_discard_send_init(MigrationState *ms, - unsigned long offset, const char *name); =20 /* diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 85fd8d7..e3f4a37 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -33,7 +33,6 @@ =20 struct PostcopyDiscardState { const char *ramblock_name; - uint64_t offset; /* Bitmap entry for the 1st bit of this RAMBlock */ uint16_t cur_entry; /* * Start and length of a discard range (bytes) @@ -717,14 +716,12 @@ void *postcopy_get_tmp_page(MigrationIncomingState *m= is) * returns: a new PDS. */ PostcopyDiscardState *postcopy_discard_send_init(MigrationState *ms, - unsigned long offset, const char *name) { PostcopyDiscardState *res =3D g_malloc0(sizeof(PostcopyDiscardState)); =20 if (res) { res->ramblock_name =3D name; - res->offset =3D offset; } =20 return res; @@ -745,7 +742,7 @@ void postcopy_discard_send_range(MigrationState *ms, Po= stcopyDiscardState *pds, { size_t tp_size =3D qemu_target_page_size(); /* Convert to byte offsets within the RAM block */ - pds->start_list[pds->cur_entry] =3D (start - pds->offset) * tp_size; + pds->start_list[pds->cur_entry] =3D start * tp_size; pds->length_list[pds->cur_entry] =3D length * tp_size; trace_postcopy_discard_send_range(pds->ramblock_name, start, length); pds->cur_entry++; diff --git a/migration/ram.c b/migration/ram.c index f48664e..1f03469 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -138,19 +138,6 @@ out: return ret; } =20 -struct RAMBitmap { - struct rcu_head rcu; - /* Main migration bitmap */ - unsigned long *bmap; - /* bitmap of pages that haven't been sent even once - * only maintained and used in postcopy at the moment - * where it's used to send the dirtymap at the start - * of the postcopy phase - */ - unsigned long *unsentmap; -}; -typedef struct RAMBitmap RAMBitmap; - /* * An outstanding page request, on the source, having been received * and queued @@ -220,8 +207,6 @@ struct RAMState { uint64_t postcopy_requests; /* protects modification of the bitmap */ QemuMutex bitmap_mutex; - /* Ram Bitmap protected by RCU */ - RAMBitmap *ram_bitmap; /* The RAMBlock used in the last src_page_requests */ RAMBlock *last_req_rb; /* Queue of outstanding page requests from the destination */ @@ -614,22 +599,17 @@ static inline unsigned long migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb, unsigned long start) { - unsigned long base =3D rb->offset >> TARGET_PAGE_BITS; - unsigned long nr =3D base + start; - uint64_t rb_size =3D rb->used_length; - unsigned long size =3D base + (rb_size >> TARGET_PAGE_BITS); - unsigned long *bitmap; - + unsigned long size =3D rb->used_length >> TARGET_PAGE_BITS; + unsigned long *bitmap =3D rb->bmap; unsigned long next; =20 - bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; - if (rs->ram_bulk_stage && nr > base) { - next =3D nr + 1; + if (rs->ram_bulk_stage && start > 0) { + next =3D start + 1; } else { - next =3D find_next_bit(bitmap, size, nr); + next =3D find_next_bit(bitmap, size, start); } =20 - return next - base; + return next; } =20 static inline bool migration_bitmap_clear_dirty(RAMState *rs, @@ -637,10 +617,8 @@ static inline bool migration_bitmap_clear_dirty(RAMSta= te *rs, unsigned long page) { bool ret; - unsigned long *bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; - unsigned long nr =3D (rb->offset >> TARGET_PAGE_BITS) + page; =20 - ret =3D test_and_clear_bit(nr, bitmap); + ret =3D test_and_clear_bit(page, rb->bmap); =20 if (ret) { rs->migration_dirty_pages--; @@ -651,10 +629,8 @@ static inline bool migration_bitmap_clear_dirty(RAMSta= te *rs, static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb, ram_addr_t start, ram_addr_t lengt= h) { - unsigned long *bitmap; - bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; rs->migration_dirty_pages +=3D - cpu_physical_memory_sync_dirty_bitmap(bitmap, rb, start, length, + cpu_physical_memory_sync_dirty_bitmap(rb, start, length, &rs->num_dirty_pages_period); } =20 @@ -1153,17 +1129,13 @@ static bool get_queued_page(RAMState *rs, PageSearc= hStatus *pss) * search already sent it. */ if (block) { - unsigned long *bitmap; unsigned long page; =20 - bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; - page =3D (block->offset + offset) >> TARGET_PAGE_BITS; - dirty =3D test_bit(page, bitmap); + page =3D offset >> TARGET_PAGE_BITS; + dirty =3D test_bit(page, block->bmap); if (!dirty) { trace_get_queued_page_not_dirty(block->idstr, (uint64_t)of= fset, - page, - test_bit(page, - atomic_rcu_read(&rs->ram_bitmap)->unsentmap)); + page, test_bit(page, block->unsentmap)); } else { trace_get_queued_page(block->idstr, (uint64_t)offset, page= ); } @@ -1301,16 +1273,13 @@ static int ram_save_target_page(RAMState *rs, PageS= earchStatus *pss, =20 /* Check the pages is dirty and if it is send it */ if (migration_bitmap_clear_dirty(rs, pss->block, pss->page)) { - unsigned long *unsentmap; /* * If xbzrle is on, stop using the data compression after first * round of migration even if compression is enabled. In theory, * xbzrle can do better than compression. */ - unsigned long page =3D - (pss->block->offset >> TARGET_PAGE_BITS) + pss->page; - if (migrate_use_compression() - && (rs->ram_bulk_stage || !migrate_use_xbzrle())) { + if (migrate_use_compression() && + (rs->ram_bulk_stage || !migrate_use_xbzrle())) { res =3D ram_save_compressed_page(rs, pss, last_stage); } else { res =3D ram_save_page(rs, pss, last_stage); @@ -1319,9 +1288,8 @@ static int ram_save_target_page(RAMState *rs, PageSea= rchStatus *pss, if (res < 0) { return res; } - unsentmap =3D atomic_rcu_read(&rs->ram_bitmap)->unsentmap; - if (unsentmap) { - clear_bit(page, unsentmap); + if (pss->block->unsentmap) { + clear_bit(pss->page, pss->block->unsentmap); } } =20 @@ -1451,25 +1419,20 @@ void free_xbzrle_decoded_buf(void) xbzrle_decoded_buf =3D NULL; } =20 -static void migration_bitmap_free(RAMBitmap *bmap) -{ - g_free(bmap->bmap); - g_free(bmap->unsentmap); - g_free(bmap); -} - static void ram_migration_cleanup(void *opaque) { - RAMState *rs =3D opaque; + RAMBlock *block; =20 /* caller have hold iothread lock or is in a bh, so there is * no writing race against this migration_bitmap */ - RAMBitmap *bitmap =3D rs->ram_bitmap; - atomic_rcu_set(&rs->ram_bitmap, NULL); - if (bitmap) { - memory_global_dirty_log_stop(); - call_rcu(bitmap, migration_bitmap_free, rcu); + memory_global_dirty_log_stop(); + + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { + g_free(block->bmap); + block->bmap =3D NULL; + g_free(block->unsentmap); + block->unsentmap =3D NULL; } =20 XBZRLE_cache_lock(); @@ -1501,27 +1464,22 @@ static void ram_state_reset(RAMState *rs) * of; it won't bother printing lines that are all this value. * If 'todump' is null the migration bitmap is dumped. */ -void ram_debug_dump_bitmap(unsigned long *todump, bool expected) +void ram_debug_dump_bitmap(unsigned long *todump, bool expected, + unsigned long pages) { - unsigned long ram_pages =3D last_ram_page(); - RAMState *rs =3D &ram_state; int64_t cur; int64_t linelen =3D 128; char linebuf[129]; =20 - if (!todump) { - todump =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; - } - - for (cur =3D 0; cur < ram_pages; cur +=3D linelen) { + for (cur =3D 0; cur < pages; cur +=3D linelen) { int64_t curb; bool found =3D false; /* * Last line; catch the case where the line length * is longer than remaining ram */ - if (cur + linelen > ram_pages) { - linelen =3D ram_pages - cur; + if (cur + linelen > pages) { + linelen =3D pages - cur; } for (curb =3D 0; curb < linelen; curb++) { bool thisbit =3D test_bit(cur + curb, todump); @@ -1539,14 +1497,12 @@ void ram_debug_dump_bitmap(unsigned long *todump, b= ool expected) =20 void ram_postcopy_migrated_memory_release(MigrationState *ms) { - RAMState *rs =3D &ram_state; struct RAMBlock *block; - unsigned long *bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; =20 QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { - unsigned long first =3D block->offset >> TARGET_PAGE_BITS; - unsigned long range =3D first + (block->used_length >> TARGET_PAGE= _BITS); - unsigned long run_start =3D find_next_zero_bit(bitmap, range, firs= t); + unsigned long *bitmap =3D block->bmap; + unsigned long range =3D block->used_length >> TARGET_PAGE_BITS; + unsigned long run_start =3D find_next_zero_bit(bitmap, range, 0); =20 while (run_start < range) { unsigned long run_end =3D find_next_bit(bitmap, range, run_sta= rt + 1); @@ -1573,16 +1529,13 @@ void ram_postcopy_migrated_memory_release(Migration= State *ms) */ static int postcopy_send_discard_bm_ram(MigrationState *ms, PostcopyDiscardState *pds, - unsigned long start, - unsigned long length) + RAMBlock *block) { - RAMState *rs =3D &ram_state; - unsigned long end =3D start + length; /* one after the end */ + unsigned long end =3D block->used_length >> TARGET_PAGE_BITS; unsigned long current; - unsigned long *unsentmap; + unsigned long *unsentmap =3D block->unsentmap; =20 - unsentmap =3D atomic_rcu_read(&rs->ram_bitmap)->unsentmap; - for (current =3D start; current < end; ) { + for (current =3D 0; current < end; ) { unsigned long one =3D find_next_bit(unsentmap, end, current); =20 if (one <=3D end) { @@ -1625,18 +1578,15 @@ static int postcopy_each_ram_send_discard(Migration= State *ms) int ret; =20 QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { - unsigned long first =3D block->offset >> TARGET_PAGE_BITS; - PostcopyDiscardState *pds =3D postcopy_discard_send_init(ms, - first, - block->idst= r); + PostcopyDiscardState *pds =3D + postcopy_discard_send_init(ms, block->idstr); =20 /* * Postcopy sends chunks of bitmap over the wire, but it * just needs indexes at this point, avoids it having * target page specific code. */ - ret =3D postcopy_send_discard_bm_ram(ms, pds, first, - block->used_length >> TARGET_PAGE_BITS= ); + ret =3D postcopy_send_discard_bm_ram(ms, pds, block); postcopy_discard_send_finish(ms, pds); if (ret) { return ret; @@ -1667,12 +1617,10 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, PostcopyDiscardState *pds) { RAMState *rs =3D &ram_state; - unsigned long *bitmap; - unsigned long *unsentmap; + unsigned long *bitmap =3D block->bmap; + unsigned long *unsentmap =3D block->unsentmap; unsigned int host_ratio =3D block->page_size / TARGET_PAGE_SIZE; - unsigned long first =3D block->offset >> TARGET_PAGE_BITS; - unsigned long len =3D block->used_length >> TARGET_PAGE_BITS; - unsigned long last =3D first + (len - 1); + unsigned long pages =3D block->used_length >> TARGET_PAGE_BITS; unsigned long run_start; =20 if (block->page_size =3D=3D TARGET_PAGE_SIZE) { @@ -1680,18 +1628,15 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, return; } =20 - bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; - unsentmap =3D atomic_rcu_read(&rs->ram_bitmap)->unsentmap; - if (unsent_pass) { /* Find a sent page */ - run_start =3D find_next_zero_bit(unsentmap, last + 1, first); + run_start =3D find_next_zero_bit(unsentmap, pages, 0); } else { /* Find a dirty page */ - run_start =3D find_next_bit(bitmap, last + 1, first); + run_start =3D find_next_bit(bitmap, pages, 0); } =20 - while (run_start <=3D last) { + while (run_start < pages) { bool do_fixup =3D false; unsigned long fixup_start_addr; unsigned long host_offset; @@ -1711,9 +1656,9 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, /* Find the end of this run */ unsigned long run_end; if (unsent_pass) { - run_end =3D find_next_bit(unsentmap, last + 1, run_start += 1); + run_end =3D find_next_bit(unsentmap, pages, run_start + 1); } else { - run_end =3D find_next_zero_bit(bitmap, last + 1, run_start= + 1); + run_end =3D find_next_zero_bit(bitmap, pages, run_start + = 1); } /* * If the end isn't at the start of a host page, then the @@ -1770,11 +1715,10 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, =20 if (unsent_pass) { /* Find the next sent page for the next iteration */ - run_start =3D find_next_zero_bit(unsentmap, last + 1, - run_start); + run_start =3D find_next_zero_bit(unsentmap, pages, run_start); } else { /* Find the next dirty page for the next iteration */ - run_start =3D find_next_bit(bitmap, last + 1, run_start); + run_start =3D find_next_bit(bitmap, pages, run_start); } } } @@ -1791,34 +1735,22 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, bool unsent_pass, * Returns zero on success * * @ms: current migration state + * @block: block we want to work with */ -static int postcopy_chunk_hostpages(MigrationState *ms) +static int postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) { - RAMState *rs =3D &ram_state; - struct RAMBlock *block; - - /* Easiest way to make sure we don't resume in the middle of a host-pa= ge */ - rs->last_seen_block =3D NULL; - rs->last_sent_block =3D NULL; - rs->last_page =3D 0; - - QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { - unsigned long first =3D block->offset >> TARGET_PAGE_BITS; - - PostcopyDiscardState *pds =3D - postcopy_discard_send_init(ms, first, block->idst= r); - - /* First pass: Discard all partially sent host pages */ - postcopy_chunk_hostpages_pass(ms, true, block, pds); - /* - * Second pass: Ensure that all partially dirty host pages are made - * fully dirty. - */ - postcopy_chunk_hostpages_pass(ms, false, block, pds); - - postcopy_discard_send_finish(ms, pds); - } /* ram_list loop */ - + PostcopyDiscardState *pds =3D + postcopy_discard_send_init(ms, block->idstr); + + /* First pass: Discard all partially sent host pages */ + postcopy_chunk_hostpages_pass(ms, true, block, pds); + /* + * Second pass: Ensure that all partially dirty host pages are made + * fully dirty. + */ + postcopy_chunk_hostpages_pass(ms, false, block, pds); + + postcopy_discard_send_finish(ms, pds); return 0; } =20 @@ -1840,43 +1772,49 @@ static int postcopy_chunk_hostpages(MigrationState = *ms) int ram_postcopy_send_discard_bitmap(MigrationState *ms) { RAMState *rs =3D &ram_state; + RAMBlock *block; int ret; - unsigned long *bitmap, *unsentmap; =20 rcu_read_lock(); =20 /* This should be our last sync, the src is now paused */ migration_bitmap_sync(rs); =20 - unsentmap =3D atomic_rcu_read(&rs->ram_bitmap)->unsentmap; - if (!unsentmap) { - /* We don't have a safe way to resize the sentmap, so - * if the bitmap was resized it will be NULL at this - * point. + /* Easiest way to make sure we don't resume in the middle of a host-pa= ge */ + rs->last_seen_block =3D NULL; + rs->last_sent_block =3D NULL; + rs->last_page =3D 0; + + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { + unsigned long pages =3D block->used_length >> TARGET_PAGE_BITS; + unsigned long *bitmap =3D block->bmap; + unsigned long *unsentmap =3D block->unsentmap; + + if (!unsentmap) { + /* We don't have a safe way to resize the sentmap, so + * if the bitmap was resized it will be NULL at this + * point. + */ + error_report("migration ram resized during precopy phase"); + rcu_read_unlock(); + return -EINVAL; + } + /* Deal with TPS !=3D HPS and huge pages */ + ret =3D postcopy_chunk_hostpages(ms, block); + if (ret) { + rcu_read_unlock(); + return ret; + } + + /* + * Update the unsentmap to be unsentmap =3D unsentmap | dirty */ - error_report("migration ram resized during precopy phase"); - rcu_read_unlock(); - return -EINVAL; - } - - /* Deal with TPS !=3D HPS and huge pages */ - ret =3D postcopy_chunk_hostpages(ms); - if (ret) { - rcu_read_unlock(); - return ret; - } - - /* - * Update the unsentmap to be unsentmap =3D unsentmap | dirty - */ - bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; - bitmap_or(unsentmap, unsentmap, bitmap, last_ram_page()); - - - trace_ram_postcopy_send_discard_bitmap(); + bitmap_or(unsentmap, unsentmap, bitmap, pages); #ifdef DEBUG_POSTCOPY - ram_debug_dump_bitmap(unsentmap, true); + ram_debug_dump_bitmap(unsentmap, true, pages); #endif + } + trace_ram_postcopy_send_discard_bitmap(); =20 ret =3D postcopy_each_ram_send_discard(ms); rcu_read_unlock(); @@ -1918,8 +1856,6 @@ err: =20 static int ram_state_init(RAMState *rs) { - unsigned long ram_bitmap_pages; - memset(rs, 0, sizeof(*rs)); qemu_mutex_init(&rs->bitmap_mutex); qemu_mutex_init(&rs->src_page_req_mutex); @@ -1961,16 +1897,19 @@ static int ram_state_init(RAMState *rs) rcu_read_lock(); ram_state_reset(rs); =20 - rs->ram_bitmap =3D g_new0(RAMBitmap, 1); /* Skip setting bitmap if there is no RAM */ if (ram_bytes_total()) { - ram_bitmap_pages =3D last_ram_page(); - rs->ram_bitmap->bmap =3D bitmap_new(ram_bitmap_pages); - bitmap_set(rs->ram_bitmap->bmap, 0, ram_bitmap_pages); + RAMBlock *block; =20 - if (migrate_postcopy_ram()) { - rs->ram_bitmap->unsentmap =3D bitmap_new(ram_bitmap_pages); - bitmap_set(rs->ram_bitmap->unsentmap, 0, ram_bitmap_pages); + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { + unsigned long pages =3D block->max_length >> TARGET_PAGE_BITS; + + block->bmap =3D bitmap_new(pages); + bitmap_set(block->bmap, 0, pages); + if (migrate_postcopy_ram()) { + block->unsentmap =3D bitmap_new(pages); + bitmap_set(block->unsentmap, 0, pages); + } } } =20 --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493891088204963.6476366762347; Thu, 4 May 2017 02:44:48 -0700 (PDT) Received: from localhost ([::1]:40725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DJW-00033T-7u for importer@patchew.org; Thu, 04 May 2017 05:44:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DFv-0008C5-2Z for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DFu-0000cs-7l for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36570) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DFu-0000cS-1P for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBFC961D15 for ; Thu, 4 May 2017 09:41:00 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AD5F1715B; Thu, 4 May 2017 09:40:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EBFC961D15 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EBFC961D15 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:45 +0200 Message-Id: <20170504094053.2329-3-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 04 May 2017 09:41:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/10] migration: setup bi-directional I/O channel for exec: protocol X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" Historically the migration data channel has only needed to be unidirectional. Thus the 'exec:' protocol was requesting an I/O channel with O_RDONLY on incoming side, and O_WRONLY on the outgoing side. This is fine for classic migration, but if you then try to run TLS over it, this fails because the TLS handshake requires a bi-directional channel. Signed-off-by: Daniel P. Berrange Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index 9157721..aba9089 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -32,7 +32,7 @@ void exec_start_outgoing_migration(MigrationState *s, con= st char *command, Error =20 trace_migration_exec_outgoing(command); ioc =3D QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_WRONLY, + O_RDWR, errp)); if (!ioc) { return; @@ -59,7 +59,7 @@ void exec_start_incoming_migration(const char *command, E= rror **errp) =20 trace_migration_exec_incoming(command); ioc =3D QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_RDONLY, + O_RDWR, errp)); if (!ioc) { return; --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493890965310622.0561748936951; Thu, 4 May 2017 02:42:45 -0700 (PDT) Received: from localhost ([::1]:40717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DHX-0001CN-TN for importer@patchew.org; Thu, 04 May 2017 05:42:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DFw-0008Co-M1 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DFv-0000ds-Sk for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DFv-0000dO-ML for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:03 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A12A6C057FA5 for ; Thu, 4 May 2017 09:41:02 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C2A37754D; Thu, 4 May 2017 09:41:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A12A6C057FA5 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A12A6C057FA5 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:46 +0200 Message-Id: <20170504094053.2329-4-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 04 May 2017 09:41:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/10] migration: to_dst_file at that point is NULL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We have just arrived as: migration.c: qemu_migrate() .... s =3D migrate_init() <- puts it to NULL .... {tcp,unix}_start_outgoing_migration -> socket_outgoing_migration migration_channel_connect() sets to_dst_file if tls is enabled, we do another round through migrate_channel_tls_connect(), but we only set it up if there is no error. So we don't need the assignation. I am removing it to remove in the follwing patches the knowledge about MigrationState in that two files. Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier Reviewed-by: Daniel P. Berrange Reviewed-by: Peter Xu --- migration/socket.c | 1 - migration/tls.c | 1 - 2 files changed, 2 deletions(-) diff --git a/migration/socket.c b/migration/socket.c index 13966f1..dc88812 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -79,7 +79,6 @@ static void socket_outgoing_migration(QIOTask *task, =20 if (qio_task_propagate_error(task, &err)) { trace_migration_socket_outgoing_error(error_get_pretty(err)); - data->s->to_dst_file =3D NULL; migrate_fd_error(data->s, err); error_free(err); } else { diff --git a/migration/tls.c b/migration/tls.c index 45bec44..a33ecb7 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -116,7 +116,6 @@ static void migration_tls_outgoing_handshake(QIOTask *t= ask, =20 if (qio_task_propagate_error(task, &err)) { trace_migration_tls_outgoing_handshake_error(error_get_pretty(err)= ); - s->to_dst_file =3D NULL; migrate_fd_error(s, err); error_free(err); } else { --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493891098121689.1286063292162; Thu, 4 May 2017 02:44:58 -0700 (PDT) Received: from localhost ([::1]:40726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DJg-0003KA-Oy for importer@patchew.org; Thu, 04 May 2017 05:44:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DFz-0008ES-83 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DFy-0000en-1F for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DFx-0000eK-OA for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:05 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 80BAD7D4E2 for ; Thu, 4 May 2017 09:41:04 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id F32541715B; Thu, 4 May 2017 09:41:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 80BAD7D4E2 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 80BAD7D4E2 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:47 +0200 Message-Id: <20170504094053.2329-5-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 04 May 2017 09:41:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/10] monitor: Remove monitor parameter from save_vmstate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" load_vmstate() already use error_report, so be consistent. There is an identical error message in load_vmstate() that ends in a period. Remove it. Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier Reviewed-by: Dr. David Alan Gilbert --- include/sysemu/sysemu.h | 2 +- migration/savevm.c | 20 ++++++++++---------- replay/replay-snapshot.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 16175f7..b6daf9d 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -76,7 +76,7 @@ void qemu_add_machine_init_done_notifier(Notifier *notify= ); void qemu_remove_machine_init_done_notifier(Notifier *notify); =20 void hmp_savevm(Monitor *mon, const QDict *qdict); -int save_vmstate(Monitor *mon, const char *name); +int save_vmstate(const char *name); int load_vmstate(const char *name); void hmp_delvm(Monitor *mon, const QDict *qdict); void hmp_info_snapshots(Monitor *mon, const QDict *qdict); diff --git a/migration/savevm.c b/migration/savevm.c index 03ae1bd..a89af80 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2070,7 +2070,7 @@ int qemu_loadvm_state(QEMUFile *f) return ret; } =20 -int save_vmstate(Monitor *mon, const char *name) +int save_vmstate(const char *name) { BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn =3D &sn1, old_sn1, *old_sn =3D &old_sn1; @@ -2084,8 +2084,8 @@ int save_vmstate(Monitor *mon, const char *name) AioContext *aio_context; =20 if (!bdrv_all_can_snapshot(&bs)) { - monitor_printf(mon, "Device '%s' is writable but does not " - "support snapshots.\n", bdrv_get_device_name(bs)); + error_report("Device '%s' is writable but does not support snapsho= ts", + bdrv_get_device_name(bs)); return ret; } =20 @@ -2102,7 +2102,7 @@ int save_vmstate(Monitor *mon, const char *name) =20 bs =3D bdrv_all_find_vmstate_bs(); if (bs =3D=3D NULL) { - monitor_printf(mon, "No block device can accept snapshots\n"); + error_report("No block device can accept snapshots"); return ret; } aio_context =3D bdrv_get_aio_context(bs); @@ -2111,7 +2111,7 @@ int save_vmstate(Monitor *mon, const char *name) =20 ret =3D global_state_store(); if (ret) { - monitor_printf(mon, "Error saving global state\n"); + error_report("Error saving global state"); return ret; } vm_stop(RUN_STATE_SAVE_VM); @@ -2143,7 +2143,7 @@ int save_vmstate(Monitor *mon, const char *name) /* save the VM state */ f =3D qemu_fopen_bdrv(bs, 1); if (!f) { - monitor_printf(mon, "Could not open VM state file\n"); + error_report("Could not open VM state file"); goto the_end; } ret =3D qemu_savevm_state(f, &local_err); @@ -2156,8 +2156,8 @@ int save_vmstate(Monitor *mon, const char *name) =20 ret =3D bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs); if (ret < 0) { - monitor_printf(mon, "Error while creating snapshot on '%s'\n", - bdrv_get_device_name(bs)); + error_report("Error while creating snapshot on '%s'", + bdrv_get_device_name(bs)); goto the_end; } =20 @@ -2173,7 +2173,7 @@ int save_vmstate(Monitor *mon, const char *name) =20 void hmp_savevm(Monitor *mon, const QDict *qdict) { - save_vmstate(mon, qdict_get_try_str(qdict, "name")); + save_vmstate(qdict_get_try_str(qdict, "name")); } =20 void qmp_xen_save_devices_state(const char *filename, Error **errp) @@ -2245,7 +2245,7 @@ int load_vmstate(const char *name) MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 if (!bdrv_all_can_snapshot(&bs)) { - error_report("Device '%s' is writable but does not support snapsho= ts.", + error_report("Device '%s' is writable but does not support snapsho= ts", bdrv_get_device_name(bs)); return -ENOTSUP; } diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index 65e2d37..8cced46 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -64,7 +64,7 @@ void replay_vmstate_init(void) { if (replay_snapshot) { if (replay_mode =3D=3D REPLAY_MODE_RECORD) { - if (save_vmstate(cur_mon, replay_snapshot) !=3D 0) { + if (save_vmstate(replay_snapshot) !=3D 0) { error_report("Could not create snapshot for icount record"= ); exit(1); } --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493891112610257.88732891865493; Thu, 4 May 2017 02:45:12 -0700 (PDT) Received: from localhost ([::1]:40729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DJv-0003VJ-BA for importer@patchew.org; Thu, 04 May 2017 05:45:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DG2-0008H6-I6 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DFz-0000ff-I0 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43690) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DFz-0000f5-98 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 391867D4E2 for ; Thu, 4 May 2017 09:41:06 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id D21DB1715B; Thu, 4 May 2017 09:41:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 391867D4E2 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 391867D4E2 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:48 +0200 Message-Id: <20170504094053.2329-6-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 04 May 2017 09:41:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/10] monitor: Move hmp_loadvm from monitor.c to hmp.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are going to move the rest of hmp snapshots functions there instead of monitor.c. Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier Reviewed-by: Dr. David Alan Gilbert --- hmp.c | 13 +++++++++++++ hmp.h | 1 + monitor.c | 13 ------------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/hmp.c b/hmp.c index ab407d6..f6b8738 100644 --- a/hmp.c +++ b/hmp.c @@ -19,6 +19,7 @@ #include "net/eth.h" #include "sysemu/char.h" #include "sysemu/block-backend.h" +#include "sysemu/sysemu.h" #include "qemu/config-file.h" #include "qemu/option.h" #include "qemu/timer.h" @@ -1268,6 +1269,18 @@ void hmp_snapshot_delete_blkdev_internal(Monitor *mo= n, const QDict *qdict) hmp_handle_error(mon, &err); } =20 +void hmp_loadvm(Monitor *mon, const QDict *qdict) +{ + int saved_vm_running =3D runstate_is_running(); + const char *name =3D qdict_get_str(qdict, "name"); + + vm_stop(RUN_STATE_RESTORE_VM); + + if (load_vmstate(name) =3D=3D 0 && saved_vm_running) { + vm_start(); + } +} + void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) { qmp_migrate_cancel(NULL); diff --git a/hmp.h b/hmp.h index 799fd37..385332c 100644 --- a/hmp.h +++ b/hmp.h @@ -63,6 +63,7 @@ void hmp_snapshot_blkdev_internal(Monitor *mon, const QDi= ct *qdict); void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict); void hmp_drive_mirror(Monitor *mon, const QDict *qdict); void hmp_drive_backup(Monitor *mon, const QDict *qdict); +void hmp_loadvm(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); diff --git a/monitor.c b/monitor.c index 62c9f81..ce11029 100644 --- a/monitor.c +++ b/monitor.c @@ -37,7 +37,6 @@ #include "net/slirp.h" #include "sysemu/char.h" #include "ui/qemu-spice.h" -#include "sysemu/sysemu.h" #include "sysemu/numa.h" #include "monitor/monitor.h" #include "qemu/config-file.h" @@ -1954,18 +1953,6 @@ void qmp_closefd(const char *fdname, Error **errp) error_setg(errp, QERR_FD_NOT_FOUND, fdname); } =20 -static void hmp_loadvm(Monitor *mon, const QDict *qdict) -{ - int saved_vm_running =3D runstate_is_running(); - const char *name =3D qdict_get_str(qdict, "name"); - - vm_stop(RUN_STATE_RESTORE_VM); - - if (load_vmstate(name) =3D=3D 0 && saved_vm_running) { - vm_start(); - } -} - int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp) { mon_fd_t *monfd; --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493890973981252.65650937924727; Thu, 4 May 2017 02:42:53 -0700 (PDT) Received: from localhost ([::1]:40718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DHf-0001Io-NP for importer@patchew.org; Thu, 04 May 2017 05:42:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DG2-0008H4-Ho for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DG1-0000gj-3r for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DG0-0000gL-Tv for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:09 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E091483F45 for ; Thu, 4 May 2017 09:41:07 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D7B31715B; Thu, 4 May 2017 09:41:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E091483F45 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E091483F45 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:49 +0200 Message-Id: <20170504094053.2329-7-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 04 May 2017 09:41:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/10] monitor: Move hmp_savevm from savevm.c to hmp.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is a monitor command, and has nothing migration specific in it. Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier Reviewed-by: Dr. David Alan Gilbert --- hmp.c | 5 +++++ hmp.h | 1 + include/sysemu/sysemu.h | 1 - migration/savevm.c | 5 ----- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hmp.c b/hmp.c index f6b8738..a82a952 100644 --- a/hmp.c +++ b/hmp.c @@ -1281,6 +1281,11 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict) } } =20 +void hmp_savevm(Monitor *mon, const QDict *qdict) +{ + save_vmstate(qdict_get_try_str(qdict, "name")); +} + void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) { qmp_migrate_cancel(NULL); diff --git a/hmp.h b/hmp.h index 385332c..b302c8d 100644 --- a/hmp.h +++ b/hmp.h @@ -64,6 +64,7 @@ void hmp_snapshot_delete_blkdev_internal(Monitor *mon, co= nst QDict *qdict); void hmp_drive_mirror(Monitor *mon, const QDict *qdict); void hmp_drive_backup(Monitor *mon, const QDict *qdict); void hmp_loadvm(Monitor *mon, const QDict *qdict); +void hmp_savevm(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b6daf9d..914c36c 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -75,7 +75,6 @@ void qemu_remove_exit_notifier(Notifier *notify); void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); =20 -void hmp_savevm(Monitor *mon, const QDict *qdict); int save_vmstate(const char *name); int load_vmstate(const char *name); void hmp_delvm(Monitor *mon, const QDict *qdict); diff --git a/migration/savevm.c b/migration/savevm.c index a89af80..8345255 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2171,11 +2171,6 @@ int save_vmstate(const char *name) return ret; } =20 -void hmp_savevm(Monitor *mon, const QDict *qdict) -{ - save_vmstate(qdict_get_try_str(qdict, "name")); -} - void qmp_xen_save_devices_state(const char *filename, Error **errp) { QEMUFile *f; --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493891236767263.69662380238196; Thu, 4 May 2017 02:47:16 -0700 (PDT) Received: from localhost ([::1]:40743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DLv-0005Iq-E8 for importer@patchew.org; Thu, 04 May 2017 05:47:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DG3-0008I8-N2 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DG2-0000i7-U5 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57692) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DG2-0000hE-LI for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:10 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 979BFBDD4 for ; Thu, 4 May 2017 09:41:09 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 400D61715B; Thu, 4 May 2017 09:41:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 979BFBDD4 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 979BFBDD4 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:50 +0200 Message-Id: <20170504094053.2329-8-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 04 May 2017 09:41:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/10] monitor: Move hmp_delvm from savevm.c to hmp.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It really uses block/* stuff, not migration one. Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier Reviewed-by: Dr. David Alan Gilbert --- hmp.c | 13 +++++++++++++ hmp.h | 1 + include/sysemu/sysemu.h | 1 - migration/savevm.c | 13 ------------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hmp.c b/hmp.c index a82a952..bb739ce 100644 --- a/hmp.c +++ b/hmp.c @@ -1286,6 +1286,19 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) save_vmstate(qdict_get_try_str(qdict, "name")); } =20 +void hmp_delvm(Monitor *mon, const QDict *qdict) +{ + BlockDriverState *bs; + Error *err; + const char *name =3D qdict_get_str(qdict, "name"); + + if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) { + error_reportf_err(err, + "Error while deleting snapshot on device '%s': ", + bdrv_get_device_name(bs)); + } +} + void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) { qmp_migrate_cancel(NULL); diff --git a/hmp.h b/hmp.h index b302c8d..6a402b1 100644 --- a/hmp.h +++ b/hmp.h @@ -65,6 +65,7 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict); void hmp_drive_backup(Monitor *mon, const QDict *qdict); void hmp_loadvm(Monitor *mon, const QDict *qdict); void hmp_savevm(Monitor *mon, const QDict *qdict); +void hmp_delvm(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 914c36c..e4f355ceb 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -77,7 +77,6 @@ void qemu_remove_machine_init_done_notifier(Notifier *not= ify); =20 int save_vmstate(const char *name); int load_vmstate(const char *name); -void hmp_delvm(Monitor *mon, const QDict *qdict); void hmp_info_snapshots(Monitor *mon, const QDict *qdict); =20 void qemu_announce_self(void); diff --git a/migration/savevm.c b/migration/savevm.c index 8345255..9e0bd9d 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2304,19 +2304,6 @@ int load_vmstate(const char *name) return 0; } =20 -void hmp_delvm(Monitor *mon, const QDict *qdict) -{ - BlockDriverState *bs; - Error *err; - const char *name =3D qdict_get_str(qdict, "name"); - - if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) { - error_reportf_err(err, - "Error while deleting snapshot on device '%s': ", - bdrv_get_device_name(bs)); - } -} - void hmp_info_snapshots(Monitor *mon, const QDict *qdict) { BlockDriverState *bs, *bs1; --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493891211042151.63441625794587; Thu, 4 May 2017 02:46:51 -0700 (PDT) Received: from localhost ([::1]:40742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DLV-00051J-FY for importer@patchew.org; Thu, 04 May 2017 05:46:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DG6-0008Kg-7O for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DG4-0000kU-KS for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37648) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DG4-0000j6-BE for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:12 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C3E57AE92 for ; Thu, 4 May 2017 09:41:11 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id E86F81715B; Thu, 4 May 2017 09:41:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4C3E57AE92 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4C3E57AE92 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:51 +0200 Message-Id: <20170504094053.2329-9-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 04 May 2017 09:41:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/10] monitor: Move hmp_info_snapshots from savevm.c to hmp.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It only uses block/* functions, nothing from migration. Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier Reviewed-by: Dr. David Alan Gilbert --- hmp.c | 143 ++++++++++++++++++++++++++++++++++++++++++++= ++ hmp.h | 1 + include/sysemu/sysemu.h | 1 - migration/savevm.c | 147 --------------------------------------------= ---- 4 files changed, 144 insertions(+), 148 deletions(-) diff --git a/hmp.c b/hmp.c index bb739ce..bd7b1ca 100644 --- a/hmp.c +++ b/hmp.c @@ -1299,6 +1299,149 @@ void hmp_delvm(Monitor *mon, const QDict *qdict) } } =20 +void hmp_info_snapshots(Monitor *mon, const QDict *qdict) +{ + BlockDriverState *bs, *bs1; + BdrvNextIterator it1; + QEMUSnapshotInfo *sn_tab, *sn; + bool no_snapshot =3D true; + int nb_sns, i; + int total; + int *global_snapshots; + AioContext *aio_context; + + typedef struct SnapshotEntry { + QEMUSnapshotInfo sn; + QTAILQ_ENTRY(SnapshotEntry) next; + } SnapshotEntry; + + typedef struct ImageEntry { + const char *imagename; + QTAILQ_ENTRY(ImageEntry) next; + QTAILQ_HEAD(, SnapshotEntry) snapshots; + } ImageEntry; + + QTAILQ_HEAD(, ImageEntry) image_list =3D + QTAILQ_HEAD_INITIALIZER(image_list); + + ImageEntry *image_entry, *next_ie; + SnapshotEntry *snapshot_entry; + + bs =3D bdrv_all_find_vmstate_bs(); + if (!bs) { + monitor_printf(mon, "No available block device supports snapshots\= n"); + return; + } + aio_context =3D bdrv_get_aio_context(bs); + + aio_context_acquire(aio_context); + nb_sns =3D bdrv_snapshot_list(bs, &sn_tab); + aio_context_release(aio_context); + + if (nb_sns < 0) { + monitor_printf(mon, "bdrv_snapshot_list: error %d\n", nb_sns); + return; + } + + for (bs1 =3D bdrv_first(&it1); bs1; bs1 =3D bdrv_next(&it1)) { + int bs1_nb_sns =3D 0; + ImageEntry *ie; + SnapshotEntry *se; + AioContext *ctx =3D bdrv_get_aio_context(bs1); + + aio_context_acquire(ctx); + if (bdrv_can_snapshot(bs1)) { + sn =3D NULL; + bs1_nb_sns =3D bdrv_snapshot_list(bs1, &sn); + if (bs1_nb_sns > 0) { + no_snapshot =3D false; + ie =3D g_new0(ImageEntry, 1); + ie->imagename =3D bdrv_get_device_name(bs1); + QTAILQ_INIT(&ie->snapshots); + QTAILQ_INSERT_TAIL(&image_list, ie, next); + for (i =3D 0; i < bs1_nb_sns; i++) { + se =3D g_new0(SnapshotEntry, 1); + se->sn =3D sn[i]; + QTAILQ_INSERT_TAIL(&ie->snapshots, se, next); + } + } + g_free(sn); + } + aio_context_release(ctx); + } + + if (no_snapshot) { + monitor_printf(mon, "There is no snapshot available.\n"); + return; + } + + global_snapshots =3D g_new0(int, nb_sns); + total =3D 0; + for (i =3D 0; i < nb_sns; i++) { + SnapshotEntry *next_sn; + if (bdrv_all_find_snapshot(sn_tab[i].name, &bs1) =3D=3D 0) { + global_snapshots[total] =3D i; + total++; + QTAILQ_FOREACH(image_entry, &image_list, next) { + QTAILQ_FOREACH_SAFE(snapshot_entry, &image_entry->snapshot= s, + next, next_sn) { + if (!strcmp(sn_tab[i].name, snapshot_entry->sn.name)) { + QTAILQ_REMOVE(&image_entry->snapshots, snapshot_en= try, + next); + g_free(snapshot_entry); + } + } + } + } + } + + monitor_printf(mon, "List of snapshots present on all disks:\n"); + + if (total > 0) { + bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL); + monitor_printf(mon, "\n"); + for (i =3D 0; i < total; i++) { + sn =3D &sn_tab[global_snapshots[i]]; + /* The ID is not guaranteed to be the same on all images, so + * overwrite it. + */ + pstrcpy(sn->id_str, sizeof(sn->id_str), "--"); + bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, sn); + monitor_printf(mon, "\n"); + } + } else { + monitor_printf(mon, "None\n"); + } + + QTAILQ_FOREACH(image_entry, &image_list, next) { + if (QTAILQ_EMPTY(&image_entry->snapshots)) { + continue; + } + monitor_printf(mon, + "\nList of partial (non-loadable) snapshots on '%s'= :\n", + image_entry->imagename); + bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL); + monitor_printf(mon, "\n"); + QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) { + bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, + &snapshot_entry->sn); + monitor_printf(mon, "\n"); + } + } + + QTAILQ_FOREACH_SAFE(image_entry, &image_list, next, next_ie) { + SnapshotEntry *next_sn; + QTAILQ_FOREACH_SAFE(snapshot_entry, &image_entry->snapshots, next, + next_sn) { + g_free(snapshot_entry); + } + g_free(image_entry); + } + g_free(sn_tab); + g_free(global_snapshots); + +} + void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) { qmp_migrate_cancel(NULL); diff --git a/hmp.h b/hmp.h index 6a402b1..37bb65a 100644 --- a/hmp.h +++ b/hmp.h @@ -66,6 +66,7 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict); void hmp_loadvm(Monitor *mon, const QDict *qdict); void hmp_savevm(Monitor *mon, const QDict *qdict); void hmp_delvm(Monitor *mon, const QDict *qdict); +void hmp_info_snapshots(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index e4f355ceb..15656b7 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -77,7 +77,6 @@ void qemu_remove_machine_init_done_notifier(Notifier *not= ify); =20 int save_vmstate(const char *name); int load_vmstate(const char *name); -void hmp_info_snapshots(Monitor *mon, const QDict *qdict); =20 void qemu_announce_self(void); =20 diff --git a/migration/savevm.c b/migration/savevm.c index 9e0bd9d..ff78a89 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -33,15 +33,12 @@ #include "hw/qdev.h" #include "hw/xen/xen.h" #include "net/net.h" -#include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "qemu/timer.h" -#include "audio/audio.h" #include "migration/migration.h" #include "migration/postcopy-ram.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" -#include "qemu/sockets.h" #include "qemu/queue.h" #include "sysemu/cpus.h" #include "exec/memory.h" @@ -50,7 +47,6 @@ #include "qemu/bitops.h" #include "qemu/iov.h" #include "block/snapshot.h" -#include "block/qapi.h" #include "qemu/cutils.h" #include "io/channel-buffer.h" #include "io/channel-file.h" @@ -2304,149 +2300,6 @@ int load_vmstate(const char *name) return 0; } =20 -void hmp_info_snapshots(Monitor *mon, const QDict *qdict) -{ - BlockDriverState *bs, *bs1; - BdrvNextIterator it1; - QEMUSnapshotInfo *sn_tab, *sn; - bool no_snapshot =3D true; - int nb_sns, i; - int total; - int *global_snapshots; - AioContext *aio_context; - - typedef struct SnapshotEntry { - QEMUSnapshotInfo sn; - QTAILQ_ENTRY(SnapshotEntry) next; - } SnapshotEntry; - - typedef struct ImageEntry { - const char *imagename; - QTAILQ_ENTRY(ImageEntry) next; - QTAILQ_HEAD(, SnapshotEntry) snapshots; - } ImageEntry; - - QTAILQ_HEAD(, ImageEntry) image_list =3D - QTAILQ_HEAD_INITIALIZER(image_list); - - ImageEntry *image_entry, *next_ie; - SnapshotEntry *snapshot_entry; - - bs =3D bdrv_all_find_vmstate_bs(); - if (!bs) { - monitor_printf(mon, "No available block device supports snapshots\= n"); - return; - } - aio_context =3D bdrv_get_aio_context(bs); - - aio_context_acquire(aio_context); - nb_sns =3D bdrv_snapshot_list(bs, &sn_tab); - aio_context_release(aio_context); - - if (nb_sns < 0) { - monitor_printf(mon, "bdrv_snapshot_list: error %d\n", nb_sns); - return; - } - - for (bs1 =3D bdrv_first(&it1); bs1; bs1 =3D bdrv_next(&it1)) { - int bs1_nb_sns =3D 0; - ImageEntry *ie; - SnapshotEntry *se; - AioContext *ctx =3D bdrv_get_aio_context(bs1); - - aio_context_acquire(ctx); - if (bdrv_can_snapshot(bs1)) { - sn =3D NULL; - bs1_nb_sns =3D bdrv_snapshot_list(bs1, &sn); - if (bs1_nb_sns > 0) { - no_snapshot =3D false; - ie =3D g_new0(ImageEntry, 1); - ie->imagename =3D bdrv_get_device_name(bs1); - QTAILQ_INIT(&ie->snapshots); - QTAILQ_INSERT_TAIL(&image_list, ie, next); - for (i =3D 0; i < bs1_nb_sns; i++) { - se =3D g_new0(SnapshotEntry, 1); - se->sn =3D sn[i]; - QTAILQ_INSERT_TAIL(&ie->snapshots, se, next); - } - } - g_free(sn); - } - aio_context_release(ctx); - } - - if (no_snapshot) { - monitor_printf(mon, "There is no snapshot available.\n"); - return; - } - - global_snapshots =3D g_new0(int, nb_sns); - total =3D 0; - for (i =3D 0; i < nb_sns; i++) { - SnapshotEntry *next_sn; - if (bdrv_all_find_snapshot(sn_tab[i].name, &bs1) =3D=3D 0) { - global_snapshots[total] =3D i; - total++; - QTAILQ_FOREACH(image_entry, &image_list, next) { - QTAILQ_FOREACH_SAFE(snapshot_entry, &image_entry->snapshot= s, - next, next_sn) { - if (!strcmp(sn_tab[i].name, snapshot_entry->sn.name)) { - QTAILQ_REMOVE(&image_entry->snapshots, snapshot_en= try, - next); - g_free(snapshot_entry); - } - } - } - } - } - - monitor_printf(mon, "List of snapshots present on all disks:\n"); - - if (total > 0) { - bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL); - monitor_printf(mon, "\n"); - for (i =3D 0; i < total; i++) { - sn =3D &sn_tab[global_snapshots[i]]; - /* The ID is not guaranteed to be the same on all images, so - * overwrite it. - */ - pstrcpy(sn->id_str, sizeof(sn->id_str), "--"); - bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, sn); - monitor_printf(mon, "\n"); - } - } else { - monitor_printf(mon, "None\n"); - } - - QTAILQ_FOREACH(image_entry, &image_list, next) { - if (QTAILQ_EMPTY(&image_entry->snapshots)) { - continue; - } - monitor_printf(mon, - "\nList of partial (non-loadable) snapshots on '%s'= :\n", - image_entry->imagename); - bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL); - monitor_printf(mon, "\n"); - QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) { - bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, - &snapshot_entry->sn); - monitor_printf(mon, "\n"); - } - } - - QTAILQ_FOREACH_SAFE(image_entry, &image_list, next, next_ie) { - SnapshotEntry *next_sn; - QTAILQ_FOREACH_SAFE(snapshot_entry, &image_entry->snapshots, next, - next_sn) { - g_free(snapshot_entry); - } - g_free(image_entry); - } - g_free(sn_tab); - g_free(global_snapshots); - -} - void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev) { qemu_ram_set_idstr(mr->ram_block, --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493891374729940.8591989438572; Thu, 4 May 2017 02:49:34 -0700 (PDT) Received: from localhost ([::1]:40752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DO9-0007Tn-Hj for importer@patchew.org; Thu, 04 May 2017 05:49:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DGB-0008Qk-3R for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DG7-0000q9-VR for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42178) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DG7-0000oR-P7 for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:15 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BBC7E2D9FDB for ; Thu, 4 May 2017 09:41:14 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EAD31715B; Thu, 4 May 2017 09:41:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BBC7E2D9FDB Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BBC7E2D9FDB From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:52 +0200 Message-Id: <20170504094053.2329-10-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 04 May 2017 09:41:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/10] migration: Move postcopy-ram.h to migration/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is internal to migration, not intended for other users. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 2 +- migration/postcopy-ram.c | 2 +- {include/migration =3D> migration}/postcopy-ram.h | 0 migration/ram.c | 2 +- migration/savevm.c | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename {include/migration =3D> migration}/postcopy-ram.h (100%) diff --git a/migration/migration.c b/migration/migration.c index 353f272..799952c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -26,7 +26,7 @@ #include "qemu/sockets.h" #include "qemu/rcu.h" #include "migration/block.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "qemu/thread.h" #include "qmp-commands.h" #include "trace.h" diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index e3f4a37..cdadaf6 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -20,7 +20,7 @@ =20 #include "qemu-common.h" #include "migration/migration.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h" #include "qemu/error-report.h" diff --git a/include/migration/postcopy-ram.h b/migration/postcopy-ram.h similarity index 100% rename from include/migration/postcopy-ram.h rename to migration/postcopy-ram.h diff --git a/migration/ram.c b/migration/ram.c index 1f03469..4918c11 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -36,7 +36,7 @@ #include "qemu/timer.h" #include "qemu/main-loop.h" #include "migration/migration.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "exec/address-spaces.h" #include "migration/page_cache.h" #include "qemu/error-report.h" diff --git a/migration/savevm.c b/migration/savevm.c index ff78a89..7668510 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -36,7 +36,7 @@ #include "sysemu/sysemu.h" #include "qemu/timer.h" #include "migration/migration.h" -#include "migration/postcopy-ram.h" +#include "postcopy-ram.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/queue.h" --=20 2.9.3 From nobody Tue May 7 00:02:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493891269967811.6970042122414; Thu, 4 May 2017 02:47:49 -0700 (PDT) Received: from localhost ([::1]:40744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DMR-0006Mv-Af for importer@patchew.org; Thu, 04 May 2017 05:47:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6DGB-0008Qh-2h for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6DG9-0000tA-Nh for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57780) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6DG9-0000rn-GV for qemu-devel@nongnu.org; Thu, 04 May 2017 05:41:17 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 716A315D9 for ; Thu, 4 May 2017 09:41:16 +0000 (UTC) Received: from secure.mitica (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ADF11715B; Thu, 4 May 2017 09:41:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 716A315D9 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 716A315D9 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 11:40:53 +0200 Message-Id: <20170504094053.2329-11-quintela@redhat.com> In-Reply-To: <20170504094053.2329-1-quintela@redhat.com> References: <20170504094053.2329-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 04 May 2017 09:41:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/10] migration: Extra tracing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" A couple more traces that would have made fixing that postcopy bug a bit easier. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 2 ++ migration/trace-events | 2 ++ 2 files changed, 4 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 4918c11..293d27c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -788,6 +788,7 @@ static int ram_save_page(RAMState *rs, PageSearchStatus= *pss, bool last_stage) ram_addr_t offset =3D pss->page << TARGET_PAGE_BITS; =20 p =3D block->host + offset; + trace_ram_save_page(block->idstr, (uint64_t)offset, p); =20 /* In doubt sent page as normal */ bytes_xmit =3D 0; @@ -2550,6 +2551,7 @@ static int ram_load(QEMUFile *f, void *opaque, int ve= rsion_id) ret =3D -EINVAL; break; } + trace_ram_load_loop(block->idstr, (uint64_t)addr, flags, host); } =20 switch (flags & ~RAM_SAVE_FLAG_CONTINUE) { diff --git a/migration/trace-events b/migration/trace-events index b8f01a2..5b8ccf3 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -69,8 +69,10 @@ migration_bitmap_sync_start(void) "" migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64 migration_throttle(void) "" ram_discard_range(const char *rbname, uint64_t start, size_t len) "%s: sta= rt: %" PRIx64 " %zx" +ram_load_loop(const char *rbname, uint64_t addr, int flags, void *host) "%= s: addr: %" PRIx64 " flags: %x host: %p" ram_load_postcopy_loop(uint64_t addr, int flags) "@%" PRIx64 " %x" ram_postcopy_send_discard_bitmap(void) "" +ram_save_page(const char *rbname, uint64_t offset, void *host) "%s: offset= : %" PRIx64 " host: %p" ram_save_queue_pages(const char *rbname, size_t start, size_t len) "%s: st= art: %zx len: %zx" =20 # migration/migration.c --=20 2.9.3