Misc changes for 2016-06-06
The following changes since commit 76462405809d29bab65a3699686998ba124ab942:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160606-1' into staging (2016-06-06 17:02:42 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to ada3d3ba63016bcd33c42f84bcc982a249768e36:
avx2 configure: Use primitives in test (2016-06-06 19:18:34 +0200)
----------------------------------------------------------------
* max-ram-below-4g improvement (Gerd)
* escc fix (xiaoqiang)
* ESP fix (Prasad)
* scsi-disk tweaks/fix (me)
* PKGVERSION improvement (Fam)
* -vnc man improvement (Robert)
* AVX2 configure fixes (Dave)
----------------------------------------------------------------
First attempt using Docker testing, let's see if I'm better now at doing pull requests...
Paolo
Dr. David Alan Gilbert (2):
Make avx2 configure test work with -O2
avx2 configure: Use primitives in test
Fam Zheng (3):
tests: Rename tests/Makefile to tests/Makefile.include
Makefile: Add a "FORCE" target
Makefile: Derive "PKGVERSION" from "git describe" by default
Gerd Hoffmann (1):
pc: allow raising low memory via max-ram-below-4g option
Paolo Bonzini (2):
scsi: mark TYPE_SCSI_DISK_BASE as abstract
scsi-disk: add missing break
Prasad J Pandit (1):
scsi: esp: check TI buffer index before read/write
Robert Ho (1):
vnc: list the 'to' parameter of '-vnc' in the qemu man page
xiaoqiang zhao (1):
hw/char: QOM'ify escc.c (fix)
Makefile | 26 +++++++++++++--
configure | 15 ++++++---
hw/char/escc.c | 12 ++++---
hw/i386/pc.c | 2 +-
hw/i386/pc_piix.c | 61 +++++++++++++++++++++++-------------
hw/scsi/esp.c | 20 ++++++------
hw/scsi/scsi-disk.c | 2 ++
linux-user/main.c | 1 +
qemu-img.c | 1 +
qemu-options.hx | 7 +++++
qmp.c | 1 +
scripts/create_config | 4 ---
tests/{Makefile => Makefile.include} | 0
util/cutils.c | 8 +----
vl.c | 1 +
15 files changed, 104 insertions(+), 57 deletions(-)
rename tests/{Makefile => Makefile.include} (100%)Signature · 1 line
2.5.5
[Qemu-devel] [PULL 02/11] pc: allow raising low memory via max-ram-below-4g option
From: Gerd Hoffmann <[email protected]>
This patch extends the functionality of the max-ram-below-4g option to also allow increasing lowmem. Use case: Give as much memory as possible to legacy non-PAE guests.
While being at it also rework the lowmem calculation logic and add a longish comment describing how it works and what the compatibility constrains are.
Note: This is a incompatible change. When setting max-ram-below-4g to a value larger than 3.5G (or 3G with gigabyte alignment) it has no effect on older qemu versions: qemu silently ignores it. With the patch applied it actually has an effect and changes the ram layout. Highly unlikely to hit in practive though as there is no reason start old qemu versions that way.
Message-Id: <[email protected]>
--- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 61 +++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 23 deletions(-)
hw/i386/pc.c +1 -1
@@ -1893,7 +1893,7 @@ static void pc_machine_initfn(Object *obj) pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); - pcms->max_ram_below_4g =1ULL <<32 ;/* 4G */ + pcms->max_ram_below_4g =0xe0000000 ;/* 3.5G */ object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g,
hw/i386/pc_piix.c +39 -22
68 lines not on this page · raw message
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 03/11] hw/char: QOM'ify escc.c (fix)
In reply to Paolo BonziniFrom: xiaoqiang zhao <[email protected]>
The previous commit e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9 (hw/char: QOM'ify escc.c) cause qemu-system-ppc/ppc64 OpenBIOS to freeze on startup, this commit fix it.
Message-Id: <[email protected]>
--- hw/char/escc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
hw/char/escc.c +7 -5
@@ -989,18 +989,13 @@ static void escc_init1(Object *obj)SysBusDevice *dev =SYS_BUS_DEVICE (obj);unsigned int i; - s->chn[0 ].disabled = s->disabled; - s->chn[1 ].disabled = s->disabled;for (i =0 ; i <2 ; i++) {sysbus_init_irq (dev, &s->chn[i].irq); s->chn[i].chn =1 - i; - s->chn[i].clock = s->frequency /2 ; } s->chn[0 ].otherchn = &s->chn[1 ]; s->chn[1 ].otherchn = &s->chn[0 ]; -memory_region_init_io (&s->mmio, obj, &escc_mem_ops, s,"escc" , -ESCC_SIZE << s->it_shift);sysbus_init_mmio (dev, &s->mmio); }
@@ -1009,8 +1004,15 @@ static void escc_realize(DeviceState *dev, Error **errp)ESCCState *s =ESCC (dev);unsigned int i; + s->chn[0 ].disabled = s->disabled; + s->chn[1 ].disabled = s->disabled; + +memory_region_init_io (&s->mmio,OBJECT (dev), &escc_mem_ops, s,"escc" , +ESCC_SIZE << s->it_shift); +for (i =0 ; i <2 ; i++) {if (s->chn[i].chr) { + s->chn[i].clock = s->frequency /2 ;qemu_chr_add_handlers (s->chn[i].chr, serial_can_receive, serial_receive1, serial_event, &s->chn[i]); }
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 04/11] scsi: esp: check TI buffer index before read/write
In reply to Paolo BonziniFrom: Prasad J Pandit <[email protected]>
The 53C9X Fast SCSI Controller(FSC) comes with internal 16-byte FIFO buffers. One is used to handle commands and other is for information transfer. Three control variables 'ti_rptr', 'ti_wptr' and 'ti_size' are used to control r/w access to the information transfer buffer ti_buf[TI_BUFSZ=16]. In that,
'ti_rptr' is used as read index, where read occurs. 'ti_wptr' is a write index, where write would occur. 'ti_size' indicates total bytes to be read from the buffer.
While reading/writing to this buffer, index could exceed its size. Add check to avoid OOB r/w access.
Message-Id: <[email protected]>
--- hw/scsi/esp.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
hw/scsi/esp.c +9 -11
@@ -400,19 +400,17 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)trace_esp_mem_readb (saddr, s->rregs[saddr]);switch (saddr) {case ESP_FIFO : -if (s->ti_size >0 ) { +if ((s->rregs[ESP_RSTAT ] &STAT_PIO_MASK ) ==0 ) { +/* Data out. */ +qemu_log_mask (LOG_UNIMP ,"esp: PIO data read not implemented\n" ); + s->rregs[ESP_FIFO ] =0 ; +esp_raise_irq (s); + }else if (s->ti_rptr < s->ti_wptr) { s->ti_size--; -if ((s->rregs[ESP_RSTAT ] &STAT_PIO_MASK ) ==0 ) { -/* Data out. */ -qemu_log_mask (LOG_UNIMP , -"esp: PIO data read not implemented\n" ); - s->rregs[ESP_FIFO ] =0 ; - }else { - s->rregs[ESP_FIFO ] = s->ti_buf[s->ti_rptr++]; - } + s->rregs[ESP_FIFO ] = s->ti_buf[s->ti_rptr++];esp_raise_irq (s); } -if (s->ti_size ==0 ) { +if (s->ti_rptr == s->ti_wptr) { s->ti_rptr =0 ; s->ti_wptr =0 ; }
@@ -456,7 +454,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) }else {trace_esp_error_fifo_overrun (); } - }else if (s->ti_size ==TI_BUFSZ -1 ) { + }else if (s->ti_wptr ==TI_BUFSZ -1 ) {trace_esp_error_fifo_overrun (); }else { s->ti_size++;
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 05/11] scsi: mark TYPE_SCSI_DISK_BASE as abstract
In reply to Paolo Bonzini--- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+)
hw/scsi/scsi-disk.c +1 -0
@@ -2842,6 +2842,7 @@ static const TypeInfo scsi_disk_base_info = { .class_init = scsi_disk_base_class_initfn, .instance_size = sizeof(SCSIDiskState), .class_size = sizeof(SCSIDiskClass), + .abstract = true, };#define DEFINE_SCSI_DISK_PROPERTIES () \
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 01/11] tests: Rename tests/Makefile to tests/Makefile.include
In reply to Paolo BonziniFrom: Fam Zheng <[email protected]>
The file is only included from the top Makefile. Rename it to reflect this more obviously.
Message-Id: <[email protected]>
---
Makefile | 2 +-
tests/{Makefile => Makefile.include} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename tests/{Makefile => Makefile.include} (100%)Makefile +1 -1
@@ -162,7 +162,7 @@ dummy := $(call unnest-vars,, \ common-obj-m) ifneq ($(wildcard config-host.mak),) -include $(SRC_PATH)/tests/Makefile +include $(SRC_PATH)/tests/Makefile.include endif all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
tests/Makefile.include renamed from tests/Makefile +0 -0
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 09/11] vnc: list the 'to' parameter of '-vnc' in the qemu man page
In reply to Paolo BonziniFrom: Robert Ho <[email protected]>
Message-Id: <[email protected]>
--- qemu-options.hx | 7 +++++++ 1 file changed, 7 insertions(+)
qemu-options.hx +7 -0
@@ -1241,6 +1241,13 @@ syntax for the @var{display} is @table @option +@item to=@var{L} + +With this option, QEMU will try next available VNC @var{display}s, until the +number @var{L}, if the origianlly defined "-vnc @var{display}" is not +available, e.g. port 5900+@var{display} is already used by another +application. By default, to=0. + @item @var{host}:@var{d} TCP connections will only be allowed from @var{host} on display @var{d}.
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 10/11] Make avx2 configure test work with -O2
In reply to Paolo BonziniFrom: "Dr. David Alan Gilbert" <[email protected]>
When configured with --extra-cflags=-O2 gcc optimised out the test and the readelf failed the check leaving avx2 disabled.
Message-Id: <[email protected]>
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -1783,7 +1783,7 @@ fi cat > $TMPC << EOF static void bar(void) {} static void *bar_ifunc(void) {return (void*) bar;} -static void foo(void) __attribute__((ifunc("bar_ifunc"))); +void foo(void) __attribute__((ifunc("bar_ifunc"))); int main(void) { foo(); return 0; } EOF if compile_prog "-mavx2" "" ; then
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default
In reply to Paolo BonziniFrom: Fam Zheng <[email protected]>
Currently, if not specified in "./configure", QEMU_PKGVERSION will be empty. Write a rule in Makefile to generate a value from "git describe" combined with a possible git tree cleanness suffix, and write into a new header.
$ cat qemu-version.h
#define QEMU_PKGVERSION "-v2.6.0-557-gd6550e9-dirty"Include the header in .c files where the macro is referenced. It's not necessary to include it in all files, otherwise each time the content of the file changes, all sources have to be recompiled.
Message-Id: <[email protected]>
--- Makefile | 22 +++++++++++++++++++++- linux-user/main.c | 1 + qemu-img.c | 1 + qmp.c | 1 + scripts/create_config | 4 ---- vl.c | 1 + 6 files changed, 25 insertions(+), 5 deletions(-)
Makefile +21 -1
@@ -50,7 +50,7 @@ endif include $(SRC_PATH)/rules.mak -GENERATED_HEADERS = config-host.h qemu-options.def +GENERATED_HEADERS = qemu-version.h config-host.h qemu-options.def GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c GENERATED_HEADERS += qmp-introspect.h
@@ -167,6 +167,26 @@ endif all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules +qemu-version.h: FORCE + $(call quiet-command, \ + (cd $(SRC_PATH); \ + printf '#define QEMU_PKGVERSION '; \ + if test -n "$(PKGVERSION)"; then \ + printf '"$(PKGVERSION)"\n'; \ + else \ + if test -d .git; then \ + printf '" ('; \ + git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ + if ! git diff-index --quiet HEAD &>/dev/null; then \ + printf -- '-dirty'; \ + fi; \ + printf ')"\n'; \ + else \ + printf '""\n'; \ + fi; \ + fi) > [email protected]) + $(call quiet-command, cmp --quiet $@ [email protected] || mv [email protected] $@) + config-host.h: config-host.h-timestamp config-host.h-timestamp: config-host.mak qemu-options.def: $(SRC_PATH)/qemu-options.hx
linux-user/main.c +1 -0
@@ -17,6 +17,7 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu-version.h" #include <sys/mman.h> #include <sys/syscall.h> #include <sys/resource.h>
qemu-img.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu-version.h" #include "qapi/error.h" #include "qapi-visit.h" #include "qapi/qmp-output-visitor.h"
qmp.c +1 -0
@@ -14,6 +14,7 @@*/ #include "qemu/osdep.h" +#include "qemu-version.h" #include "qemu/cutils.h" #include "monitor/monitor.h" #include "sysemu/sysemu.h"
scripts/create_config +0 -4
@@ -9,10 +9,6 @@ case $line in version=${line#*=} echo "#define QEMU_VERSION \"$version\"" ;; - PKGVERSION=*) # configuration - pkgversion=${line#*=} - echo "#define QEMU_PKGVERSION \"$pkgversion\"" - ;; qemu_*dir=*) # qemu-specific directory configuration name=${line%=*} value=${line#*=}
vl.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu-version.h" #include "qemu/cutils.h" #include "qemu/help_option.h"
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default
Quoted 23 lines · Paolo Bonzini
From: Fam Zheng <[email protected]>
Currently, if not specified in "./configure",
QEMU_PKGVERSIONwill be empty. Write a rule inMakefileto generate a value from "git describe" combined with a possible git tree cleanness suffix, and write into a new header.$ cat qemu-version.h #define QEMU_PKGVERSION "-v2.6.0-557-gd6550e9-dirty"Include the header in .c files where the macro is referenced. It's not necessary to include it in all files, otherwise each time the content of the file changes, all sources have to be recompiled.
Makefile +9
-0+qemu-version.h: FORCE + $(call quiet-command, \ + (cd $(SRC_PATH); \ + printf '#define QEMU_PKGVERSION '; \ + if test -n "$(PKGVERSION)"; then \ + printf '"$(PKGVERSION)"\n'; \ + else \ + if test -d .git; then \ + printf '" ('; \
Makefile endif · line 188
Quoted 10 lines
Makefile +10
-0+ git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ + if ! git diff-index --quiet HEAD &>/dev/null; then \ + printf -- '-dirty'; \ + fi; \ + printf ')"\n'; \ + else \ + printf '""\n'; \ + fi; \ + fi) > [email protected]) + $(call quiet-command, cmp --quiet $@ [email protected] || mv [email protected] $@)
I've just discovered that this rune incorrectly always adds "-dirty" to the version string if /bin/sh is dash.
This is because "&>/dev/null" is not POSIX shell syntax, it is a bash extension, and if you run this with dash then the command always fails.
I'm not sure why we are redirecting anything here, since we are using git diff-index's --quiet option which suppresses all output. The simplest fix would seem to be to just delete the redirect option entirely.
The fix for this should probably be cc:stable since it's annoying that you can't out of the box build QEMU and have the version number say '2.7.0' rather than '2.7.0-dirty'...
thanks
-- PMM
[Qemu-devel] [PULL 06/11] Makefile: Add a "FORCE" target
In reply to Paolo BonziniFrom: Fam Zheng <[email protected]>
Message-Id: <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -82,7 +82,7 @@ Makefile: ; configure: ; .PHONY: all clean cscope distclean dvi html info install install-doc \ - pdf recurse-all speed test dist msi + pdf recurse-all speed test dist msi FORCE $(call set-vpath, $(SRC_PATH))
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 11/11] avx2 configure: Use primitives in test
In reply to Paolo BonziniFrom: "Dr. David Alan Gilbert" <[email protected]>
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.
Message-Id: <[email protected]>
--- configure | 15 +++++++++++---- util/cutils.c | 8 +------- 2 files changed, 12 insertions(+), 11 deletions(-)
configure +11 -4
@@ -1781,12 +1781,19 @@ fi # avx2 optimization requirement check cat > $TMPC << EOF -static void bar(void) {} +#pragma GCC push_options +#pragma GCC target("avx2") +#include <cpuid.h> +#include <immintrin.h> + +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 compile_prog "" ; then if readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then avx2_opt="yes" fi
util/cutils.c +1 -7
@@ -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 definedCONFIG_AVX2_OPT &&QEMU_GNUC_PREREQ (4 ,9 ) +#if definedCONFIG_AVX2_OPT #pragma GCC push_options#pragma GCC target("avx2")#include <cpuid.h>
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 08/11] scsi-disk: add missing break
In reply to Paolo Bonzini--- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+)
hw/scsi/scsi-disk.c +1 -0
@@ -2740,6 +2740,7 @@ static int32_t scsi_block_dma_command(SCSIRequest *req, uint8_t *buf)/* 10-byte CDB. */ r->cdb1 = req->cmd.buf[1 ]; r->group_number = req->cmd.buf[6 ]; +break ;case 4 :/* 12-byte CDB. */ r->cdb1 = req->cmd.buf[1 ];
Signature · 1 line
2.5.5
Quoted 12 lines · Paolo Bonzini
The following changes since commit
76462405809d29bab65a3699686998ba124ab942:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160606-1' into staging (2016-06-06 17:02:42 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
ada3d3ba63016bcd33c42f84bcc982a249768e36:avx2 configure: Use primitives in test (2016-06-06 19:18:34 +0200)
Quoted 8 lines
----------------------------------------------------------------
* max-ram-below-4g improvement (Gerd)
* escc fix (xiaoqiang)
* ESP fix (Prasad)
* scsi-disk tweaks/fix (me)
* PKGVERSION improvement (Fam)
* -vnc man improvement (Robert)
* AVX2 configure fixes (Dave)
Hi. I'm afraid this fails to build for me (x86-64 Linux, gcc).
I think this is the "trying to use the #pragma target("avx2") doesn't work under ccache" problem again. (configure tests run not under ccache, but the build proper does.) See
https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg05298.html
from last time we tried this...
Possibly it's just that you deleted the "requires gcc 4.9" check with the comment that says "this doesn't work with older gcc", so now we're again trying to do this on the older gcc where it doesn't work ;-)
Compiler errors below.
/home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘can_use_buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:275:29: error:
‘__m256i’ undeclared (first use in this function)
* sizeof(AVX2_VECTYPE)) == 0
^/home/petmay01/linaro/qemu-for-merges/util/cutils.c:275:29: note: each undeclared identifier is reported only once for each function it appears in /home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:281:5: error:
unknown type name ‘__m256i’
const AVX2_VECTYPE *p = buf;
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:282:5: error:
unknown type name ‘__m256i’
const AVX2_VECTYPE zero = (AVX2_VECTYPE){0};
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:282:27: error:
‘__m256i’ undeclared (first use in this function)
const AVX2_VECTYPE zero = (AVX2_VECTYPE){0};
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:282:35: error:
expected ‘,’ or ‘;’ before ‘{’ token
const AVX2_VECTYPE zero = (AVX2_VECTYPE){0};
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error:
implicit declaration of function ‘_mm256_movemask_epi8’
[-Werror=implicit-function-declaration]
if (!AVX2_ALL_EQ(p[i], zero)) {
^/home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error:
nested extern declaration of ‘_mm256_movemask_epi8’ [-Werror=nested-externs] /home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error:
implicit declaration of function ‘_mm256_cmpeq_epi8’ [-Werror=implicit-function-declaration] /home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error:
nested extern declaration of ‘_mm256_cmpeq_epi8’ [-Werror=nested-externs] /home/petmay01/linaro/qemu-for-merges/util/cutils.c:300:17: error:
expected ‘;’ before ‘tmp0’
AVX2_VECTYPE tmp0 = AVX2_VEC_OR(p[i + 0], p[i + 1]);
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:301:17: error:
expected ‘;’ before ‘tmp1’
AVX2_VECTYPE tmp1 = AVX2_VEC_OR(p[i + 2], p[i + 3]);
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:302:17: error:
expected ‘;’ before ‘tmp2’
AVX2_VECTYPE tmp2 = AVX2_VEC_OR(p[i + 4], p[i + 5]);
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:303:17: error:
expected ‘;’ before ‘tmp3’
AVX2_VECTYPE tmp3 = AVX2_VEC_OR(p[i + 6], p[i + 7]);
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:304:17: error:
expected ‘;’ before ‘tmp01’
AVX2_VECTYPE tmp01 = AVX2_VEC_OR(tmp0, tmp1);
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:305:17: error:
expected ‘;’ before ‘tmp23’
AVX2_VECTYPE tmp23 = AVX2_VEC_OR(tmp2, tmp3);
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:9: error:
implicit declaration of function ‘_mm256_or_si256’
[-Werror=implicit-function-declaration]
if (!AVX2_ALL_EQ(AVX2_VEC_OR(tmp01, tmp23), zero)) {
^/home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:9: error:
nested extern declaration of ‘_mm256_or_si256’ [-Werror=nested-externs] /home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:71: error:
‘tmp01’ undeclared (first use in this function)
if (!AVX2_ALL_EQ(AVX2_VEC_OR(tmp01, tmp23), zero)) {
^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:78: error:
‘tmp23’ undeclared (first use in this function)
if (!AVX2_ALL_EQ(AVX2_VEC_OR(tmp01, tmp23), zero)) {
^/home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘can_use_buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:277:1: error:
control reaches end of non-void function [-Werror=return-type]
}
^/home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:312:1: error:
control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors
thanks
-- PMM
Quoted 30 lines · * Peter Maydell ([email protected]) wrote:
Quoted 12 lines · Paolo Bonzini
The following changes since commit
76462405809d29bab65a3699686998ba124ab942:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160606-1' into staging (2016-06-06 17:02:42 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
ada3d3ba63016bcd33c42f84bcc982a249768e36:avx2 configure: Use primitives in test (2016-06-06 19:18:34 +0200)
Quoted 8 lines
----------------------------------------------------------------
* max-ram-below-4g improvement (Gerd)
* escc fix (xiaoqiang)
* ESP fix (Prasad)
* scsi-disk tweaks/fix (me)
* PKGVERSION improvement (Fam)
* -vnc man improvement (Robert)
* AVX2 configure fixes (Dave)Hi. I'm afraid this fails to build for me (x86-64 Linux, gcc).
I think this is the "trying to use the #pragma
target("avx2")doesn't work under ccache" problem again. (configure tests run not under ccache, but the build proper does.) See
https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg05298.html
from last time we tried this...
Quoted 5 lines
Possibly it's just that you deleted the "requires gcc 4.9" check with the comment that says "this doesn't work with older gcc", so now we're again trying to do this on the older gcc where it doesn't work ;-)
Compiler errors below.
Sigh I see; so the configure test is run with a different set of compiler options than the main compiles? How is any configure test supposed to check that it's got a sane configuration?
In that case, I suggest the fix is to leave the change to the configure script, but for the moment leave the #if QEMU_GNUC_PREREG(4, 9)
Dave
Quoted 98 lines
/home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘can_use_buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:275:29: error:
‘__m256i’ undeclared (first use in this function)
*sizeof(AVX2_VECTYPE)) == 0
^/home/petmay01/linaro/qemu-for-merges/util/cutils.c:275:29: note: each undeclared identifier is reported only once for each function it appears in/home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:281:5: error:
unknown type name ‘__m256i’const AVX2_VECTYPE *p = buf; ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:282:5: error: unknown type name ‘__m256i’ const AVX2_VECTYPE zero = (AVX2_VECTYPE){0}; ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:282:27: error: ‘__m256i’ undeclared (first use in this function) const AVX2_VECTYPE zero = (AVX2_VECTYPE){0}; ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:282:35: error: expected ‘,’ or ‘;’ before ‘{’ token const AVX2_VECTYPE zero = (AVX2_VECTYPE){0}; ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error: implicit declaration of function ‘_mm256_movemask_epi8’ [-Werror=implicit-function-declaration] if (!AVX2_ALL_EQ(p[i], zero)) { ^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error:
nested extern declaration of ‘_mm256_movemask_epi8’ [-Werror=nested-externs]/home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error:
implicit declaration of function ‘_mm256_cmpeq_epi8’ [-Werror=implicit-function-declaration]/home/petmay01/linaro/qemu-for-merges/util/cutils.c:292:9: error:
nested extern declaration of ‘_mm256_cmpeq_epi8’ [-Werror=nested-externs]/home/petmay01/linaro/qemu-for-merges/util/cutils.c:300:17: error:
expected ‘;’ before ‘tmp0’AVX2_VECTYPE tmp0 = AVX2_VEC_OR(p[i + 0], p[i + 1]); ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:301:17: error: expected ‘;’ before ‘tmp1’ AVX2_VECTYPE tmp1 = AVX2_VEC_OR(p[i + 2], p[i + 3]); ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:302:17: error: expected ‘;’ before ‘tmp2’ AVX2_VECTYPE tmp2 = AVX2_VEC_OR(p[i + 4], p[i + 5]); ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:303:17: error: expected ‘;’ before ‘tmp3’ AVX2_VECTYPE tmp3 = AVX2_VEC_OR(p[i + 6], p[i + 7]); ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:304:17: error: expected ‘;’ before ‘tmp01’ AVX2_VECTYPE tmp01 = AVX2_VEC_OR(tmp0, tmp1); ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:305:17: error: expected ‘;’ before ‘tmp23’ AVX2_VECTYPE tmp23 = AVX2_VEC_OR(tmp2, tmp3); ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:9: error: implicit declaration of function ‘_mm256_or_si256’ [-Werror=implicit-function-declaration] if (!AVX2_ALL_EQ(AVX2_VEC_OR(tmp01, tmp23), zero)) { ^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:9: error:
nested extern declaration of ‘_mm256_or_si256’ [-Werror=nested-externs]/home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:71: error:
‘tmp01’ undeclared (first use in this function)if (!AVX2_ALL_EQ(AVX2_VEC_OR(tmp01, tmp23), zero)) { ^ /home/petmay01/linaro/qemu-for-merges/util/cutils.c:306:78: error: ‘tmp23’ undeclared (first use in this function) if (!AVX2_ALL_EQ(AVX2_VEC_OR(tmp01, tmp23), zero)) { ^
/home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘can_use_buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:277:1: error:
control reaches end of non-void function [-Werror=return-type]
}
^/home/petmay01/linaro/qemu-for-merges/util/cutils.c: In function ‘buffer_find_nonzero_offset_avx2’:/home/petmay01/linaro/qemu-for-merges/util/cutils.c:312:1: error:
control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors
Quoted 2 lines
thanks
-- PMM
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 3 lines · Dr. David Alan Gilbert
Sigh I see; so the configure test is run with a different set of compiler options than the main compiles? How is any configure test supposed to check that it's got a sane configuration?
I wasn't quite right -- we do run configure tests with ccache, we just force it to not read the cache. So I think your problem is just that your configure test doesn't fail when run under ccache, even though the main cutils.c compile does:
$ cat /tmp/zz9.c
#pragma GCC push_options
#pragma GCC target("avx2")
#include <cpuid.h>
#include <immintrin.h>static int bar(void *a) {
return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a, (__m256i){0}));
}
static void *bar_ifunc(void) {return (void*) bar;}
int foo(void *a) __attribute__((ifunc("bar_ifunc")));
int main(int argc, char *argv[]) { return foo(argv[0]);}
$ ccache gcc -g -Wall -o /tmp/zz9 /tmp/zz9.cThis seems to be because to get the compile failure you have to be doing a .c to .o compile:
$ ccache gcc -g -Wall -o /tmp/zz9.o -c /tmp/zz9.c
/tmp/zz9.c: In function ‘bar’:
/tmp/zz9.c:7:5: warning: implicit declaration of function
‘_mm256_movemask_epi8’ [-Wimplicit-function-declaration]
return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a,
(__m256i){0}));
^
/tmp/zz9.c:7:5: warning: implicit declaration of function
‘_mm256_cmpeq_epi8’ [-Wimplicit-function-declaration]
/tmp/zz9.c:7:53: error: ‘__m256i’ undeclared (first use in this function)
return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a,
(__m256i){0}));
^
/tmp/zz9.c:7:53: note: each undeclared identifier is reported only
once for each function it appears in
/tmp/zz9.c:7:62: error: expected expression before ‘)’ token
return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a,
(__m256i){0}));
^
/tmp/zz9.c:8:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^but since your test is using compile_prog it does a .c to executable.
The difference is because ccache doesn't intercept .c-to-executable compiles, so they go straight to real gcc and don't have -save-temps, but it does intercept a .c-to-.o compile, which thus does get -save-temps and so hits the gcc bug.
TLDR: if you make your configure test use compile_object it ought to correctly detect that AVX2 doesn't work for this gcc+ccache combo.
thanks
-- PMM
Quoted 26 lines · * Peter Maydell ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Sigh I see; so the configure test is run with a different set of compiler options than the main compiles? How is any configure test supposed to check that it's got a sane configuration?
I wasn't quite right -- we do run configure tests with ccache, we just force it to not read the cache. So I think your problem is just that your configure test doesn't fail when run under ccache, even though the main
cutils.ccompile does:$ cat /tmp/zz9.c #pragma GCC push_options #pragma GCC target("avx2") #include <cpuid.h> #include <immintrin.h>static int bar(void *a) { return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a, (__m256i){0})); } static void *bar_ifunc(void) {return (void*) bar;} int foo(void *a) __attribute__((ifunc("bar_ifunc"))); int main(int argc, char *argv[]) { return foo(argv[0]);} $ ccache gcc -g -Wall -o /tmp/zz9 /tmp/zz9.cThis seems to be because to get the compile failure you have to be doing a .c to .o compile:
<snip>
Quoted 7 lines
The difference is because ccache doesn't intercept .c-to-executable compiles, so they go straight to real gcc and don't have -save-temps, but it does intercept a .c-to-.o compile, which thus does get -save-temps and so hits the gcc bug.
TLDR: if you make your configure test use
compile_objectit ought to correctly detect that AVX2 doesn't work for this gcc+ccache combo.
Does the following (on top of the existing patch) fix it for you:
configure +2 -2
@@ -1793,8 +1793,8 @@ static void *bar_ifunc(void) {return (void*) bar;} int foo(void *a) __attribute__((ifunc("bar_ifunc"))); int main(int argc, char *argv[]) { return foo(argv[0]);} EOF -if compile_prog "" ; 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
Dave
Quoted 3 lines
thanks
-- PMM
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK