qemu-devel
[Top][All Lists]
Advanced

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

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


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] spice/qlx: atomic-alignment error with clang-7
Date: Wed, 18 Jul 2018 11:56:35 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

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.

static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
{
    uint32_t old_pending;
    uint32_t le_events = cpu_to_le32(events);
    ...
    old_pending = atomic_fetch_or(&d->ram->int_pending, le_events);
    if ((old_pending & le_events) == le_events) {
        return;
    }
    ...
}

Having:

typedef struct PCIQXLDevice {
    QXLRam *ram;
    ...
} PCIQXLDevice;

And from <spice/qxl_dev.h>:

typedef struct SPICE_ATTR_PACKED QXLRam {
    uint32_t magic;
    uint32_t int_pending;
    uint32_t int_mask;
    uint8_t log_buf[QXL_LOG_BUF_SIZE];
    ...
} QXLRam;

Any idea how this could get fixed?

Thanks

Phil.



reply via email to

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