qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 05/22] memory: return bitmap from memory_region_


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 05/22] memory: return bitmap from memory_region_is_logging
Date: Sun, 29 Mar 2015 09:33:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 28/03/2015 19:54, Michael S. Tsirkin wrote:
> This API is pretty easy to misuse, and return
> value is completely undocumented. In fact, if I see
> "is" I assume a boolean return type.
> 
> As you are touching all users anyway, how about
> wrappers that answer specific questions:
> memory_region_is_logging_dirty_memory_vga
> memory_region_is_logging_dirty_memory_migration
> memory_region_is_logging_dirty_memory_except_migration
> ?

The full return value is used later in the series.

I'll add a "client" argument to memory_region_is_logging (so that the
compiler will catch anything I forger) and add
memory_region_get_dirty_log_mask for the other users.

Regarding memory_region_is_logging_dirty_memory_except_migration, it
will go away once migration stops being special cased via
log_global_start/log_global_stop.

Paolo

> As a bonus, compiler will catch you if you forget to
> change some caller.
> 
>> diff --git a/xen-hvm.c b/xen-hvm.c
>> index 315864c..acd89c8 100644
>> --- a/xen-hvm.c
>> +++ b/xen-hvm.c
>> @@ -488,7 +488,8 @@ static void xen_set_memory(struct MemoryListener 
>> *listener,
>>      XenIOState *state = container_of(listener, XenIOState, memory_listener);
>>      hwaddr start_addr = section->offset_within_address_space;
>>      ram_addr_t size = int128_get64(section->size);
>> -    bool log_dirty = memory_region_is_logging(section->mr);
>> +    bool log_dirty =
>> +        memory_region_is_logging(section->mr) & ~(1 << 
>> DIRTY_MEMORY_MIGRATION);
>>      hvmmem_type_t mem_type;
>>  
>>      if (section->mr == &ram_memory) {
>> -- 
>> 2.3.3
>>
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]