From d6822f1d19b7c8f6e91869b811a301277ff88ab9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 19 Aug 2013 14:59:19 +0100 Subject: [PATCH 009/118] launch: direct: Specify -cpu host,+kvmclock. '-cpu host' makes the CPU look like the host CPU. This is useful because it means the appliance can use all the host CPU's features, eg. for fast checksumming or MD XORing. 'kvmclock' is the paravirtualized clock for qemu/KVM. It's much more stable than relying on tsc or a virtualized device such as HPET, and clock instability is one of the problems we have encountered when running libguestfs on a heavily loaded machine, especially in a nested VM. Note that we require qemu >= 1.2 (and have for a while) which has long supported both of these options. (cherry picked from commit 038ed0a08eaed33e62a27c9f91780a25de0bc08c) --- TODO | 8 -------- src/launch-appliance.c | 4 ++++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 86b661c..c84d71c 100644 --- a/TODO +++ b/TODO @@ -477,14 +477,6 @@ image would be replaced by equivalent files of zeroes, thus minimizing the size of the debug image that needs to be shipped to us by the customer. -Optimize the appliance ----------------------- - -Pass -cpu host. Anything else? - -[The libvirt attach-method uses 'host-model' which is basically -the same as this] - Sort out partitioning --------------------- diff --git a/src/launch-appliance.c b/src/launch-appliance.c index bb9c832..a667b1d 100644 --- a/src/launch-appliance.c +++ b/src/launch-appliance.c @@ -319,6 +319,10 @@ launch_appliance (guestfs_h *g, const char *arg) add_cmdline (g, "-enable-kvm"); } + /* Specify the host CPU for speed, and kvmclock for stability. */ + add_cmdline (g, "-cpu"); + add_cmdline (g, "host,+kvmclock"); + if (g->smp > 1) { snprintf (buf, sizeof buf, "%d", g->smp); add_cmdline (g, "-smp"); -- 2.7.4