All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06
@ 2016-06-06 17:35 Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 01/11] tests: Rename tests/Makefile to tests/Makefile.include Paolo Bonzini
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel

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%)
-- 
2.5.5

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 01/11] tests: Rename tests/Makefile to tests/Makefile.include
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 02/11] pc: allow raising low memory via max-ram-below-4g option Paolo Bonzini
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng

From: Fam Zheng <famz@redhat.com>

The file is only included from the top Makefile. Rename it to reflect
this more obviously.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <1464747811-26917-1-git-send-email-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile                             | 2 +-
 tests/{Makefile => Makefile.include} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tests/{Makefile => Makefile.include} (100%)

diff --git a/Makefile b/Makefile
index b8563db..ae75dd2 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/tests/Makefile b/tests/Makefile.include
similarity index 100%
rename from tests/Makefile
rename to tests/Makefile.include
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 02/11] pc: allow raising low memory via max-ram-below-4g option
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 01/11] tests: Rename tests/Makefile to tests/Makefile.include Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 03/11] hw/char: QOM'ify escc.c (fix) Paolo Bonzini
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1464857305-26675-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/pc.c      |  2 +-
 hw/i386/pc_piix.c | 61 +++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e29ccc8..bfaf5a3 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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,
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 24e7042..7b4790f 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -87,29 +87,46 @@ static void pc_init1(MachineState *machine,
     MemoryRegion *rom_memory;
     ram_addr_t lowmem;
 
-    /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
-     * If it doesn't, we need to split it in chunks below and above 4G.
-     * In any case, try to make sure that guest addresses aligned at
-     * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
-     * For old machine types, use whatever split we used historically to avoid
-     * breaking migration.
-     */
-    if (machine->ram_size >= 0xe0000000) {
-        lowmem = pcmc->gigabyte_align ? 0xc0000000 : 0xe0000000;
-    } else {
-        lowmem = 0xe0000000;
-    }
-
-    /* Handle the machine opt max-ram-below-4g.  It is basically doing
-     * min(qemu limit, user limit).
+    /*
+     * Calculate ram split, for memory below and above 4G.  It's a bit
+     * complicated for backward compatibility reasons ...
+     *
+     *  - Traditional split is 3.5G (lowmem = 0xe0000000).  This is the
+     *    default value for max_ram_below_4g now.
+     *
+     *  - Then, to gigabyte align the memory, we move the split to 3G
+     *    (lowmem = 0xc0000000).  But only in case we have to split in
+     *    the first place, i.e. ram_size is larger than (traditional)
+     *    lowmem.  And for new machine types (gigabyte_align = true)
+     *    only, for live migration compatibility reasons.
+     *
+     *  - Next the max-ram-below-4g option was added, which allowed to
+     *    reduce lowmem to a smaller value, to allow a larger PCI I/O
+     *    window below 4G.  qemu doesn't enforce gigabyte alignment here,
+     *    but prints a warning.
+     *
+     *  - Finally max-ram-below-4g got updated to also allow raising lowmem,
+     *    so legacy non-PAE guests can get as much memory as possible in
+     *    the 32bit address space below 4G.
+     *
+     * Examples:
+     *    qemu -M pc-1.7 -m 4G    (old default)    -> 3584M low,  512M high
+     *    qemu -M pc -m 4G        (new default)    -> 3072M low, 1024M high
+     *    qemu -M pc,max-ram-below-4g=2G -m 4G     -> 2048M low, 2048M high
+     *    qemu -M pc,max-ram-below-4g=4G -m 3968M  -> 3968M low (=4G-128M)
      */
-    if (lowmem > pcms->max_ram_below_4g) {
-        lowmem = pcms->max_ram_below_4g;
-        if (machine->ram_size - lowmem > lowmem &&
-            lowmem & ((1ULL << 30) - 1)) {
-            error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
-                         ") not a multiple of 1G; possible bad performance.",
-                         pcms->max_ram_below_4g);
+    lowmem = pcms->max_ram_below_4g;
+    if (machine->ram_size >= pcms->max_ram_below_4g) {
+        if (pcmc->gigabyte_align) {
+            if (lowmem > 0xc0000000) {
+                lowmem = 0xc0000000;
+            }
+            if (lowmem & ((1ULL << 30) - 1)) {
+                error_report("Warning: Large machine and max_ram_below_4g "
+                             "(%" PRIu64 ") not a multiple of 1G; "
+                             "possible bad performance.",
+                             pcms->max_ram_below_4g);
+            }
         }
     }
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 03/11] hw/char: QOM'ify escc.c (fix)
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 01/11] tests: Rename tests/Makefile to tests/Makefile.include Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 02/11] pc: allow raising low memory via max-ram-below-4g option Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 04/11] scsi: esp: check TI buffer index before read/write Paolo Bonzini
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: xiaoqiang zhao

From: xiaoqiang zhao <zxq_yx_007@163.com>

The previous commit e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9
(hw/char: QOM'ify escc.c) cause qemu-system-ppc/ppc64
OpenBIOS to freeze on startup, this commit fix it.

Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <1464767898-30526-1-git-send-email-zxq_yx_007@163.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/escc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/char/escc.c b/hw/char/escc.c
index 8e6a7df..31a5f90 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -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]);
         }
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 04/11] scsi: esp: check TI buffer index before read/write
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 03/11] hw/char: QOM'ify escc.c (fix) Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 05/11] scsi: mark TYPE_SCSI_DISK_BASE as abstract Paolo Bonzini
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

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.

Reported-by: Huawei PSIRT <psirt@huawei.com>
Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <1465230883-22303-1-git-send-email-ppandit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/esp.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 591c817..3adb685 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -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++;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 05/11] scsi: mark TYPE_SCSI_DISK_BASE as abstract
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 04/11] scsi: esp: check TI buffer index before read/write Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 06/11] Makefile: Add a "FORCE" target Paolo Bonzini
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index ab7cf9c..6724cbf 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -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()                                \
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 06/11] Makefile: Add a "FORCE" target
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 05/11] scsi: mark TYPE_SCSI_DISK_BASE as abstract Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default Paolo Bonzini
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng

From: Fam Zheng <famz@redhat.com>

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <1464774261-648-2-git-send-email-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ae75dd2..59af636 100644
--- a/Makefile
+++ b/Makefile
@@ -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))
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (5 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 06/11] Makefile: Add a "FORCE" target Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-10-07 12:58   ` Peter Maydell
  2016-06-06 17:35 ` [Qemu-devel] [PULL 08/11] scsi-disk: add missing break Paolo Bonzini
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng

From: Fam Zheng <famz@redhat.com>

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.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <1464774261-648-3-git-send-email-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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(-)

diff --git a/Makefile b/Makefile
index 59af636..fa85628 100644
--- a/Makefile
+++ b/Makefile
@@ -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) > $@.tmp)
+	$(call quiet-command, cmp --quiet $@ $@.tmp || mv $@.tmp $@)
+
 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak
 qemu-options.def: $(SRC_PATH)/qemu-options.hx
diff --git a/linux-user/main.c b/linux-user/main.c
index b2bc6ab..8a11d02 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -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>
diff --git a/qemu-img.c b/qemu-img.c
index 4b56ad3..32e307c 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -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"
diff --git a/qmp.c b/qmp.c
index 3165f87..7df6543 100644
--- a/qmp.c
+++ b/qmp.c
@@ -14,6 +14,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-version.h"
 #include "qemu/cutils.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
diff --git a/scripts/create_config b/scripts/create_config
index b2d2ebb..d47057b 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -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#*=}
diff --git a/vl.c b/vl.c
index 2f74fe8..9539f92 100644
--- a/vl.c
+++ b/vl.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu-version.h"
 #include "qemu/cutils.h"
 #include "qemu/help_option.h"
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 08/11] scsi-disk: add missing break
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (6 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 09/11] vnc: list the 'to' parameter of '-vnc' in the qemu man page Paolo Bonzini
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 6724cbf..1881969 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -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];
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 09/11] vnc: list the 'to' parameter of '-vnc' in the qemu man page
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (7 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 08/11] scsi-disk: add missing break Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 10/11] Make avx2 configure test work with -O2 Paolo Bonzini
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Robert Ho

From: Robert Ho <robert.hu@intel.com>

Signed-off-by: Robert Ho <robert.hu@intel.com>
Message-Id: <1464678190-9290-2-git-send-email-robert.hu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-options.hx | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/qemu-options.hx b/qemu-options.hx
index 9f33361..c433143 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -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}.
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 10/11] Make avx2 configure test work with -O2
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (8 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 09/11] vnc: list the 'to' parameter of '-vnc' in the qemu man page Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 17:35 ` [Qemu-devel] [PULL 11/11] avx2 configure: Use primitives in test Paolo Bonzini
  2016-06-06 19:14 ` [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Peter Maydell
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

When configured with --extra-cflags=-O2 gcc optimised out the test
and the readelf failed the check leaving avx2 disabled.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1464792879-30954-2-git-send-email-dgilbert@redhat.com>
Reviewed-by: Liang Li <liang.z.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 6d01d96..08952af 100755
--- a/configure
+++ b/configure
@@ -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
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 11/11] avx2 configure: Use primitives in test
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (9 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 10/11] Make avx2 configure test work with -O2 Paolo Bonzini
@ 2016-06-06 17:35 ` Paolo Bonzini
  2016-06-06 19:14 ` [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Peter Maydell
  11 siblings, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2016-06-06 17:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

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 <dgilbert@redhat.com>
Message-Id: <1464792879-30954-3-git-send-email-dgilbert@redhat.com>
Reviewed-by: Liang Li <liang.z.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure     | 15 +++++++++++----
 util/cutils.c |  8 +-------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 08952af..b19171b 100755
--- a/configure
+++ b/configure
@@ -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
diff --git a/util/cutils.c b/util/cutils.c
index 43d1afb..5830a68 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 <cpuid.h>
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06
  2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
                   ` (10 preceding siblings ...)
  2016-06-06 17:35 ` [Qemu-devel] [PULL 11/11] avx2 configure: Use primitives in test Paolo Bonzini
@ 2016-06-06 19:14 ` Peter Maydell
  2016-06-06 19:22   ` Dr. David Alan Gilbert
  11 siblings, 1 reply; 17+ messages in thread
From: Peter Maydell @ 2016-06-06 19:14 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers, Dr. David Alan Gilbert

On 6 June 2016 at 18:35, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 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)

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06
  2016-06-06 19:14 ` [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Peter Maydell
@ 2016-06-06 19:22   ` Dr. David Alan Gilbert
  2016-06-06 19:35     ` Peter Maydell
  0 siblings, 1 reply; 17+ messages in thread
From: Dr. David Alan Gilbert @ 2016-06-06 19:22 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers

* Peter Maydell (peter.maydell@linaro.org) wrote:
> On 6 June 2016 at 18:35, Paolo Bonzini <pbonzini@redhat.com> wrote:
> > 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)
> 
> 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.

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

> 
> 
> /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
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06
  2016-06-06 19:22   ` Dr. David Alan Gilbert
@ 2016-06-06 19:35     ` Peter Maydell
  2016-06-07  9:51       ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 17+ messages in thread
From: Peter Maydell @ 2016-06-06 19:35 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: Paolo Bonzini, QEMU Developers

On 6 June 2016 at 20:22, Dr. David Alan Gilbert <dgilbert@redhat.com> wrote:
> 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.c

This 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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06
  2016-06-06 19:35     ` Peter Maydell
@ 2016-06-07  9:51       ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 17+ messages in thread
From: Dr. David Alan Gilbert @ 2016-06-07  9:51 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers

* Peter Maydell (peter.maydell@linaro.org) wrote:
> On 6 June 2016 at 20:22, Dr. David Alan Gilbert <dgilbert@redhat.com> wrote:
> > 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.c
> 
> This seems to be because to get the compile failure you have
> to be doing a .c to .o compile:

<snip>

> 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.

Does the following (on top of the existing patch) fix it for you:

diff --git a/configure b/configure
index 6449e65..65e603c 100755
--- a/configure
+++ b/configure
@@ -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

> 
> thanks
> -- PMM
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default
  2016-06-06 17:35 ` [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default Paolo Bonzini
@ 2016-10-07 12:58   ` Peter Maydell
  0 siblings, 0 replies; 17+ messages in thread
From: Peter Maydell @ 2016-10-07 12:58 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers, Fam Zheng

On 6 June 2016 at 18:35, Paolo Bonzini <pbonzini@redhat.com> wrote:
> From: Fam Zheng <famz@redhat.com>
>
> 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.
>
> +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) > $@.tmp)
> +       $(call quiet-command, cmp --quiet $@ $@.tmp || mv $@.tmp $@)

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-10-07 12:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 01/11] tests: Rename tests/Makefile to tests/Makefile.include Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 02/11] pc: allow raising low memory via max-ram-below-4g option Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 03/11] hw/char: QOM'ify escc.c (fix) Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 04/11] scsi: esp: check TI buffer index before read/write Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 05/11] scsi: mark TYPE_SCSI_DISK_BASE as abstract Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 06/11] Makefile: Add a "FORCE" target Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default Paolo Bonzini
2016-10-07 12:58   ` Peter Maydell
2016-06-06 17:35 ` [Qemu-devel] [PULL 08/11] scsi-disk: add missing break Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 09/11] vnc: list the 'to' parameter of '-vnc' in the qemu man page Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 10/11] Make avx2 configure test work with -O2 Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 11/11] avx2 configure: Use primitives in test Paolo Bonzini
2016-06-06 19:14 ` [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Peter Maydell
2016-06-06 19:22   ` Dr. David Alan Gilbert
2016-06-06 19:35     ` Peter Maydell
2016-06-07  9:51       ` Dr. David Alan Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.