mbox series

[v3,0/2] meson: ensure we enable CMPXCHG128 on x86_64

Message ID 20241007172317.1439564-1-pbonzini@redhat.com
Headers show
Series meson: ensure we enable CMPXCHG128 on x86_64 | expand

Message

Paolo Bonzini Oct. 7, 2024, 5:23 p.m. UTC
Alex discovered that CMPXCHG128 was not enabled when building for
x86_64, resulting in slow execution for wide atomic instructions,
creating a huge contention when combined with a high number of cpus
(found while booting android aarch64 guest on x86_64 host).

The problem is that even though we enable -mcx16 option for x86_64, this
is not used when testing for CMPXCHG128. Thus, we silently turn it off.

x86_64 is the only architecture adding machine flags for now, so the
problem is limited to this host architecture.  However, the problem
is generic, so define a new variable for all the -m options, so that
they can be used for other such tests in the future.

Based-on: <20241004223715.1275428-1-pierrick.bouvier@linaro.org>

v2->v3: collect *-by tags
        append to qemu_isa_flags instead of prepending

Paolo Bonzini (2):
  meson: define qemu_isa_flags
  meson: ensure -mcx16 is passed when detecting ATOMIC128

 meson.build | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

Comments

Michael Tokarev Oct. 7, 2024, 5:37 p.m. UTC | #1
07.10.2024 20:23, Paolo Bonzini wrote:
> 
> Alex discovered that CMPXCHG128 was not enabled when building for
> x86_64, resulting in slow execution for wide atomic instructions,
> creating a huge contention when combined with a high number of cpus
> (found while booting android aarch64 guest on x86_64 host).
> 
> The problem is that even though we enable -mcx16 option for x86_64, this
> is not used when testing for CMPXCHG128. Thus, we silently turn it off.
> 
> x86_64 is the only architecture adding machine flags for now, so the
> problem is limited to this host architecture.  However, the problem
> is generic, so define a new variable for all the -m options, so that
> they can be used for other such tests in the future.
> 
> Based-on: <20241004223715.1275428-1-pierrick.bouvier@linaro.org>
> 
> v2->v3: collect *-by tags
>          append to qemu_isa_flags instead of prepending

Yeah, this now looks much better wrt the appending, thank
you for the v2!

/mjt
Richard Henderson Oct. 7, 2024, 7:12 p.m. UTC | #2
On 10/7/24 10:23, Paolo Bonzini wrote:
> v2->v3: collect *-by tags
>          append to qemu_isa_flags instead of prepending
> 
> Paolo Bonzini (2):
>    meson: define qemu_isa_flags
>    meson: ensure -mcx16 is passed when detecting ATOMIC128

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~