Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qboot changes for PVH boot #17

Merged
merged 4 commits into from Dec 28, 2018

Conversation

@merwick
Copy link
Contributor

commented Dec 7, 2018

For certain applications it is desirable to rapidly boot a KVM virtual
machine. In cases where legacy hardware and software support within the
guest is not needed, QEMU should be able to boot directly into the
uncompressed Linux kernel binary with minimal firmware involvement.

There already exists an ABI to allow this for Xen PVH guests and the ABI
is supported by Linux and FreeBSD:

https://xenbits.xen.org/docs/unstable/misc/pvh.html

Details on the Linux changes: https://lkml.org/lkml/2018/12/6/26
QEMU patches: http://lists.nongnu.org/archive/html/qemu-devel/2018-12/msg00957.html

v1 of this series was sent to qemu-devel: https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg00953.html

changed v1 -> v2

  • Feedback from Paolo
  • moved ldl/st inline routines to new memaccess.h
  • moved struct hvm_start_info declaration
  • made boot_pvh_from_fw_cfg() static
  • Moved assignement to start_info.rsdp_paddr to do_alloc()

This patch series provides qboot support to populate the start_info struct
needed by the direct boot ABI and to configure the guest e820 tables to
enable Qemu to use that same entry point for booting KVM guests.

Usіng the methods/scripts documented by the NEMU team at

https://github.com/intel/nemu/wiki/Measuring-Boot-Latency
https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg00200.html

below are some timings measured (vmlinux and bzImage from the same build).
Time to get to kernel start is almost halved (95ṁs -> 48ms)

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)

Liam Merwick (4):
qboot: Move inline load and store routines to memaccess.h
pvh: Add x86/HVM direct boot ABI header file
pvh: use x86/HVM direct boot ABI
pvh: add benchmark exit point

@bonzini

This comment has been minimized.

Copy link
Owner

commented Dec 19, 2018

Patches look good, I'll wait for the Linux side and then merge.

merwick added 2 commits Nov 16, 2018
The x86/HVM direct boot ABI permits a guest to be able to boot directly
into the uncompressed Linux kernel binary.

https://xenbits.xen.org/docs/unstable/misc/pvh.html

This commit adds the header file that defines the start_info struct
that needs to be populated in order to use this ABI.

Signed-off-by: Maran Wilson <Maran.Wilson@oracle.com>
Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Move lduw_p, ldl_p, stw_p, stl_p from linuxboot.c to
include/memaccess.h so they can be reused more easily.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
fw_cfg.c Outdated Show resolved Hide resolved
merwick added 2 commits Nov 20, 2018
These changes (along with corresponding QEMU and Linux kernel changes)
enable a guest to be booted using the x86/HVM direct boot ABI.

QEMU parses the uncompressed kernel binary passed to it via -kernel
to read the ELF Note which contains the address to be loaded.  QEMU
then depends on qboot to populate the start_info struct needed by
the direct boot ABI and configure the guest e820 tables before
jumping to the loaded kernel entry.

Signed-off-by: George Kennedy <George.Kennedy@oracle.com>
Signed-off-by: Liam Merwick <Liam.Merwick@oracle.com>
This commit adds a PVH specific VM exit point for use in benchmarking
boot times using a QEMU specific device that terminates the QEMU process
and thus the VM itself when handling those VM exits. Since the VM
terminates right at those exit points, generic tools like time can
be used to measure the time spent between the QEMU startup
and termination moments.

The QEMU device used for those measurement is called isa-debug-exit
for the PC and Q35 machine types. These devices take 2 arguments:
iobase and iosize.  iobase specifies which IO port we need to write
into to have these devices eventually handle the corresponding VM exit.

If for example, QEMU is started with the following argument:

-device isa-debug-exit,iobase=0xf4

then any IO write to 0xf4 will terminate the QEMU process and the
corresponding VM.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
@merwick

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2018

I can't see a way of collapsing that 5th commit into 0c9acc4 as I intended or updating the PR to point to a new branch (I've pushed a 'pvh-v2' branch to my repo including this change and a spurious blank line removal). Will I just open a new PR?

@bonzini

This comment has been minimized.

Copy link
Owner

commented Dec 21, 2018

Just force-push to your branch. Yes, this is exactly why GitHub PR is not at all great.

@merwick merwick force-pushed the merwick:pvh branch from d4ee723 to 35b131f Dec 21, 2018
@merwick

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2018

I've forced a push to merwick/qboot/pvh and verified that changes are as expected (the old bits are available at merwick/qboot/pvh-v1 for comparison - the new bits are identical to merwick/qboot/pvh-v2)

@bonzini

This comment has been minimized.

Copy link
Owner

commented Dec 28, 2018

Merged - the Linux changes are now in as of commit 460023a5d1d2aa0f733b6708b2fae5ea9f9dfec0.

@bonzini bonzini closed this Dec 28, 2018
@bonzini bonzini reopened this Dec 28, 2018
@bonzini bonzini merged commit 9c48d67 into bonzini:master Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.