1 Star 0 Fork 131

imxcc/pat-qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vfio-Change-default-dirty-pages-tracking-behavior-du.patch 3.34 KB
一键复制 编辑 原始数据 按行查看 历史
From 69d1cc17c0a77dbd0d8e811cfaa899b01bf2e5bc Mon Sep 17 00:00:00 2001
From: Kirti Wankhede <kwankhede@nvidia.com>
Date: Mon, 23 Nov 2020 19:53:19 +0530
Subject: [PATCH] vfio: Change default dirty pages tracking behavior during
migration
By default dirty pages tracking is enabled during iterative phase
(pre-copy phase).
Added per device opt-out option 'x-pre-copy-dirty-page-tracking' to
disable dirty pages tracking during iterative phase. If the option
'x-pre-copy-dirty-page-tracking=off' is set for any VFIO device, dirty
pages tracking during iterative phase will be disabled.
Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
hw/vfio/common.c | 11 +++++++----
hw/vfio/pci.c | 3 +++
include/hw/vfio/vfio-common.h | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index a86a4c4506..d9cc3509ef 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -310,7 +310,7 @@ bool vfio_mig_active(void)
return true;
}
-static bool vfio_devices_all_stopped_and_saving(VFIOContainer *container)
+static bool vfio_devices_all_saving(VFIOContainer *container)
{
VFIOGroup *group;
VFIODevice *vbasedev;
@@ -328,8 +328,11 @@ static bool vfio_devices_all_stopped_and_saving(VFIOContainer *container)
return false;
}
- if ((migration->device_state & VFIO_DEVICE_STATE_SAVING) &&
- !(migration->device_state & VFIO_DEVICE_STATE_RUNNING)) {
+ if (migration->device_state & VFIO_DEVICE_STATE_SAVING) {
+ if ((vbasedev->pre_copy_dirty_page_tracking == ON_OFF_AUTO_OFF)
+ && (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) {
+ return false;
+ }
continue;
} else {
return false;
@@ -1088,7 +1091,7 @@ static void vfio_listerner_log_sync(MemoryListener *listener,
return;
}
- if (vfio_devices_all_stopped_and_saving(container)) {
+ if (vfio_devices_all_saving(container)) {
vfio_sync_dirty_bitmap(container, section);
}
}
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 2795b8bd12..3641ad0c5c 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3180,6 +3180,9 @@ static void vfio_instance_init(Object *obj)
static Property vfio_pci_dev_properties[] = {
DEFINE_PROP_PCI_HOST_DEVADDR("host", VFIOPCIDevice, host),
DEFINE_PROP_STRING("sysfsdev", VFIOPCIDevice, vbasedev.sysfsdev),
+ DEFINE_PROP_ON_OFF_AUTO("x-pre-copy-dirty-page-tracking", VFIOPCIDevice,
+ vbasedev.pre_copy_dirty_page_tracking,
+ ON_OFF_AUTO_ON),
DEFINE_PROP_ON_OFF_AUTO("display", VFIOPCIDevice,
display, ON_OFF_AUTO_OFF),
DEFINE_PROP_UINT32("xres", VFIOPCIDevice, display_xres, 0),
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 7398631d4c..475aa9fb40 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -130,6 +130,7 @@ typedef struct VFIODevice {
unsigned int flags;
VFIOMigration *migration;
Error *migration_blocker;
+ OnOffAuto pre_copy_dirty_page_tracking;
} VFIODevice;
struct VFIODeviceOps {
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/imxcc/pat-qemu.git
git@gitee.com:imxcc/pat-qemu.git
imxcc
pat-qemu
pat-qemu
master

搜索帮助