代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/qemu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 1545a60a8b78490c7dc8909b7012bca63dba63cd Mon Sep 17 00:00:00 2001
From: Jinhua Cao <caojinhua1@huawei.com>
Date: Sat, 12 Feb 2022 15:41:08 +0800
Subject: [PATCH] qmp: add command to query used memslots of vhost-net and
vhost-user
Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
---
hw/virtio/vhost-backend.c | 2 +-
hw/virtio/vhost-user.c | 2 +-
include/hw/virtio/vhost-backend.h | 2 ++
monitor/qmp-cmds.c | 12 ++++++++++++
qapi/net.json | 18 ++++++++++++++++++
qapi/pragma.json | 4 +++-
6 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c
index 2acfb750fd..d8e1710758 100644
--- a/hw/virtio/vhost-backend.c
+++ b/hw/virtio/vhost-backend.c
@@ -300,7 +300,7 @@ static void vhost_kernel_set_used_memslots(struct vhost_dev *dev)
vhost_kernel_used_memslots = dev->mem->nregions;
}
-static unsigned int vhost_kernel_get_used_memslots(void)
+unsigned int vhost_kernel_get_used_memslots(void)
{
return vhost_kernel_used_memslots;
}
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 176cae9244..8f69a3b850 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -2544,7 +2544,7 @@ static void vhost_user_set_used_memslots(struct vhost_dev *dev)
vhost_user_used_memslots = counter;
}
-static unsigned int vhost_user_get_used_memslots(void)
+unsigned int vhost_user_get_used_memslots(void)
{
return vhost_user_used_memslots;
}
diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
index a64708f456..7bbc658161 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -190,4 +190,6 @@ int vhost_backend_handle_iotlb_msg(struct vhost_dev *dev,
int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd);
+unsigned int vhost_kernel_get_used_memslots(void);
+unsigned int vhost_user_get_used_memslots(void);
#endif /* VHOST_BACKEND_H */
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 98868cee03..f3e80ec8a7 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -36,6 +36,7 @@
#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-ui.h"
+#include "qapi/qapi-commands-net.h"
#include "qapi/type-helpers.h"
#include "qapi/qmp/qerror.h"
#include "exec/ramlist.h"
@@ -43,6 +44,7 @@
#include "hw/acpi/acpi_dev_interface.h"
#include "hw/intc/intc.h"
#include "hw/rdma/rdma.h"
+#include "hw/virtio/vhost-backend.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -471,3 +473,13 @@ int64_t qmp_query_rtc_date_diff(Error **errp)
{
return get_rtc_date_diff();
}
+
+uint32_t qmp_query_vhost_kernel_used_memslots(Error **errp)
+{
+ return vhost_kernel_get_used_memslots();
+}
+
+uint32_t qmp_query_vhost_user_used_memslots(Error **errp)
+{
+ return vhost_user_get_used_memslots();
+}
diff --git a/qapi/net.json b/qapi/net.json
index 7fab2e7cd8..c9ff849eed 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -696,3 +696,21 @@
##
{ 'event': 'FAILOVER_NEGOTIATED',
'data': {'device-id': 'str'} }
+
+##
+# @query-vhost-kernel-used-memslots:
+#
+# Get vhost-kernel nic used memslots
+#
+# Since: 4.1
+##
+{ 'command': 'query-vhost-kernel-used-memslots', 'returns': 'uint32' }
+
+##
+# @query-vhost-user-used-memslots:
+#
+# Get vhost-user nic used memslots
+#
+# Since: 4.1
+##
+{ 'command': 'query-vhost-user-used-memslots', 'returns': 'uint32' }
diff --git a/qapi/pragma.json b/qapi/pragma.json
index b37f6de445..d35c897acb 100644
--- a/qapi/pragma.json
+++ b/qapi/pragma.json
@@ -27,7 +27,9 @@
'query-tpm-models',
'query-tpm-types',
'ringbuf-read',
- 'query-rtc-date-diff' ],
+ 'query-rtc-date-diff',
+ 'query-vhost-user-used-memslots',
+ 'query-vhost-kernel-used-memslots' ],
# Externally visible types whose member names may use uppercase
'member-name-exceptions': [ # visible in:
'ACPISlotType', # query-acpi-ospm-status
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。