libvirt与qemu通信

2019-04-14 17:13发布

虚拟机下电
libvirt部分:
qemuMonitorSystemPowerdown -> qemuMonitorJSONSystemPowerdown -> qemuMonitorJSONCommand -> qemuMonitorJSONCommandWithFd qemu部分:
handle_qmp_command -> qmp_call_cmd -> do_system_powerdown -> qemu_system_powerdown_request
虚拟机强制重启
libvirt部分: qemuProcessFakeReboot ->qemuMonitorSystemReset -> qemuMonitorJSONSystemReset -> qemuMonitorJSONCommand -> qemuMonitorJSONCommandWithFd qemu部分:
qmp_marshal_input_system_reset  ->qmp_system_reset 虚拟机正常重启
libvirt部分: qemuProcessFakeReboot -> qemuProcessStartCPUs -> qemuMonitorStartCPUs -> qemuMonitorJSONStartCPUs qemu部分:
do_cont –> qemu部分:
qemu_init_vcpu -> qemu_kvm_start_vcpu #0  qemu_system_reset_request () at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/vl.c:1391
#1  0x00007fe483256908 in kbd_write_command (opaque=0x7fe484863e98, addr=0,
    val=254) at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/hw/pckbd.c:300
#2  0x00007fe483389024 in memory_region_iorange_write (iorange=0x7fe484863ff0,
    offset=0, width=1, data=254)
    at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/memory.c:446
#3  0x00007fe4833762c9 in ioport_writeb_thunk (opaque=0x7fe484863ff0,
    addr=100, data=254) at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/ioport.c:211
#4  0x00007fe483375cb4 in ioport_write (index=0, address=100, data=254)
    at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/ioport.c:82
#5  0x00007fe48337677a in cpu_outb (addr=100, val=254 '376')
    at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/ioport.c:274
#6  0x00007fe48337a08f in kvm_handle_io (port=100, data=0x7fe483100000,
    direction=1, size=1, count=1)
    at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/kvm-all.c:857
#7  0x00007fe48337a810 in kvm_cpu_exec (env=0x7fe483fef5c0)
    at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/kvm-all.c:1008
#8  0x00007fe483343cad in qemu_kvm_cpu_thread_fn (arg=0x7fe483fef5c0)
    at /home/sdc/wyf/kvm/qemu-kvm-1.0.1/cpus.c:740
#9  0x00007fe4811eff05 in start_thread () from /lib64/libpthread.so.0
#10 0x00007fe480f3253d in clone () from /lib64/libc.so.6
qemuMonitorSend是个同步通信的过程