Drop support for 64 bit guests on 32 bit hosts
cover Drop support for 64 bit guests on 32 bit hosts
Hi,
I'm proposing for the 2.8 cycle we officially drop supporting 64 bit guests on 32 bit hosts. For most of the KVM targets it doesn't make any sense anyway and for TCG it makes things harder (e.g. supporting 64 bit atomics on a 32 bit platform). I'm not actually convinced things actually work if built or that anyone relies on these combinations. Consider these patches a way of flushing any such users out ;-)
Alex Bennée (3):
configure: check CPU width and disable larger guests
configure: filter 64 bit machines on 32 bit builds cpu-defs.h: add compile check for HOST vs TARGET LONG_BITS
configure | 50 +++++++++++++++++++++++++++++++++++++++++++++++-- include/exec/cpu-defs.h | 9 +++++++++ 2 files changed, 57 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
RFC 1/3 configure: check CPU width and disable larger guests
Emulating 64 bit guests on a 32 bit host is either impossible with KVM or needs a lot of special casing for TCG targets. As 64 bit hosts are fairly normal nowadays and there can't be many people trying this combination lets disable it completely.
--- configure | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
configure +33 -1
@@ -478,6 +478,7 @@ elif check_define __x86_64__ ; then cpu="x32" else cpu="x86_64" + cpu_width=64 fi elif check_define __sparc__ ; then if check_define __arch64__ ; then
@@ -515,26 +516,36 @@ ARCH= # Normalise host CPU name and set ARCH. # Note that this case should only have supported host CPUs, not guests. case "$cpu" in - ia64|ppc|ppc64|s390|s390x|sparc64|x32) + ppc|s390|x32) cpu="$cpu" + cpu_width=32 + ;; + ia64|ppc64|s390x|sparc64) + cpu="$cpu" + cpu_width=64 ;; i386|i486|i586|i686|i86pc|BePC) cpu="i386" + cpu_width=32 ;; x86_64|amd64) cpu="x86_64" + cpu_width=64 ;; armv*b|armv*l|arm) cpu="arm" + cpu_width=32 ;; aarch64) cpu="aarch64" + cpu_width=32 ;; mips*) cpu="mips" ;; sparc|sun4[cdmuv]) cpu="sparc" + cpu_width=32 ;; *) # This will result in either an error or falling back to TCI later
@@ -1700,6 +1711,26 @@ else fi ########################################## +# host address width checks +too_wide_targets="" + +if test "$cpu_width" = "32"; then + for target in $target_list; do + target_name=$(echo $target | cut -d '-' -f 1) + case "$target_name" in + aarch64|mips64|ppc64|s390x|sparc64) + too_wide_targets="$too_wide_targets $target" + ;; + esac + done +fi + +if test ! -z "$too_wide_targets" ; then + error_exit "Support for the following targets can't be built on 32 bit systems:\n\t$too_wide_targets" +fi + + +########################################## # cocoa implies not SDL or GTK # (the cocoa UI code currently assumes it is always the active UI # and doesn't interact well with other UI frontend code)
@@ -4795,6 +4826,7 @@ if test "$slirp" = "yes" ; then fi echo "module support $modules" echo "host CPU $cpu" +echo "host CPU width $cpu_width" echo "host big endian $bigendian" echo "target list $target_list" echo "tcg debug enabled $debug_tcg"
Signature · 1 line
2.7.4
Re: [Qemu-devel] [RFC for 2.8 1/3] configure: check CPU width and disable larger guests
Quoted 24 lines · Alex Bennée
Emulating 64 bit guests on a 32 bit host is either impossible with KVM or needs a lot of special casing for TCG targets. As 64 bit hosts are fairly normal nowadays and there can't be many people trying this combination lets disable it completely.
Signed-off-by Alex Bennée <[email protected]>--- configure | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)configure +1
-0@@ -478,6 +478,7 @@ elif check_define __x86_64__ ; then cpu="x32" else cpu="x86_64" + cpu_width=64 fi elif check_define __sparc__ ; then if check_define __arch64__ ; then@@ -515,26 +516,36 @@ ARCH= # Normalise host CPU name and set ARCH.
configure ARCH= · line 525
Quoted 10 lines
configure +6
-1# Note that this case should only have supported host CPUs, not guests. case "$cpu" in - ia64|ppc|ppc64|s390|s390x|sparc64|x32) + ppc|s390|x32) cpu="$cpu" + cpu_width=32 + ;; + ia64|ppc64|s390x|sparc64) + cpu="$cpu" + cpu_width=64
We can detect the host pointer width generically at configure time, in a similar way to how we detect its endianness:
cat > $TMPC << EOF
#include <inttypes.h>
uintptr_t be[] = { (uintptr_t)0x4c6f4e674c6f4e67ULL }; uintptr_t le[] = { (uintptr_t)0x674e6f4c674e6f4cULL }; extern int foo(uintptr_t *a, uintptr_t *b);
int main(void) {
return foo(le, be);
}EOF
if compile_object; then
if grep -q LoNgLoNg $TMPO; then
hostwidth=64
elif grep -q LoNg $TMPO; then
hostwidth=32
else
error_exit "Host pointer width detection failed"
fi
else
error_exit "Host pointer width detection failed"
fi
(I've tested the C code here but not the shell-scriptery.)
configure else · line 1721
Quoted 9 lines
configure +8
-0########################################## +# host address width checks +too_wide_targets="" + +if test "$cpu_width" = "32"; then + for target in $target_list; do + target_name=$(echo $target | cut -d '-' -f 1) + case "$target_name" in + aarch64|mips64|ppc64|s390x|sparc64)
We should find a way to avoid having to specify the guest CPU's pointer width twice (once here and once by setting TARGET_LONG_BITS in its cpu.h). Otherwise people are going to forget to update this list for new CPUs.
configure else · line 1730
Quoted 9 lines
configure +9
-0+ too_wide_targets="$too_wide_targets $target" + ;; + esac + done +fi + +if test ! -z "$too_wide_targets" ; then + error_exit "Support for the following targets can't be built on 32 bit systems:\n\t$too_wide_targets" +fi
Won't this break running configure on a 32-bit host with no target-list specified at all?
thanks
-- PMM
Re: [Qemu-devel] [RFC for 2.8 1/3] configure: check CPU width and disable larger guests
In reply to Alex BennéeQuoted 21 lines · Alex Bennée
configure +9
-1- ia64|ppc|ppc64|s390|s390x|sparc64|x32) + ppc|s390|x32) cpu="$cpu" + cpu_width=32 + ;; + ia64|ppc64|s390x|sparc64) + cpu="$cpu" + cpu_width=64 ;; i386|i486|i586|i686|i86pc|BePC) cpu="i386" + cpu_width=32 ;; x86_64|amd64) cpu="x86_64" + cpu_width=64 ;; armv*b|armv*l|arm) cpu="arm" + cpu_width=32 ;;
configure ARCH= · line 548
Quoted 10 lines
configure +2
-0aarch64) cpu="aarch64" + cpu_width=32 ;; mips*) cpu="mips" ;; sparc|sun4[cdmuv]) cpu="sparc" + cpu_width=32
Note that x32 and sparc are both 64-bit hosts with 32-bit pointers (we don't support sparcv8 as a host anymore, just sparcv8+, aka sparcv9 in a 32-bit context).
Not that I believe these to be interesting hosts, since VMA space is half the battle when it comes to emulation.
r~
RFC 2/3 configure: filter 64 bit machines on 32 bit builds
In reply to Alex BennéeIf the user doesn't specify any targets we build a default_target_list from the target .mak fragements. If we don't filter out the 64 bit targets when building on 32 bit machines we'll error out later on.
--- configure | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
configure +15 -1
@@ -1252,7 +1252,21 @@ if [ "$bsd_user" = "yes" ]; then fi for config in $mak_wilds; do - default_target_list="${default_target_list} $(basename "$config" .mak)" + + target=$(basename "$config" .mak) + + if test "$cpu_width" = "32"; then + case $target in + *64*|s390x-*) + # skip 64 bit machines + ;; + *) + default_target_list="${default_target_list} ${target}" + ;; + esac + else + default_target_list="${default_target_list} ${target}" + fi done if test x"$show_help" = x"yes" ; then
Signature · 1 line
2.7.4
Re: [Qemu-devel] [RFC for 2.8 2/3] configure: filter 64 bit machines on 32 bit builds
Quoted 24 lines · Alex Bennée
If the user doesn't specify any targets we build a
default_target_listfrom the target .mak fragements. If we don't filter out the 64 bit targets when building on 32 bit machines we'll error out later on.Signed-off-by Alex Bennée <[email protected]>--- configure | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)configure +6
-1@@ -1252,7 +1252,21 @@ if [ "$bsd_user" = "yes" ]; then fi for config in $mak_wilds; do - default_target_list="${default_target_list} $(basename "$config" .mak)" + + target=$(basename "$config" .mak) + + if test "$cpu_width" = "32"; then + case $target in + *64*|s390x-*)
configure if [ "$bsd_user" = "yes" ]; then · line 1270
Quoted 10 lines
configure +9
-0+ # skip 64 bit machines + ;; + *) + default_target_list="${default_target_list} ${target}" + ;; + esac + else + default_target_list="${default_target_list} ${target}" + fi done
Ah, this is where the default target list gets updated. You need to squash this into patch 1 or you break bisection on 32-bit hosts.
thanks
-- PMM
Re: [Qemu-devel] [RFC for 2.8 2/3] configure: filter 64 bit machines on 32 bit builds
Squash or move to the position before?
Quoted 42 lines · Peter Maydell
Quoted 24 lines · Alex Bennée
If the user doesn't specify any targets we build a
default_target_listfrom the target .mak fragements. If we don't filter out the 64 bit targets when building on 32 bit machines we'll error out later on.Signed-off-by Alex Bennée <[email protected]>--- configure | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)configure +6
-1@@ -1252,7 +1252,21 @@ if [ "$bsd_user" = "yes" ]; then fi for config in $mak_wilds; do - default_target_list="${default_target_list} $(basename "$config" .mak)" + + target=$(basename "$config" .mak) + + if test "$cpu_width" = "32"; then + case $target in + *64*|s390x-*)configure if [ "$bsd_user" = "yes" ]; then · line 1270
Quoted 10 lines
configure +9
-0+ # skip 64 bit machines + ;; + *) + default_target_list="${default_target_list} ${target}" + ;; + esac + else + default_target_list="${default_target_list} ${target}" + fi doneAh, this is where the default target list gets updated. You need to squash this into patch 1 or you break bisection on 32-bit hosts.
thanks
-- PMM
Signature · 2 lines
Alex Bennée KVM/QEMU Hacker for Linaro
Re: [Qemu-devel] [RFC for 2.8 2/3] configure: filter 64 bit machines on 32 bit builds
Quoted 1 line · Alex Bennée
Squash or move to the position before?
There's not much code here and in any case it assumes the existence of variables only set in the previous patch, so I'd just squash.
PS:
Quoted 4 lines
Quoted 4 lines
configure if [ "$bsd_user" = "yes" ]; then · line 1261
Quoted 4 lines
configure +4
-0+ if test "$cpu_width" = "32"; then + case $target in + *64*|s390x-*) + # skip 64 bit machines
...this is adding another place that's listing all 64-bit targets and which would need to be changed if we add another 64-bit target in future.
thanks
-- PMM
RFC 3/3 cpu-defs.h: add compile check for HOST vs TARGET LONG_BITS
In reply to Alex BennéeThis shouldn't trigger as the configure check ensures we don't build any unsupported combinations. However we make the explicit check in cpu-defs to catch any new ones being introduced.
--- include/exec/cpu-defs.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/exec/cpu-defs.h +9 -0
@@ -54,6 +54,15 @@ typedef uint64_t target_ulong;#error TARGET_LONG_SIZE undefined#endif +/* Supporting 64 bit vCPUs on 32 bit hosts is getting increasingly +* complicated so we no longer do it. The configure script should have +* prevented such a configuration being built but we double check +* here. +*/ +#if HOST_LONG_BITS <TARGET_LONG_BITS +#error wide-on-narrow CPU emulation is no longer supported +#endif +#if !defined(CONFIG_USER_ONLY )/* use a fully associative victim tlb of 8 entries */ #define CPU_VTLB_SIZE 8
Signature · 1 line
2.7.4
Quoted 9 lines · Alex Bennée
Hi,
I'm proposing for the 2.8 cycle we officially drop supporting 64 bit guests on 32 bit hosts. For most of the KVM targets it doesn't make any sense anyway and for TCG it makes things harder (e.g. supporting 64 bit atomics on a 32 bit platform). I'm not actually convinced things actually work if built or that anyone relies on these combinations. Consider these patches a way of flushing any such users out ;-)
Adding xen-devel to Cc.
64bit xen hypervisor with 32bit dom0 running 32bit qemu, providing device emulation for 64bit dumUs at least used to be a common setup years ago. I have my doubts this is still the case in recent xen versions, but I guess we better ask the Xen guys ...
Can anyone clarify?
thanks,
Gerd
Quoted 11 lines · Gerd Hoffmann
Quoted 9 lines · Alex Bennée
Hi,
I'm proposing for the 2.8 cycle we officially drop supporting 64 bit guests on 32 bit hosts. For most of the KVM targets it doesn't make any sense anyway and for TCG it makes things harder (e.g. supporting 64 bit atomics on a 32 bit platform). I'm not actually convinced things actually work if built or that anyone relies on these combinations. Consider these patches a way of flushing any such users out ;-)
Quoted 8 lines
Adding xen-devel to Cc.
64bit xen hypervisor with 32bit dom0 running 32bit qemu, providing device emulation for 64bit dumUs at least used to be a common setup years ago. I have my doubts this is still the case in recent xen versions, but I guess we better ask the Xen guys ...
Can anyone clarify?
Hi Gerd, thanks for CC'ing xen-devel on this.
Although 32bit Dom0 deployments are not as common as they used to be, they are still certainly a valid scenario. However for them to work, QEMU doesn't really need to support TCG 32bit on 64bit. QEMU when used with Xen as accelerator doesn't actually do any CPU emulation; there was even a proposal to remove the CPU emulation completely from Xen machines a couple of years back
(http://marc.info/?l=qemu-devel&m=139051862915170&w=2). I hope this helps.
Quoted 9 lines · Alex Bennée
Hi,
I'm proposing for the 2.8 cycle we officially drop supporting 64 bit guests on 32 bit hosts. For most of the KVM targets it doesn't make any sense anyway and for TCG it makes things harder (e.g. supporting 64 bit atomics on a 32 bit platform). I'm not actually convinced things actually work if built or that anyone relies on these combinations. Consider these patches a way of flushing any such users out ;-)
So the other use case which got mentioned to me today was developers who want to test 64 bit system emulation on 32 bit ARM chromebooks. So together with Xen's use case it seems this isn't going to fly for this cycle.
I suspect for working atomics in MTTCG though we'll need to stick to single threaded mode on these combinations.
Quoted 9 lines
Alex Bennée (3):
configure: check CPU width and disable larger guests
configure: filter 64 bit machines on 32 bit buildscpu-defs.h: add compile check for HOST vs TARGETLONG_BITSconfigure | 50 +++++++++++++++++++++++++++++++++++++++++++++++-- include/exec/cpu-defs.h | 9 +++++++++ 2 files changed, 57 insertions(+), 2 deletions(-)
--
Alex Bennée