Skip to the content.

qmp 和 hmp

基本使用

qmp shell

qmp shell 常见命令:

  1. query-cpu-definitions

qom-get

{ "execute": "qom-get",
             "arguments": { "path": "/machine/peripheral/balloon0",
             "property": "guest-stats" } }

hmp

源码分析

void hmp_info_balloon(Monitor *mon, const QDict *qdict)
{
    BalloonInfo *info;
    Error *err = NULL;

    info = qmp_query_balloon(&err);
    if (hmp_handle_error(mon, err)) {
        return;
    }

    monitor_printf(mon, "balloon: actual=%" PRId64 "\n", info->actual >> 20);

    qapi_free_BalloonInfo(info);
}

总结一些和 qobject 纠缠在一起的功能

static void qemu_process_sugar_options(void)
{
    if (mem_prealloc) {
        QObject *smp = qdict_get(machine_opts_dict, "smp");
        if (smp && qobject_type(smp) == QTYPE_QDICT) {
            QObject *cpus = qdict_get(qobject_to(QDict, smp), "cpus");
            if (cpus && qobject_type(cpus) == QTYPE_QSTRING) {
                const char *val = qstring_get_str(qobject_to(QString, cpus));
                object_register_sugar_prop("memory-backend", "prealloc-threads",
                                           val, false);
            }
        }
        object_register_sugar_prop("memory-backend", "prealloc", "on", false);
    }
}

如何快速定位到代码

hmp 中提供了一个 mce 命令,如何找到对应的实现:

hmp_mce 直接搜索 hmp_mce 即可

分析下

https://qemu.readthedocs.io/en/v8.1.5/interop/qemu-qmp-ref.html

hmp 中的 sendkey 是如何实现的

此外,相关配置: https://vncdotool.readthedocs.io/en/latest/usage.html

arm 上面没办法用,难道是这个问题? https://lists.gnu.org/archive/html/qemu-devel/2018-02/msg06218.html

qmp shell 中的命令可以看下

x-query-irq                        x-query-ramblock                   x-query-virtio-queue-element
x-query-jit                        x-query-roms                       x-query-virtio-queue-status
x-query-numa                       x-query-usb                        x-query-virtio-status
x-query-opcount                    x-query-virtio                     x-query-virtio-vhost-queue-status
(QEMU) x-query-irq
{"return": {"human-readable-text": "IRQ statistics for kvm-ioapic:\n 0: 13\n 1: 11\n 3: 2\n 4: 2\n 6: 3\n 8: 1\n10: 156\n12: 15\nIRQ statistics for kvm-i8259:\n 0: 13\n 1: 11\n 3: 2\n 4: 2\n 6: 3\n 8: 1\n10: 156\n12: 15\n"}}
(QEMU) x-query-jit
{"error": {"class": "GenericError", "desc": "JIT information is only available with accel=tcg"}}

也许有用

给Qemu虚拟机“打信号”:自定义QMP注入SCI中断 - MyStackTrace的文章 - 知乎 https://zhuanlan.zhihu.com/p/1943785816179607321

qmp :没办法,不搞的话,dirty bitmap 是没有办法维持生活的

qmp

本站所有文章转发 CSDN 将按侵权追究法律责任,其它情况随意。