All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jianfeng Tan <jianfeng.tan@intel.com>
To: qemu-devel@nongnu.org
Cc: Jianfeng Tan <jianfeng.tan@intel.com>,
	Jason Wang <jasowang@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [RFC] exec: eliminate ram naming issue as migration
Date: Mon,  5 Feb 2018 14:58:55 +0000	[thread overview]
Message-ID: <1517842735-9011-1-git-send-email-jianfeng.tan@intel.com> (raw)

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

             reply	other threads:[~2018-02-05 14:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 14:58 Jianfeng Tan [this message]
2018-02-05 15:45 ` [Qemu-devel] [RFC] exec: eliminate ram naming issue as migration 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

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=1517842735-9011-1-git-send-email-jianfeng.tan@intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=jasowang@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 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.