add dirty ring command

This commit is contained in:
mii
2024-04-22 08:34:21 +00:00
parent 62dbe54c24
commit 1a1ee1de48
7 changed files with 44 additions and 0 deletions

View File

@ -1862,3 +1862,17 @@ SRST
List event channels in the guest List event channels in the guest
ERST ERST
#endif #endif
{
.name = "dirtyring",
.args_type = "",
.params = "",
.help = "",
.cmd = hmp_dirtyring,
},
SRST
``dirtyring``
Dirty ring
ERST

View File

@ -183,3 +183,5 @@ void hmp_info_mtree(Monitor *mon, const QDict *qdict);
void hmp_info_cryptodev(Monitor *mon, const QDict *qdict); void hmp_info_cryptodev(Monitor *mon, const QDict *qdict);
#endif #endif
void hmp_dirtyring(Monitor *mon, const QDict *qdict);

View File

@ -672,6 +672,7 @@ static int parse_args(int argc, char **argv)
int main(int argc, char **argv, char **envp) int main(int argc, char **argv, char **envp)
{ {
printf("Dirty ring QEMU\n");
struct target_pt_regs regs1, *regs = &regs1; struct target_pt_regs regs1, *regs = &regs1;
struct image_info info1, *info = &info1; struct image_info info1, *info = &info1;
struct linux_binprm bprm; struct linux_binprm bprm;

View File

@ -28,6 +28,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "sysemu/runstate.h" #include "sysemu/runstate.h"
#include "sysemu/kvm.h"
#include "ui/qemu-spice.h" #include "ui/qemu-spice.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "options.h" #include "options.h"
@ -235,6 +236,10 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
info->vfio->transferred >> 10); info->vfio->transferred >> 10);
} }
monitor_printf(mon, "kvm_dirty_ring_enabled: %s\n",
kvm_dirty_ring_enabled() ? "on" : "off");
qapi_free_MigrationInfo(info); qapi_free_MigrationInfo(info);
} }

View File

@ -28,6 +28,7 @@
#include "hw/intc/intc.h" #include "hw/intc/intc.h"
#include "qemu/log.h" #include "qemu/log.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
bool hmp_handle_error(Monitor *mon, Error *err) bool hmp_handle_error(Monitor *mon, Error *err)
{ {
@ -443,3 +444,12 @@ void hmp_info_mtree(Monitor *mon, const QDict *qdict)
mtree_info(flatview, dispatch_tree, owner, disabled); mtree_info(flatview, dispatch_tree, owner, disabled);
} }
void hmp_dirtyring(Monitor *mon, const QDict *qdict)
{
if (kvm_dirty_ring_enabled()) {
printf("Dirty ring enabled.\n");
} else {
printf("Dirty ring disabled.\n");
}
}

View File

@ -209,3 +209,8 @@ static void __attribute__((__constructor__)) monitor_init_qmp_commands(void)
qmp_marshal_qmp_capabilities, qmp_marshal_qmp_capabilities,
QCO_ALLOW_PRECONFIG, 0); QCO_ALLOW_PRECONFIG, 0);
} }
void qmp_dirtyring(Error **errp)
{
printf("Hello, world!\n");
}

View File

@ -605,3 +605,10 @@
{ 'event': 'VFU_CLIENT_HANGUP', { 'event': 'VFU_CLIENT_HANGUP',
'data': { 'vfu-id': 'str', 'vfu-qom-path': 'str', 'data': { 'vfu-id': 'str', 'vfu-qom-path': 'str',
'dev-id': 'str', 'dev-qom-path': 'str' } } 'dev-id': 'str', 'dev-qom-path': 'str' } }
##
# @dirtyring:
#
# Since: 9.0
##
{ 'command': 'dirtyring' }