1 Star 0 Fork 121

luofeng14/src-openEuler

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vhost-user-add-vhost_set_mem_table-when-vm-load_setu.patch 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
From 5c753d539a968f2127ff6e5b916cd4b38a08b40c Mon Sep 17 00:00:00 2001
From: Jinhua Cao <caojinhua1@huawei.com>
Date: Fri, 11 Feb 2022 18:59:34 +0800
Subject: [PATCH] vhost-user: add vhost_set_mem_table when vm load_setup at
destination
When migrate huge vm, packages lost are 90+.
During the load_setup of the destination vm, pass the
vm mem structure to ovs, the netcard could be enabled
when the migration finish state shifting.
Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
---
hw/virtio/vhost-user.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index fc2b1b81c9..a8feea489b 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1920,6 +1920,28 @@ static int vhost_user_postcopy_notifier(NotifierWithReturn *notifier,
return 0;
}
+static int vhost_user_load_setup(QEMUFile *f, void *opaque)
+{
+ struct vhost_dev *hdev = opaque;
+ int r;
+
+ if (hdev->vhost_ops && hdev->vhost_ops->vhost_set_mem_table) {
+ r = hdev->vhost_ops->vhost_set_mem_table(hdev, hdev->mem);
+ if (r < 0) {
+ qemu_log("error: vhost_set_mem_table failed: %s(%d)\n",
+ strerror(errno), errno);
+ return r;
+ } else {
+ qemu_log("info: vhost_set_mem_table OK\n");
+ }
+ }
+ return 0;
+}
+
+SaveVMHandlers savevm_vhost_user_handlers = {
+ .load_setup = vhost_user_load_setup,
+};
+
static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
Error **errp)
{
@@ -2044,6 +2066,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
u->postcopy_notifier.notify = vhost_user_postcopy_notifier;
postcopy_add_notifier(&u->postcopy_notifier);
+ register_savevm_live("vhost-user", -1, 1, &savevm_vhost_user_handlers, dev);
return 0;
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/luofeng14/qemu2.git
git@gitee.com:luofeng14/qemu2.git
luofeng14
qemu2
src-openEuler
master

搜索帮助