From: Liam Merwick <liam.merwick@oracle.com>
To: pbonzini@redhat.com
Cc: qemu-devel@nongnu.org, sgarzare@redhat.com,
maran.wilson@oracle.com, liam.merwick@oracle.com
Subject: [Qemu-devel] [RFC qboot 3/3] pvh: add benchmark exit point
Date: Wed, 5 Dec 2018 22:31:23 +0000 [thread overview]
Message-ID: <1544049083-16087-4-git-send-email-liam.merwick@oracle.com> (raw)
In-Reply-To: <1544049083-16087-1-git-send-email-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>
---
benchmark.h | 3 ++-
fw_cfg.c | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/benchmark.h b/benchmark.h
index 089c549b5803..2be08e7b2cec 100644
--- a/benchmark.h
+++ b/benchmark.h
@@ -9,5 +9,6 @@
#define FW_START 1
#define LINUX_START_FWCFG 2
#define LINUX_START_BOOT 3
+#define LINUX_START_PVHBOOT 4
-#endif
+#endif /* BENCHMARK_H */
diff --git a/fw_cfg.c b/fw_cfg.c
index e13ec20d0e8b..690ff19e74a0 100644
--- a/fw_cfg.c
+++ b/fw_cfg.c
@@ -240,10 +240,17 @@ void boot_pvh_from_fw_cfg(void)
if (!sz)
panic();
+
fw_cfg_select(FW_CFG_KERNEL_ENTRY);
kernel_entry = (void *) fw_cfg_readl_le();
asm volatile("movl %0, %%ebx" : : "r"(&start_info));
+#ifdef BENCHMARK_HACK
+ /* Exit just before jumping to vmlinux, so that it is easy
+ * to time/profile the firmware.
+ */
+ outb(LINUX_EXIT_PORT, LINUX_START_PVHBOOT);
+#endif
asm volatile("jmp *%2" : : "a" (0x2badb002),
"b"(&start_info), "c"(kernel_entry));
panic();
--
1.8.3.1
next prev parent reply other threads:[~2018-12-05 22:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 22:31 [Qemu-devel] [RFC 0/3] qboot changes for PVH boot Liam Merwick
2018-12-05 22:31 ` [Qemu-devel] [RFC qboot 1/3] pvh: Add x86/HVM direct boot ABI header file Liam Merwick
2018-12-05 22:31 ` [Qemu-devel] [RFC qboot 2/3] pvh: use x86/HVM direct boot ABI Liam Merwick
2018-12-06 20:12 ` Paolo Bonzini
2018-12-05 22:31 ` Liam Merwick [this message]
2018-12-06 20:13 ` [Qemu-devel] [RFC 0/3] qboot changes for PVH boot Paolo Bonzini
2018-12-07 20:15 ` Liam Merwick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1544049083-16087-4-git-send-email-liam.merwick@oracle.com \
--to=liam.merwick@oracle.com \
--cc=maran.wilson@oracle.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).