All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] Bitmaps patches
@ 2018-07-04  6:33 John Snow
  2018-07-04  6:33 ` [Qemu-devel] [PULL 1/2] block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked John Snow
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Snow @ 2018-07-04  6:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, jsnow

The following changes since commit 79c2b203a932db5882a3f328db53e5a448cd47f9:

  Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180703-pull-request' into staging (2018-07-03 21:09:27 +0100)

are available in the Git repository at:

  https://github.com/jnsnow/qemu.git tags/bitmaps-pull-request

for you to fetch changes up to 58f72b965e9e1820d246329461216c4d13140122:

  dirty-bitmap: fix double lock on bitmap enabling (2018-07-04 02:12:49 -0400)

----------------------------------------------------------------
Pull request

----------------------------------------------------------------

Vladimir Sementsov-Ogievskiy (2):
  block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked
  dirty-bitmap: fix double lock on bitmap enabling

 block/dirty-bitmap.c           | 12 +++++++++---
 include/block/dirty-bitmap.h   |  1 +
 migration/block-dirty-bitmap.c |  4 ++--
 3 files changed, 12 insertions(+), 5 deletions(-)

-- 
2.14.4

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

* [Qemu-devel] [PULL 1/2] block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked
  2018-07-04  6:33 [Qemu-devel] [PULL 0/2] Bitmaps patches John Snow
@ 2018-07-04  6:33 ` John Snow
  2018-07-04  6:33 ` [Qemu-devel] [PULL 2/2] dirty-bitmap: fix double lock on bitmap enabling John Snow
  2018-07-05 13:25 ` [Qemu-devel] [PULL 0/2] Bitmaps patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: John Snow @ 2018-07-04  6:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, jsnow, Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Add _locked version of bdrv_enable_dirty_bitmap, to fix dirty bitmap
migration in the following patch.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20180625165745.25259-2-vsementsov@virtuozzo.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/dirty-bitmap.c         | 9 +++++++--
 include/block/dirty-bitmap.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index db1782ec1f..93744b3565 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -241,6 +241,12 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
     return 0;
 }
 
+void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap)
+{
+    assert(!bdrv_dirty_bitmap_frozen(bitmap));
+    bitmap->disabled = false;
+}
+
 /* Called with BQL taken. */
 void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap)
 {
@@ -424,8 +430,7 @@ void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
 {
     bdrv_dirty_bitmap_lock(bitmap);
-    assert(!bdrv_dirty_bitmap_frozen(bitmap));
-    bitmap->disabled = false;
+    bdrv_enable_dirty_bitmap_locked(bitmap);
     bdrv_dirty_bitmap_unlock(bitmap);
 }
 
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
index 288dc6adb6..259bd27c40 100644
--- a/include/block/dirty-bitmap.h
+++ b/include/block/dirty-bitmap.h
@@ -32,6 +32,7 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
                                          Error **errp);
 void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
+void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap);
 BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
 uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
 uint32_t bdrv_dirty_bitmap_granularity(const BdrvDirtyBitmap *bitmap);
-- 
2.14.4

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

* [Qemu-devel] [PULL 2/2] dirty-bitmap: fix double lock on bitmap enabling
  2018-07-04  6:33 [Qemu-devel] [PULL 0/2] Bitmaps patches John Snow
  2018-07-04  6:33 ` [Qemu-devel] [PULL 1/2] block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked John Snow
@ 2018-07-04  6:33 ` John Snow
  2018-07-05 13:25 ` [Qemu-devel] [PULL 0/2] Bitmaps patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: John Snow @ 2018-07-04  6:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, jsnow, Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Bitmap lock/unlock were added to bdrv_enable_dirty_bitmap in
8b1402ce80d, but some places were not updated correspondingly, which
leads to trying to take this lock twice, which is dead-lock. Fix this.

Actually, iotest 199 (about dirty bitmap postcopy migration) is broken
now, and this fixes it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20180625165745.25259-3-vsementsov@virtuozzo.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/dirty-bitmap.c           | 3 ++-
 migration/block-dirty-bitmap.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 93744b3565..c9b8a6fd52 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -250,8 +250,9 @@ void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap)
 /* Called with BQL taken. */
 void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap)
 {
+    assert(bitmap->mutex == bitmap->successor->mutex);
     qemu_mutex_lock(bitmap->mutex);
-    bdrv_enable_dirty_bitmap(bitmap->successor);
+    bdrv_enable_dirty_bitmap_locked(bitmap->successor);
     qemu_mutex_unlock(bitmap->mutex);
 }
 
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 3bafbbdc4c..477826330c 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -511,7 +511,7 @@ void dirty_bitmap_mig_before_vm_start(void)
         DirtyBitmapLoadBitmapState *b = item->data;
 
         if (b->migrated) {
-            bdrv_enable_dirty_bitmap(b->bitmap);
+            bdrv_enable_dirty_bitmap_locked(b->bitmap);
         } else {
             bdrv_dirty_bitmap_enable_successor(b->bitmap);
         }
@@ -547,7 +547,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s)
         if (enabled_bitmaps == NULL) {
             /* in postcopy */
             bdrv_reclaim_dirty_bitmap_locked(s->bs, s->bitmap, &error_abort);
-            bdrv_enable_dirty_bitmap(s->bitmap);
+            bdrv_enable_dirty_bitmap_locked(s->bitmap);
         } else {
             /* target not started, successor must be empty */
             int64_t count = bdrv_get_dirty_count(s->bitmap);
-- 
2.14.4

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

* Re: [Qemu-devel] [PULL 0/2] Bitmaps patches
  2018-07-04  6:33 [Qemu-devel] [PULL 0/2] Bitmaps patches John Snow
  2018-07-04  6:33 ` [Qemu-devel] [PULL 1/2] block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked John Snow
  2018-07-04  6:33 ` [Qemu-devel] [PULL 2/2] dirty-bitmap: fix double lock on bitmap enabling John Snow
@ 2018-07-05 13:25 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2018-07-05 13:25 UTC (permalink / raw)
  To: John Snow; +Cc: QEMU Developers

On 4 July 2018 at 07:33, John Snow <jsnow@redhat.com> wrote:
> The following changes since commit 79c2b203a932db5882a3f328db53e5a448cd47f9:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180703-pull-request' into staging (2018-07-03 21:09:27 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/jnsnow/qemu.git tags/bitmaps-pull-request
>
> for you to fetch changes up to 58f72b965e9e1820d246329461216c4d13140122:
>
>   dirty-bitmap: fix double lock on bitmap enabling (2018-07-04 02:12:49 -0400)
>
> ----------------------------------------------------------------
> Pull request
>
> ----------------------------------------------------------------
>


Applied, thanks.

-- PMM

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

end of thread, other threads:[~2018-07-05 13:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04  6:33 [Qemu-devel] [PULL 0/2] Bitmaps patches John Snow
2018-07-04  6:33 ` [Qemu-devel] [PULL 1/2] block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked John Snow
2018-07-04  6:33 ` [Qemu-devel] [PULL 2/2] dirty-bitmap: fix double lock on bitmap enabling John Snow
2018-07-05 13:25 ` [Qemu-devel] [PULL 0/2] Bitmaps patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.