今天看到公司内部的backport过了一遍,让KVM支持启动PVH的guest,挺有意思的功能,把启动时间的优化做到了极致,不走bios,qboot直接建立memory map,并跳转到kernel入口地址。这个入口不同于native入口地址,在upstream里是pvh_start_xen, 通过下面的elfnote导出。
ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, _ASM_PTR (pvh_start_xen - __START_KERNEL_map))
ABI的细节可以看 https://xenbits.xen.org/docs/unstable/misc/pvh.html
同事做的性能比较,运行到内核入口的时间少了一半!
QEMU + qboot + vmlinux (PVH + 4.20-rc4) qemu_init_end: 41.550521 fw_start: 41.667139 (+0.116618) fw_do_boot: 47.448495 (+5.781356) linux_startup_64: 47.720785 (+0.27229) linux_start_kernel: 48.399541 (+0.678756) linux_start_user: 296.952056 (+248.552515) QEMU + qboot + bzImage: qemu_init_end: 29.209276 fw_start: 29.317342 (+0.108066) linux_start_boot: 36.679362 (+7.36202) linux_startup_64: 94.531349 (+57.851987) linux_start_kernel: 94.900913 (+0.369564) linux_start_user: 401.060971 (+306.160058) QEMU + bzImage: qemu_init_end: 30.424430 linux_startup_64: 893.770334 (+863.345904) linux_start_kernel: 894.17049 (+0.400156) linux_start_user: 1208.679768 (+314.509278)