系列文章目录

第二十一章 QEMU系统仿真的机器创建分析实例



前言

本文以 QEMU 8.2.2 为例,分析其作为系统仿真工具的工作过程,并为读者展示各种 QEMU 系统仿真的启动配置实例。
本文读者需要具备一定的 QEMU 系统仿真使用经验,并对 C 语言编程有一定了解。


一、QEMU是什么?

QEMU 是一个通用且开源的机器模拟器和虚拟机。
其官方主页是:https://www.qemu.org/


二、QEMU系统仿真的机器创建分析实例

1.系统仿真的命令行参数

QEMU 作为系统仿真工具,其入口代码在 system/main.c 文件中,初始化函数 qemu_init() 的实现在 system/vl.c 文件中。
前文完成创建目标机器的过程分析,本文将继续后续运行过程的分析,读者需要对 QEMU 系统启动过程的程序代码有所了解,相关内容可以参考《QEMU系统分析之启动篇》系列文章。

..\qemu\8.2.2-qkd\qemu-system-x86_64.exe -cpu "Penryn,vendor=GenuineIntel,+ssse3,+sse4.2" -M  "q35,accel=whpx,smm=off" -m "6G" -audio "sdl,model=hda" -vga "std" -netdev "user,id=mynet0" -device "e1000,id=nic1,netdev=mynet0" -L "data" -qtest "unix:qtest-sock,server,nowait"

2. 解析机器的存储设备设置

这部分代码在 system/vl.c 文件中,实现如下:

int qemu_init(int argc, char **argv)
{
...
    qemu_resolve_machine_memdev();
...
}

前文分析了 CPU 配置项的解析过程,本文将分析解析机器的存储设备设置的过程。


qemu_resolve_machine_memdev()

函数 qemu_resolve_machine_memdev() 代码如下:

static void qemu_resolve_machine_memdev(void)
{
    if (ram_memdev_id) {
        Object *backend;
        ram_addr_t backend_size;

        backend = object_resolve_path_type(ram_memdev_id,
                                           TYPE_MEMORY_BACKEND, NULL);
        if (!backend) {
            error_report("Memory backend '%s' not found", ram_memdev_id);
            exit(EXIT_FAILURE);
        }
        if (!have_custom_ram_size) {
            backend_size = object_property_get_uint(backend, "size",  &error_abort);
            current_machine->ram_size = backend_size;
        }
        object_property_set_link(OBJECT(current_machine),
                                 "memory-backend", backend, &error_fatal);
    }
}

首先,调用函数 object_resolve_path_type() 获取存储设备的后端驱动,代码如下:

        backend = object_resolve_path_type(ram_memdev_id,
                                           TYPE_MEMORY_BACKEND, NULL);```

---

####  object_resolve_path_type()

代码如下:

```c
Object *object_resolve_path_type(const char *path, const char *typename,
                                 bool *ambiguousp)
{
    Object *obj;
    char **parts;

    parts = g_strsplit(path, "/", 0);
    assert(parts);

    if (parts[0] == NULL || strcmp(parts[0], "") != 0) {
        bool ambiguous = false;
        obj = object_resolve_partial_path(object_get_root(), parts,
                                          typename, &ambiguous);
        if (ambiguousp) {
            *ambiguousp = ambiguous;
        }
    } else {
        obj = object_resolve_abs_path(object_get_root(), parts + 1, typename);
    }

    g_strfreev(parts);

    return obj;
}

然后,调用函数 object_property_set_link() 完成当前机器与存储设备后端驱动的关联,代码如下:


object_property_set_link()

代码如下:

bool object_property_set_link(Object *obj, const char *name,
                              Object *value, Error **errp)
{
    g_autofree char *path = NULL;

    if (value) {
        path = object_get_canonical_path(value);
    }
    return object_property_set_str(obj, name, path ?: "", errp);
}

3.调试输出

首先,添加跟踪调试信息,修改后的代码如下:

int qemu_init(int argc, char **argv)
{
...
    huedbg_flag = 1;
    HUEDBG("\n");
    qemu_resolve_machine_memdev();
    HUEDBG("\n");
    huedbg_flag = 0;
...
}


static void qemu_resolve_machine_memdev(void)
{
    HUEDBG("enter\n");
    HUEDBG("ram_memdev_id=[%s]\n", ram_memdev_id);
    if (ram_memdev_id) {
        Object *backend;
        ram_addr_t backend_size;

        backend = object_resolve_path_type(ram_memdev_id,
                                           TYPE_MEMORY_BACKEND, NULL);
        if (!backend) {
            error_report("Memory backend '%s' not found", ram_memdev_id);
            exit(EXIT_FAILURE);
        }
        if (!have_custom_ram_size) {
            backend_size = object_property_get_uint(backend, "size",  &error_abort);
            current_machine->ram_size = backend_size;
        }
        object_property_set_link(OBJECT(current_machine),
                                 "memory-backend", backend, &error_fatal);
    }
}


bool object_property_set_link(Object *obj, const char *name,
                              Object *value, Error **errp)
{
    g_autofree char *path = NULL;

    if (value) {
        path = object_get_canonical_path(value);
    }
    HUEDBG("name=[%s] path=[%s]\n", name, path);
    return object_property_set_str(obj, name, path ?: "", errp);
}

运行后,输出信息如下:

[18860]../system/vl.c/qemu_init(3869):
[18860]../system/vl.c/qemu_resolve_machine_memdev(2079):enter
[18860]../system/vl.c/qemu_resolve_machine_memdev(2080):ram_memdev_id=[ram0]
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(chardev)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev-vc) has parent(chardev)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev-vc) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(chardev)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev-vc) has parent(chardev)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev-vc) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(chardev)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev-socket) has parent(chardev)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev-socket) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(chardev)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev-vc) has parent(chardev)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev-vc) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(chardev) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(chardev) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(generic-pc-machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(pc-q35-8.2-machine) has parent(generic-pc-machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(pc-q35-8.2-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(x86-machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(generic-pc-machine) has parent(x86-machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(generic-pc-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(x86-machine) has parent(machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(x86-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(machine) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(sys-bus-device)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(cfi.pflash01) has parent(sys-bus-device)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(cfi.pflash01) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(device)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(sys-bus-device) has parent(device)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(sys-bus-device) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(device) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(device) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(sys-bus-device)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(cfi.pflash01) has parent(sys-bus-device)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(cfi.pflash01) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(device)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(sys-bus-device) has parent(device)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(sys-bus-device) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(device) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(device) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(bus)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(System) has parent(bus)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(System) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(bus) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(bus) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(memory-region) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(memory-region) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(memory-region) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(memory-region) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(qtest) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(qtest) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/type_table_lookup(103):lookup type(memory-backend) in hash table
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/type_get_parent(194):parent_type(memory-backend)
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(memory-backend)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(memory-backend-ram) has parent(memory-backend)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(memory-backend-ram) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(memory-backend) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(memory-backend) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(memory-region) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(memory-region) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_property_set_link(1570):name=[memory-backend] path=[/objects/ram0]
[18860]../qom/qom-qobject.c/object_property_set_qobject(26):name=[memory-backend] enter!
[18860]../qom/object.c/object_property_set(1507):name=[memory-backend] enter!
[18860]../qom/object.c/object_property_set(1509):name=[memory-backend] run!
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(generic-pc-machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(pc-q35-8.2-machine) has parent(generic-pc-machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(pc-q35-8.2-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(x86-machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(generic-pc-machine) has parent(x86-machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(generic-pc-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(x86-machine) has parent(machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(x86-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(machine) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_property_set(1511):name=[memory-backend] run!
[18860]../qom/object.c/object_property_set(1524):name=[memory-backend] run!
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(generic-pc-machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(pc-q35-8.2-machine) has parent(generic-pc-machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(pc-q35-8.2-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(x86-machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(generic-pc-machine) has parent(x86-machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(generic-pc-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(machine)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(x86-machine) has parent(machine)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(x86-machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(machine) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(machine) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[18860]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[18860]../qom/object.c/object_class_get_parent(1130):enter
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[18860]../qom/object.c/type_table_lookup(103):lookup type(memory-backend) in hash table
[18860]../qom/object.c/type_get_parent(194):parent_type(object)
[18860]../qom/object.c/type_get_parent(196):no parent_type
[18860]../qom/object.c/type_get_parent(194):parent_type(memory-backend)
[18860]../qom/object.c/object_property_set(1526):name=[memory-backend] return!
[18860]../qom/qom-qobject.c/object_property_set_qobject(33):name=[memory-backend] return!
[18860]../system/vl.c/qemu_init(3871):

几个需要关注的地方:

[18860]../system/vl.c/qemu_resolve_machine_memdev(2080):ram_memdev_id=[ram0]
...
[18860]../qom/object.c/object_property_set_link(1570):name=[memory-backend] path=[/objects/ram0]


总结

以上分析了系统初始化过程中解析机器的存储设备设置的过程。

05-08 09:44