From 02d0e095031b7fda77de8b558465a57659ea79cb Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 6 Jun 2016 13:57:39 +0200 Subject: os-posix: include sys/mman.h qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous inclusion of sys/mman.h. Include it in sysemu/os-posix.h and remove it from everywhere else. Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- util/memfd.c | 2 -- util/mmap-alloc.c | 1 - util/osdep.c | 4 ---- util/oslib-posix.c | 1 - 4 files changed, 8 deletions(-) (limited to 'util') diff --git a/util/memfd.c b/util/memfd.c index b374238a59..4571d1aba8 100644 --- a/util/memfd.c +++ b/util/memfd.c @@ -29,8 +29,6 @@ #include -#include - #include "qemu/memfd.h" #ifdef CONFIG_MEMFD diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 0b4cc7f7f1..629d97a362 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" #include -#include #define HUGETLBFS_MAGIC 0x958458f6 diff --git a/util/osdep.c b/util/osdep.c index 9a7a439e13..ff004e8074 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -25,10 +25,6 @@ /* Needed early for CONFIG_BSD etc. */ -#if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE) -#include -#endif - #ifdef CONFIG_SOLARIS #include /* See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 4adde93ac1..e2e1d4d39f 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -36,7 +36,6 @@ #include "trace.h" #include "qapi/error.h" #include "qemu/sockets.h" -#include #include #include #include "qemu/cutils.h" -- cgit v1.2.3-55-g7522 From e9abfcb57fd222d58a0c3c71917f9e40d09e9d35 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 6 Jun 2016 18:56:37 +0200 Subject: clean-includes: run it once more Signed-off-by: Paolo Bonzini --- hw/net/net_tx_pkt.c | 1 + hw/net/net_tx_pkt.h | 1 - include/qemu/qdist.h | 1 - include/qemu/qht.h | 1 - tests/e1000e-test.c | 1 - tests/postcopy-test.c | 1 - tests/qht-bench.c | 1 - tests/test-qdist.c | 1 - tests/test-qht-par.c | 1 - tests/test-qht.c | 1 - util/qdist.c | 1 + util/qht.c | 1 + 12 files changed, 3 insertions(+), 9 deletions(-) (limited to 'util') diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index e4478bead8..efd43b47b8 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -15,6 +15,7 @@ * */ +#include "qemu/osdep.h" #include "net_tx_pkt.h" #include "net/eth.h" #include "net/checksum.h" diff --git a/hw/net/net_tx_pkt.h b/hw/net/net_tx_pkt.h index 07b9a2098b..212ecc62fc 100644 --- a/hw/net/net_tx_pkt.h +++ b/hw/net/net_tx_pkt.h @@ -18,7 +18,6 @@ #ifndef NET_TX_PKT_H #define NET_TX_PKT_H -#include "qemu/osdep.h" #include "net/eth.h" #include "exec/hwaddr.h" diff --git a/include/qemu/qdist.h b/include/qemu/qdist.h index f30050c2d1..54ece760d6 100644 --- a/include/qemu/qdist.h +++ b/include/qemu/qdist.h @@ -7,7 +7,6 @@ #ifndef QEMU_QDIST_H #define QEMU_QDIST_H -#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/bitops.h" diff --git a/include/qemu/qht.h b/include/qemu/qht.h index aec60aa534..70bfc68b8d 100644 --- a/include/qemu/qht.h +++ b/include/qemu/qht.h @@ -7,7 +7,6 @@ #ifndef QEMU_QHT_H #define QEMU_QHT_H -#include "qemu/osdep.h" #include "qemu/seqlock.h" #include "qemu/thread.h" #include "qemu/qdist.h" diff --git a/tests/e1000e-test.c b/tests/e1000e-test.c index dbf4859f88..d497b0857c 100644 --- a/tests/e1000e-test.c +++ b/tests/e1000e-test.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" -#include #include "libqtest.h" #include "qemu-common.h" #include "libqos/pci-pc.h" diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c index a35efb3969..35d5180173 100644 --- a/tests/postcopy-test.c +++ b/tests/postcopy-test.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include #include "libqtest.h" #include "qemu/option.h" diff --git a/tests/qht-bench.c b/tests/qht-bench.c index ad8efbca95..76360a0cf5 100644 --- a/tests/qht-bench.c +++ b/tests/qht-bench.c @@ -5,7 +5,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include #include "qemu/processor.h" #include "qemu/atomic.h" #include "qemu/qht.h" diff --git a/tests/test-qdist.c b/tests/test-qdist.c index a67f26057e..0298986ac9 100644 --- a/tests/test-qdist.c +++ b/tests/test-qdist.c @@ -5,7 +5,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include #include "qemu/qdist.h" #include diff --git a/tests/test-qht-par.c b/tests/test-qht-par.c index f09e004ec6..d8a83caf5c 100644 --- a/tests/test-qht-par.c +++ b/tests/test-qht-par.c @@ -5,7 +5,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include #define TEST_QHT_STRING "tests/qht-bench 1>/dev/null 2>&1 -R -S0.1 -D10000 -N1 " diff --git a/tests/test-qht.c b/tests/test-qht.c index c8eb9305ed..f1d628371d 100644 --- a/tests/test-qht.c +++ b/tests/test-qht.c @@ -5,7 +5,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include #include "qemu/qht.h" #define N 5000 diff --git a/util/qdist.c b/util/qdist.c index 4ea2e34fc2..56f573837d 100644 --- a/util/qdist.c +++ b/util/qdist.c @@ -6,6 +6,7 @@ * License: GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "qemu/qdist.h" #include diff --git a/util/qht.c b/util/qht.c index 6f749098f4..40d6e218f7 100644 --- a/util/qht.c +++ b/util/qht.c @@ -65,6 +65,7 @@ * + Corbet, "Relativistic hash tables, part 1: Algorithms", @ lwn.net, 2014. * https://lwn.net/Articles/612021/ */ +#include "qemu/osdep.h" #include "qemu/qht.h" #include "qemu/atomic.h" #include "qemu/rcu.h" -- cgit v1.2.3-55-g7522 From 4fb8320a2efb2216c7ddcc929ad0362f4e285681 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert Date: Fri, 10 Jun 2016 12:16:18 +0100 Subject: avx2 configure: Use primitives in test Use the avx2 primitives during the test, thus making sure that the compiler and assembler could actually use avx2. This also detects the failure case on gcc 4.8.x with -save-temps and avoids the need for the gcc version check in cutils. Signed-off-by: Dr. David Alan Gilbert Message-Id: <1465557378-24105-3-git-send-email-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 17 ++++++++++++----- util/cutils.c | 8 +------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'util') diff --git a/configure b/configure index 3c0e279762..c57d6a7a6d 100755 --- a/configure +++ b/configure @@ -1779,13 +1779,20 @@ fi # avx2 optimization requirement check cat > $TMPC << EOF -static void bar(void) {} +#pragma GCC push_options +#pragma GCC target("avx2") +#include +#include + +static int bar(void *a) { + return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a, (__m256i){0})); +} static void *bar_ifunc(void) {return (void*) bar;} -void foo(void) __attribute__((ifunc("bar_ifunc"))); -int main(void) { foo(); return 0; } +int foo(void *a) __attribute__((ifunc("bar_ifunc"))); +int main(int argc, char *argv[]) { return foo(argv[0]);} EOF -if compile_prog "-mavx2" "" ; then - if readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then +if compile_object "" ; then + if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then avx2_opt="yes" fi fi diff --git a/util/cutils.c b/util/cutils.c index 43d1afbbec..5830a688dc 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -256,13 +256,7 @@ static size_t buffer_find_nonzero_offset_inner(const void *buf, size_t len) return i * sizeof(VECTYPE); } -/* - * GCC before version 4.9 has a bug which will cause the target - * attribute work incorrectly and failed to compile in some case, - * restrict the gcc version to 4.9+ to prevent the failure. - */ - -#if defined CONFIG_AVX2_OPT && QEMU_GNUC_PREREQ(4, 9) +#if defined CONFIG_AVX2_OPT #pragma GCC push_options #pragma GCC target("avx2") #include -- cgit v1.2.3-55-g7522