qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: 陈梁 <chenliang0016@icloud.com>
Cc: pbonzini@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org,
	dgilbert@redhat.com
Subject: Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr
Date: Sat, 10 May 2014 15:13:57 +0200	[thread overview]
Message-ID: <536E2615.7050403@kamp.de> (raw)
In-Reply-To: <5CA9C66B-507E-4F95-90C8-2850C5552C21@icloud.com>

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	other threads:[~2014-05-10 13:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-10 10:51 [Qemu-devel] [PATCH] migration: cache memory region ram ptr Peter Lieven
2014-05-10 11:38 ` 陈梁
2014-05-10 13:13   ` Peter Lieven [this message]
2014-05-10 15:33 ` Paolo Bonzini
2014-05-10 16:07   ` Peter Lieven
2014-05-10 16:32   ` Peter Lieven
2014-05-10 16:44     ` Peter Lieven
2014-05-12  6:09     ` Paolo Bonzini
2014-05-12  8:16       ` Peter Lieven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=536E2615.7050403@kamp.de \
    --to=pl@kamp.de \
    --cc=chenliang0016@icloud.com \
    --cc=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).