qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] bitmaps patches for 2020-10-26
@ 2020-10-26 12:02 Eric Blake
  2020-10-26 12:02 ` [PULL 1/2] migration/block-dirty-bitmap: fix larger granularity bitmaps Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Blake @ 2020-10-26 12:02 UTC (permalink / raw)
  To: qemu-devel

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(-)
-- 
2.29.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PULL 1/2] migration/block-dirty-bitmap: fix larger granularity bitmaps
  2020-10-26 12:02 [PULL 0/2] bitmaps patches for 2020-10-26 Eric Blake
@ 2020-10-26 12:02 ` Eric Blake
  2020-10-26 12:02 ` [PULL 2/2] migration/block-dirty-bitmap: fix uninitialized variable warning Eric Blake
  2020-10-27 10:25 ` [PULL 0/2] bitmaps patches for 2020-10-26 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2020-10-26 12:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Vladimir Sementsov-Ogievskiy, open list:Dirty Bitmaps,
	Juan Quintela, Stefan Reiter, Dr. David Alan Gilbert,
	Stefan Hajnoczi, John Snow

From: Stefan Reiter <s.reiter@proxmox.com>

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.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Message-Id: <20201021144456.1072-1-s.reiter@proxmox.com>
Fixes: b35ebdf07 migration: add postcopy migration of dirty bitmaps
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: Use correct type for 8ULL, use () to avoid overflow]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 migration/block-dirty-bitmap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 5bef793ac0eb..98921db77271 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -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;
         }
-- 
2.29.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PULL 2/2] migration/block-dirty-bitmap: fix uninitialized variable warning
  2020-10-26 12:02 [PULL 0/2] bitmaps patches for 2020-10-26 Eric Blake
  2020-10-26 12:02 ` [PULL 1/2] migration/block-dirty-bitmap: fix larger granularity bitmaps Eric Blake
@ 2020-10-26 12:02 ` Eric Blake
  2020-10-27 10:25 ` [PULL 0/2] bitmaps patches for 2020-10-26 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2020-10-26 12:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Vladimir Sementsov-Ogievskiy, open list:Dirty Bitmaps,
	Juan Quintela, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Euler Robot, Chen Qun, John Snow

From: Chen Qun <kuhn.chenqun@huawei.com>

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));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Message-Id: <20201014114430.1898684-1-kuhn.chenqun@huawei.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
[eblake: commit message grammar tweaks]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 migration/block-dirty-bitmap.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 98921db77271..c61d382be87c 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -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);
             }
         }

-- 
2.29.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PULL 0/2] bitmaps patches for 2020-10-26
  2020-10-26 12:02 [PULL 0/2] bitmaps patches for 2020-10-26 Eric Blake
  2020-10-26 12:02 ` [PULL 1/2] migration/block-dirty-bitmap: fix larger granularity bitmaps Eric Blake
  2020-10-26 12:02 ` [PULL 2/2] migration/block-dirty-bitmap: fix uninitialized variable warning Eric Blake
@ 2020-10-27 10:25 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-10-27 10:25 UTC (permalink / raw)
  To: Eric Blake; +Cc: QEMU Developers

On Mon, 26 Oct 2020 at 12:05, Eric Blake <eblake@redhat.com> wrote:
>
> 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


Applied, thanks.

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

-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-27 10:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 12:02 [PULL 0/2] bitmaps patches for 2020-10-26 Eric Blake
2020-10-26 12:02 ` [PULL 1/2] migration/block-dirty-bitmap: fix larger granularity bitmaps Eric Blake
2020-10-26 12:02 ` [PULL 2/2] migration/block-dirty-bitmap: fix uninitialized variable warning Eric Blake
2020-10-27 10:25 ` [PULL 0/2] bitmaps patches for 2020-10-26 Peter Maydell

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).