qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH for-8.1] tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128
Date: Fri, 14 Jul 2023 07:18:40 +0100	[thread overview]
Message-ID: <df0a73d8-8063-4147-e697-6e08085a09c5@linaro.org> (raw)
In-Reply-To: <c99ad0cb-a5b6-3a6b-a256-32aa9028eb2a@linaro.org>

On 7/13/23 22:36, Philippe Mathieu-Daudé wrote:
> Hi Richard,
> 
> On 13/7/23 22:23, Richard Henderson wrote:
>> We adjust CONFIG_ATOMIC128 and CONFIG_CMPXCHG128 with
>> CONFIG_ATOMIC128_OPT in atomic128.h.  It is difficult
>> to tell when those changes have been applied with the
>> ifdef we must use with CONFIG_CMPXCHG128.  So instead
>> use HAVE_CMPXCHG128, which triggers -Werror-undef when
>> the proper header has not been included.
>>
>> Improves tcg_gen_atomic_cmpxchg_i128 for s390x host, which
>> requires CONFIG_ATOMIC128_OPT.  Without this we fall back
>> to EXCP_ATOMIC to single-step 128-bit atomics, which is
>> slow enough to cause some tests to time out.
>>
>> Reported-by: Thomas Huth <thuth@redhat.com>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>
>> Thomas, this issue does not quite match the one you bisected, but
>> other than the cmpxchg, I don't see any see any qemu_{ld,st}_i128
>> being used in BootLinuxS390X.test_s390_ccw_virtio_tcg.
>>
>> As far as I can see, this wasn't broken by the addition of
>> CONFIG_ATOMIC128_OPT, rather that fix didn't go far enough.
>>
>> Anyway, test_s390_ccw_virtio_tcg now passes in 159s on our host.
> 
> IIUC:
> 
> If we have CONFIG_ATOMIC128, we use qatomic_cmpxchg__nocheck;
> else if we have CONFIG_CMPXCHG128 we use __sync_val_compare_and_swap_16;
> in both cases we set HAVE_CMPXCHG128;
> otherwise we can not use atomic128 cmpxchg().
> 
> (I'm trying to figure why we need both CONFIGs).

Or sometimes we use inline asm, because there's no compiler support at all.
Please see host/include/*/host/atomic16-*.h.


r~


  reply	other threads:[~2023-07-14  6:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 20:23 [PATCH for-8.1] tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128 Richard Henderson
2023-07-13 21:36 ` Philippe Mathieu-Daudé
2023-07-14  6:18   ` Richard Henderson [this message]
2023-07-14  9:12 ` Thomas Huth

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=df0a73d8-8063-4147-e697-6e08085a09c5@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).