qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 10/15] savevm: Migrate RAM based on name/offset


From: Paolo Bonzini
Subject: [Qemu-devel] Re: [PATCH 10/15] savevm: Migrate RAM based on name/offset
Date: Thu, 24 Jun 2010 07:49:33 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5

On 06/24/2010 06:42 AM, Alex Williamson wrote:
          if (flags&  RAM_SAVE_FLAG_COMPRESS) {
-            uint8_t ch = qemu_get_byte(f);
-            memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
+            void *host;
+            uint8_t ch;
+
+            if (version_id == 3) {
+                host = qemu_get_ram_ptr(addr);
+            } else {
+                RAMBlock *block;
+                char id[256];
+                uint8_t len;
+
+                len = qemu_get_byte(f);
+                qemu_get_buffer(f, (uint8_t *)id, len);
+                id[len] = 0;

Can you measure the amount of bytes transferred before and now? It seems pretty expensive. Maybe you could add another flag so that the memory name is passed on the wire only if it differs from the previous one. Alternatively (perhaps better) define a new kind of RAM save data just for the RAM block, and assume all pages after it are for that block. You can even encode the RAM length in the flags, so that you only have to pass "len | RAM_SAVE_FLAG_BLOCK_NAME" followed by the length+characters of the name.

Also, code like this:

+                len = qemu_get_byte(f);
+                qemu_get_buffer(f, (uint8_t *)id, len);
+                id[len] = 0;
+
+                QLIST_FOREACH(block, &ram_list.blocks, next) {
+                    if (!strncmp(id, block->idstr, sizeof(id)))
+                        break;
+                }
+                if (!block)
+                    return -EINVAL;

is present three times. It should be split in two functions and these functions be called (the first function can also be used elsewhere, I think, though this of course can be done in a followup).

Paolo



reply via email to

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