No easy way to use hugetlbfs with QEMU
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
qemu (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Trusty |
Fix Released
|
High
|
Unassigned |
Bug Description
=======
Impact: ksm not enabled, users cannot easily use hugepages, and on older kernels the kvm_{amd,intel}.ko won't get mounted
Test case: cat /sys/kernel/
Regression potential: this upstart job was always installed up through near the end of trusty cycle, so there should be no regression potential
=======
In previous releases (tested with Saucy), if one wanted to use hugetlbfs for a VM, the needed procedure was:
1) Add "vm.nr_hugepages" to /etc/sysctl.
2) start procps
3) Set KVM_HUGEPAGES=1 in /etc/default/
4) restart qemu-kvm
5) Enable "<memoryBacking> <hugepages/
6) Restart the guest
Now with Trusty, this doesn't work anymore as there is no (obvious?) way to have the hugetlbfs mounted where QEMU expects it.
On Saucy, the upstart job for qemu-kvm contains this:
# mount hugepages if available and requested
if [ "$KVM_HUGEPAGES" -eq "1" ]; then
if ! grep -q hugetlbfs /proc/filesystems; then
logger -t qemu-kvm "Error: hugepages not available in the kernel!"
elif grep -q /run/hugepages/kvm /proc/mounts; then
logger -t qemu-kvm "/run/hugepages/kvm already mounted"
elif ! grep -q kvm /etc/group; then
logger -t qemu-kvm "Error: group kvm does not exist!"
else
kvmgid=`grep kvm /etc/group | cut -d: -f 3`
mkdir -p /run/hugepages/kvm
mount -t hugetlbfs hugetlbfs-kvm -o mode=775,
fi
fi
But it seems there is nothing similar in Trusty and manually mounting the hugetlbfs doesn't help as qemu cannot find it there.
Host information:
$ lsb_release -rd
Description: Ubuntu 14.04 LTS
Release: 14.04
$ apt-cache policy qemu-system-x86 libvirt-bin
qemu-system-x86:
Installed: 2.0.0+dfsg-2ubuntu1
Candidate: 2.0.0+dfsg-2ubuntu1
Version table:
*** 2.0.0+dfsg-2ubuntu1 0
500 http://
100 /var/lib/
2.
500 http://
500 http://
2.
500 http://
libvirt-bin:
Installed: 1.2.2-0ubuntu13.1
Candidate: 1.2.2-0ubuntu13.1
Version table:
*** 1.2.2-0ubuntu13.1 0
500 http://
100 /var/lib/
1.
500 http://
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: qemu-system-common 2.0.0+dfsg-2ubuntu1
ProcVersionSign
Uname: Linux 3.13.0-24-generic x86_64
ApportVersion: 2.14.1-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Fri May 2 10:05:18 2014
InstallationDate: Installed on 2014-01-26 (95 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Alpha amd64 (20140124)
SourcePackage: qemu
UpgradeStatus: No upgrade log present (probably fresh install)
description: | updated |
Hi,
could you show the contents of your /etc/init/ qemu-kvm. conf? The package still provides the code you seem to be referring to, and on my laptop /run/hugepages/kvm is still mounted, so I'm curious what is going on on your system.