]> git.proxmox.com Git - mirror_qemu.git/commit - target/i386/cpu.c
x86: host-phys-bits-limit option
authorEduardo Habkost <ehabkost@redhat.com>
Tue, 11 Dec 2018 19:25:27 +0000 (17:25 -0200)
committerEduardo Habkost <ehabkost@redhat.com>
Mon, 14 Jan 2019 14:23:36 +0000 (12:23 -0200)
commit258fe08bd341d2e230676228307294e41f33002c
tree05e61251395e306358edb2d3abbd8d466a214869
parentecb85fe48cacb2f8740186e81f2f38a2e02bd963
x86: host-phys-bits-limit option

Some downstream distributions of QEMU set host-phys-bits=on by
default.  This worked very well for most use cases, because
phys-bits really didn't have huge consequences. The only
difference was on the CPUID data seen by guests, and on the
handling of reserved bits.

This changed in KVM commit 855feb673640 ("KVM: MMU: Add 5 level
EPT & Shadow page table support").  Now choosing a large
phys-bits value for a VM has bigger impact: it will make KVM use
5-level EPT even when it's not really necessary.  This means
using the host phys-bits value may not be the best choice.

Management software could address this problem by manually
configuring phys-bits depending on the size of the VM and the
amount of MMIO address space required for hotplug.  But this is
not trivial to implement.

However, there's another workaround that would work for most
cases: keep using the host phys-bits value, but only if it's
smaller than 48.  This patch makes this possible by introducing a
new "-cpu" option: "host-phys-bits-limit".  Management software
or users can make sure they will always use 4-level EPT using:
"host-phys-bits=on,host-phys-bits-limit=48".

This behavior is still not enabled by default because QEMU
doesn't enable host-phys-bits=on by default.  But users,
management software, or downstream distributions may choose to
change their defaults using the new option.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181211192527.13254-1-ehabkost@redhat.com>
[ehabkost: removed test code while some issues are addressed]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
target/i386/cpu.c
target/i386/cpu.h