Skip to contentSkip to conversation

bitmaps patches for 2020-10-26

GIT PULL Applied Eric Blake 2 participants 4 messages Oct 26, 2020 – Oct 27, 2020

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

The following changes since commit 4c5b97bfd0dd54dc27717ae8d1cd10e14eef1430:

Merge remote-tracking branch 'remotes/kraxel/tags/modules-20201022-pull-request' into staging (2020-10-22 12:33:21 +0100)

are available in the Git repository at:

https://repo.or.cz/qemu/ericb.git tags/pull-bitmaps-2020-10-26

for you to fetch changes up to a024890a64085d3d37ad7eda164775251285c14c:

migration/block-dirty-bitmap: fix uninitialized variable warning (2020-10-26 06:56:24 -0500)

----------------------------------------------------------------
bitmaps patches for 2020-10-26

- fix infloop on large bitmap granularity
- silence compiler warning

----------------------------------------------------------------
Chen Qun (1):
migration/block-dirty-bitmap: fix uninitialized variable warning

Stefan Reiter (1):
migration/block-dirty-bitmap: fix larger granularity bitmaps

 migration/block-dirty-bitmap.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
Signature · 1 line
2.29.0
author
#1 lore raw

[PULL 2/2] migration/block-dirty-bitmap: fix uninitialized variable warning

From: Chen Qun <[email protected]>

A default value is provided for the variable 'bitmap_name' to avoid a compiler warning.

The compiler showed the warning:
migration/block-dirty-bitmap.c:1090:13: warning: ‘bitmap_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]

       g_strlcpy(s->bitmap_name, bitmap_name, sizeof(s->bitmap_name));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message-Id: <[email protected]>

[eblake: commit message grammar tweaks]
---
 migration/block-dirty-bitmap.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
migration/block-dirty-bitmap.c +9 -12
index 98921db77271..c61d382be87c 100644
@@ -1072,18 +1072,15 @@ static int dirty_bitmap_load_header(QEMUFile *f, DBMLoadState *s,
             return -EINVAL;
         }
 
-        if (!s->cancelled) {
-            if (bitmap_alias_map) {
-                bitmap_name = g_hash_table_lookup(bitmap_alias_map,
-                                                  s->bitmap_alias);
-                if (!bitmap_name) {
-                    error_report("Error: Unknown bitmap alias '%s' on node "
-                                 "'%s' (alias '%s')", s->bitmap_alias,
-                                 s->bs->node_name, s->node_alias);
-                    cancel_incoming_locked(s);
-                }
-            } else {
-                bitmap_name = s->bitmap_alias;
+        bitmap_name = s->bitmap_alias;
+        if (!s->cancelled && bitmap_alias_map) {
+            bitmap_name = g_hash_table_lookup(bitmap_alias_map,
+                                              s->bitmap_alias);
+            if (!bitmap_name) {
+                error_report("Error: Unknown bitmap alias '%s' on node "
+                             "'%s' (alias '%s')", s->bitmap_alias,
+                             s->bs->node_name, s->node_alias);
+                cancel_incoming_locked(s);
             }
         }
 
Signature · 1 line
2.29.0
author
#2 lore raw

[PULL 1/2] migration/block-dirty-bitmap: fix larger granularity bitmaps

In reply to Eric Blake

From: Stefan Reiter <[email protected]>

sectors_per_chunk is a 64 bit integer, but the calculation is done in 32 bits, leading to an overflow for coarse bitmap granularities.

If that results in the value 0, it leads to a hang where no progress is made but send_bitmap_bits is constantly called with nr_sectors being 0.

Message-Id: <[email protected]>

Fixes b35ebdf07 migration: add postcopy migration of dirty bitmaps
[eblake: Use correct type for 8ULL, use () to avoid overflow]
---
 migration/block-dirty-bitmap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
migration/block-dirty-bitmap.c +3 -2
index 5bef793ac0eb..98921db77271 100644
@@ -562,8 +562,9 @@ static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs,
         dbms->bitmap_alias = g_strdup(bitmap_alias);
         dbms->bitmap = bitmap;
         dbms->total_sectors = bdrv_nb_sectors(bs);
-        dbms->sectors_per_chunk = CHUNK_SIZE * 8 *
-            bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS;
+        dbms->sectors_per_chunk = CHUNK_SIZE * 8LLU *
+            (bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS);
+        assert(dbms->sectors_per_chunk != 0);
         if (bdrv_dirty_bitmap_enabled(bitmap)) {
             dbms->flags |= DIRTY_BITMAP_MIG_START_FLAG_ENABLED;
         }
Signature · 1 line
2.29.0
#3 lore raw
In reply to Eric Blake
Quoted 11 lines · Eric Blake

The following changes since commit 4c5b97bfd0dd54dc27717ae8d1cd10e14eef1430:

Merge remote-tracking branch 'remotes/kraxel/tags/modules-20201022-pull-request' into staging (2020-10-22 12:33:21 +0100)

are available in the Git repository at:

https://repo.or.cz/qemu/ericb.git tags/pull-bitmaps-2020-10-26

for you to fetch changes up to a024890a64085d3d37ad7eda164775251285c14c:

Quoted 7 lines

migration/block-dirty-bitmap: fix uninitialized variable warning (2020-10-26 06:56:24 -0500)

----------------------------------------------------------------
bitmaps patches for 2020-10-26

- fix infloop on large bitmap granularity
- silence compiler warning

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM