All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] exec: eliminate ram naming issue as migration
@ 2018-02-05 14:58 Jianfeng Tan
  2018-02-05 15:45 ` no-reply
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: Jianfeng Tan @ 2018-02-05 14:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Jianfeng Tan, Jason Wang, Michael S . Tsirkin, Maxime Coquelin,
	Paolo Bonzini

Existing VMs with virtio devices and vhost-kernel as the backend
are always started with mem config:

  "-m xG"
  (with a ram block named "pc.ram")

while new VMs with virtio devices and vhost-user as the backend
are always started with mem config:

  "-m xG -numa node,memdev=pc.ram -object memory-backend-file,id=pc.ram,..."
  (with a ram block named "/object/pc.ram")

As we migrate from vhost-kernel to vhost-user, it failes as:

  Unknown ramblock "pc.ram", cannot accept migration
  error while loading state for instance 0x0 of device 'ram'
  load of migration failed: Invalid argument

Here are some options to fix this:

1. When we do ram name comparison, we truncate the prefix as this patch shows.
It cannot cover the corner case: the source VM could have two ram blocks
with name of "pc.ram" and "/object/pc.ram".

2. We add an alias name to RAMBlock; when we do name comparison, not only
idstr is compared, but also compared to the alias. But this will add more
complexity to upper layer stack OpenStack/libvirt.

Any thoughts?

Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 exec.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 4722e52..d294e5c 100644
--- a/exec.c
+++ b/exec.c
@@ -2334,13 +2334,24 @@ found:
 RAMBlock *qemu_ram_block_by_name(const char *name)
 {
     RAMBlock *block;
+    char *name1, *id1;
+    char *name2, *id2;
+
+    name1 = strdup(name);
+    id1 = basename(name1);
 
     RAMBLOCK_FOREACH(block) {
-        if (!strcmp(name, block->idstr)) {
+        name2 = strdup(block->idstr);
+	id2 = basename(name2);
+        if (!strcmp(id1, id2)) {
+            free(name1);
+	    free(name2);
             return block;
         }
+	free(name2);
     }
 
+    free(name1);
     return NULL;
 }
 
-- 
2.7.4

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

end of thread, other threads:[~2018-02-28 15:40 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 14:58 [Qemu-devel] [RFC] exec: eliminate ram naming issue as migration Jianfeng Tan
2018-02-05 15:45 ` no-reply
2018-02-05 15:53 ` Paolo Bonzini
2018-02-05 16:12   ` Tan, Jianfeng
2018-02-05 16:19     ` Paolo Bonzini
2018-02-05 16:44       ` Tan, Jianfeng
2018-02-05 16:53         ` Paolo Bonzini
2018-02-05 17:15       ` Igor Mammedov
2018-02-05 17:31         ` Paolo Bonzini
2018-02-07  7:49           ` Tan, Jianfeng
2018-02-07 12:06             ` Igor Mammedov
2018-02-08  1:20               ` Tan, Jianfeng
2018-02-08  9:51                 ` Igor Mammedov
2018-02-08 10:18                   ` Tan, Jianfeng
2018-02-08 11:30                     ` Igor Mammedov
2018-02-24  3:08                       ` Tan, Jianfeng
2018-02-24  3:11                       ` Tan, Jianfeng
2018-02-26 12:55                         ` Igor Mammedov
2018-02-26 14:43                           ` Paolo Bonzini
2018-02-27  4:55                             ` Tan, Jianfeng
2018-02-27  4:36                           ` Tan, Jianfeng
2018-02-28 15:40                             ` Igor Mammedov
2018-02-05 18:44         ` Dr. David Alan Gilbert
2018-02-05 16:12 ` no-reply
2018-02-05 16:29 ` Igor Mammedov
2018-02-05 16:51   ` Tan, Jianfeng
2018-02-05 18:36     ` Dr. David Alan Gilbert
2018-02-06 15:24       ` Igor Mammedov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.