qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr


From: Peter Lieven
Subject: Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr
Date: Sat, 10 May 2014 15:13:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Am 10.05.2014 13:38, schrieb 陈梁:
> Hi,
> The patch is correct. There is a small improved point.
>>             /* In doubt sent page as normal */
>>             bytes_sent = -1;
>> @@ -990,16 +996,17 @@ static inline void *host_from_stream_offset(QEMUFile 
>> *f,
>>                                             int flags)
>> {
>>     static RAMBlock *block = NULL;
>        RAMBlock *block = NULL;

This one has to be static as well. Why do you think it should not?

Peter

>
>> +    static uint8_t *ram_ptr;
>>     char id[256];
>>     uint8_t len;
>>
>>     if (flags & RAM_SAVE_FLAG_CONTINUE) {
>> -        if (!block) {
>> +        if (!block || !ram_ptr) {
>              if (!ram_ptr) {
>
> Best regards
> ChenLiang
>
>>             fprintf(stderr, "Ack, bad migration stream!\n");
>>             return NULL;
>>         }
>>
>> -        return memory_region_get_ram_ptr(block->mr) + offset;
>> +        return ram_ptr + offset;
>>     }
>>
>>     len = qemu_get_byte(f);
>> @@ -1007,8 +1014,10 @@ static inline void *host_from_stream_offset(QEMUFile 
>> *f,
>>     id[len] = 0;
>>
>>     QTAILQ_FOREACH(block, &ram_list.blocks, next) {
>> -        if (!strncmp(id, block->idstr, sizeof(id)))
>> -            return memory_region_get_ram_ptr(block->mr) + offset;
>> +        if (!strncmp(id, block->idstr, sizeof(id))) {
>> +            ram_ptr = memory_region_get_ram_ptr(block->mr);
>> +            return ram_ptr + offset;
>> +        }
>>     }
>>
>>     fprintf(stderr, "Can't find block %s!\n", id);
>> -- 
>> 1.7.9.5
>>
>>




reply via email to

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