qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] spice/qlx: atomic-alignment error with clang-7


From: Peter Maydell
Subject: Re: [Qemu-devel] spice/qlx: atomic-alignment error with clang-7
Date: Thu, 27 Sep 2018 13:53:00 +0100

On 27 September 2018 at 13:22, Peter Maydell <address@hidden> wrote:
> On 18 July 2018 at 16:12, Paolo Bonzini <address@hidden> wrote:
>> On 18/07/2018 16:56, Philippe Mathieu-Daudé wrote:
>>> Using clang-7 (Debian) on x86_64 to build v3.0.0-rc1.
>>>
>>> Not a regression, it was probably always there:
>>>
>>> $ ./configure --cc=clang-7 && make hw/display/qxl.o
>>> hw/display/qxl.c:1884:19: error: misaligned or large atomic operation
>>> may incur significant performance penalty [-Werror,-Watomic-alignment]
>>>     old_pending = atomic_fetch_or(&d->ram->int_pending, le_events);
>>>                   ^
>>> include/qemu/atomic.h:206:34: note: expanded from macro 'atomic_fetch_or'
>>> #define atomic_fetch_or(ptr, n)  __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)
>>>                                  ^
>>> 1 error generated.
>>
>> Hi, this is fixed in the latest SPICE git.  The upstream commit is
>>
>> https://gitlab.freedesktop.org/spice/spice-protocol/commit/beda5ec7a6848be20c0cac2a9a8ef2a41e8069c1
>
> ...so what's the plan for handling existing in-the-wild spice
> headers which have this bug? I guess refusing to compile against
> those headers would be a bit harsh.
>
> I'll put together a patch that uses the gcc diagnostic pragma
> to suppress the warning around this line.

...turns out merely suppressing the warning isn't sufficient,
because clang actually generates code that won't link: it
generates an out of line call to __atomic_fetch_or_4 which
causes a link failure because we don't link against libatomic.
Maybe I can do something to persuade the compiler that the
pointer really is 4 aligned...

thanks
-- PMM



reply via email to

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