Skip to content

Commit

Permalink
KVM: use cache=unsafe
Browse files Browse the repository at this point in the history
When running with raw image files, we're not passing in any cache= parameter,
making KVM use the default. Unfortunately, the default is horribly slow and
way too secure about data which doesn't matter for our build use case.

So instead, we should just use cache=unsafe, rendering flush requests from the
guest as nops, making builds faster by many times.

Signed-off-by: Alexander Graf <[email protected]>
  • Loading branch information
agraf authored and adrianschroeter committed Oct 1, 2011
1 parent d674a36 commit 7aefa9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -1527,10 +1527,12 @@ for SPECFILE in "${SPECFILES[@]}" ; do
elif [ "$VM_TYPE" = 'qemu' -o "$VM_TYPE" = 'kvm' ]; then
echo "booting $VM_TYPE ..."
if [ "$kvm_virtio" = 1 ]; then
CACHE=""
if [ "$VM_TYPE" = 'kvm' -a -b "$VM_IMAGE" ]; then
# speed optimization when using kvm with raw devices
CACHE=",cache=none"
else
# speed optimization when using kvm with raw files
CACHE=",cache=unsafe"
fi
qemu_args=(-drive file="$VM_IMAGE",if=virtio$CACHE -hda "$VM_IMAGE")
if [ -n "$VM_SWAP" ]; then
Expand Down

0 comments on commit 7aefa9e

Please sign in to comment.