qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 0/2] Libslirp patches


From: Peter Maydell
Subject: Re: [PULL 0/2] Libslirp patches
Date: Mon, 5 Jul 2021 17:31:05 +0100

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 via email to

[Prev in Thread] Current Thread [Next in Thread]