From: "Alex Bennée" <alex.bennee@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org,
Artyom Kunakovsky <artyomkunakovsky@gmail.com>,
Richard Henderson <richard.henderson@linaro.org>,
Pierrick Bouvier <pierrick.bouvier@linaro.org>
Subject: Re: [PULL 01/24] configure: move -mcx16 flag out of CPU_CFLAGS
Date: Fri, 04 Oct 2024 17:08:09 +0100 [thread overview]
Message-ID: <87cykflul2.fsf@draig.linaro.org> (raw)
In-Reply-To: <20240525113332.1404158-2-pbonzini@redhat.com> (Paolo Bonzini's message of "Sat, 25 May 2024 13:33:09 +0200")
Paolo Bonzini <pbonzini@redhat.com> writes:
> From: Artyom Kunakovsky <artyomkunakovsky@gmail.com>
>
> The point of CPU_CFLAGS is really just to select the appropriate multilib,
> for example for library linking tests, and -mcx16 is not needed for
> that purpose.
>
> Furthermore, if -mcx16 is part of QEMU's choice of a basic x86_64
> instruction set, it should be applied to cross-compiled x86_64 code too;
> it is plausible that tests/tcg would want to cover cmpxchg16b as well,
> for example. In the end this makes just as much sense as a per sub-build
> tweak, so move the flag to meson.build and cross_cc_cflags_x86_64.
>
> This leaves out contrib/plugins, which would fail when attempting to use
> __sync_val_compare_and_swap_16 (note it does not do yet); while minor,
> this *is* a disadvantage of this change. But building contrib/plugins
> with a Makefile instead of meson.build is something self-inflicted just
> for the sake of showing that it can be done, and if this kind of papercut
> started becoming a problem we could make the directory part of the meson
> build. Until then, we can live with the limitation.
>
> Signed-off-by: Artyom Kunakovsky <artyomkunakovsky@gmail.com>
> Message-ID: <20240523051118.29367-1-artyomkunakovsky@gmail.com>
> [rewrite commit message, remove from configure. - Paolo]
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> configure | 7 ++-----
> meson.build | 7 +++++++
> 2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/configure b/configure
> index 38ee2577013..4d01a42ba65 100755
> --- a/configure
> +++ b/configure
> @@ -512,10 +512,7 @@ case "$cpu" in
> cpu="x86_64"
> host_arch=x86_64
> linux_arch=x86
> - # ??? Only extremely old AMD cpus do not have cmpxchg16b.
> - # If we truly care, we should simply detect this case at
> - # runtime and generate the fallback to serial emulation.
> - CPU_CFLAGS="-m64 -mcx16"
> + CPU_CFLAGS="-m64"
> ;;
> esac
>
> @@ -1203,7 +1200,7 @@ fi
> : ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"}
> : ${cross_cc_sparc="$cross_cc_sparc64"}
> : ${cross_cc_cflags_sparc="-m32 -mcpu=supersparc"}
> -: ${cross_cc_cflags_x86_64="-m64"}
> +: ${cross_cc_cflags_x86_64="-m64 -mcx16"}
>
> compute_target_variable() {
> eval "$2="
> diff --git a/meson.build b/meson.build
> index a9de71d4506..7fd82b5f48c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -336,6 +336,13 @@ if host_arch == 'i386' and not cc.links('''
> qemu_common_flags = ['-march=i486'] + qemu_common_flags
> endif
>
> +# ??? Only extremely old AMD cpus do not have cmpxchg16b.
> +# If we truly care, we should simply detect this case at
> +# runtime and generate the fallback to serial emulation.
> +if host_arch == 'x86_64'
> + qemu_common_flags = ['-mcx16'] + qemu_common_flags
> +endif
> +
> if get_option('prefer_static')
> qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static'
> endif
This breaks atomic detection resulting in:
#undef CONFIG_ATOMIC128
#undef CONFIG_ATOMIC128_OPT
#undef CONFIG_CMPXCHG128
which makes the TCG atomic handling code fallback to cpu_step_atomic,
killing performance.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-10-04 16:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-25 11:33 [PULL 00/24] Build system and target/i386/translate.c cleanups for 2025-05-25 Paolo Bonzini
2024-05-25 11:33 ` [PULL 01/24] configure: move -mcx16 flag out of CPU_CFLAGS Paolo Bonzini
2024-10-04 16:08 ` Alex Bennée [this message]
2024-10-04 22:42 ` Pierrick Bouvier
2024-05-25 11:33 ` [PULL 02/24] target/i386: disable jmp_opt if EFLAGS.RF is 1 Paolo Bonzini
2024-05-25 11:33 ` [PULL 03/24] target/i386: no single-step exception after MOV or POP SS Paolo Bonzini
2024-05-25 11:33 ` [PULL 04/24] target/i386: cleanup eob handling of RSM Paolo Bonzini
2024-05-25 11:33 ` [PULL 05/24] target/i386: remove unnecessary gen_update_cc_op before gen_eob* Paolo Bonzini
2024-05-25 11:33 ` [PULL 06/24] target/i386: cpu_load_eflags already sets cc_op Paolo Bonzini
2024-05-25 11:33 ` [PULL 07/24] target/i386: set CC_OP in helpers if they want CC_OP_EFLAGS Paolo Bonzini
2024-05-25 11:33 ` [PULL 08/24] target/i386: document and group DISAS_* constants Paolo Bonzini
2024-05-25 11:33 ` [PULL 09/24] target/i386: avoid calling gen_eob_syscall before tb_stop Paolo Bonzini
2024-05-25 11:33 ` [PULL 10/24] target/i386: avoid calling gen_eob_inhibit_irq " Paolo Bonzini
2024-05-25 11:33 ` [PULL 11/24] target/i386: assert that gen_update_eip_cur and gen_update_eip_next are the same in tb_stop Paolo Bonzini
2024-05-25 11:33 ` [PULL 12/24] target/i386: raze the gen_eob* jungle Paolo Bonzini
2024-05-25 11:33 ` [PULL 13/24] target/i386: reg in gen_ldst_modrm is always OR_TMP0 Paolo Bonzini
2024-05-25 11:33 ` [PULL 14/24] target/i386: split gen_ldst_modrm for load and store Paolo Bonzini
2024-05-25 11:33 ` [PULL 15/24] target/i386: inline gen_add_A0_ds_seg Paolo Bonzini
2024-05-25 11:33 ` [PULL 16/24] target/i386: use mo_stacksize more Paolo Bonzini
2024-05-25 11:33 ` [PULL 17/24] target/i386: introduce gen_lea_ss_ofs Paolo Bonzini
2024-05-25 11:33 ` [PULL 18/24] target/i386: clean up repeated string operations Paolo Bonzini
2024-05-25 11:33 ` [PULL 19/24] target/i386: remove aflag argument of gen_lea_v_seg Paolo Bonzini
2024-05-25 11:33 ` [PULL 20/24] meson: remove unnecessary reference to libm Paolo Bonzini
2024-05-25 11:33 ` [PULL 21/24] meson: remove unnecessary dependency Paolo Bonzini
2024-05-25 11:33 ` [PULL 22/24] tcg: include dependencies in static_library() Paolo Bonzini
2024-05-25 11:33 ` [PULL 23/24] meson: do not query modules before they are processed Paolo Bonzini
2024-05-25 11:33 ` [PULL 24/24] migration: remove unnecessary zlib dependency Paolo Bonzini
2024-05-26 1:34 ` [PULL 00/24] Build system and target/i386/translate.c cleanups for 2025-05-25 Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cykflul2.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=artyomkunakovsky@gmail.com \
--cc=pbonzini@redhat.com \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.