qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PULL 0/2] Libslirp patches
Date: Mon, 5 Jul 2021 17:31:05 +0100	[thread overview]
Message-ID: <CAFEAcA9JnYri2TiB-zE1J0w26TQnUzzMe_z2XUD9YxBugJm6tg@mail.gmail.com> (raw)
In-Reply-To: <YOMyh9fu5ZEAlGHN@stefanha-x1.localdomain>

On Mon, 5 Jul 2021 at 17:25, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> On Mon, Jul 05, 2021 at 12:31:01PM +0200, Philippe Mathieu-Daudé wrote:
> > +Richard/Stefan for "atomic" error.
> ...
> > > [2363/9207] Linking target qemu-system-aarch64
> > > FAILED: qemu-system-aarch64
> > > clang++ @qemu-system-aarch64.rsp
> > > libqemu-aarch64-softmmu.fa.p/accel_tcg_cputlb.c.o: In function
> > > `helper_atomic_cmpxchgq_le_mmu':
> > > /tmp/tmp.VkWONZ62bA/build/../accel/tcg/atomic_template.h:86: undefined
> > > reference to `__atomic_compare_exchange_8'
> > > libqemu-aarch64-softmmu.fa.p/accel_tcg_cputlb.c.o: In function
> > > `helper_atomic_xchgq_le_mmu':
> > > /tmp/tmp.VkWONZ62bA/build/../accel/tcg/atomic_template.h:134: undefined
> > > reference to `__atomic_exchange_8'
> > > libqemu-aarch64-softmmu.fa.p/accel_tcg_cputlb.c.o: In function
> > > `helper_atomic_fetch_addq_le_mmu':
>
> According to docs/devel/atomics.rst:
>
>   These operations are polymorphic; they operate on any type that is as
>   wide as a pointer or smaller.
>
> It looks like the compiler doesn't support 8-bit atomics here?

8 here means "8 bytes", not "8 bits". And indeed on i386 you can't
do 8-byte atomics with simple insns. The compiler's answer to this
is "emit a call to a helper in libatomic, which will emulate an
atomic access by taking some kind of lock". We don't ever want to
fall back to "take a lock" because sometimes our accesses to the
atomic variables are from TCG generated code -- this is why we
don't link against libatomic. The problem is that we have not
correctly detected that this compiler can't do inline atomics
for 64-bit values and avoided using them. But at least we have
made this a compile failure rather than a silently-wrong-code bug :-)

thanks
-- PMM


  reply	other threads:[~2021-07-05 16:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 18:55 [PULL 0/2] Libslirp patches marcandre.lureau
2021-05-29 18:55 ` [PULL 1/2] Update libslirp to v4.5.0 marcandre.lureau
2021-06-18 16:01   ` Doug Evans
2021-06-18 18:14     ` Marc-André Lureau
2021-07-27 20:05       ` Doug Evans
2021-05-29 18:55 ` [PULL 2/2] build-sys: make libslirp a meson subproject marcandre.lureau
2021-06-01  9:10 ` [PULL 0/2] Libslirp patches Peter Maydell
2021-06-01 11:01   ` Marc-André Lureau
2021-06-07 12:16     ` Peter Maydell
2021-06-08 15:55       ` Marc-André Lureau
2021-06-08 16:55         ` Peter Maydell
2021-06-08 20:35           ` Marc-André Lureau
2021-07-05 10:31             ` Philippe Mathieu-Daudé
2021-07-05 16:25               ` Stefan Hajnoczi
2021-07-05 16:31                 ` Peter Maydell [this message]
2021-07-05 16:43                   ` Paolo Bonzini
2021-07-05 16:47         ` Paolo Bonzini

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=CAFEAcA9JnYri2TiB-zE1J0w26TQnUzzMe_z2XUD9YxBugJm6tg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=marcandre.lureau@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stefanha@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).