qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough
@ 2019-07-18  1:25 Wei Yang
  2019-07-18  1:37 ` Peter Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wei Yang @ 2019-07-18  1:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Wei Yang, dgilbert, quintela

RAMBlock->used_length is always passed to migration_bitmap_sync_range(),
which could be retrieved from RAMBlock.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 migration/ram.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index 908517fc2b..0a6070d787 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,
     return ret;
 }
 
-static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb,
-                                        ram_addr_t length)
+static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb)
 {
     rs->migration_dirty_pages +=
-        cpu_physical_memory_sync_dirty_bitmap(rb, 0, length,
+        cpu_physical_memory_sync_dirty_bitmap(rb, 0, rb->used_length,
                                               &rs->num_dirty_pages_period);
 }
 
@@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)
     qemu_mutex_lock(&rs->bitmap_mutex);
     rcu_read_lock();
     RAMBLOCK_FOREACH_NOT_IGNORED(block) {
-        migration_bitmap_sync_range(rs, block, block->used_length);
+        migration_bitmap_sync_range(rs, block);
     }
     ram_counters.remaining = ram_bytes_remaining();
     rcu_read_unlock();
@@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)
     memory_global_dirty_log_sync();
     rcu_read_lock();
     RAMBLOCK_FOREACH_NOT_IGNORED(block) {
-        migration_bitmap_sync_range(ram_state, block, block->used_length);
+        migration_bitmap_sync_range(ram_state, block);
     }
     rcu_read_unlock();
 
-- 
2.17.1



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

* Re: [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough
  2019-07-18  1:25 [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough Wei Yang
@ 2019-07-18  1:37 ` Peter Xu
  2019-07-18  8:17 ` Paolo Bonzini
  2019-08-07 17:46 ` Dr. David Alan Gilbert
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Xu @ 2019-07-18  1:37 UTC (permalink / raw)
  To: Wei Yang; +Cc: pbonzini, quintela, qemu-devel, dgilbert

On Thu, Jul 18, 2019 at 09:25:47AM +0800, Wei Yang wrote:
> RAMBlock->used_length is always passed to migration_bitmap_sync_range(),
> which could be retrieved from RAMBlock.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu


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

* Re: [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough
  2019-07-18  1:25 [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough Wei Yang
  2019-07-18  1:37 ` Peter Xu
@ 2019-07-18  8:17 ` Paolo Bonzini
  2019-07-18  8:43   ` Wei Yang
  2019-08-07 17:46 ` Dr. David Alan Gilbert
  2 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2019-07-18  8:17 UTC (permalink / raw)
  To: Wei Yang, qemu-devel; +Cc: dgilbert, quintela

On 18/07/19 03:25, Wei Yang wrote:
> RAMBlock->used_length is always passed to migration_bitmap_sync_range(),
> which could be retrieved from RAMBlock.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  migration/ram.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index 908517fc2b..0a6070d787 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,
>      return ret;
>  }
>  
> -static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb,
> -                                        ram_addr_t length)
> +static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb)
>  {
>      rs->migration_dirty_pages +=
> -        cpu_physical_memory_sync_dirty_bitmap(rb, 0, length,
> +        cpu_physical_memory_sync_dirty_bitmap(rb, 0, rb->used_length,
>                                                &rs->num_dirty_pages_period);
>  }
>  
> @@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)
>      qemu_mutex_lock(&rs->bitmap_mutex);
>      rcu_read_lock();
>      RAMBLOCK_FOREACH_NOT_IGNORED(block) {
> -        migration_bitmap_sync_range(rs, block, block->used_length);
> +        migration_bitmap_sync_range(rs, block);
>      }
>      ram_counters.remaining = ram_bytes_remaining();
>      rcu_read_unlock();
> @@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)
>      memory_global_dirty_log_sync();
>      rcu_read_lock();
>      RAMBLOCK_FOREACH_NOT_IGNORED(block) {
> -        migration_bitmap_sync_range(ram_state, block, block->used_length);
> +        migration_bitmap_sync_range(ram_state, block);
>      }
>      rcu_read_unlock();
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

and in fact we can rename the function to ramblock_sync_dirty_bitmap.

Paolo


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

* Re: [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough
  2019-07-18  8:17 ` Paolo Bonzini
@ 2019-07-18  8:43   ` Wei Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Yang @ 2019-07-18  8:43 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: quintela, Wei Yang, dgilbert, qemu-devel

On Thu, Jul 18, 2019 at 10:17:19AM +0200, Paolo Bonzini wrote:
>On 18/07/19 03:25, Wei Yang wrote:
>> RAMBlock->used_length is always passed to migration_bitmap_sync_range(),
>> which could be retrieved from RAMBlock.
>> 
>> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> ---
>>  migration/ram.c | 9 ++++-----
>>  1 file changed, 4 insertions(+), 5 deletions(-)
>> 
>> diff --git a/migration/ram.c b/migration/ram.c
>> index 908517fc2b..0a6070d787 100644
>> --- a/migration/ram.c
>> +++ b/migration/ram.c
>> @@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,
>>      return ret;
>>  }
>>  
>> -static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb,
>> -                                        ram_addr_t length)
>> +static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb)
>>  {
>>      rs->migration_dirty_pages +=
>> -        cpu_physical_memory_sync_dirty_bitmap(rb, 0, length,
>> +        cpu_physical_memory_sync_dirty_bitmap(rb, 0, rb->used_length,
>>                                                &rs->num_dirty_pages_period);
>>  }
>>  
>> @@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)
>>      qemu_mutex_lock(&rs->bitmap_mutex);
>>      rcu_read_lock();
>>      RAMBLOCK_FOREACH_NOT_IGNORED(block) {
>> -        migration_bitmap_sync_range(rs, block, block->used_length);
>> +        migration_bitmap_sync_range(rs, block);
>>      }
>>      ram_counters.remaining = ram_bytes_remaining();
>>      rcu_read_unlock();
>> @@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)
>>      memory_global_dirty_log_sync();
>>      rcu_read_lock();
>>      RAMBLOCK_FOREACH_NOT_IGNORED(block) {
>> -        migration_bitmap_sync_range(ram_state, block, block->used_length);
>> +        migration_bitmap_sync_range(ram_state, block);
>>      }
>>      rcu_read_unlock();
>>  
>> 
>
>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
>and in fact we can rename the function to ramblock_sync_dirty_bitmap.

Sounds reasonable. Let me improve it.

>
>Paolo

-- 
Wei Yang
Help you, Help me


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

* Re: [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough
  2019-07-18  1:25 [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough Wei Yang
  2019-07-18  1:37 ` Peter Xu
  2019-07-18  8:17 ` Paolo Bonzini
@ 2019-08-07 17:46 ` Dr. David Alan Gilbert
  2 siblings, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2019-08-07 17:46 UTC (permalink / raw)
  To: Wei Yang; +Cc: pbonzini, qemu-devel, quintela

* Wei Yang (richardw.yang@linux.intel.com) wrote:
> RAMBlock->used_length is always passed to migration_bitmap_sync_range(),
> which could be retrieved from RAMBlock.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

Queued

> ---
>  migration/ram.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index 908517fc2b..0a6070d787 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,
>      return ret;
>  }
>  
> -static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb,
> -                                        ram_addr_t length)
> +static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb)
>  {
>      rs->migration_dirty_pages +=
> -        cpu_physical_memory_sync_dirty_bitmap(rb, 0, length,
> +        cpu_physical_memory_sync_dirty_bitmap(rb, 0, rb->used_length,
>                                                &rs->num_dirty_pages_period);
>  }
>  
> @@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)
>      qemu_mutex_lock(&rs->bitmap_mutex);
>      rcu_read_lock();
>      RAMBLOCK_FOREACH_NOT_IGNORED(block) {
> -        migration_bitmap_sync_range(rs, block, block->used_length);
> +        migration_bitmap_sync_range(rs, block);
>      }
>      ram_counters.remaining = ram_bytes_remaining();
>      rcu_read_unlock();
> @@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)
>      memory_global_dirty_log_sync();
>      rcu_read_lock();
>      RAMBLOCK_FOREACH_NOT_IGNORED(block) {
> -        migration_bitmap_sync_range(ram_state, block, block->used_length);
> +        migration_bitmap_sync_range(ram_state, block);
>      }
>      rcu_read_unlock();
>  
> -- 
> 2.17.1
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


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

end of thread, other threads:[~2019-08-07 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-18  1:25 [Qemu-devel] [PATCH] migration: just pass RAMBlock is enough Wei Yang
2019-07-18  1:37 ` Peter Xu
2019-07-18  8:17 ` Paolo Bonzini
2019-07-18  8:43   ` Wei Yang
2019-08-07 17:46 ` Dr. David Alan Gilbert

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