qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock
@ 2017-04-06 13:14 Juan Quintela
  2017-04-06 13:14 ` [Qemu-devel] [PATCH] ram: Remove migration_bitmap_extend() Juan Quintela
  2017-04-06 14:11 ` [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock Eric Blake
  0 siblings, 2 replies; 3+ messages in thread
From: Juan Quintela @ 2017-04-06 13:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Hi

For v2 this is a rebase on top of all the changes that happened in the
prvious two series.

Please, review.

[RFC]
This series split the migration and unsent bitmaps by ramblock.  This
makes it easier to synchronize in small bits.  This is on top of the
RAMState and not-hotplug series.

Why?

reason 1:

People have complained that by the time that we detect that a page is
sent, it has already been marked dirty "again" inside kvm, so we are
going to send it again.  On top of this patch, my idea is, for words
of the bitmap that have any bit set, just synchonize the bitmap before
sending the pages.  I have not looking into performance numbers yet,
jsut asking for comments about how it is done.

reason 2:

In case where the host page is a multiple of the the TARGET_PAGE_SIZE,
we do a lot of work when we are synchronizing the bitmaps to pass it
to target page size.  The idea is to change the bitmaps on that
RAMBlocks to mean host page size and not TARGET_PAGE_SIZE.

Note that there are two reason for this, ARM and PPC do things like
guests with 4kb pages on hosts with 16/64kb hosts, and then we have
HugePages.  Note all the workarounds that postcopy has to do because
to work in HugePages size.

Please, comment?

Later, Juan.


*** BLURB HERE ***

Juan Quintela (1):
  ram: Remove migration_bitmap_extend()

 exec.c                  |  1 -
 include/exec/ram_addr.h |  2 --
 migration/ram.c         | 34 ----------------------------------
 3 files changed, 37 deletions(-)

-- 
2.9.3

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

* [Qemu-devel] [PATCH] ram: Remove migration_bitmap_extend()
  2017-04-06 13:14 [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock Juan Quintela
@ 2017-04-06 13:14 ` Juan Quintela
  2017-04-06 14:11 ` [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock Eric Blake
  1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2017-04-06 13:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

We have disabled memory hotplug, so we don't need to handle
migration_bitamp there.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 exec.c                  |  1 -
 include/exec/ram_addr.h |  2 --
 migration/ram.c         | 34 ----------------------------------
 3 files changed, 37 deletions(-)

diff --git a/exec.c b/exec.c
index de843f4..c2def9e 100644
--- a/exec.c
+++ b/exec.c
@@ -1758,7 +1758,6 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
     new_ram_size = MAX(old_ram_size,
               (new_block->offset + new_block->max_length) >> TARGET_PAGE_BITS);
     if (new_ram_size > old_ram_size) {
-        migration_bitmap_extend(old_ram_size, new_ram_size);
         dirty_memory_extend(old_ram_size, new_ram_size);
     }
     /* Keep the list sorted from biggest to smallest block.  Unlike QTAILQ,
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index a8411c7..c9ddcd0 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -413,7 +413,5 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned long *dest,
 
     return num_dirty;
 }
-
-void migration_bitmap_extend(ram_addr_t old, ram_addr_t new);
 #endif
 #endif
diff --git a/migration/ram.c b/migration/ram.c
index 92d6ff7..f05080f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1496,40 +1496,6 @@ static void ram_state_reset(RAMState *rs)
 
 #define MAX_WAIT 50 /* ms, half buffered_file limit */
 
-void migration_bitmap_extend(ram_addr_t old, ram_addr_t new)
-{
-    RAMState *rs = &ram_state;
-
-    /* called in qemu main thread, so there is
-     * no writing race against this migration_bitmap
-     */
-    if (rs->ram_bitmap) {
-        RAMBitmap *old_bitmap = rs->ram_bitmap, *bitmap;
-        bitmap = g_new(RAMBitmap, 1);
-        bitmap->bmap = bitmap_new(new);
-
-        /* prevent migration_bitmap content from being set bit
-         * by migration_bitmap_sync_range() at the same time.
-         * it is safe to migration if migration_bitmap is cleared bit
-         * at the same time.
-         */
-        qemu_mutex_lock(&rs->bitmap_mutex);
-        bitmap_copy(bitmap->bmap, old_bitmap->bmap, old);
-        bitmap_set(bitmap->bmap, old, new - old);
-
-        /* We don't have a way to safely extend the sentmap
-         * with RCU; so mark it as missing, entry to postcopy
-         * will fail.
-         */
-        bitmap->unsentmap = NULL;
-
-        atomic_rcu_set(&rs->ram_bitmap, bitmap);
-        qemu_mutex_unlock(&rs->bitmap_mutex);
-        rs->migration_dirty_pages += new - old;
-        call_rcu(old_bitmap, migration_bitmap_free, rcu);
-    }
-}
-
 /*
  * 'expected' is the value you expect the bitmap mostly to be full
  * of; it won't bother printing lines that are all this value.
-- 
2.9.3

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

* Re: [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock
  2017-04-06 13:14 [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock Juan Quintela
  2017-04-06 13:14 ` [Qemu-devel] [PATCH] ram: Remove migration_bitmap_extend() Juan Quintela
@ 2017-04-06 14:11 ` Eric Blake
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2017-04-06 14:11 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

On 04/06/2017 08:14 AM, Juan Quintela wrote:
> Hi
> 
> For v2 this is a rebase on top of all the changes that happened in the
> prvious two series.
> 

> 
> Please, comment?
> 
> Later, Juan.
> 
> 
> *** BLURB HERE ***
> 
> Juan Quintela (1):
>   ram: Remove migration_bitmap_extend()

Is this the intended patch?

> 
>  exec.c                  |  1 -
>  include/exec/ram_addr.h |  2 --
>  migration/ram.c         | 34 ----------------------------------
>  3 files changed, 37 deletions(-)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

end of thread, other threads:[~2017-04-06 14:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-06 13:14 [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock Juan Quintela
2017-04-06 13:14 ` [Qemu-devel] [PATCH] ram: Remove migration_bitmap_extend() Juan Quintela
2017-04-06 14:11 ` [Qemu-devel] [PATCH v2] Split migration bitmaps by ramblock Eric Blake

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