All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-01 20:58 Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 01/97] target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw Michael Roth
                   ` (98 more replies)
  0 siblings, 99 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

Hi everyone,                                                                                              

The following new patches are queued for QEMU stable v3.0.1:

  https://github.com/mdroth/qemu/commits/stable-3.0-staging

The release is planned for 2019-04-11:

  https://wiki.qemu.org/Planning/3.0

Please respond here or CC qemu-stable@nongnu.org on any patches you
think should be included in the release.

Note that this update falls outside the normal stable release support
window (~1 development cycle), but is being release now since it was
delayed from its intended release date.

Thanks!

----------------------------------------------------------------
Alberto Garcia (1):
      block: Fix use after free error in bdrv_open_inherit()

BALATON Zoltan (1):
      i2c: Move typedef of bitbang_i2c_interface to i2c.h

Bharata B Rao (1):
      spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn

Christian Borntraeger (1):
      iotests: make 235 work on s390 (and others)

Corey Minyard (2):
      i2c: Add a length check to the SMBus write handling
      pc:piix4: Update smbus I/O space after a migration

Daniel Henrique Barboza (1):
      qga: update docs with systemd suspend support info

Daniel P. Berrangé (1):
      qemu-img: fix regression copying secrets during convert

Denis V. Lunev (1):
      nbd: fix NBD_FLAG_SEND_CACHE value

Eduardo Habkost (1):
      i386: Disable TOPOEXT by default on "-cpu host"

Eric Blake (4):
      nbd/server: Advertise all contexts in response to bare LIST
      nbd/client: Make x-dirty-bitmap more reliable
      nbd/client: Send NBD_CMD_DISC if open fails after connect
      bitmap: Update count after a merge

Fam Zheng (5):
      nvme: Fix nvme_init error handling
      aio-posix: Don't count ctx->notifier as progress when polling
      aio: Do aio_notify_accept only during blocking aio_poll
      slirp: Add sanity check for str option length
      job: Fix nested aio_poll() hanging in job_txn_apply

Gerd Hoffmann (3):
      fmops: fix off-by-one in AR_TABLE and DR_TABLE array size
      usb-mtp: outlaw slashes in filenames
      usb-mtp: use O_NOFOLLOW and O_CLOEXEC.

Greg Kurz (1):
      9p: fix QEMU crash when renaming files

Igor Mammedov (1):
      pc: acpi: revert back to 1 SRAT entry for hotpluggable area

Ilya Maximets (1):
      migration: Stop postcopy fault thread before notifying

Janosch Frank (1):
      s390x: Return specification exception for unimplemented diag 308 subcodes

Jason Wang (5):
      ne2000: fix possible out of bound access in ne2000_receive
      rtl8139: fix possible out of bound access
      pcnet: fix possible buffer overflow
      net: ignore packet size greater than INT_MAX
      net: drop too large packet early

Jeff Cody (6):
      block: for jobs, do not clear user_paused until after the resume
      block: iotest to catch abort on forced blockjob cancel
      block/rbd: pull out qemu_rbd_convert_options
      block/rbd: Attempt to parse legacy filenames
      block/rbd: add iotest for rbd legacy keyvalue filename parsing
      block/rbd: add deprecation documentation for filename keyvalue pairs

Kevin Wolf (4):
      block/qapi: Fix memory leak in qmp_query_blockstats()
      mirror: Fail gracefully for source == target
      block-backend: Set werror/rerror defaults in blk_new()
      block: Fix invalidate_cache error path for parent activation

Liam Merwick (1):
      tpm_tis: fix loop that cancels any seizure by a lower locality

Marc-André Lureau (1):
      monitor: fix oob command leak

Marcel Apfelbaum (1):
      hw/rdma: another clang compilation fix

Mark Cave-Ayland (1):
      fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled

Markus Armbruster (1):
      vfio-helpers: Fix qemu_vfio_open_pci() crash

Max Filippov (3):
      target/xtensa: fix FPU2000 bugs
      target/xtensa: fix s32c1i TCGMemOp flags
      target/xtensa: drop num_[core_]regs from dc232b/dc233c configs

Max Reitz (2):
      qemu-img: Fix typo
      qemu-img: Fix leak

Michael Roth (1):
      make-release: add skiboot .version file

Michael S. Tsirkin (1):
      tests: update acpi expected files

Paolo Bonzini (3):
      virtio: update MemoryRegionCaches when guest negotiates features
      virtio: do not take address of packed members
      nvme: fix out-of-bounds access to the CMB

Paul A. Clarke (1):
      Changes requirement for "vsubsbs" instruction

Peter Maydell (4):
      virt: Suppress external aborts on virt-2.10 and earlier
      target/arm: Correct condition for v8M callee stack push
      linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0
      exec.c: Don't reallocate IOMMUNotifiers that are in use

Peter Wu (1):
      vnc: fix memleak of the "vnc-worker-output" name

Peter Xu (2):
      intel_iommu: introduce vtd_reset_caches()
      intel_iommu: better handling of dmar state switch

Prasad J Pandit (1):
      tpm: use loop iterator to set sts data field

Prasad Singamsetty (1):
      kvm: add call to qemu_add_opts() for -overcommit option

Richard Henderson (16):
      target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw
      target/arm: Fix typo in do_sat_addsub_64
      target/arm: Reorganize SVE WHILE
      target/arm: Fix typo in helper_sve_movz_d
      target/arm: Fix typo in helper_sve_ld1hss_r
      target/arm: Fix sign-extension in sve do_ldr/do_str
      target/arm: Fix offset for LD1R instructions
      target/arm: Fix offset scaling for LD_zprr and ST_zprr
      target/arm: Reformat integer register dump
      target/arm: Dump SVE state if enabled
      target/arm: Add sve-max-vq cpu property to -cpu max
      target/arm: Adjust FPCR_MASK for FZ16
      target/arm: Ignore float_flag_input_denormal from fp_status_f16
      target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h
      target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half
      target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs

Stefan Berger (4):
      tpm: Zero-init structure to avoid uninitialized variables in valgrind log
      tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
      tpm: Make sure the locality received from backend is valid
      acpi: Make TPM 2.0 with TIS available as MSFT0101

Thomas Huth (1):
      hw/s390x: Fix bad mask in time2tod()

Tony Garnock-Jones (1):
      linux-user: write(fd, NULL, 0) parity with linux's treatment of same

Vladimir Sementsov-Ogievskiy (4):
      nbd/server: fix bitmap export
      nbd/server: fix NBD_CMD_CACHE
      mirror: fix dead-lock
      iotests: simple mirror test with kvm on 1G image

William Bowling (1):
      slirp: check sscanf result when emulating ident

Yury Kotov (1):
      vhost: fix invalid downcast

Zheng Xiang (1):
      pcie: set link state inactive/active after hot unplug/plug

liujunjie (1):
      clean up callback when del virtqueue

yuchenlin (1):
      vhost-scsi: prevent using uninitialized vqs

 block.c                                    |   2 +
 block/block-backend.c                      |   3 +
 block/mirror.c                             |  18 ++---
 block/nbd-client.c                         |  22 +++++-
 block/nvme.c                               |  37 ++++------
 block/qapi.c                               |   3 +-
 block/rbd.c                                |  90 ++++++++++++++++++++----
 exec.c                                     |  10 +--
 hw/9pfs/9p.c                               |   3 +
 hw/acpi/piix4.c                            |   1 +
 hw/arm/virt.c                              |   2 +
 hw/audio/fmopl.h                           |   4 +-
 hw/block/fdc.c                             |   2 +-
 hw/block/nvme.c                            |   2 +-
 hw/char/virtio-serial-bus.c                |   6 +-
 hw/i2c/bitbang_i2c.h                       |   2 -
 hw/i2c/smbus.c                             |   6 +-
 hw/i386/acpi-build.c                       |  85 ++++++-----------------
 hw/i386/intel_iommu.c                      |  34 ++++++---
 hw/net/ne2000.c                            |   4 +-
 hw/net/pcnet.c                             |   4 +-
 hw/net/rtl8139.c                           |   8 +--
 hw/pci/pcie.c                              |  12 ++++
 hw/ppc/spapr_cpu_core.c                    |  62 +++++++++--------
 hw/rdma/rdma_rm_defs.h                     |   4 +-
 hw/scsi/vhost-scsi.c                       |   2 +-
 hw/tpm/tpm_emulator.c                      |   1 +
 hw/tpm/tpm_tis.c                           |  10 ++-
 hw/usb/dev-mtp.c                           |  19 ++++--
 hw/virtio/vhost.c                          |   4 +-
 hw/virtio/virtio.c                         |  17 ++++-
 include/block/nbd.h                        |   4 +-
 include/hw/i2c/i2c.h                       |   2 +
 include/hw/i2c/ppc4xx_i2c.h                |   3 -
 include/hw/s390x/tod.h                     |   2 +-
 include/net/net.h                          |   6 --
 job.c                                      |  20 ++----
 linux-user/syscall.c                       |  44 +++++++++---
 migration/postcopy-ram.c                   |  11 +--
 monitor.c                                  |   2 +
 nbd/server.c                               |   9 ++-
 net/net.c                                  |  23 +++++--
 net/slirp.c                                |   9 +++
 qemu-deprecated.texi                       |  15 ++++
 qemu-img.c                                 |  35 +++++-----
 qga/qapi-schema.json                       |  25 ++++---
 scripts/make-release                       |   1 +
 slirp/bootp.c                              |  32 ++++++---
 slirp/tcp_subr.c                           |  10 +--
 target/arm/cpu.c                           |   6 +-
 target/arm/cpu.h                           |   5 +-
 target/arm/cpu64.c                         |  29 ++++++++
 target/arm/helper.c                        |  55 +++++++++------
 target/arm/sve_helper.c                    |  23 +++----
 target/arm/translate-a64.c                 | 106 ++++++++++++++++++++++++-----
 target/arm/translate-sve.c                 |  81 +++++++++++++---------
 target/i386/cpu.c                          |   6 ++
 target/ppc/translate/vmx-ops.inc.c         |   2 +-
 target/s390x/diag.c                        |   2 +-
 target/xtensa/core-dc232b.c                |   2 -
 target/xtensa/core-dc232b/gdb-config.inc.c |   1 +
 target/xtensa/core-dc233c.c                |   2 -
 target/xtensa/core-dc233c/gdb-config.inc.c |   1 +
 target/xtensa/translate.c                  |   8 +--
 tests/Makefile.include                     |   2 +-
 tests/acpi-test-data/pc/DSDT               | Bin 5144 -> 5131 bytes
 tests/acpi-test-data/pc/DSDT.bridge        | Bin 7003 -> 6990 bytes
 tests/acpi-test-data/pc/DSDT.cphp          | Bin 5607 -> 5594 bytes
 tests/acpi-test-data/pc/DSDT.dimmpxm       | Bin 6803 -> 6790 bytes
 tests/acpi-test-data/pc/DSDT.ipmikcs       | Bin 5216 -> 5203 bytes
 tests/acpi-test-data/pc/DSDT.memhp         | Bin 6509 -> 6496 bytes
 tests/acpi-test-data/pc/DSDT.numamem       | Bin 5150 -> 5137 bytes
 tests/acpi-test-data/pc/SRAT.dimmpxm       | Bin 472 -> 392 bytes
 tests/acpi-test-data/pc/SRAT.memhp         | Bin 264 -> 264 bytes
 tests/acpi-test-data/q35/DSDT              | Bin 7828 -> 7815 bytes
 tests/acpi-test-data/q35/DSDT.bridge       | Bin 7845 -> 7832 bytes
 tests/acpi-test-data/q35/DSDT.cphp         | Bin 8291 -> 8278 bytes
 tests/acpi-test-data/q35/DSDT.dimmpxm      | Bin 9487 -> 9474 bytes
 tests/acpi-test-data/q35/DSDT.ipmibt       | Bin 7903 -> 7890 bytes
 tests/acpi-test-data/q35/DSDT.memhp        | Bin 9193 -> 9180 bytes
 tests/acpi-test-data/q35/DSDT.numamem      | Bin 7834 -> 7821 bytes
 tests/acpi-test-data/q35/SRAT.dimmpxm      | Bin 472 -> 392 bytes
 tests/acpi-test-data/q35/SRAT.memhp        | Bin 264 -> 264 bytes
 tests/nvme-test.c                          |  68 +++++++++++++++---
 tests/qemu-iotests/041                     |   6 ++
 tests/qemu-iotests/041.out                 |   4 +-
 tests/qemu-iotests/067.out                 |   1 +
 tests/qemu-iotests/229                     |  95 ++++++++++++++++++++++++++
 tests/qemu-iotests/229.out                 |  23 +++++++
 tests/qemu-iotests/231                     |  62 +++++++++++++++++
 tests/qemu-iotests/231.out                 |   9 +++
 tests/qemu-iotests/235                     |  78 +++++++++++++++++++++
 tests/qemu-iotests/235.out                 |   3 +
 tests/qemu-iotests/group                   |   3 +
 ui/vnc-jobs.c                              |   3 +-
 util/aio-posix.c                           |   7 +-
 util/aio-win32.c                           |   3 +-
 util/hbitmap.c                             |   3 +
 util/vfio-helpers.c                        |   2 +-
 vl.c                                       |   1 +
 100 files changed, 1033 insertions(+), 401 deletions(-)
 create mode 100755 tests/qemu-iotests/229
 create mode 100644 tests/qemu-iotests/229.out
 create mode 100755 tests/qemu-iotests/231
 create mode 100644 tests/qemu-iotests/231.out
 create mode 100755 tests/qemu-iotests/235
 create mode 100644 tests/qemu-iotests/235.out

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

* [Qemu-devel] [PATCH 01/97] target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 02/97] target/arm: Fix typo in do_sat_addsub_64 Michael Roth
                   ` (97 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

The normal vector element is sign-extended before
comparing with the wide vector element.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180801123111.3595-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit df4e001093988544d09887122ae824f18ba55c68)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/sve_helper.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index 54795c9194..9bd0694d55 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -2436,13 +2436,13 @@ uint32_t HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, uint32_t desc) \
 #define DO_CMP_PPZW_S(NAME, TYPE, TYPEW, OP) \
     DO_CMP_PPZW(NAME, TYPE, TYPEW, OP, H1_4, 0x1111111111111111ull)
 
-DO_CMP_PPZW_B(sve_cmpeq_ppzw_b, uint8_t,  uint64_t, ==)
-DO_CMP_PPZW_H(sve_cmpeq_ppzw_h, uint16_t, uint64_t, ==)
-DO_CMP_PPZW_S(sve_cmpeq_ppzw_s, uint32_t, uint64_t, ==)
+DO_CMP_PPZW_B(sve_cmpeq_ppzw_b, int8_t,  uint64_t, ==)
+DO_CMP_PPZW_H(sve_cmpeq_ppzw_h, int16_t, uint64_t, ==)
+DO_CMP_PPZW_S(sve_cmpeq_ppzw_s, int32_t, uint64_t, ==)
 
-DO_CMP_PPZW_B(sve_cmpne_ppzw_b, uint8_t,  uint64_t, !=)
-DO_CMP_PPZW_H(sve_cmpne_ppzw_h, uint16_t, uint64_t, !=)
-DO_CMP_PPZW_S(sve_cmpne_ppzw_s, uint32_t, uint64_t, !=)
+DO_CMP_PPZW_B(sve_cmpne_ppzw_b, int8_t,  uint64_t, !=)
+DO_CMP_PPZW_H(sve_cmpne_ppzw_h, int16_t, uint64_t, !=)
+DO_CMP_PPZW_S(sve_cmpne_ppzw_s, int32_t, uint64_t, !=)
 
 DO_CMP_PPZW_B(sve_cmpgt_ppzw_b, int8_t,   int64_t, >)
 DO_CMP_PPZW_H(sve_cmpgt_ppzw_h, int16_t,  int64_t, >)
-- 
2.17.1

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

* [Qemu-devel] [PATCH 02/97] target/arm: Fix typo in do_sat_addsub_64
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 01/97] target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 03/97] target/arm: Reorganize SVE WHILE Michael Roth
                   ` (96 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

Used the wrong temporary in the computation of subtractive overflow.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180801123111.3595-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 7a31e0c6c68baffab0867bdd92b8744568b1d3ba)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/translate-sve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 374051cd20..9dd4c38bab 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -1625,7 +1625,7 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d)
             /* Detect signed overflow for subtraction.  */
             tcg_gen_xor_i64(t0, reg, val);
             tcg_gen_sub_i64(t1, reg, val);
-            tcg_gen_xor_i64(reg, reg, t0);
+            tcg_gen_xor_i64(reg, reg, t1);
             tcg_gen_and_i64(t0, t0, reg);
 
             /* Bound the result.  */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 03/97] target/arm: Reorganize SVE WHILE
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 01/97] target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 02/97] target/arm: Fix typo in do_sat_addsub_64 Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 04/97] target/arm: Fix typo in helper_sve_movz_d Michael Roth
                   ` (95 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

The pseudocode for this operation is an increment + compare loop,
so comparing <= the maximum integer produces an all-true predicate.

Rather than bound in both the inline code and the helper, pass the
helper the number of predicate bits to set instead of the number
of predicate elements to set.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180801123111.3595-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit bbd0968c458d48e34a08b8694fa3309a9fe1c9e7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/sve_helper.c    |  5 ----
 target/arm/translate-sve.c | 49 +++++++++++++++++++++++++-------------
 2 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index 9bd0694d55..87594a8adb 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -2846,11 +2846,6 @@ uint32_t HELPER(sve_while)(void *vd, uint32_t count, uint32_t pred_desc)
         return flags;
     }
 
-    /* Scale from predicate element count to bits.  */
-    count <<= esz;
-    /* Bound to the bits in the predicate.  */
-    count = MIN(count, oprsz * 8);
-
     /* Set all of the requested bits.  */
     for (i = 0; i < count / 64; ++i) {
         d->p[i] = esz_mask;
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 9dd4c38bab..89efc80ee7 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -3173,19 +3173,19 @@ static bool trans_CTERM(DisasContext *s, arg_CTERM *a, uint32_t insn)
 
 static bool trans_WHILE(DisasContext *s, arg_WHILE *a, uint32_t insn)
 {
-    if (!sve_access_check(s)) {
-        return true;
-    }
-
-    TCGv_i64 op0 = read_cpu_reg(s, a->rn, 1);
-    TCGv_i64 op1 = read_cpu_reg(s, a->rm, 1);
-    TCGv_i64 t0 = tcg_temp_new_i64();
-    TCGv_i64 t1 = tcg_temp_new_i64();
+    TCGv_i64 op0, op1, t0, t1, tmax;
     TCGv_i32 t2, t3;
     TCGv_ptr ptr;
     unsigned desc, vsz = vec_full_reg_size(s);
     TCGCond cond;
 
+    if (!sve_access_check(s)) {
+        return true;
+    }
+
+    op0 = read_cpu_reg(s, a->rn, 1);
+    op1 = read_cpu_reg(s, a->rm, 1);
+
     if (!a->sf) {
         if (a->u) {
             tcg_gen_ext32u_i64(op0, op0);
@@ -3198,32 +3198,47 @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a, uint32_t insn)
 
     /* For the helper, compress the different conditions into a computation
      * of how many iterations for which the condition is true.
-     *
-     * This is slightly complicated by 0 <= UINT64_MAX, which is nominally
-     * 2**64 iterations, overflowing to 0.  Of course, predicate registers
-     * aren't that large, so any value >= predicate size is sufficient.
      */
+    t0 = tcg_temp_new_i64();
+    t1 = tcg_temp_new_i64();
     tcg_gen_sub_i64(t0, op1, op0);
 
-    /* t0 = MIN(op1 - op0, vsz).  */
-    tcg_gen_movi_i64(t1, vsz);
-    tcg_gen_umin_i64(t0, t0, t1);
+    tmax = tcg_const_i64(vsz >> a->esz);
     if (a->eq) {
         /* Equality means one more iteration.  */
         tcg_gen_addi_i64(t0, t0, 1);
+
+        /* If op1 is max (un)signed integer (and the only time the addition
+         * above could overflow), then we produce an all-true predicate by
+         * setting the count to the vector length.  This is because the
+         * pseudocode is described as an increment + compare loop, and the
+         * max integer would always compare true.
+         */
+        tcg_gen_movi_i64(t1, (a->sf
+                              ? (a->u ? UINT64_MAX : INT64_MAX)
+                              : (a->u ? UINT32_MAX : INT32_MAX)));
+        tcg_gen_movcond_i64(TCG_COND_EQ, t0, op1, t1, tmax, t0);
     }
 
-    /* t0 = (condition true ? t0 : 0).  */
+    /* Bound to the maximum.  */
+    tcg_gen_umin_i64(t0, t0, tmax);
+    tcg_temp_free_i64(tmax);
+
+    /* Set the count to zero if the condition is false.  */
     cond = (a->u
             ? (a->eq ? TCG_COND_LEU : TCG_COND_LTU)
             : (a->eq ? TCG_COND_LE : TCG_COND_LT));
     tcg_gen_movi_i64(t1, 0);
     tcg_gen_movcond_i64(cond, t0, op0, op1, t0, t1);
+    tcg_temp_free_i64(t1);
 
+    /* Since we're bounded, pass as a 32-bit type.  */
     t2 = tcg_temp_new_i32();
     tcg_gen_extrl_i64_i32(t2, t0);
     tcg_temp_free_i64(t0);
-    tcg_temp_free_i64(t1);
+
+    /* Scale elements to bits.  */
+    tcg_gen_shli_i32(t2, t2, a->esz);
 
     desc = (vsz / 8) - 2;
     desc = deposit32(desc, SIMD_DATA_SHIFT, 2, a->esz);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 04/97] target/arm: Fix typo in helper_sve_movz_d
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (2 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 03/97] target/arm: Reorganize SVE WHILE Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 05/97] target/arm: Fix typo in helper_sve_ld1hss_r Michael Roth
                   ` (94 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180801123111.3595-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 054e7adf4e64e4acb3b033348ebf7cc871baa34f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/sve_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index 87594a8adb..c3cbec9cf5 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -1042,7 +1042,7 @@ void HELPER(sve_movz_d)(void *vd, void *vn, void *vg, uint32_t desc)
     uint64_t *d = vd, *n = vn;
     uint8_t *pg = vg;
     for (i = 0; i < opr_sz; i += 1) {
-        d[i] = n[1] & -(uint64_t)(pg[H1(i)] & 1);
+        d[i] = n[i] & -(uint64_t)(pg[H1(i)] & 1);
     }
 }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 05/97] target/arm: Fix typo in helper_sve_ld1hss_r
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (3 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 04/97] target/arm: Fix typo in helper_sve_movz_d Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 06/97] target/arm: Fix sign-extension in sve do_ldr/do_str Michael Roth
                   ` (93 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

Cc: qemu-stable@nongnu.org (3.0.1)
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 573ec0fe40b9a412085ac7dfb41975a0fc2b28dd)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/sve_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index c3cbec9cf5..e03f954a26 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -4045,7 +4045,7 @@ DO_LD1(sve_ld1bdu_r, cpu_ldub_data_ra, uint64_t, uint8_t, )
 DO_LD1(sve_ld1bds_r, cpu_ldsb_data_ra, uint64_t, int8_t, )
 
 DO_LD1(sve_ld1hsu_r, cpu_lduw_data_ra, uint32_t, uint16_t, H1_4)
-DO_LD1(sve_ld1hss_r, cpu_ldsw_data_ra, uint32_t, int8_t, H1_4)
+DO_LD1(sve_ld1hss_r, cpu_ldsw_data_ra, uint32_t, int16_t, H1_4)
 DO_LD1(sve_ld1hdu_r, cpu_lduw_data_ra, uint64_t, uint16_t, )
 DO_LD1(sve_ld1hds_r, cpu_ldsw_data_ra, uint64_t, int16_t, )
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 06/97] target/arm: Fix sign-extension in sve do_ldr/do_str
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (4 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 05/97] target/arm: Fix typo in helper_sve_ld1hss_r Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 07/97] target/arm: Fix offset for LD1R instructions Michael Roth
                   ` (92 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

The expression (int) imm + (uint32_t) len_align turns into uint32_t
and thus with negative imm produces a memory operation at the wrong
offset.  None of the numbers involved are particularly large, so
change everything to use int.

Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 19f2acc915a0f8f443a959844540a6f09133cc96)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/translate-sve.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 89efc80ee7..9e63b5f8e5 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -4372,12 +4372,11 @@ static bool trans_UCVTF_dd(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
  * The load should begin at the address Rn + IMM.
  */
 
-static void do_ldr(DisasContext *s, uint32_t vofs, uint32_t len,
-                   int rn, int imm)
+static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
 {
-    uint32_t len_align = QEMU_ALIGN_DOWN(len, 8);
-    uint32_t len_remain = len % 8;
-    uint32_t nparts = len / 8 + ctpop8(len_remain);
+    int len_align = QEMU_ALIGN_DOWN(len, 8);
+    int len_remain = len % 8;
+    int nparts = len / 8 + ctpop8(len_remain);
     int midx = get_mem_index(s);
     TCGv_i64 addr, t0, t1;
 
@@ -4458,12 +4457,11 @@ static void do_ldr(DisasContext *s, uint32_t vofs, uint32_t len,
 }
 
 /* Similarly for stores.  */
-static void do_str(DisasContext *s, uint32_t vofs, uint32_t len,
-                   int rn, int imm)
+static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
 {
-    uint32_t len_align = QEMU_ALIGN_DOWN(len, 8);
-    uint32_t len_remain = len % 8;
-    uint32_t nparts = len / 8 + ctpop8(len_remain);
+    int len_align = QEMU_ALIGN_DOWN(len, 8);
+    int len_remain = len % 8;
+    int nparts = len / 8 + ctpop8(len_remain);
     int midx = get_mem_index(s);
     TCGv_i64 addr, t0;
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 07/97] target/arm: Fix offset for LD1R instructions
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (5 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 06/97] target/arm: Fix sign-extension in sve do_ldr/do_str Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 08/97] target/arm: Fix offset scaling for LD_zprr and ST_zprr Michael Roth
                   ` (91 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

The immediate should be scaled by the size of the memory reference,
not the size of the elements into which it is loaded.

Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit d0e372b0298f897993f831dbff7ad4f1c70f138e)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/translate-sve.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 9e63b5f8e5..f635822a61 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -4819,6 +4819,7 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a, uint32_t insn)
     unsigned vsz = vec_full_reg_size(s);
     unsigned psz = pred_full_reg_size(s);
     unsigned esz = dtype_esz[a->dtype];
+    unsigned msz = dtype_msz(a->dtype);
     TCGLabel *over = gen_new_label();
     TCGv_i64 temp;
 
@@ -4842,7 +4843,7 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a, uint32_t insn)
 
     /* Load the data.  */
     temp = tcg_temp_new_i64();
-    tcg_gen_addi_i64(temp, cpu_reg_sp(s, a->rn), a->imm << esz);
+    tcg_gen_addi_i64(temp, cpu_reg_sp(s, a->rn), a->imm << msz);
     tcg_gen_qemu_ld_i64(temp, temp, get_mem_index(s),
                         s->be_data | dtype_mop[a->dtype]);
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 08/97] target/arm: Fix offset scaling for LD_zprr and ST_zprr
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (6 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 07/97] target/arm: Fix offset for LD1R instructions Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 09/97] target/arm: Reformat integer register dump Michael Roth
                   ` (90 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

The scaling should be solely on the memory operation size; the number
of registers being loaded does not come in to the initial computation.

Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 50ef1cbf31caad21019ae6fa8036ed6f29244ba5)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/translate-sve.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index f635822a61..d27bc8c946 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -4665,8 +4665,7 @@ static bool trans_LD_zprr(DisasContext *s, arg_rprr_load *a, uint32_t insn)
     }
     if (sve_access_check(s)) {
         TCGv_i64 addr = new_tmp_a64(s);
-        tcg_gen_muli_i64(addr, cpu_reg(s, a->rm),
-                         (a->nreg + 1) << dtype_msz(a->dtype));
+        tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype));
         tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn));
         do_ld_zpa(s, a->rd, a->pg, addr, a->dtype, a->nreg);
     }
@@ -4899,7 +4898,7 @@ static bool trans_ST_zprr(DisasContext *s, arg_rprr_store *a, uint32_t insn)
     }
     if (sve_access_check(s)) {
         TCGv_i64 addr = new_tmp_a64(s);
-        tcg_gen_muli_i64(addr, cpu_reg(s, a->rm), (a->nreg + 1) << a->msz);
+        tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->msz);
         tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn));
         do_st_zpa(s, a->rd, a->pg, addr, a->msz, a->esz, a->nreg);
     }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 09/97] target/arm: Reformat integer register dump
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (7 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 08/97] target/arm: Fix offset scaling for LD_zprr and ST_zprr Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 10/97] target/arm: Dump SVE state if enabled Michael Roth
                   ` (89 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

With PC, there are 33 registers.  Three per line lines up nicely
without overflowing 80 columns.

Cc: qemu-stable@nongnu.org (3.0.1)
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 3cb506a399854c481c2fd2efabecda0654700c47)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/translate-a64.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 45a6c2a3aa..358f169c75 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -137,14 +137,13 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
     int el = arm_current_el(env);
     const char *ns_status;
 
-    cpu_fprintf(f, "PC=%016"PRIx64"  SP=%016"PRIx64"\n",
-            env->pc, env->xregs[31]);
-    for (i = 0; i < 31; i++) {
-        cpu_fprintf(f, "X%02d=%016"PRIx64, i, env->xregs[i]);
-        if ((i % 4) == 3) {
-            cpu_fprintf(f, "\n");
+    cpu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
+    for (i = 0; i < 32; i++) {
+        if (i == 31) {
+            cpu_fprintf(f, " SP=%016" PRIx64 "\n", env->xregs[i]);
         } else {
-            cpu_fprintf(f, " ");
+            cpu_fprintf(f, "X%02d=%016" PRIx64 "%s", i, env->xregs[i],
+                        (i + 2) % 3 ? " " : "\n");
         }
     }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 10/97] target/arm: Dump SVE state if enabled
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (8 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 09/97] target/arm: Reformat integer register dump Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 11/97] target/arm: Add sve-max-vq cpu property to -cpu max Michael Roth
                   ` (88 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

Also fold the FPCR/FPSR state onto the same line as PSTATE,
and mention but do not dump disabled FPU state.

Cc: qemu-stable@nongnu.org (3.0.1)
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 2bf5f3f91bb4e3faa2a19aec042138a938afbf6a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/translate-a64.c | 93 +++++++++++++++++++++++++++++++++-----
 1 file changed, 82 insertions(+), 11 deletions(-)

diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 358f169c75..b29dc49c4f 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -152,8 +152,7 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
     } else {
         ns_status = "";
     }
-
-    cpu_fprintf(f, "\nPSTATE=%08x %c%c%c%c %sEL%d%c\n",
+    cpu_fprintf(f, "PSTATE=%08x %c%c%c%c %sEL%d%c",
                 psr,
                 psr & PSTATE_N ? 'N' : '-',
                 psr & PSTATE_Z ? 'Z' : '-',
@@ -163,17 +162,89 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
                 el,
                 psr & PSTATE_SP ? 'h' : 't');
 
-    if (flags & CPU_DUMP_FPU) {
-        int numvfpregs = 32;
-        for (i = 0; i < numvfpregs; i++) {
+    if (!(flags & CPU_DUMP_FPU)) {
+        cpu_fprintf(f, "\n");
+        return;
+    }
+    cpu_fprintf(f, "     FPCR=%08x FPSR=%08x\n",
+                vfp_get_fpcr(env), vfp_get_fpsr(env));
+
+    if (arm_feature(env, ARM_FEATURE_SVE)) {
+        int j, zcr_len = env->vfp.zcr_el[1] & 0xf; /* fix for system mode */
+
+        for (i = 0; i <= FFR_PRED_NUM; i++) {
+            bool eol;
+            if (i == FFR_PRED_NUM) {
+                cpu_fprintf(f, "FFR=");
+                /* It's last, so end the line.  */
+                eol = true;
+            } else {
+                cpu_fprintf(f, "P%02d=", i);
+                switch (zcr_len) {
+                case 0:
+                    eol = i % 8 == 7;
+                    break;
+                case 1:
+                    eol = i % 6 == 5;
+                    break;
+                case 2:
+                case 3:
+                    eol = i % 3 == 2;
+                    break;
+                default:
+                    /* More than one quadword per predicate.  */
+                    eol = true;
+                    break;
+                }
+            }
+            for (j = zcr_len / 4; j >= 0; j--) {
+                int digits;
+                if (j * 4 + 4 <= zcr_len + 1) {
+                    digits = 16;
+                } else {
+                    digits = (zcr_len % 4 + 1) * 4;
+                }
+                cpu_fprintf(f, "%0*" PRIx64 "%s", digits,
+                            env->vfp.pregs[i].p[j],
+                            j ? ":" : eol ? "\n" : " ");
+            }
+        }
+
+        for (i = 0; i < 32; i++) {
+            if (zcr_len == 0) {
+                cpu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
+                            i, env->vfp.zregs[i].d[1],
+                            env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
+            } else if (zcr_len == 1) {
+                cpu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
+                            ":%016" PRIx64 ":%016" PRIx64 "\n",
+                            i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
+                            env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
+            } else {
+                for (j = zcr_len; j >= 0; j--) {
+                    bool odd = (zcr_len - j) % 2 != 0;
+                    if (j == zcr_len) {
+                        cpu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
+                    } else if (!odd) {
+                        if (j > 0) {
+                            cpu_fprintf(f, "   [%x-%x]=", j, j - 1);
+                        } else {
+                            cpu_fprintf(f, "     [%x]=", j);
+                        }
+                    }
+                    cpu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
+                                env->vfp.zregs[i].d[j * 2 + 1],
+                                env->vfp.zregs[i].d[j * 2],
+                                odd || j == 0 ? "\n" : ":");
+                }
+            }
+        }
+    } else {
+        for (i = 0; i < 32; i++) {
             uint64_t *q = aa64_vfp_qreg(env, i);
-            uint64_t vlo = q[0];
-            uint64_t vhi = q[1];
-            cpu_fprintf(f, "q%02d=%016" PRIx64 ":%016" PRIx64 "%c",
-                        i, vhi, vlo, (i & 1 ? '\n' : ' '));
+            cpu_fprintf(f, "Q%02d=%016" PRIx64 ":%016" PRIx64 "%s",
+                        i, q[1], q[0], (i & 1 ? "\n" : " "));
         }
-        cpu_fprintf(f, "FPCR: %08x  FPSR: %08x\n",
-                    vfp_get_fpcr(env), vfp_get_fpsr(env));
     }
 }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 11/97] target/arm: Add sve-max-vq cpu property to -cpu max
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (9 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 10/97] target/arm: Dump SVE state if enabled Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 12/97] spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn Michael Roth
                   ` (87 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

This allows the default (and maximum) vector length to be set
from the command-line.  Which is extraordinarily helpful in
debugging problems depending on vector length without having to
bake knowledge of PR_SET_SVE_VL into every guest binary.

Cc: qemu-stable@nongnu.org (3.0.1)
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit adf92eab90e3f5f34c285da6d14d48952b7a8e72)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 linux-user/syscall.c | 19 +++++++++++++------
 target/arm/cpu.c     |  6 +++---
 target/arm/cpu.h     |  3 +++
 target/arm/cpu64.c   | 29 +++++++++++++++++++++++++++++
 target/arm/helper.c  |  7 +++++--
 5 files changed, 53 insertions(+), 11 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index dfc851cc35..5a4af76c03 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10848,15 +10848,22 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #ifdef TARGET_AARCH64
         case TARGET_PR_SVE_SET_VL:
-            /* We cannot support either PR_SVE_SET_VL_ONEXEC
-               or PR_SVE_VL_INHERIT.  Therefore, anything above
-               ARM_MAX_VQ results in EINVAL.  */
+            /*
+             * We cannot support either PR_SVE_SET_VL_ONEXEC or
+             * PR_SVE_VL_INHERIT.  Note the kernel definition
+             * of sve_vl_valid allows for VQ=512, i.e. VL=8192,
+             * even though the current architectural maximum is VQ=16.
+             */
             ret = -TARGET_EINVAL;
             if (arm_feature(cpu_env, ARM_FEATURE_SVE)
-                && arg2 >= 0 && arg2 <= ARM_MAX_VQ * 16 && !(arg2 & 15)) {
+                && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) {
                 CPUARMState *env = cpu_env;
-                int old_vq = (env->vfp.zcr_el[1] & 0xf) + 1;
-                int vq = MAX(arg2 / 16, 1);
+                ARMCPU *cpu = arm_env_get_cpu(env);
+                uint32_t vq, old_vq;
+
+                old_vq = (env->vfp.zcr_el[1] & 0xf) + 1;
+                vq = MAX(arg2 / 16, 1);
+                vq = MIN(vq, cpu->sve_max_vq);
 
                 if (vq < old_vq) {
                     aarch64_sve_narrow_vq(env, vq);
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 64a8005a4b..b25898ed4c 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -168,9 +168,9 @@ static void arm_cpu_reset(CPUState *s)
         env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3);
         env->cp15.cptr_el[3] |= CPTR_EZ;
         /* with maximum vector length */
-        env->vfp.zcr_el[1] = ARM_MAX_VQ - 1;
-        env->vfp.zcr_el[2] = ARM_MAX_VQ - 1;
-        env->vfp.zcr_el[3] = ARM_MAX_VQ - 1;
+        env->vfp.zcr_el[1] = cpu->sve_max_vq - 1;
+        env->vfp.zcr_el[2] = env->vfp.zcr_el[1];
+        env->vfp.zcr_el[3] = env->vfp.zcr_el[1];
 #else
         /* Reset into the highest available EL */
         if (arm_feature(env, ARM_FEATURE_EL3)) {
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index e310ffc29d..9526ed27cb 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -857,6 +857,9 @@ struct ARMCPU {
 
     /* Used to synchronize KVM and QEMU in-kernel device levels */
     uint8_t device_irq_level;
+
+    /* Used to set the maximum vector length the cpu will support.  */
+    uint32_t sve_max_vq;
 };
 
 static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index d0581d59d8..800bff780e 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -29,6 +29,7 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
+#include "qapi/visitor.h"
 
 static inline void set_feature(CPUARMState *env, int feature)
 {
@@ -217,6 +218,29 @@ static void aarch64_a53_initfn(Object *obj)
     define_arm_cp_regs(cpu, cortex_a57_a53_cp_reginfo);
 }
 
+static void cpu_max_get_sve_vq(Object *obj, Visitor *v, const char *name,
+                               void *opaque, Error **errp)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+    visit_type_uint32(v, name, &cpu->sve_max_vq, errp);
+}
+
+static void cpu_max_set_sve_vq(Object *obj, Visitor *v, const char *name,
+                               void *opaque, Error **errp)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+    Error *err = NULL;
+
+    visit_type_uint32(v, name, &cpu->sve_max_vq, &err);
+
+    if (!err && (cpu->sve_max_vq == 0 || cpu->sve_max_vq > ARM_MAX_VQ)) {
+        error_setg(&err, "unsupported SVE vector length");
+        error_append_hint(&err, "Valid sve-max-vq in range [1-%d]\n",
+                          ARM_MAX_VQ);
+    }
+    error_propagate(errp, err);
+}
+
 /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
  * otherwise, a CPU with as many features enabled as our emulation supports.
  * The version of '-cpu max' for qemu-system-arm is defined in cpu.c;
@@ -253,6 +277,10 @@ static void aarch64_max_initfn(Object *obj)
         cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
         cpu->dcz_blocksize = 7; /*  512 bytes */
 #endif
+
+        cpu->sve_max_vq = ARM_MAX_VQ;
+        object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_vq,
+                            cpu_max_set_sve_vq, NULL, NULL, &error_fatal);
     }
 }
 
@@ -405,6 +433,7 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq)
     uint64_t pmask;
 
     assert(vq >= 1 && vq <= ARM_MAX_VQ);
+    assert(vq <= arm_env_get_cpu(env)->sve_max_vq);
 
     /* Zap the high bits of the zregs.  */
     for (i = 0; i < 32; i++) {
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 66afb08ee0..c24c66d43e 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -12408,9 +12408,12 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
             zcr_len = 0;
         } else {
             int current_el = arm_current_el(env);
+            ARMCPU *cpu = arm_env_get_cpu(env);
 
-            zcr_len = env->vfp.zcr_el[current_el <= 1 ? 1 : current_el];
-            zcr_len &= 0xf;
+            zcr_len = cpu->sve_max_vq - 1;
+            if (current_el <= 1) {
+                zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]);
+            }
             if (current_el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
                 zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]);
             }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 12/97] spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (10 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 11/97] target/arm: Add sve-max-vq cpu property to -cpu max Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 13/97] target/arm: Adjust FPCR_MASK for FZ16 Michael Roth
                   ` (86 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Bharata B Rao, David Gibson

From: Bharata B Rao <bharata@linux.ibm.com>

VMStateDescription vmstate_spapr_cpu_state was added by commit
b94020268e0b6 (spapr_cpu_core: migrate per-CPU data) to migrate per-CPU
data with the required vmstate registration and unregistration calls.
However the unregistration is being done only from vcpu creation error path
and not from CPU delete path.

This causes migration to fail with the following error if migration is
attempted after a CPU unplug like this:
Unknown savevm section or instance 'spapr_cpu' 16
Additionally this leaves the source VM unresponsive after migration failure.

Fix this by ensuring the vmstate_unregister happens during CPU removal.
Fixing this becomes easier when vmstate (un)registration calls are moved to
vcpu (un)realize functions which is what this patch does.

Fixes: https://bugs.launchpad.net/qemu/+bug/1785972
Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
(cherry picked from commit cc71c7760e263f808c4240a725425671eeeb7e4d)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/ppc/spapr_cpu_core.c | 62 +++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 993759db47..bb88a3ce4e 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -113,26 +113,6 @@ const char *spapr_get_cpu_core_type(const char *cpu_type)
     return object_class_get_name(oc);
 }
 
-static void spapr_unrealize_vcpu(PowerPCCPU *cpu)
-{
-    qemu_unregister_reset(spapr_cpu_reset, cpu);
-    object_unparent(cpu->intc);
-    cpu_remove_sync(CPU(cpu));
-    object_unparent(OBJECT(cpu));
-}
-
-static void spapr_cpu_core_unrealize(DeviceState *dev, Error **errp)
-{
-    sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
-    CPUCore *cc = CPU_CORE(dev);
-    int i;
-
-    for (i = 0; i < cc->nr_threads; i++) {
-        spapr_unrealize_vcpu(sc->threads[i]);
-    }
-    g_free(sc->threads);
-}
-
 static bool slb_shadow_needed(void *opaque)
 {
     sPAPRCPUState *spapr_cpu = opaque;
@@ -207,10 +187,34 @@ static const VMStateDescription vmstate_spapr_cpu_state = {
     }
 };
 
+static void spapr_unrealize_vcpu(PowerPCCPU *cpu, sPAPRCPUCore *sc)
+{
+    if (!sc->pre_3_0_migration) {
+        vmstate_unregister(NULL, &vmstate_spapr_cpu_state, cpu->machine_data);
+    }
+    qemu_unregister_reset(spapr_cpu_reset, cpu);
+    object_unparent(cpu->intc);
+    cpu_remove_sync(CPU(cpu));
+    object_unparent(OBJECT(cpu));
+}
+
+static void spapr_cpu_core_unrealize(DeviceState *dev, Error **errp)
+{
+    sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
+    CPUCore *cc = CPU_CORE(dev);
+    int i;
+
+    for (i = 0; i < cc->nr_threads; i++) {
+        spapr_unrealize_vcpu(sc->threads[i], sc);
+    }
+    g_free(sc->threads);
+}
+
 static void spapr_realize_vcpu(PowerPCCPU *cpu, sPAPRMachineState *spapr,
-                               Error **errp)
+                               sPAPRCPUCore *sc, Error **errp)
 {
     CPUPPCState *env = &cpu->env;
+    CPUState *cs = CPU(cpu);
     Error *local_err = NULL;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", &local_err);
@@ -233,6 +237,11 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, sPAPRMachineState *spapr,
         goto error_unregister;
     }
 
+    if (!sc->pre_3_0_migration) {
+        vmstate_register(NULL, cs->cpu_index, &vmstate_spapr_cpu_state,
+                         cpu->machine_data);
+    }
+
     return;
 
 error_unregister:
@@ -272,10 +281,6 @@ static PowerPCCPU *spapr_create_vcpu(sPAPRCPUCore *sc, int i, Error **errp)
     }
 
     cpu->machine_data = g_new0(sPAPRCPUState, 1);
-    if (!sc->pre_3_0_migration) {
-        vmstate_register(NULL, cs->cpu_index, &vmstate_spapr_cpu_state,
-                         cpu->machine_data);
-    }
 
     object_unref(obj);
     return cpu;
@@ -290,9 +295,6 @@ static void spapr_delete_vcpu(PowerPCCPU *cpu, sPAPRCPUCore *sc)
 {
     sPAPRCPUState *spapr_cpu = spapr_cpu_state(cpu);
 
-    if (!sc->pre_3_0_migration) {
-        vmstate_unregister(NULL, &vmstate_spapr_cpu_state, cpu->machine_data);
-    }
     cpu->machine_data = NULL;
     g_free(spapr_cpu);
     object_unparent(OBJECT(cpu));
@@ -325,7 +327,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
     }
 
     for (j = 0; j < cc->nr_threads; j++) {
-        spapr_realize_vcpu(sc->threads[j], spapr, &local_err);
+        spapr_realize_vcpu(sc->threads[j], spapr, sc, &local_err);
         if (local_err) {
             goto err_unrealize;
         }
@@ -334,7 +336,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
 
 err_unrealize:
     while (--j >= 0) {
-        spapr_unrealize_vcpu(sc->threads[j]);
+        spapr_unrealize_vcpu(sc->threads[j], sc);
     }
 err:
     while (--i >= 0) {
-- 
2.17.1

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

* [Qemu-devel] [PATCH 13/97] target/arm: Adjust FPCR_MASK for FZ16
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (11 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 12/97] spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 14/97] target/arm: Ignore float_flag_input_denormal from fp_status_f16 Michael Roth
                   ` (85 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

When support for FZ16 was added, we failed to include the bit
within FPCR_MASK, which means that it could never be set.
Continue to zero FZ16 when ARMv8.2-FP16 is not enabled.

Fixes: d81ce0ef2c4
Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180810193129.1556-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 0b62159be33d45d00dfa34a317c6d3da30ffb480)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/cpu.h    | 2 +-
 target/arm/helper.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 9526ed27cb..0dce472aae 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -1263,7 +1263,7 @@ void vfp_set_fpscr(CPUARMState *env, uint32_t val);
  * we store the underlying state in fpscr and just mask on read/write.
  */
 #define FPSR_MASK 0xf800009f
-#define FPCR_MASK 0x07f79f00
+#define FPCR_MASK 0x07ff9f00
 
 #define FPCR_FZ16   (1 << 19)   /* ARMv8.2+, FP16 flush-to-zero */
 #define FPCR_FZ     (1 << 24)   /* Flush-to-zero enable bit */
diff --git a/target/arm/helper.c b/target/arm/helper.c
index c24c66d43e..c2287c76e5 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11320,6 +11320,11 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
     int i;
     uint32_t changed;
 
+    /* When ARMv8.2-FP16 is not supported, FZ16 is RES0.  */
+    if (!arm_feature(env, ARM_FEATURE_V8_FP16)) {
+        val &= ~FPCR_FZ16;
+    }
+
     changed = env->vfp.xregs[ARM_VFP_FPSCR];
     env->vfp.xregs[ARM_VFP_FPSCR] = (val & 0xffc8ffff);
     env->vfp.vec_len = (val >> 16) & 7;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 14/97] target/arm: Ignore float_flag_input_denormal from fp_status_f16
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (12 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 13/97] target/arm: Adjust FPCR_MASK for FZ16 Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 15/97] target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h Michael Roth
                   ` (84 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

When FZ is set, input_denormal exceptions are recognized, but this does
not happen with FZ16.  The softfloat code has no way to distinguish
these bits and will raise such exceptions into fp_status_f16.flags,
so ignore them when computing the accumulated flags.

Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180810193129.1556-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 19062c169e5bcdda3d60df9161228e107bf0f96e)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index c2287c76e5..991b077e8f 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11283,9 +11283,13 @@ uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
     fpscr = (env->vfp.xregs[ARM_VFP_FPSCR] & 0xffc8ffff)
             | (env->vfp.vec_len << 16)
             | (env->vfp.vec_stride << 20);
+
     i = get_float_exception_flags(&env->vfp.fp_status);
     i |= get_float_exception_flags(&env->vfp.standard_fp_status);
-    i |= get_float_exception_flags(&env->vfp.fp_status_f16);
+    /* FZ16 does not generate an input denormal exception.  */
+    i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
+          & ~float_flag_input_denormal);
+
     fpscr |= vfp_exceptbits_from_host(i);
     return fpscr;
 }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 15/97] target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (13 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 14/97] target/arm: Ignore float_flag_input_denormal from fp_status_f16 Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 16/97] target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half Michael Roth
                   ` (83 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

This makes float16_muladd correctly use FZ16 not FZ.

Fixes: 6ceabaad110
Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180810193129.1556-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 52a339b11d1719a6589de40606859939875fda9a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/sve_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index e03f954a26..0f98097253 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -3358,7 +3358,7 @@ static void do_fmla_zpzzz_h(CPUARMState *env, void *vg, uint32_t desc,
                 e1 = *(uint16_t *)(vn + H1_2(i)) ^ neg1;
                 e2 = *(uint16_t *)(vm + H1_2(i));
                 e3 = *(uint16_t *)(va + H1_2(i)) ^ neg3;
-                r = float16_muladd(e1, e2, e3, 0, &env->vfp.fp_status);
+                r = float16_muladd(e1, e2, e3, 0, &env->vfp.fp_status_f16);
                 *(uint16_t *)(vd + H1_2(i)) = r;
             }
         } while (i & 63);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 16/97] target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (14 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 15/97] target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 17/97] block/qapi: Fix memory leak in qmp_query_blockstats() Michael Roth
                   ` (82 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

We were using the wrong flush-to-zero bit for the non-half input.

Fixes: 46d33d1e3c9
Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 20180810193129.1556-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit e4ab5124a5c2e2291006b24bdc21c3dd8d087ff4)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/translate-sve.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index d27bc8c946..667879564f 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -4093,7 +4093,7 @@ static bool do_zpz_ptr(DisasContext *s, int rd, int rn, int pg,
 
 static bool trans_FCVT_sh(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
 {
-    return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvt_sh);
+    return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_sh);
 }
 
 static bool trans_FCVT_hs(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
@@ -4103,7 +4103,7 @@ static bool trans_FCVT_hs(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
 
 static bool trans_FCVT_dh(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
 {
-    return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvt_dh);
+    return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_dh);
 }
 
 static bool trans_FCVT_hd(DisasContext *s, arg_rpr_esz *a, uint32_t insn)
-- 
2.17.1

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

* [Qemu-devel] [PATCH 17/97] block/qapi: Fix memory leak in qmp_query_blockstats()
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (15 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 16/97] target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 18/97] mirror: Fail gracefully for source == target Michael Roth
                   ` (81 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Kevin Wolf

From: Kevin Wolf <kwolf@redhat.com>

For BlockBackends that are skipped in query-blockstats, we would leak
info since commit 567dcb31. Allocate info only later to avoid the memory
leak.

Fixes: CID 1394727
Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
(cherry picked from commit f62492bb8d1ea7f7e156ffbdf411de46107072c5)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/qapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/qapi.c b/block/qapi.c
index 339727f0f4..c66f949db8 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -594,7 +594,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
         }
     } else {
         for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
-            BlockStatsList *info = g_malloc0(sizeof(*info));
+            BlockStatsList *info;
             AioContext *ctx = blk_get_aio_context(blk);
             BlockStats *s;
             char *qdev;
@@ -619,6 +619,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
             bdrv_query_blk_stats(s->stats, blk);
             aio_context_release(ctx);
 
+            info = g_malloc0(sizeof(*info));
             info->value = s;
             *p_next = info;
             p_next = &info->next;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 18/97] mirror: Fail gracefully for source == target
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (16 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 17/97] block/qapi: Fix memory leak in qmp_query_blockstats() Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 19/97] qemu-img: fix regression copying secrets during convert Michael Roth
                   ` (80 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Kevin Wolf

From: Kevin Wolf <kwolf@redhat.com>

blockdev-mirror with the same node for source and target segfaults
today: A node is in its own backing chain, so mirror_start_job() decides
that this is an active commit. When adding the intermediate nodes with
block_job_add_bdrv(), it starts the iteration through the subchain with
the backing file of source, though, so it never reaches target and
instead runs into NULL at the base.

While we could fix that by starting with source itself, there is no
point in allowing mirroring a node into itself and I wouldn't be
surprised if this caused more problems later.

So just check for this scenario and error out.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 86fae10c64d642256cf019e6829929fa0d259c7a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/mirror.c             | 5 +++++
 tests/qemu-iotests/041     | 6 ++++++
 tests/qemu-iotests/041.out | 4 ++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/block/mirror.c b/block/mirror.c
index b48c3f8cf5..dd5ca02b09 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1499,6 +1499,11 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
         buf_size = DEFAULT_MIRROR_BUF_SIZE;
     }
 
+    if (bs == target) {
+        error_setg(errp, "Can't mirror node into itself");
+        return;
+    }
+
     /* In the case of active commit, add dummy driver to provide consistent
      * reads on the top, while disabling it in the intermediate nodes, and make
      * the backing chain writable. */
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index c20ac7da87..9336ab6ff5 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -234,6 +234,12 @@ class TestSingleBlockdev(TestSingleDrive):
         result = self.vm.qmp("blockdev-add", **args)
         self.assert_qmp(result, 'return', {})
 
+    def test_mirror_to_self(self):
+        result = self.vm.qmp(self.qmp_cmd, job_id='job0',
+                             device=self.qmp_target, sync='full',
+                             target=self.qmp_target)
+        self.assert_qmp(result, 'error/class', 'GenericError')
+
     test_large_cluster = None
     test_image_not_found = None
     test_small_buffer2 = None
diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out
index c28b392b87..e071d0b261 100644
--- a/tests/qemu-iotests/041.out
+++ b/tests/qemu-iotests/041.out
@@ -1,5 +1,5 @@
-.....................................................................................
+........................................................................................
 ----------------------------------------------------------------------
-Ran 85 tests
+Ran 88 tests
 
 OK
-- 
2.17.1

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

* [Qemu-devel] [PATCH 19/97] qemu-img: fix regression copying secrets during convert
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (17 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 18/97] mirror: Fail gracefully for source == target Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 20/97] nvme: Fix nvme_init error handling Michael Roth
                   ` (79 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Daniel P. Berrangé, Kevin Wolf

From: Daniel P. Berrangé <berrange@redhat.com>

When the convert command is creating an output file that needs
secrets, we need to ensure those secrets are passed to both the
blk_new_open and bdrv_create API calls.

This is done by qemu-img extracting all opts matching the name
suffix "key-secret". Unfortunately the code doing this was run after the
call to bdrv_create(), which meant the QemuOpts it was extracting
secrets from was now empty.

Previously this worked by luks as a bug meant the "key-secret"
parameters were not purged from the QemuOpts. This bug was fixed in

  commit b76b4f604521e59f857d6177bc55f6f2e41fd392
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   Thu Jan 11 16:18:08 2018 +0100

    qcow2: Use visitor for options in qcow2_create()

Exposing the latent bug in qemu-img. This fix simply moves the copying
of secrets to before the bdrv_create() call.

Cc: qemu-stable@nongnu.org
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 8d65a3ccfd5db7f0436e095cd952f5d0c3a873ba)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qemu-img.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 1acddf693c..b12f4cd19b 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -345,21 +345,6 @@ static int img_add_key_secrets(void *opaque,
     return 0;
 }
 
-static BlockBackend *img_open_new_file(const char *filename,
-                                       QemuOpts *create_opts,
-                                       const char *fmt, int flags,
-                                       bool writethrough, bool quiet,
-                                       bool force_share)
-{
-    QDict *options = NULL;
-
-    options = qdict_new();
-    qemu_opt_foreach(create_opts, img_add_key_secrets, options, &error_abort);
-
-    return img_open_file(filename, options, fmt, flags, writethrough, quiet,
-                         force_share);
-}
-
 
 static BlockBackend *img_open(bool image_opts,
                               const char *filename,
@@ -2018,6 +2003,7 @@ static int img_convert(int argc, char **argv)
     BlockDriverState *out_bs;
     QemuOpts *opts = NULL, *sn_opts = NULL;
     QemuOptsList *create_opts = NULL;
+    QDict *open_opts = NULL;
     char *options = NULL;
     Error *local_err = NULL;
     bool writethrough, src_writethrough, quiet = false, image_opts = false,
@@ -2362,6 +2348,16 @@ static int img_convert(int argc, char **argv)
         }
     }
 
+    /*
+     * The later open call will need any decryption secrets, and
+     * bdrv_create() will purge "opts", so extract them now before
+     * they are lost.
+     */
+    if (!skip_create) {
+        open_opts = qdict_new();
+        qemu_opt_foreach(opts, img_add_key_secrets, open_opts, &error_abort);
+    }
+
     if (!skip_create) {
         /* Create the new image */
         ret = bdrv_create(drv, out_filename, opts, &local_err);
@@ -2388,8 +2384,9 @@ static int img_convert(int argc, char **argv)
          * That has to wait for bdrv_create to be improved
          * to allow filenames in option syntax
          */
-        s.target = img_open_new_file(out_filename, opts, out_fmt,
-                                     flags, writethrough, quiet, false);
+        s.target = img_open_file(out_filename, open_opts, out_fmt,
+                                 flags, writethrough, quiet, false);
+        open_opts = NULL; /* blk_new_open will have freed it */
     }
     if (!s.target) {
         ret = -1;
@@ -2464,6 +2461,7 @@ out:
     qemu_opts_del(opts);
     qemu_opts_free(create_opts);
     qemu_opts_del(sn_opts);
+    qobject_unref(open_opts);
     blk_unref(s.target);
     if (s.src) {
         for (bs_i = 0; bs_i < s.src_num; bs_i++) {
-- 
2.17.1

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

* [Qemu-devel] [PATCH 20/97] nvme: Fix nvme_init error handling
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (18 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 19/97] qemu-img: fix regression copying secrets during convert Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 21/97] aio-posix: Don't count ctx->notifier as progress when polling Michael Roth
                   ` (78 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Fam Zheng

From: Fam Zheng <famz@redhat.com>

It is wrong to leave this field as 1, as nvme_close() called in the
error handling code in nvme_file_open() will use it and try to free
s->queues again.

Another problem is the cleaning ups are duplicated between the fail*
labels of nvme_init() and nvme_file_open(), which calls nvme_close().

A third problem is nvme_close() misses g_free() and
event_notifier_cleanup().

Fix all of them.

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>

Message-Id: <20180712025420.4932-1-famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit 9582f357bb6f6573c9a452743d8f3ab41ba2e3fa)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/nvme.c | 37 ++++++++++++-------------------------
 1 file changed, 12 insertions(+), 25 deletions(-)

diff --git a/block/nvme.c b/block/nvme.c
index 6f71122bf5..37805e8890 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -569,13 +569,13 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     s->vfio = qemu_vfio_open_pci(device, errp);
     if (!s->vfio) {
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
 
     s->regs = qemu_vfio_pci_map_bar(s->vfio, 0, 0, NVME_BAR_SIZE, errp);
     if (!s->regs) {
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
 
     /* Perform initialize sequence as described in NVMe spec "7.6.1
@@ -585,7 +585,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     if (!(cap & (1ULL << 37))) {
         error_setg(errp, "Device doesn't support NVMe command set");
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
 
     s->page_size = MAX(4096, 1 << (12 + ((cap >> 48) & 0xF)));
@@ -603,7 +603,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
                              PRId64 " ms)",
                        timeout_ms);
             ret = -ETIMEDOUT;
-            goto fail;
+            goto out;
         }
     }
 
@@ -613,7 +613,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     s->queues[0] = nvme_create_queue_pair(bs, 0, NVME_QUEUE_SIZE, errp);
     if (!s->queues[0]) {
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
     QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000);
     s->regs->aqa = cpu_to_le32((NVME_QUEUE_SIZE << 16) | NVME_QUEUE_SIZE);
@@ -633,14 +633,14 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
                              PRId64 " ms)",
                        timeout_ms);
             ret = -ETIMEDOUT;
-            goto fail_queue;
+            goto out;
         }
     }
 
     ret = qemu_vfio_pci_init_irq(s->vfio, &s->irq_notifier,
                                  VFIO_PCI_MSIX_IRQ_INDEX, errp);
     if (ret) {
-        goto fail_queue;
+        goto out;
     }
     aio_set_event_notifier(bdrv_get_aio_context(bs), &s->irq_notifier,
                            false, nvme_handle_event, nvme_poll_cb);
@@ -649,30 +649,15 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     if (local_err) {
         error_propagate(errp, local_err);
         ret = -EIO;
-        goto fail_handler;
+        goto out;
     }
 
     /* Set up command queues. */
     if (!nvme_add_io_queue(bs, errp)) {
         ret = -EIO;
-        goto fail_handler;
     }
-    return 0;
-
-fail_handler:
-    aio_set_event_notifier(bdrv_get_aio_context(bs), &s->irq_notifier,
-                           false, NULL, NULL);
-fail_queue:
-    nvme_free_queue_pair(bs, s->queues[0]);
-fail:
-    g_free(s->queues);
-    if (s->regs) {
-        qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)s->regs, 0, NVME_BAR_SIZE);
-    }
-    if (s->vfio) {
-        qemu_vfio_close(s->vfio);
-    }
-    event_notifier_cleanup(&s->irq_notifier);
+out:
+    /* Cleaning up is done in nvme_file_open() upon error. */
     return ret;
 }
 
@@ -739,8 +724,10 @@ static void nvme_close(BlockDriverState *bs)
     for (i = 0; i < s->nr_queues; ++i) {
         nvme_free_queue_pair(bs, s->queues[i]);
     }
+    g_free(s->queues);
     aio_set_event_notifier(bdrv_get_aio_context(bs), &s->irq_notifier,
                            false, NULL, NULL);
+    event_notifier_cleanup(&s->irq_notifier);
     qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)s->regs, 0, NVME_BAR_SIZE);
     qemu_vfio_close(s->vfio);
 }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 21/97] aio-posix: Don't count ctx->notifier as progress when polling
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (19 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 20/97] nvme: Fix nvme_init error handling Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 22/97] aio: Do aio_notify_accept only during blocking aio_poll Michael Roth
                   ` (77 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Fam Zheng

From: Fam Zheng <famz@redhat.com>

The same logic exists in fd polling. This change is especially important
to avoid busy loop once we limit aio_notify_accept() to blocking
aio_poll().

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20180809132259.18402-2-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit 70232b5253a3c4e03ed1ac47ef9246a8ac66c6fa)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 util/aio-posix.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/aio-posix.c b/util/aio-posix.c
index 118bf5784b..b5c7f463aa 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -494,7 +494,8 @@ static bool run_poll_handlers_once(AioContext *ctx)
     QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
         if (!node->deleted && node->io_poll &&
             aio_node_check(ctx, node->is_external) &&
-            node->io_poll(node->opaque)) {
+            node->io_poll(node->opaque) &&
+            node->opaque != &ctx->notifier) {
             progress = true;
         }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 22/97] aio: Do aio_notify_accept only during blocking aio_poll
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (20 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 21/97] aio-posix: Don't count ctx->notifier as progress when polling Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 23/97] monitor: fix oob command leak Michael Roth
                   ` (76 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Fam Zheng

From: Fam Zheng <famz@redhat.com>

An aio_notify() pairs with an aio_notify_accept(). The former should
happen in the main thread or a vCPU thread, and the latter should be
done in the IOThread.

There is one rare case that the main thread or vCPU thread may "steal"
the aio_notify() event just raised by itself, in bdrv_set_aio_context()
[1]. The sequence is like this:

    main thread                     IO Thread
    ===============================================================
    bdrv_drained_begin()
      aio_disable_external(ctx)
                                    aio_poll(ctx, true)
                                      ctx->notify_me += 2
    ...
    bdrv_drained_end()
      ...
        aio_notify()
    ...
    bdrv_set_aio_context()
      aio_poll(ctx, false)
[1]     aio_notify_accept(ctx)
                                      ppoll() /* Hang! */

[1] is problematic. It will clear the ctx->notifier event so that
the blocked ppoll() will not return.

(For the curious, this bug was noticed when booting a number of VMs
simultaneously in RHV.  One or two of the VMs will hit this race
condition, making the VIRTIO device unresponsive to I/O commands. When
it hangs, Seabios is busy waiting for a read request to complete (read
MBR), right after initializing the virtio-blk-pci device, using 100%
guest CPU. See also https://bugzilla.redhat.com/show_bug.cgi?id=1562750
for the original bug analysis.)

aio_notify() only injects an event when ctx->notify_me is set,
correspondingly aio_notify_accept() is only useful when ctx->notify_me
_was_ set. Move the call to it into the "blocking" branch. This will
effectively skip [1] and fix the hang.

Furthermore, blocking aio_poll is only allowed on home thread
(in_aio_context_home_thread), because otherwise two blocking
aio_poll()'s can steal each other's ctx->notifier event and cause
hanging just like described above.

Cc: qemu-stable@nongnu.org
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20180809132259.18402-3-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit b37548fcd1b8ac2e88e185a395bef851f3fc4e65)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 util/aio-posix.c | 4 ++--
 util/aio-win32.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/util/aio-posix.c b/util/aio-posix.c
index b5c7f463aa..b5c609b68b 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -591,6 +591,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
      * so disable the optimization now.
      */
     if (blocking) {
+        assert(in_aio_context_home_thread(ctx));
         atomic_add(&ctx->notify_me, 2);
     }
 
@@ -633,6 +634,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
 
     if (blocking) {
         atomic_sub(&ctx->notify_me, 2);
+        aio_notify_accept(ctx);
     }
 
     /* Adjust polling time */
@@ -676,8 +678,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
         }
     }
 
-    aio_notify_accept(ctx);
-
     /* if we have any readable fds, dispatch event */
     if (ret > 0) {
         for (i = 0; i < npfd; i++) {
diff --git a/util/aio-win32.c b/util/aio-win32.c
index e676a8d9b2..c58957cc4b 100644
--- a/util/aio-win32.c
+++ b/util/aio-win32.c
@@ -373,11 +373,12 @@ bool aio_poll(AioContext *ctx, bool blocking)
         ret = WaitForMultipleObjects(count, events, FALSE, timeout);
         if (blocking) {
             assert(first);
+            assert(in_aio_context_home_thread(ctx));
             atomic_sub(&ctx->notify_me, 2);
+            aio_notify_accept(ctx);
         }
 
         if (first) {
-            aio_notify_accept(ctx);
             progress |= aio_bh_poll(ctx);
             first = false;
         }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 23/97] monitor: fix oob command leak
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (21 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 22/97] aio: Do aio_notify_accept only during blocking aio_poll Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 24/97] vnc: fix memleak of the "vnc-worker-output" name Michael Roth
                   ` (75 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Marc-André Lureau, Markus Armbruster

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Spotted by ASAN, during make check...

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f8e27262c48 in malloc (/lib64/libasan.so.5+0xeec48)
    #1 0x7f8e26a5f3c5 in g_malloc (/lib64/libglib-2.0.so.0+0x523c5)
    #2 0x555ab67078a8 in qstring_from_str /home/elmarco/src/qq/qobject/qstring.c:67
    #3 0x555ab67071e4 in qstring_new /home/elmarco/src/qq/qobject/qstring.c:24
    #4 0x555ab6713fbf in qstring_from_escaped_str /home/elmarco/src/qq/qobject/json-parser.c:144
    #5 0x555ab671738c in parse_literal /home/elmarco/src/qq/qobject/json-parser.c:506
    #6 0x555ab67179c3 in parse_value /home/elmarco/src/qq/qobject/json-parser.c:569
    #7 0x555ab6715123 in parse_pair /home/elmarco/src/qq/qobject/json-parser.c:306
    #8 0x555ab6715483 in parse_object /home/elmarco/src/qq/qobject/json-parser.c:357
    #9 0x555ab671798b in parse_value /home/elmarco/src/qq/qobject/json-parser.c:561
    #10 0x555ab6717a6b in json_parser_parse_err /home/elmarco/src/qq/qobject/json-parser.c:592
    #11 0x555ab4fd4dcf in handle_qmp_command /home/elmarco/src/qq/monitor.c:4257
    #12 0x555ab6712c4d in json_message_process_token /home/elmarco/src/qq/qobject/json-streamer.c:105
    #13 0x555ab67e01e2 in json_lexer_feed_char /home/elmarco/src/qq/qobject/json-lexer.c:323
    #14 0x555ab67e0af6 in json_lexer_feed /home/elmarco/src/qq/qobject/json-lexer.c:373
    #15 0x555ab6713010 in json_message_parser_feed /home/elmarco/src/qq/qobject/json-streamer.c:124
    #16 0x555ab4fd58ec in monitor_qmp_read /home/elmarco/src/qq/monitor.c:4337
    #17 0x555ab6559df2 in qemu_chr_be_write_impl /home/elmarco/src/qq/chardev/char.c:175
    #18 0x555ab6559e95 in qemu_chr_be_write /home/elmarco/src/qq/chardev/char.c:187
    #19 0x555ab6560127 in fd_chr_read /home/elmarco/src/qq/chardev/char-fd.c:66
    #20 0x555ab65d9c73 in qio_channel_fd_source_dispatch /home/elmarco/src/qq/io/channel-watch.c:84
    #21 0x7f8e26a598ac in g_main_context_dispatch (/lib64/libglib-2.0.so.0+0x4c8ac)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180809114417.28718-4-marcandre.lureau@redhat.com>
[Screwed up in commit b27314567d4]
Cc: qemu-stable@nongnu.org
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
(cherry picked from commit cb9ec42f33c07cd07d2e2971422bf7636c761202)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 monitor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/monitor.c b/monitor.c
index 77861e96af..a1999e396c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4277,6 +4277,8 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
         trace_monitor_qmp_cmd_out_of_band(qobject_get_try_str(id)
                                           ?: "");
         monitor_qmp_dispatch(mon, req, id);
+        qobject_unref(req);
+        qobject_unref(id);
         return;
     }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 24/97] vnc: fix memleak of the "vnc-worker-output" name
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (22 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 23/97] monitor: fix oob command leak Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 25/97] i386: Disable TOPOEXT by default on "-cpu host" Michael Roth
                   ` (74 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Wu, Gerd Hoffmann

From: Peter Wu <peter@lekensteyn.nl>

Fixes repeated memory leaks of 18 bytes when using VNC:

    Direct leak of 831024 byte(s) in 46168 object(s) allocated from:
        ...
        #4 0x7f6d2f919bdd in g_strdup_vprintf glib/gstrfuncs.c:514
        #5 0x56085cdcf660 in buffer_init util/buffer.c:59
        #6 0x56085ca6a7ec in vnc_async_encoding_start ui/vnc-jobs.c:177
        #7 0x56085ca6b815 in vnc_worker_thread_loop ui/vnc-jobs.c:240

Fixes: 543b95801f98 ("vnc: attach names to buffers")
Cc: Gerd Hoffmann <kraxel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20180807221830.3844-1-peter@lekensteyn.nl
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 0ae0b069aa8f23a138cc6d2d83edaa5c22f948a5)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 ui/vnc-jobs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index b0b15d42a8..929391f85d 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -193,6 +193,7 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
 
 static void vnc_async_encoding_end(VncState *orig, VncState *local)
 {
+    buffer_free(&local->output);
     orig->tight = local->tight;
     orig->zlib = local->zlib;
     orig->hextile = local->hextile;
@@ -278,7 +279,7 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
         /* Copy persistent encoding data */
         vnc_async_encoding_end(job->vs, &vs);
 
-	qemu_bh_schedule(job->vs->bh);
+        qemu_bh_schedule(job->vs->bh);
     }  else {
         buffer_reset(&vs.output);
         /* Copy persistent encoding data */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 25/97] i386: Disable TOPOEXT by default on "-cpu host"
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (23 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 24/97] vnc: fix memleak of the "vnc-worker-output" name Michael Roth
@ 2019-04-01 20:58 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 26/97] block: for jobs, do not clear user_paused until after the resume Michael Roth
                   ` (73 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

Enabling TOPOEXT is always allowed, but it can't be enabled
blindly by "-cpu host" because it may make guests crash if the
rest of the cache topology information isn't provided or isn't
consistent.

This addresses the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=1613277

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20180809221852.15285-1-ehabkost@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 7210a02c58572b2686a3a8d610c6628f87864aed)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/i386/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 723e02221e..3ac627978f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -849,6 +849,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid_eax = 0x80000001, .cpuid_reg = R_ECX,
         .tcg_features = TCG_EXT3_FEATURES,
+        /*
+         * TOPOEXT is always allowed but can't be enabled blindly by
+         * "-cpu host", as it requires consistent cache topology info
+         * to be provided so it doesn't confuse guests.
+         */
+        .no_autoenable_flags = CPUID_EXT3_TOPOEXT,
     },
     [FEAT_C000_0001_EDX] = {
         .feat_names = {
-- 
2.17.1

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

* [Qemu-devel] [PATCH 26/97] block: for jobs, do not clear user_paused until after the resume
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (24 preceding siblings ...)
  2019-04-01 20:58 ` [Qemu-devel] [PATCH 25/97] i386: Disable TOPOEXT by default on "-cpu host" Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 27/97] block: iotest to catch abort on forced blockjob cancel Michael Roth
                   ` (72 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jeff Cody

From: Jeff Cody <jcody@redhat.com>

The function job_cancel_async() will always cause an assert for blockjob
user resume.  We set job->user_paused to false, and then call
job->driver->user_resume().  In the case of blockjobs, this is the
block_job_user_resume() function.

In that function, we assert that job.user_paused is set to true.
Unfortunately, right before calling this function, it has explicitly
been set to false.

The fix is pretty simple: set job->user_paused to false only after the
job user_resume() function has been called.

Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Message-id: bb183b77d8f2dd6bd67b8da559a90ac1e74b2052.1534868459.git.jcody@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit e321c0597c7590499bacab239d7f86e257f96bcd)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 job.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/job.c b/job.c
index fa671b431a..e36ebaafd8 100644
--- a/job.c
+++ b/job.c
@@ -732,10 +732,10 @@ static void job_cancel_async(Job *job, bool force)
 {
     if (job->user_paused) {
         /* Do not call job_enter here, the caller will handle it.  */
-        job->user_paused = false;
         if (job->driver->user_resume) {
             job->driver->user_resume(job);
         }
+        job->user_paused = false;
         assert(job->pause_count > 0);
         job->pause_count--;
     }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 27/97] block: iotest to catch abort on forced blockjob cancel
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (25 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 26/97] block: for jobs, do not clear user_paused until after the resume Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 28/97] virtio: update MemoryRegionCaches when guest negotiates features Michael Roth
                   ` (71 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jeff Cody

From: Jeff Cody <jcody@redhat.com>

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: df317f617fbe5affcf699cb8560e7b0c2e028a64.1534868459.git.jcody@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit 26bf474ba92c76e61bea51726e22da6dfd185296)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 tests/qemu-iotests/229     | 95 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/229.out | 23 +++++++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 119 insertions(+)
 create mode 100755 tests/qemu-iotests/229
 create mode 100644 tests/qemu-iotests/229.out

diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
new file mode 100755
index 0000000000..ff851ec431
--- /dev/null
+++ b/tests/qemu-iotests/229
@@ -0,0 +1,95 @@
+#!/bin/bash
+#
+# Test for force canceling a running blockjob that is paused in
+# an error state.
+#
+# Copyright (C) 2018 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=jcody@redhat.com
+
+seq="$(basename $0)"
+echo "QA output created by $seq"
+
+here="$PWD"
+status=1	# failure is the default!
+
+_cleanup()
+{
+    _cleanup_qemu
+    _cleanup_test_img
+    rm -f "$TEST_IMG" "$DEST_IMG"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.qemu
+
+# Needs backing file and backing format support
+_supported_fmt qcow2 qed
+_supported_proto file
+_supported_os Linux
+
+
+DEST_IMG="$TEST_DIR/d.$IMGFMT"
+TEST_IMG="$TEST_DIR/b.$IMGFMT"
+
+_make_test_img 2M
+
+# destination for mirror will be too small, causing error
+TEST_IMG=$DEST_IMG _make_test_img 1M
+
+$QEMU_IO -c 'write 0 2M' "$TEST_IMG" | _filter_qemu_io
+
+_launch_qemu -drive id=testdisk,file="$TEST_IMG",format="$IMGFMT"
+
+_send_qemu_cmd $QEMU_HANDLE \
+    "{'execute': 'qmp_capabilities'}" \
+    'return'
+
+echo
+echo '=== Starting drive-mirror, causing error & stop  ==='
+echo
+
+_send_qemu_cmd $QEMU_HANDLE \
+    "{'execute': 'drive-mirror',
+                 'arguments': {'device': 'testdisk',
+                               'mode':   'absolute-paths',
+                               'format': '$IMGFMT',
+                               'target': '$DEST_IMG',
+                               'sync':   'full',
+                               'mode':   'existing',
+                               'on-source-error': 'stop',
+                               'on-target-error': 'stop' }}"    \
+     "JOB_STATUS_CHANGE.*pause"
+
+echo
+echo '=== Force cancel job paused in error state  ==='
+echo
+
+success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \
+    "{'execute': 'block-job-cancel',
+                 'arguments': { 'device': 'testdisk',
+                                'force': true}}" \
+     "BLOCK_JOB_CANCELLED" "Assertion"
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/229.out b/tests/qemu-iotests/229.out
new file mode 100644
index 0000000000..4c4112805f
--- /dev/null
+++ b/tests/qemu-iotests/229.out
@@ -0,0 +1,23 @@
+QA output created by 229
+Formatting 'TEST_DIR/b.IMGFMT', fmt=IMGFMT size=2097152
+Formatting 'TEST_DIR/d.IMGFMT', fmt=IMGFMT size=1048576
+wrote 2097152/2097152 bytes at offset 0
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+{"return": {}}
+
+=== Starting drive-mirror, causing error & stop  ===
+
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "testdisk"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
+{"return": {}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "testdisk"}}
+
+=== Force cancel job paused in error state  ===
+
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
+{"return": {}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}}
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index b973dc842d..743790745b 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -225,3 +225,4 @@
 225 rw auto quick
 226 auto quick
 227 auto quick
+229 auto quick
-- 
2.17.1

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

* [Qemu-devel] [PATCH 28/97] virtio: update MemoryRegionCaches when guest negotiates features
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (26 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 27/97] block: iotest to catch abort on forced blockjob cancel Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 29/97] target/xtensa: fix FPU2000 bugs Michael Roth
                   ` (70 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Paolo Bonzini, Michael S . Tsirkin

From: Paolo Bonzini <pbonzini@redhat.com>

Because the cache is sized to include the rings and the event indices,
negotiating the VIRTIO_RING_F_EVENT_IDX feature will result in the size
of the cache changing.  And because MemoryRegionCache accesses are
range-checked, if we skip this we end up with an assertion failure.
This happens with OpenBSD 6.3.

Reported-by: Fam Zheng <famz@redhat.com>
Fixes: 97cd965c070152bc626c7507df9fb356bbe1cd81
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit db812c4073c77c8a64db8d6663b3416a587c7b4a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/virtio/virtio.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index d4e4d98b59..f6a588ab57 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2006,14 +2006,25 @@ static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
 
 int virtio_set_features(VirtIODevice *vdev, uint64_t val)
 {
-   /*
+    int ret;
+    /*
      * The driver must not attempt to set features after feature negotiation
      * has finished.
      */
     if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) {
         return -EINVAL;
     }
-    return virtio_set_features_nocheck(vdev, val);
+    ret = virtio_set_features_nocheck(vdev, val);
+    if (!ret && virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
+        /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches.  */
+        int i;
+        for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
+            if (vdev->vq[i].vring.num != 0) {
+                virtio_init_region_cache(vdev, i);
+            }
+        }
+    }
+    return ret;
 }
 
 int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
-- 
2.17.1

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

* [Qemu-devel] [PATCH 29/97] target/xtensa: fix FPU2000 bugs
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (27 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 28/97] virtio: update MemoryRegionCaches when guest negotiates features Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 30/97] kvm: add call to qemu_add_opts() for -overcommit option Michael Roth
                   ` (69 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Max Filippov

From: Max Filippov <jcmvbkbc@gmail.com>

- FPU2000 defines rfr and wfr opcodes, not rfr.s and wfr.s;
- movcond.s uses incorrect operand in tcg_gen_movcond: in case the
  condition is not satisfied it must not change its argument 0.

Fixes: c04e1692e3aa ("target/xtensa: extract FPU2000 opcode
translators")
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
(cherry picked from commit e8e05fd472cbe77650353eaa50d5a9703a91c1db)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/xtensa/translate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index d22cdcdb16..25399058a0 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -4706,7 +4706,7 @@ static void translate_movcond_s(DisasContext *dc, const uint32_t arg[],
 
         tcg_gen_movcond_i32(par[0], cpu_FR[arg[0]],
                             cpu_R[arg[2]], zero,
-                            cpu_FR[arg[1]], cpu_FR[arg[2]]);
+                            cpu_FR[arg[1]], cpu_FR[arg[0]]);
         tcg_temp_free(zero);
     }
 }
@@ -4867,7 +4867,7 @@ static const XtensaOpcodeOps fpu2000_ops[] = {
         .translate = translate_compare_s,
         .par = (const uint32_t[]){COMPARE_OLT},
     }, {
-        .name = "rfr.s",
+        .name = "rfr",
         .translate = translate_rfr_s,
     }, {
         .name = "round.s",
@@ -4921,7 +4921,7 @@ static const XtensaOpcodeOps fpu2000_ops[] = {
         .translate = translate_ftoi_s,
         .par = (const uint32_t[]){float_round_to_zero, true},
     }, {
-        .name = "wfr.s",
+        .name = "wfr",
         .translate = translate_wfr_s,
     },
 };
-- 
2.17.1

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

* [Qemu-devel] [PATCH 30/97] kvm: add call to qemu_add_opts() for -overcommit option
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (28 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 29/97] target/xtensa: fix FPU2000 bugs Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 31/97] slirp: Add sanity check for str option length Michael Roth
                   ` (68 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Prasad Singamsetty, Paolo Bonzini

From: Prasad Singamsetty <prasad.singamsetty@oracle.com>

qemu command fails to process -overcommit option. Add the missing
call to qemu_add_opts() in vl.c.

Signed-off-by: Prasad Singamsetty <prasad.singamsetty@oracle.com>
Message-Id: <20180815175704.105902-1-prasad.singamsetty@oracle.com>
Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 1fdd4748711a62d863744f42b958472509a6f202)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 vl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vl.c b/vl.c
index 16b913f9d5..12d27fa028 100644
--- a/vl.c
+++ b/vl.c
@@ -2987,6 +2987,7 @@ int main(int argc, char **argv, char **envp)
     qemu_add_opts(&qemu_object_opts);
     qemu_add_opts(&qemu_tpmdev_opts);
     qemu_add_opts(&qemu_realtime_opts);
+    qemu_add_opts(&qemu_overcommit_opts);
     qemu_add_opts(&qemu_msg_opts);
     qemu_add_opts(&qemu_name_opts);
     qemu_add_opts(&qemu_numa_opts);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 31/97] slirp: Add sanity check for str option length
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (29 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 30/97] kvm: add call to qemu_add_opts() for -overcommit option Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 32/97] vhost: fix invalid downcast Michael Roth
                   ` (67 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Fam Zheng, Samuel Thibault

From: Fam Zheng <famz@redhat.com>

When user provides a long domainname or hostname that doesn't fit in the
DHCP packet, we mustn't overflow the response packet buffer. Instead,
report errors, following the g_warning() in the slirp->vdnssearch
branch.

Also check the strlen against 256 when initializing slirp, which limit
is also from the protocol where one byte represents the string length.
This gives an early error before the warning which is harder to notice
or diagnose.

Reported-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
(cherry picked from commit 6e157a0339793bb081705f52318fc77afd10addf)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 net/slirp.c   |  9 +++++++++
 slirp/bootp.c | 32 ++++++++++++++++++++++----------
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/net/slirp.c b/net/slirp.c
index 1e14318b4d..fd21dc728c 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -365,6 +365,15 @@ static int net_slirp_init(NetClientState *peer, const char *model,
         return -1;
     }
 
+    if (vdomainname && strlen(vdomainname) > 255) {
+        error_setg(errp, "'domainname' parameter cannot exceed 255 bytes");
+        return -1;
+    }
+
+    if (vhostname && strlen(vhostname) > 255) {
+        error_setg(errp, "'vhostname' parameter cannot exceed 255 bytes");
+        return -1;
+    }
 
     nc = qemu_new_net_client(&net_slirp_info, peer, model, name);
 
diff --git a/slirp/bootp.c b/slirp/bootp.c
index 9e7b53ba94..1e8185f0ec 100644
--- a/slirp/bootp.c
+++ b/slirp/bootp.c
@@ -159,6 +159,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
     struct in_addr preq_addr;
     int dhcp_msg_type, val;
     uint8_t *q;
+    uint8_t *end;
     uint8_t client_ethaddr[ETH_ALEN];
 
     /* extract exact DHCP msg type */
@@ -240,6 +241,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
     rbp->bp_siaddr = saddr.sin_addr; /* Server IP address */
 
     q = rbp->bp_vend;
+    end = (uint8_t *)&rbp[1];
     memcpy(q, rfc1533_cookie, 4);
     q += 4;
 
@@ -292,24 +294,33 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
 
         if (*slirp->client_hostname) {
             val = strlen(slirp->client_hostname);
-            *q++ = RFC1533_HOSTNAME;
-            *q++ = val;
-            memcpy(q, slirp->client_hostname, val);
-            q += val;
+            if (q + val + 2 >= end) {
+                g_warning("DHCP packet size exceeded, "
+                    "omitting host name option.");
+            } else {
+                *q++ = RFC1533_HOSTNAME;
+                *q++ = val;
+                memcpy(q, slirp->client_hostname, val);
+                q += val;
+            }
         }
 
         if (slirp->vdomainname) {
             val = strlen(slirp->vdomainname);
-            *q++ = RFC1533_DOMAINNAME;
-            *q++ = val;
-            memcpy(q, slirp->vdomainname, val);
-            q += val;
+            if (q + val + 2 >= end) {
+                g_warning("DHCP packet size exceeded, "
+                    "omitting domain name option.");
+            } else {
+                *q++ = RFC1533_DOMAINNAME;
+                *q++ = val;
+                memcpy(q, slirp->vdomainname, val);
+                q += val;
+            }
         }
 
         if (slirp->vdnssearch) {
-            size_t spaceleft = sizeof(rbp->bp_vend) - (q - rbp->bp_vend);
             val = slirp->vdnssearch_len;
-            if (val + 1 > spaceleft) {
+            if (q + val >= end) {
                 g_warning("DHCP packet size exceeded, "
                     "omitting domain-search option.");
             } else {
@@ -331,6 +342,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
         memcpy(q, nak_msg, sizeof(nak_msg) - 1);
         q += sizeof(nak_msg) - 1;
     }
+    assert(q < end);
     *q = RFC1533_END;
 
     daddr.sin_addr.s_addr = 0xffffffffu;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 32/97] vhost: fix invalid downcast
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (30 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 31/97] slirp: Add sanity check for str option length Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 33/97] pc: acpi: revert back to 1 SRAT entry for hotpluggable area Michael Roth
                   ` (66 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Yury Kotov, Michael S . Tsirkin

From: Yury Kotov <yury-kotov@yandex-team.ru>

virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bit.
If returned hwaddr is not equal to 0 but least-significant 32 bits are
equal to 0 then this code will not actually stop running queue.

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Acked-by: Jia He <hejianet@gmail.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit fa4ae4be15fb08b37bec35139688ef563311d0b9)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/virtio/vhost.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index d4cb5894a8..569c4053ea 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1073,10 +1073,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
         .index = vhost_vq_index,
     };
     int r;
-    int a;
 
-    a = virtio_queue_get_desc_addr(vdev, idx);
-    if (a == 0) {
+    if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
         /* Don't stop the virtqueue which might have not been started */
         return;
     }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 33/97] pc: acpi: revert back to 1 SRAT entry for hotpluggable area
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (31 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 32/97] vhost: fix invalid downcast Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 34/97] tests: update acpi expected files Michael Roth
                   ` (65 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Igor Mammedov, Michael S . Tsirkin

From: Igor Mammedov <imammedo@redhat.com>

Commit
  10efd7e108 "pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size"
attemped to fix hotplug regression introduced by
  848a1cc1e "hw/acpi-build: build SRAT memory affinity structures for DIMM devices"

fixed issue for Windows/3.0+ linux kernels, however it regressed 2.6 based
kernels (RHEL6) to the point where guest might crash at boot.
Reason is that 2.6 kernel discards SRAT table due too small last entry
which down the road leads to crashes. Hack I've tried in 10efd7e108 is also
not ACPI spec compliant according to which whole possible RAM should be
described in SRAT. Revert 10efd7e108 to fix regression for 2.6 based kernels.

With 10efd7e108 reverted, I've also tried splitting SRAT table statically
in different ways %/node and %/slot but Windows still fails to online
2nd pc-dimm hot-plugged into node 0 (as described in 10efd7e108) and
sometimes even coldplugged pc-dimms where affected with static SRAT
partitioning.
The only known so far way where Windows stays happy is when we have 1
SRAT entry in the last node covering all hotplug area.

Revert 848a1cc1e until we come up with a way to avoid regression
on Windows with hotplug area split in several entries.
Tested this with 2.6/3.0 based kernels (RHEL6/7) and WS20[08/12/12R2/16]).

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit dbb6da8ba7e02105bdbb33b527e088249c9843c8)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/i386/acpi-build.c | 73 ++++++++------------------------------------
 1 file changed, 12 insertions(+), 61 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index e1ee8ae9e0..1599caa7c5 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2251,64 +2251,6 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
 #define HOLE_640K_START  (640 * KiB)
 #define HOLE_640K_END   (1 * MiB)
 
-static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
-                                           uint64_t len, int default_node)
-{
-    MemoryDeviceInfoList *info_list = qmp_memory_device_list();
-    MemoryDeviceInfoList *info;
-    MemoryDeviceInfo *mi;
-    PCDIMMDeviceInfo *di;
-    uint64_t end = base + len, cur, size;
-    bool is_nvdimm;
-    AcpiSratMemoryAffinity *numamem;
-    MemoryAffinityFlags flags;
-
-    for (cur = base, info = info_list;
-         cur < end;
-         cur += size, info = info->next) {
-        numamem = acpi_data_push(table_data, sizeof *numamem);
-
-        if (!info) {
-            /*
-             * Entry is required for Windows to enable memory hotplug in OS
-             * and for Linux to enable SWIOTLB when booted with less than
-             * 4G of RAM. Windows works better if the entry sets proximity
-             * to the highest NUMA node in the machine at the end of the
-             * reserved space.
-             * Memory devices may override proximity set by this entry,
-             * providing _PXM method if necessary.
-             */
-            build_srat_memory(numamem, end - 1, 1, default_node,
-                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
-            break;
-        }
-
-        mi = info->value;
-        is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
-        di = !is_nvdimm ? mi->u.dimm.data : mi->u.nvdimm.data;
-
-        if (cur < di->addr) {
-            build_srat_memory(numamem, cur, di->addr - cur, default_node,
-                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
-            numamem = acpi_data_push(table_data, sizeof *numamem);
-        }
-
-        size = di->size;
-
-        flags = MEM_AFFINITY_ENABLED;
-        if (di->hotpluggable) {
-            flags |= MEM_AFFINITY_HOTPLUGGABLE;
-        }
-        if (is_nvdimm) {
-            flags |= MEM_AFFINITY_NON_VOLATILE;
-        }
-
-        build_srat_memory(numamem, di->addr, size, di->node, flags);
-    }
-
-    qapi_free_MemoryDeviceInfoList(info_list);
-}
-
 static void
 build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
 {
@@ -2414,10 +2356,19 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
         build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
     }
 
+    /*
+     * Entry is required for Windows to enable memory hotplug in OS
+     * and for Linux to enable SWIOTLB when booted with less than
+     * 4G of RAM. Windows works better if the entry sets proximity
+     * to the highest NUMA node in the machine.
+     * Memory devices may override proximity set by this entry,
+     * providing _PXM method if necessary.
+     */
     if (hotplugabble_address_space_size) {
-        build_srat_hotpluggable_memory(table_data, machine->device_memory->base,
-                                       hotplugabble_address_space_size,
-                                       pcms->numa_nodes - 1);
+        numamem = acpi_data_push(table_data, sizeof *numamem);
+        build_srat_memory(numamem, machine->device_memory->base,
+                          hotplugabble_address_space_size, pcms->numa_nodes - 1,
+                          MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
     }
 
     build_header(linker, table_data,
-- 
2.17.1

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

* [Qemu-devel] [PATCH 34/97] tests: update acpi expected files
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (32 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 33/97] pc: acpi: revert back to 1 SRAT entry for hotpluggable area Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 35/97] block: Fix use after free error in bdrv_open_inherit() Michael Roth
                   ` (64 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Michael S. Tsirkin

From: "Michael S. Tsirkin" <mst@redhat.com>

Fixes: dbb6da8ba7e ("pc: acpi: revert back to 1 SRAT entry for hotpluggable area")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit d2a1b1d602986a5f02658f6d4fc9ed422f8ddebf)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 tests/acpi-test-data/pc/DSDT          | Bin 5144 -> 5131 bytes
 tests/acpi-test-data/pc/DSDT.bridge   | Bin 7003 -> 6990 bytes
 tests/acpi-test-data/pc/DSDT.cphp     | Bin 5607 -> 5594 bytes
 tests/acpi-test-data/pc/DSDT.dimmpxm  | Bin 6803 -> 6790 bytes
 tests/acpi-test-data/pc/DSDT.ipmikcs  | Bin 5216 -> 5203 bytes
 tests/acpi-test-data/pc/DSDT.memhp    | Bin 6509 -> 6496 bytes
 tests/acpi-test-data/pc/DSDT.numamem  | Bin 5150 -> 5137 bytes
 tests/acpi-test-data/pc/SRAT.dimmpxm  | Bin 472 -> 392 bytes
 tests/acpi-test-data/pc/SRAT.memhp    | Bin 264 -> 264 bytes
 tests/acpi-test-data/q35/DSDT         | Bin 7828 -> 7815 bytes
 tests/acpi-test-data/q35/DSDT.bridge  | Bin 7845 -> 7832 bytes
 tests/acpi-test-data/q35/DSDT.cphp    | Bin 8291 -> 8278 bytes
 tests/acpi-test-data/q35/DSDT.dimmpxm | Bin 9487 -> 9474 bytes
 tests/acpi-test-data/q35/DSDT.ipmibt  | Bin 7903 -> 7890 bytes
 tests/acpi-test-data/q35/DSDT.memhp   | Bin 9193 -> 9180 bytes
 tests/acpi-test-data/q35/DSDT.numamem | Bin 7834 -> 7821 bytes
 tests/acpi-test-data/q35/SRAT.dimmpxm | Bin 472 -> 392 bytes
 tests/acpi-test-data/q35/SRAT.memhp   | Bin 264 -> 264 bytes
 18 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/tests/acpi-test-data/pc/DSDT b/tests/acpi-test-data/pc/DSDT
index 99f05a502752d9dbac38fdd93f1ebb79b4564fb4..c6adfe32d5ba6a5db2ca3e210766839547e122c8 100644
GIT binary patch
delta 45
zcmbQC(XGMd66_MfEyBRSxN##_B|DRk+2mIC)lB}{n~gYHnHVi5@8r_l{EkbD695z3
B42=K)

delta 57
zcmeCyn4!Vt66_KpA;Q4G7`~CKlAX!Zd~z%MY9=3@%|;xpOiZpUlXq}wa&gDIdKoY}
L1BuP|xpX)Iow5#g

diff --git a/tests/acpi-test-data/pc/DSDT.bridge b/tests/acpi-test-data/pc/DSDT.bridge
index cf23343e6402421f09da5d09f72811108fbd2661..f01fa3ad4ee6aed5262daef464a1ade41e06975d 100644
GIT binary patch
delta 45
zcmca@cFv5;CD<jzPnv;&@z+MKN_Hk6v&pUOtC{?@Hyd%ZGBH|A-pQr8`5jlT002W>
B4h#SQ

delta 57
zcmX?ScH4~0CD<h-TAG1@aluBeN_Hks^U1C3tC@UsHXCuYGBLTbOy0qz$;BP->Se&_
M3?w$+=gJoV0Nbw*^#A|>

diff --git a/tests/acpi-test-data/pc/DSDT.cphp b/tests/acpi-test-data/pc/DSDT.cphp
index c99c49f43705e99d1e0a8ba19d44145dfa63d009..3295d81c7f725472671632ac612a1c3ed81d7492 100644
GIT binary patch
delta 45
zcmaE^eM_6mCD<k8mM8-QqxMFwN_Hmi;K{A*tC{>fHXCsqWMZ_N{FO^{vljPWE&xQw
B4gvrG

delta 57
zcmcbm{al;NCD<k8xhMkz<He0!mF!F&A(LC#S2KBgZZ_gL$i(E$GWiRaCKq?StCs<z
MGmzLU&Ap!s01Y4z>i_@%

diff --git a/tests/acpi-test-data/pc/DSDT.dimmpxm b/tests/acpi-test-data/pc/DSDT.dimmpxm
index 38661cb13ee348718ab45bfc69452cd642cf9bb9..f6ec911b1180a409e61ef8d50279ab6dba7f1bdd 100644
GIT binary patch
delta 45
zcmbPi+Gfh-66_MvCdI(OXt<H9lAX!LV{$9|Y9@Ev%|;w6m>BIQ-{I2SEXdu&4*(kq
B41fRt

delta 57
zcmZoOooveG66_K(S&D&y@%l!tN_Hkk&&jRqtC?KvHXCuQU}ExSnS7f|lZ!jv)ysg<
M8Axnq;%?yw0M!W(X#fBK

diff --git a/tests/acpi-test-data/pc/DSDT.ipmikcs b/tests/acpi-test-data/pc/DSDT.ipmikcs
index 5e970fda7296f9ce44487e0a578a1dead982ba66..2633a8cecf017bfce01ba8377428b8c5433e0be2 100644
GIT binary patch
delta 45
zcmaE$aan`QCD<h-ScHLr(QG5vL3Sn|v&m=KS2Ou*Z?58KWn#3L%*d^|*^FC@696%Z
B3{(IB

delta 56
zcmcbt@j!#iCD<h-L4<*U@y<rBgX~P6=9AB|uV(Vm*<8iZ%EaW#GKpK0i#y)c%Ye}t
LNNiT;*5L#I;W7_A

diff --git a/tests/acpi-test-data/pc/DSDT.memhp b/tests/acpi-test-data/pc/DSDT.memhp
index 1fe6871aa245277e0562ff0a1e93a9bf3bcf2295..e31ef502968b14e2146cb1a1328dc0ce555b1d7f 100644
GIT binary patch
delta 44
zcmaEB^uUPACD<h-L6U)i@z6%DN_Ix4$t~<_m|S%>8*#KUG1^Vu$)&mZ9alXc05=~E
A%m4rY

delta 56
zcmaE0^wx;WCD<h-SCWB&F>)hUB|D@4<QDcdOisF+jW}AFn7mmg@8Htp;*NLqGGKHD
L5}WUHHSz%f%cl>u

diff --git a/tests/acpi-test-data/pc/DSDT.numamem b/tests/acpi-test-data/pc/DSDT.numamem
index 224cfdd9e983e02dac5f4bf7e210eaa64cb0dc78..71a975b3e25f8b5cc4491f16d5575a3a35afc777 100644
GIT binary patch
delta 44
zcmbQIF;RodCD<iIP=tYjF?u6cB|D?j<QDcdOs+bcjW}AF80{wS<kH;yj>~`(00AKk
A3jhEB

delta 56
zcmbQJF;9cbCD<iIPK1Gh@zX}GN_Iy7$t~<_n4EMs8*#KUF?q90-od5G#U1bJWx(hR
LBsSmYGU5aPu8j`#

diff --git a/tests/acpi-test-data/pc/SRAT.dimmpxm b/tests/acpi-test-data/pc/SRAT.dimmpxm
index 5aa6f693ef9819b3d30cbd76cafb0ee8b5fc5534..f5c0267ea24bb404b6b4e687390140378fbdc3f1 100644
GIT binary patch
delta 58
qcmcb?+`-Hh9OM|%!N|bC*szf+f>Di`0S16#An*f1F)$!x7#IKwZw2lE

delta 138
zcmeBRzQN2D9OM{sgOP!Oao0w!2*xrX3kskt4j7*q#sJcc8cZ-A2f8|Tm<(7QMA!fS
P|G$IOAxvjrKsFBmfb|MK

diff --git a/tests/acpi-test-data/pc/SRAT.memhp b/tests/acpi-test-data/pc/SRAT.memhp
index 5de8a100a4adf968b79a7b154a7f98123d583474..e508b4ae3cd9e3000209a4f9597913faa4206ec1 100644
GIT binary patch
delta 51
pcmeBR>R{pu4ss0PU}RumTr`pEo&p09068G=141z{FvA!?8UWLX1)2Z=

delta 51
pcmeBR>R{pu4ss0PU}RumTso2Kp2GkC|Gxt{3?K{x%rFL!1^_r@2$}!@

diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT
index aa402cca667f82ed0a2dc4969508d8f6e38ad910..7576ffcd05991ad5a3901c0f7698a52fffc6d6e2 100644
GIT binary patch
delta 45
zcmbPY+iuI{66_MvF2}&Y*szhySdz)dY_h%NY9@c}&2J=InHVi57t3gFULo^_5dbFH
B4Y>dS

delta 57
zcmZp-onp)766_K(MUH`iQEelau_TkH`DA;^)l5D*o8L&bGBLTbOfHhq<l>HZ^)g^|
M1`?ZR%DiI)0Jy6Uq5uE@

diff --git a/tests/acpi-test-data/q35/DSDT.bridge b/tests/acpi-test-data/q35/DSDT.bridge
index fc3e79c583ababf5615e76ba2f7bc3df1483abb4..c623cc5d72a2e346793fa9128e7e88b6781241b2 100644
GIT binary patch
delta 45
zcmZ2#JHwXCCD<ioh8zO}qryfmV@W0-v&r_7tC{?@H@}f=Wn#3LTr8uxd4<ehMgSw1
B4V?f0

delta 57
zcmbPXyVRD;CD<iosT>0X<FSog#*$2)=9BFuS2OwOY<?rz%EaW#GPy`blZ!jv)ysg<
M8AxoNDf6EZ0Nzayh5!Hn

diff --git a/tests/acpi-test-data/q35/DSDT.cphp b/tests/acpi-test-data/q35/DSDT.cphp
index fd3cb3421814d0383863dc780d9a2a9077b727a3..7ac526e4669fd84048b2d8ec6af8661503e1a9fa 100644
GIT binary patch
delta 45
zcmaFtaLs|sCD<h-Oo4%c@#jV^V@W3O;K}xqtC{>fHouWP$i!$jdA*G0<|i`s%m7rz
B4=w-z

delta 57
zcmccS@YsRNCD<h-S%HCpasEawV@W2DkjeIvtC_q#H@}fQ$i(E$GI^bhCKq?StCs<z
MGmzMPRi=>{0Qw9O7XSbN

diff --git a/tests/acpi-test-data/q35/DSDT.dimmpxm b/tests/acpi-test-data/q35/DSDT.dimmpxm
index 14904e8ea2376abd989aa9e99f5bf388a3b85032..3837792dec13c4c77c66b140f68959d86a09de8e 100644
GIT binary patch
delta 45
zcmeD8YVzW833dr#Qe|LZe7KRzSdz)bW3s*EY9@Ev&2J=EFfrOqo+hKY`Lv7+2LLB$
B4UPZ+

delta 57
zcmZqj>i6Pu33dtLS7l&eY~RRbEXm~PIoV!vHIs|o<~Ncnn3%j-CQp^o<l>HZ^)g^|
M1`?b1$hdI;0KEDScK`qY

diff --git a/tests/acpi-test-data/q35/DSDT.ipmibt b/tests/acpi-test-data/q35/DSDT.ipmibt
index 332237529e114256384c051858fdac36b024c72e..c7f431f058bcb54e364be4edfd9d4609bc9bb602 100644
GIT binary patch
delta 45
zcmca_d&!o|CD<k8k{kmA<I;^>b&^azW|O-lS2Ou*Z#I`|Wn#3LyiZ1R^Jkeii~v_f
B4>te+

delta 57
zcmca)d*7DJCD<k8z8nJsqxVLxI!Pu^^T}P3tC@UsHk(VeGBLTbOx`P_$;BP->Se&_
M3?w!`k$J}m0QWEvAOHXW

diff --git a/tests/acpi-test-data/q35/DSDT.memhp b/tests/acpi-test-data/q35/DSDT.memhp
index f0a27e1a3093ff7525f62b7509ea44dfe9eb8908..8fba0baf79de0239f2630035afeee78f3e7f43c2 100644
GIT binary patch
delta 44
zcmaFqe#f25CD<k8jxqxS<HU_z#*&OqlkFteFuCe%ek0k+#Ar9USVnX63K>Us07u#l
A`2YX_

delta 56
zcmccP{?eVxCD<k8r7{BpqsB%qV@XE;$##-!n4EMszmaTZV)AC0TqL8(#U1bJWx(hR
LBsR~Kab^bq<X#Wr

diff --git a/tests/acpi-test-data/q35/DSDT.numamem b/tests/acpi-test-data/q35/DSDT.numamem
index 8c9fa445b0119b6f67533cb968855b41fb9925d9..6c0d4f2bcb384cc3f3919b7472021ed51b93cbf5 100644
GIT binary patch
delta 44
zcmbPb+iT0^66_MvE62dVsI`&HSd!6cvYq4_CRd%!ZzNlp80{t(%V=(1A@hk502A8{
AHvj+t

delta 56
zcmeCRon_1A66_K(OOAno@!&=-V@XE;$##-!n4EMszmaTZV)AC0TqL8(#U1bJWx(hR
LBsR~K`N9YQ$wLqz

diff --git a/tests/acpi-test-data/q35/SRAT.dimmpxm b/tests/acpi-test-data/q35/SRAT.dimmpxm
index 5aa6f693ef9819b3d30cbd76cafb0ee8b5fc5534..f5c0267ea24bb404b6b4e687390140378fbdc3f1 100644
GIT binary patch
delta 58
qcmcb?+`-Hh9OM|%!N|bC*szf+f>Di`0S16#An*f1F)$!x7#IKwZw2lE

delta 138
zcmeBRzQN2D9OM{sgOP!Oao0w!2*xrX3kskt4j7*q#sJcc8cZ-A2f8|Tm<(7QMA!fS
P|G$IOAxvjrKsFBmfb|MK

diff --git a/tests/acpi-test-data/q35/SRAT.memhp b/tests/acpi-test-data/q35/SRAT.memhp
index 5de8a100a4adf968b79a7b154a7f98123d583474..e508b4ae3cd9e3000209a4f9597913faa4206ec1 100644
GIT binary patch
delta 51
pcmeBR>R{pu4ss0PU}RumTr`pEo&p09068G=141z{FvA!?8UWLX1)2Z=

delta 51
pcmeBR>R{pu4ss0PU}RumTso2Kp2GkC|Gxt{3?K{x%rFL!1^_r@2$}!@

-- 
2.17.1

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

* [Qemu-devel] [PATCH 35/97] block: Fix use after free error in bdrv_open_inherit()
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (33 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 34/97] tests: update acpi expected files Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 36/97] job: Fix nested aio_poll() hanging in job_txn_apply Michael Roth
                   ` (63 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Alberto Garcia, Kevin Wolf

From: Alberto Garcia <berto@igalia.com>

When a block device is opened with BDRV_O_SNAPSHOT and the
bdrv_append_temp_snapshot() call fails then the error code path tries
to unref the already destroyed 'options' QDict.

This can be reproduced easily by setting TMPDIR to a location where
the QEMU process can't write:

   $ TMPDIR=/nonexistent $QEMU -drive driver=null-co,snapshot=on

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 8961be33e8ca7e809c603223803ea66ef7ea5be7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block.c b/block.c
index 39f373e035..a7f6a13a74 100644
--- a/block.c
+++ b/block.c
@@ -2787,6 +2787,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
     bdrv_parent_cb_change_media(bs, true);
 
     qobject_unref(options);
+    options = NULL;
 
     /* For snapshot=on, create a temporary qcow2 overlay. bs points to the
      * temporary snapshot afterwards. */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 36/97] job: Fix nested aio_poll() hanging in job_txn_apply
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (34 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 35/97] block: Fix use after free error in bdrv_open_inherit() Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 37/97] target/xtensa: fix s32c1i TCGMemOp flags Michael Roth
                   ` (62 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Fam Zheng, Kevin Wolf

From: Fam Zheng <famz@redhat.com>

All callers have acquired ctx already. Doing that again results in
aio_poll() hang. This fixes the problem that a BDRV_POLL_WHILE() in the
callback cannot make progress because ctx is recursively locked, for
example, when drive-backup finishes.

There are two callers of job_finalize():

    fam@lemon:~/work/qemu [master]$ git grep -w -A1 '^\s*job_finalize'
    blockdev.c:    job_finalize(&job->job, errp);
    blockdev.c-    aio_context_release(aio_context);
    --
    job-qmp.c:    job_finalize(job, errp);
    job-qmp.c-    aio_context_release(aio_context);
    --
    tests/test-blockjob.c:    job_finalize(&job->job, &error_abort);
    tests/test-blockjob.c-    assert(job->job.status == JOB_STATUS_CONCLUDED);

Ignoring the test, it's easy to see both callers to job_finalize (and
job_do_finalize) have acquired the context.

Cc: qemu-stable@nongnu.org
Reported-by: Gu Nini <ngu@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 49880165a44f26dc84651858750facdee31f2513)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 job.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/job.c b/job.c
index e36ebaafd8..a3bec7fb22 100644
--- a/job.c
+++ b/job.c
@@ -136,21 +136,13 @@ static void job_txn_del_job(Job *job)
     }
 }
 
-static int job_txn_apply(JobTxn *txn, int fn(Job *), bool lock)
+static int job_txn_apply(JobTxn *txn, int fn(Job *))
 {
-    AioContext *ctx;
     Job *job, *next;
     int rc = 0;
 
     QLIST_FOREACH_SAFE(job, &txn->jobs, txn_list, next) {
-        if (lock) {
-            ctx = job->aio_context;
-            aio_context_acquire(ctx);
-        }
         rc = fn(job);
-        if (lock) {
-            aio_context_release(ctx);
-        }
         if (rc) {
             break;
         }
@@ -807,11 +799,11 @@ static void job_do_finalize(Job *job)
     assert(job && job->txn);
 
     /* prepare the transaction to complete */
-    rc = job_txn_apply(job->txn, job_prepare, true);
+    rc = job_txn_apply(job->txn, job_prepare);
     if (rc) {
         job_completed_txn_abort(job);
     } else {
-        job_txn_apply(job->txn, job_finalize_single, true);
+        job_txn_apply(job->txn, job_finalize_single);
     }
 }
 
@@ -857,10 +849,10 @@ static void job_completed_txn_success(Job *job)
         assert(other_job->ret == 0);
     }
 
-    job_txn_apply(txn, job_transition_to_pending, false);
+    job_txn_apply(txn, job_transition_to_pending);
 
     /* If no jobs need manual finalization, automatically do so */
-    if (job_txn_apply(txn, job_needs_finalize, false) == 0) {
+    if (job_txn_apply(txn, job_needs_finalize) == 0) {
         job_do_finalize(job);
     }
 }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 37/97] target/xtensa: fix s32c1i TCGMemOp flags
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (35 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 36/97] job: Fix nested aio_poll() hanging in job_txn_apply Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 38/97] nbd/server: fix bitmap export Michael Roth
                   ` (61 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Max Filippov

From: Max Filippov <jcmvbkbc@gmail.com>

s32c1i must load and store value with target endianness, not host.
This results in an infinite loop in atomic cmpxchg sequences when target
endianness doesn't match host endianness.

Fixes: 9fb40342d4b3 ("target/xtensa: support MTTCG")
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 7a54cfbcee8dd7aa87ce655a321b622107556326)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/xtensa/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 25399058a0..c626583cd9 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -2288,7 +2288,7 @@ static void translate_s32c1i(DisasContext *dc, const uint32_t arg[],
         gen_load_store_alignment(dc, 2, addr, true);
         gen_check_atomctl(dc, addr);
         tcg_gen_atomic_cmpxchg_i32(cpu_R[arg[0]], addr, cpu_SR[SCOMPARE1],
-                                   tmp, dc->cring, MO_32);
+                                   tmp, dc->cring, MO_TEUL);
         tcg_temp_free(addr);
         tcg_temp_free(tmp);
     }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 38/97] nbd/server: fix bitmap export
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (36 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 37/97] target/xtensa: fix s32c1i TCGMemOp flags Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 39/97] clean up callback when del virtqueue Michael Roth
                   ` (60 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Vladimir Sementsov-Ogievskiy, Eric Blake

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

bitmap_to_extents function is broken: it switches dirty variable after
every iteration, however it can process only part of dirty (or zero)
area during one iteration in case when this area is too large for one
extent.

Fortunately, the bug doesn't produce wrong extent flags: it just inserts
a zero-length extent between sequential extents representing large dirty
(or zero) area. However, zero-length extents are forbidden by the NBD
protocol. So, a careful client should consider such a reply as a server
fault, while a less-careful will likely ignore zero-length extents.

The bug can only be triggered by a client that requests block status
for nearly 4G at once (a request of 4G and larger is impossible per
the protocol, and requests smaller than 4G less the bitmap granularity
cause the loop to quit iterating rather than revisit the tail of the
large area); it also cannot trigger if the client used the
NBD_CMD_FLAG_REQ_ONE flag.  Since qemu 3.0 as client (using the
x-dirty-bitmap extension) always passes the flag, it is immune; and
we are not aware of other open-source clients that know how to request
qemu:dirty-bitmap:FOO contexts.  Clients that want to avoid the bug
could cap block status requests to a smaller length, such as 2G or 3G.

Fix this by more careful handling of dirty variable.

Bug was introduced in 3d068aff16
 "nbd/server: implement dirty bitmap export", with the whole function.
and is present in v3.0.0 release.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20180914165116.23182-1-vsementsov@virtuozzo.com>
CC: qemu-stable@nongnu.org
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: improved commit message]
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 6545916d528de7a6b784f4d10e7b236b30bfaced)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 nbd/server.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nbd/server.c b/nbd/server.c
index ea5fe0eb33..12f721482d 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1951,6 +1951,8 @@ static unsigned int bitmap_to_extents(BdrvDirtyBitmap *bitmap, uint64_t offset,
 
     assert(begin < overall_end && nb_extents);
     while (begin < overall_end && i < nb_extents) {
+        bool next_dirty = !dirty;
+
         if (dirty) {
             end = bdrv_dirty_bitmap_next_zero(bitmap, begin);
         } else {
@@ -1962,6 +1964,7 @@ static unsigned int bitmap_to_extents(BdrvDirtyBitmap *bitmap, uint64_t offset,
             end = MIN(bdrv_dirty_bitmap_size(bitmap),
                       begin + UINT32_MAX + 1 -
                       bdrv_dirty_bitmap_granularity(bitmap));
+            next_dirty = dirty;
         }
         if (dont_fragment && end > overall_end) {
             end = overall_end;
@@ -1971,7 +1974,7 @@ static unsigned int bitmap_to_extents(BdrvDirtyBitmap *bitmap, uint64_t offset,
         extents[i].flags = cpu_to_be32(dirty ? NBD_STATE_DIRTY : 0);
         i++;
         begin = end;
-        dirty = !dirty;
+        dirty = next_dirty;
     }
 
     bdrv_dirty_iter_free(it);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 39/97] clean up callback when del virtqueue
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (37 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 38/97] nbd/server: fix bitmap export Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 40/97] block/rbd: pull out qemu_rbd_convert_options Michael Roth
                   ` (59 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, liujunjie, Jason Wang

From: liujunjie <liujunjie23@huawei.com>

Before, we did not clear callback like handle_output when delete
the virtqueue which may result be segmentfault.
The scene is as follows:
1. Start a vm with multiqueue vhost-net,
2. then we write VIRTIO_PCI_GUEST_FEATURES in PCI configuration to
triger multiqueue disable in this vm which will delete the virtqueue.
In this step, the tx_bh is deleted but the callback virtio_net_handle_tx_bh
still exist.
3. Finally, we write VIRTIO_PCI_QUEUE_NOTIFY in PCI configuration to
notify the deleted virtqueue. In this way, virtio_net_handle_tx_bh
will be called and qemu will be crashed.

Although the way described above is uncommon, we had better reinforce it.

CC: qemu-stable@nongnu.org
Signed-off-by: liujunjie <liujunjie23@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 7da2d99fb9fbf30104125c061caaff330e362d74)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/virtio/virtio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index f6a588ab57..57a603a65b 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1604,6 +1604,8 @@ void virtio_del_queue(VirtIODevice *vdev, int n)
 
     vdev->vq[n].vring.num = 0;
     vdev->vq[n].vring.num_default = 0;
+    vdev->vq[n].handle_output = NULL;
+    vdev->vq[n].handle_aio_output = NULL;
 }
 
 static void virtio_set_isr(VirtIODevice *vdev, int value)
-- 
2.17.1

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

* [Qemu-devel] [PATCH 40/97] block/rbd: pull out qemu_rbd_convert_options
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (38 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 39/97] clean up callback when del virtqueue Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 41/97] block/rbd: Attempt to parse legacy filenames Michael Roth
                   ` (58 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jeff Cody

From: Jeff Cody <jcody@redhat.com>

Code movement to pull the conversion from Qdict to BlockdevOptionsRbd
into a helper function.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Message-id: 5b49a980f2cde6610ab1df41bb0277d00b5db893.1536704901.git.jcody@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit f24b03b56cdb28d753b4ff9ae210d555f14cb0d8)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/rbd.c | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index ca8e5bbace..b199450f9f 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -655,12 +655,34 @@ failed_opts:
     return r;
 }
 
+static int qemu_rbd_convert_options(QDict *options, BlockdevOptionsRbd **opts,
+                                    Error **errp)
+{
+    Visitor *v;
+    Error *local_err = NULL;
+
+    /* Convert the remaining options into a QAPI object */
+    v = qobject_input_visitor_new_flat_confused(options, errp);
+    if (!v) {
+        return -EINVAL;
+    }
+
+    visit_type_BlockdevOptionsRbd(v, NULL, opts, &local_err);
+    visit_free(v);
+
+    if (local_err) {
+        error_propagate(errp, local_err);
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
 static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
                          Error **errp)
 {
     BDRVRBDState *s = bs->opaque;
     BlockdevOptionsRbd *opts = NULL;
-    Visitor *v;
     const QDictEntry *e;
     Error *local_err = NULL;
     char *keypairs, *secretid;
@@ -676,19 +698,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
         qdict_del(options, "password-secret");
     }
 
-    /* Convert the remaining options into a QAPI object */
-    v = qobject_input_visitor_new_flat_confused(options, errp);
-    if (!v) {
-        r = -EINVAL;
-        goto out;
-    }
-
-    visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err);
-    visit_free(v);
-
+    r = qemu_rbd_convert_options(options, &opts, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
-        r = -EINVAL;
         goto out;
     }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 41/97] block/rbd: Attempt to parse legacy filenames
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (39 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 40/97] block/rbd: pull out qemu_rbd_convert_options Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 42/97] block/rbd: add iotest for rbd legacy keyvalue filename parsing Michael Roth
                   ` (57 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jeff Cody

From: Jeff Cody <jcody@redhat.com>

When we converted rbd to get rid of the older key/value-centric
encoding format, we broke compatibility with image files with backing
file strings encoded in the old format.

This leaves a bit of an ugly conundrum, and a hacky solution.

If the initial attempt to parse the "proper" options fails, it assumes
that we may have an older key/value encoded filename.  Fall back to
attempting to parse the filename, and extract the required options from
it.  If that fails, pass along the original error message.

We do not support mixed modern usage alongside legacy keyvalue pair
usage.

A deprecation warning has been added, although care should be taken
when actually deprecating since the impact is not limited to
commandline or qapi usage, but also opening existing images.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Message-id: 15b332e5432ad069441f7275a46080f465d789a0.1536704901.git.jcody@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit 084d1d13bdb753d558b991996e7686c077bd6d80)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/rbd.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index b199450f9f..014c68d629 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -678,6 +678,33 @@ static int qemu_rbd_convert_options(QDict *options, BlockdevOptionsRbd **opts,
     return 0;
 }
 
+static int qemu_rbd_attempt_legacy_options(QDict *options,
+                                           BlockdevOptionsRbd **opts,
+                                           char **keypairs)
+{
+    char *filename;
+    int r;
+
+    filename = g_strdup(qdict_get_try_str(options, "filename"));
+    if (!filename) {
+        return -EINVAL;
+    }
+    qdict_del(options, "filename");
+
+    qemu_rbd_parse_filename(filename, options, NULL);
+
+    /* keypairs freed by caller */
+    *keypairs = g_strdup(qdict_get_try_str(options, "=keyvalue-pairs"));
+    if (*keypairs) {
+        qdict_del(options, "=keyvalue-pairs");
+    }
+
+    r = qemu_rbd_convert_options(options, opts, NULL);
+
+    g_free(filename);
+    return r;
+}
+
 static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
                          Error **errp)
 {
@@ -700,8 +727,31 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
 
     r = qemu_rbd_convert_options(options, &opts, &local_err);
     if (local_err) {
-        error_propagate(errp, local_err);
-        goto out;
+        /* If keypairs are present, that means some options are present in
+         * the modern option format.  Don't attempt to parse legacy option
+         * formats, as we won't support mixed usage. */
+        if (keypairs) {
+            error_propagate(errp, local_err);
+            goto out;
+        }
+
+        /* If the initial attempt to convert and process the options failed,
+         * we may be attempting to open an image file that has the rbd options
+         * specified in the older format consisting of all key/value pairs
+         * encoded in the filename.  Go ahead and attempt to parse the
+         * filename, and see if we can pull out the required options. */
+        r = qemu_rbd_attempt_legacy_options(options, &opts, &keypairs);
+        if (r < 0) {
+            /* Propagate the original error, not the legacy parsing fallback
+             * error, as the latter was just a best-effort attempt. */
+            error_propagate(errp, local_err);
+            goto out;
+        }
+        /* Take care whenever deciding to actually deprecate; once this ability
+         * is removed, we will not be able to open any images with legacy-styled
+         * backing image strings. */
+        error_report("RBD options encoded in the filename as keyvalue pairs "
+                     "is deprecated");
     }
 
     /* Remove the processed options from the QDict (the visitor processes
-- 
2.17.1

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

* [Qemu-devel] [PATCH 42/97] block/rbd: add iotest for rbd legacy keyvalue filename parsing
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (40 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 41/97] block/rbd: Attempt to parse legacy filenames Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 43/97] block/rbd: add deprecation documentation for filename keyvalue pairs Michael Roth
                   ` (56 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jeff Cody

From: Jeff Cody <jcody@redhat.com>

This is a small test that will check for the ability to parse
both legacy and modern options for rbd.

The way the test is set up is for failure to occur, but without
having to wait to timeout on a non-existent rbd server.  The error
messages in the success path show that the arguments were parsed.

The failure behavior prior to the patch series that has this test, is
qemu-img complaining about mandatory options (e.g. 'pool') not being
provided.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Message-id: f830580e339b974a83ed4870d11adcdc17f49a47.1536704901.git.jcody@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit 66e6a735e97450ac50fcaf40f78600c688534cae)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 tests/qemu-iotests/231     | 62 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/231.out |  9 ++++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 72 insertions(+)
 create mode 100755 tests/qemu-iotests/231
 create mode 100644 tests/qemu-iotests/231.out

diff --git a/tests/qemu-iotests/231 b/tests/qemu-iotests/231
new file mode 100755
index 0000000000..3e283708b4
--- /dev/null
+++ b/tests/qemu-iotests/231
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# Test legacy and modern option parsing for rbd/ceph.  This will not
+# actually connect to a ceph server, but rather looks for the appropriate
+# error message that indicates we parsed the options correctly.
+#
+# Copyright (C) 2018 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=jcody@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+status=1	# failure is the default!
+
+_cleanup()
+{
+    rm "${BOGUS_CONF}"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt generic
+_supported_proto rbd
+_supported_os Linux
+
+BOGUS_CONF=${TEST_DIR}/ceph-$$.conf
+touch "${BOGUS_CONF}"
+
+_filter_conf()
+{
+    sed -e "s#$BOGUS_CONF#BOGUS_CONF#g"
+}
+
+# We expect this to fail, with no monitor ip provided and a null conf file.  Just want it
+# to fail in the right way.
+$QEMU_IMG info "json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=${BOGUS_CONF}'}" 2>&1 | _filter_conf
+$QEMU_IMG info "json:{'file.driver':'rbd','file.pool':'rbd','file.image':'bogus','file.conf':'${BOGUS_CONF}'}" 2>&1 | _filter_conf
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/231.out b/tests/qemu-iotests/231.out
new file mode 100644
index 0000000000..579ba11c16
--- /dev/null
+++ b/tests/qemu-iotests/231.out
@@ -0,0 +1,9 @@
+QA output created by 231
+qemu-img: RBD options encoded in the filename as keyvalue pairs is deprecated.  Future versions may cease to parse these options in the future.
+unable to get monitor info from DNS SRV with service name: ceph-mon
+no monitors specified to connect to.
+qemu-img: Could not open 'json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=BOGUS_CONF'}': error connecting: No such file or directory
+unable to get monitor info from DNS SRV with service name: ceph-mon
+no monitors specified to connect to.
+qemu-img: Could not open 'json:{'file.driver':'rbd','file.pool':'rbd','file.image':'bogus','file.conf':'BOGUS_CONF'}': error connecting: No such file or directory
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 743790745b..31f6e77dcb 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -226,3 +226,4 @@
 226 auto quick
 227 auto quick
 229 auto quick
+231 auto quick
-- 
2.17.1

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

* [Qemu-devel] [PATCH 43/97] block/rbd: add deprecation documentation for filename keyvalue pairs
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (41 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 42/97] block/rbd: add iotest for rbd legacy keyvalue filename parsing Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 44/97] target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs Michael Roth
                   ` (55 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jeff Cody

From: Jeff Cody <jcody@redhat.com>

Signed-off-by: Jeff Cody <jcody@redhat.com>
Message-id: 647f5b5ab7efd8bf567a504c832b1d2d6f719b23.1536704901.git.jcody@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit 3bebd37e04f972775b1ece1bdda95451bc9fb14c)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qemu-deprecated.texi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 9920a85adc..cff0e8b309 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -227,6 +227,21 @@ from old QEMU versions anymore. A newer machine type should be used instead.
 In order to prevent QEMU from automatically opening an image's backing
 chain, use ``"backing": null'' instead.
 
+@subsubsection rbd keyvalue pair encoded filenames: "" (since 3.1.0)
+
+Options for ``rbd'' should be specified according to its runtime options,
+like other block drivers.  Legacy parsing of keyvalue pair encoded
+filenames is useful to open images with the old format for backing files;
+These image files should be updated to use the current format.
+
+Example of legacy encoding:
+
+@code{json:@{"file.driver":"rbd", "file.filename":"rbd:rbd/name"@}}
+
+The above, converted to the current supported format:
+
+@code{json:@{"file.driver":"rbd", "file.pool":"rbd", "file.image":"name"@}}
+
 @subsection vio-spapr-device device options
 
 @subsubsection "irq": "" (since 3.0.0)
-- 
2.17.1

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

* [Qemu-devel] [PATCH 44/97] target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (42 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 43/97] block/rbd: add deprecation documentation for filename keyvalue pairs Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 45/97] ne2000: fix possible out of bound access in ne2000_receive Michael Roth
                   ` (54 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Richard Henderson, Peter Maydell

From: Richard Henderson <richard.henderson@linaro.org>

Not only are the sve-related tb_flags fields unused when SVE is
disabled, but not all of the cpu registers are initialized properly
for computing same.  This can corrupt other fields by ORing in -1,
which might result in QEMU crashing.

This bug was not present in 3.0, but this patch is cc'd to
stable because adf92eab90e3f5f34c285 where the bug was
introduced was marked for stable.

Fixes: adf92eab90e3f5f34c285
Cc: qemu-stable@nongnu.org (3.0.1)
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit e79b445d896deb61909be52b61b87c98a9ed96f7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/helper.c | 45 ++++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 991b077e8f..7ee614c04f 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -12401,36 +12401,39 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
     uint32_t flags;
 
     if (is_a64(env)) {
-        int sve_el = sve_exception_el(env);
-        uint32_t zcr_len;
-
         *pc = env->pc;
         flags = ARM_TBFLAG_AARCH64_STATE_MASK;
         /* Get control bits for tagged addresses */
         flags |= (arm_regime_tbi0(env, mmu_idx) << ARM_TBFLAG_TBI0_SHIFT);
         flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT);
-        flags |= sve_el << ARM_TBFLAG_SVEEXC_EL_SHIFT;
 
-        /* If SVE is disabled, but FP is enabled,
-           then the effective len is 0.  */
-        if (sve_el != 0 && fp_el == 0) {
-            zcr_len = 0;
-        } else {
-            int current_el = arm_current_el(env);
-            ARMCPU *cpu = arm_env_get_cpu(env);
+        if (arm_feature(env, ARM_FEATURE_SVE)) {
+            int sve_el = sve_exception_el(env);
+            uint32_t zcr_len;
 
-            zcr_len = cpu->sve_max_vq - 1;
-            if (current_el <= 1) {
-                zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]);
-            }
-            if (current_el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
-                zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]);
-            }
-            if (current_el < 3 && arm_feature(env, ARM_FEATURE_EL3)) {
-                zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]);
+            /* If SVE is disabled, but FP is enabled,
+             * then the effective len is 0.
+             */
+            if (sve_el != 0 && fp_el == 0) {
+                zcr_len = 0;
+            } else {
+                int current_el = arm_current_el(env);
+                ARMCPU *cpu = arm_env_get_cpu(env);
+
+                zcr_len = cpu->sve_max_vq - 1;
+                if (current_el <= 1) {
+                    zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]);
+                }
+                if (current_el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
+                    zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]);
+                }
+                if (current_el < 3 && arm_feature(env, ARM_FEATURE_EL3)) {
+                    zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]);
+                }
             }
+            flags |= sve_el << ARM_TBFLAG_SVEEXC_EL_SHIFT;
+            flags |= zcr_len << ARM_TBFLAG_ZCR_LEN_SHIFT;
         }
-        flags |= zcr_len << ARM_TBFLAG_ZCR_LEN_SHIFT;
     } else {
         *pc = env->regs[15];
         flags = (env->thumb << ARM_TBFLAG_THUMB_SHIFT)
-- 
2.17.1

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

* [Qemu-devel] [PATCH 45/97] ne2000: fix possible out of bound access in ne2000_receive
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (43 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 44/97] target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 46/97] rtl8139: fix possible out of bound access Michael Roth
                   ` (53 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jason Wang

From: Jason Wang <jasowang@redhat.com>

In ne2000_receive(), we try to assign size_ to size which converts
from size_t to integer. This will cause troubles when size_ is greater
INT_MAX, this will lead a negative value in size and it can then pass
the check of size < MIN_BUF_SIZE which may lead out of bound access of
for both buf and buf1.

Fixing by converting the type of size to size_t.

CC: qemu-stable@nongnu.org
Reported-by: Daniel Shapira <daniel@twistlock.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit fdc89e90fac40c5ca2686733df17b6423fb8d8fb)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/net/ne2000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
index 07d79e317f..869518ee06 100644
--- a/hw/net/ne2000.c
+++ b/hw/net/ne2000.c
@@ -174,7 +174,7 @@ static int ne2000_buffer_full(NE2000State *s)
 ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
 {
     NE2000State *s = qemu_get_nic_opaque(nc);
-    int size = size_;
+    size_t size = size_;
     uint8_t *p;
     unsigned int total_len, next, avail, len, index, mcast_idx;
     uint8_t buf1[60];
@@ -182,7 +182,7 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
         { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
 #if defined(DEBUG_NE2000)
-    printf("NE2000: received len=%d\n", size);
+    printf("NE2000: received len=%zu\n", size);
 #endif
 
     if (s->cmd & E8390_STOP || ne2000_buffer_full(s))
-- 
2.17.1

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

* [Qemu-devel] [PATCH 46/97] rtl8139: fix possible out of bound access
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (44 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 45/97] ne2000: fix possible out of bound access in ne2000_receive Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 47/97] pcnet: fix possible buffer overflow Michael Roth
                   ` (52 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jason Wang

From: Jason Wang <jasowang@redhat.com>

In rtl8139_do_receive(), we try to assign size_ to size which converts
from size_t to integer. This will cause troubles when size_ is greater
INT_MAX, this will lead a negative value in size and it can then pass
the check of size < MIN_BUF_SIZE which may lead out of bound access of
for both buf and buf1.

Fixing by converting the type of size to size_t.

CC: qemu-stable@nongnu.org
Reported-by: Daniel Shapira <daniel@twistlock.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 1a326646fef38782e5542280040ec3ea23e4a730)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/net/rtl8139.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 46daa16202..2342a095e3 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -817,7 +817,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
     RTL8139State *s = qemu_get_nic_opaque(nc);
     PCIDevice *d = PCI_DEVICE(s);
     /* size is the length of the buffer passed to the driver */
-    int size = size_;
+    size_t size = size_;
     const uint8_t *dot1q_buf = NULL;
 
     uint32_t packet_header = 0;
@@ -826,7 +826,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
     static const uint8_t broadcast_macaddr[6] =
         { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
-    DPRINTF(">>> received len=%d\n", size);
+    DPRINTF(">>> received len=%zu\n", size);
 
     /* test if board clock is stopped */
     if (!s->clock_enabled)
@@ -1035,7 +1035,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
 
         if (size+4 > rx_space)
         {
-            DPRINTF("C+ Rx mode : descriptor %d size %d received %d + 4\n",
+            DPRINTF("C+ Rx mode : descriptor %d size %d received %zu + 4\n",
                 descriptor, rx_space, size);
 
             s->IntrStatus |= RxOverflow;
@@ -1148,7 +1148,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
         if (avail != 0 && RX_ALIGN(size + 8) >= avail)
         {
             DPRINTF("rx overflow: rx buffer length %d head 0x%04x "
-                "read 0x%04x === available 0x%04x need 0x%04x\n",
+                "read 0x%04x === available 0x%04x need 0x%04zx\n",
                 s->RxBufferSize, s->RxBufAddr, s->RxBufPtr, avail, size + 8);
 
             s->IntrStatus |= RxOverflow;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 47/97] pcnet: fix possible buffer overflow
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (45 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 46/97] rtl8139: fix possible out of bound access Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 48/97] net: ignore packet size greater than INT_MAX Michael Roth
                   ` (51 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jason Wang

From: Jason Wang <jasowang@redhat.com>

In pcnet_receive(), we try to assign size_ to size which converts from
size_t to integer. This will cause troubles when size_ is greater
INT_MAX, this will lead a negative value in size and it can then pass
the check of size < MIN_BUF_SIZE which may lead out of bound access
for both buf and buf1.

Fixing by converting the type of size to size_t.

CC: qemu-stable@nongnu.org
Reported-by: Daniel Shapira <daniel@twistlock.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit b1d80d12c5f7ff081bb80ab4f4241d4248691192)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/net/pcnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
index 0c44554168..d9ba04bdfc 100644
--- a/hw/net/pcnet.c
+++ b/hw/net/pcnet.c
@@ -988,14 +988,14 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
     uint8_t buf1[60];
     int remaining;
     int crc_err = 0;
-    int size = size_;
+    size_t size = size_;
 
     if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size ||
         (CSR_LOOP(s) && !s->looptest)) {
         return -1;
     }
 #ifdef PCNET_DEBUG
-    printf("pcnet_receive size=%d\n", size);
+    printf("pcnet_receive size=%zu\n", size);
 #endif
 
     /* if too small buffer, then expand it */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 48/97] net: ignore packet size greater than INT_MAX
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (46 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 47/97] pcnet: fix possible buffer overflow Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 49/97] virt: Suppress external aborts on virt-2.10 and earlier Michael Roth
                   ` (50 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jason Wang

From: Jason Wang <jasowang@redhat.com>

There should not be a reason for passing a packet size greater than
INT_MAX. It's usually a hint of bug somewhere, so ignore packet size
greater than INT_MAX in qemu_deliver_packet_iov()

CC: qemu-stable@nongnu.org
Reported-by: Daniel Shapira <daniel@twistlock.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 1592a9947036d60dde5404204a5d45975133caf5)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 net/net.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/net.c b/net/net.c
index 2a3133990c..46db72811b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -712,10 +712,15 @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender,
                                 void *opaque)
 {
     NetClientState *nc = opaque;
+    size_t size = iov_size(iov, iovcnt);
     int ret;
 
+    if (size > INT_MAX) {
+        return size;
+    }
+
     if (nc->link_down) {
-        return iov_size(iov, iovcnt);
+        return size;
     }
 
     if (nc->receive_disabled) {
-- 
2.17.1

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

* [Qemu-devel] [PATCH 49/97] virt: Suppress external aborts on virt-2.10 and earlier
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (47 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 48/97] net: ignore packet size greater than INT_MAX Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 50/97] virtio: do not take address of packed members Michael Roth
                   ` (49 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Maydell

From: Peter Maydell <peter.maydell@linaro.org>

In commit c79c0a314c43b78 we enabled emulation of external aborts
when the guest attempts to access a physical address with no
mapped device. In commit 4672cbd7bed88dc6 we suppress this for
most legacy boards to prevent breakage of previously working
guests, but we didn't suppress it in the 'virt' board, with
the rationale "we know that guests won't try to prod devices
that we don't describe in the device tree or ACPI tables". This
is mostly true, but we've had a report of a Linux guest image
that this did break. The problem seems to be that the guest
is (incorrectly) configured with a DEBUG_UART_PHYS value that
tells it there is a uart at 0x10009000 (which is true for
vexpress but not for virt), so in early bootup the kernel
probes this bogus address.

This is a misconfigured guest, so we don't need to worry
about it too much, but we can arrange that guests that ran
on QEMU v2.10 (before c79c0a314c43b78) will still run on
the "virt-2.10" board model, by suppressing external aborts
only for that version and earlier. This seems a reasonable
compromise: "virt-2.10" is supposed to behave the same way
that "virt" did in the 2.10 release, and making it do that
provides a usable workaround for guests with bugs like this.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180925144127.31965-1-peter.maydell@linaro.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
(cherry picked from commit 846690dee8ca6a4143d20b39e894fd1f24627561)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/arm/virt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 281ddcdf6e..7f234ff6e8 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1881,6 +1881,8 @@ static void virt_machine_2_10_options(MachineClass *mc)
 {
     virt_machine_2_11_options(mc);
     SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_10);
+    /* before 2.11 we never faulted accesses to bad addresses */
+    mc->ignore_memory_transaction_failures = true;
 }
 DEFINE_VIRT_MACHINE(2, 10)
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 50/97] virtio: do not take address of packed members
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (48 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 49/97] virt: Suppress external aborts on virt-2.10 and earlier Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 51/97] block-backend: Set werror/rerror defaults in blk_new() Michael Roth
                   ` (48 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Paolo Bonzini, Jason Wang, Peter Maydell

From: Paolo Bonzini <pbonzini@redhat.com>

The address of a packed member is not packed, which may cause accesses
to unaligned pointers.  Avoid this by reading the packed value before
passing it to another function.

Cc: Jason Wang <jasowang@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit d41ca5afe3bc513ecf10b3ba5aa59523e3cd54aa)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/char/virtio-serial-bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index d2dd8ab502..04e3ebe352 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -667,9 +667,9 @@ static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f)
 
     /* The config space (ignored on the far end in current versions) */
     get_config(vdev, (uint8_t *)&config);
-    qemu_put_be16s(f, &config.cols);
-    qemu_put_be16s(f, &config.rows);
-    qemu_put_be32s(f, &config.max_nr_ports);
+    qemu_put_be16(f, config.cols);
+    qemu_put_be16(f, config.rows);
+    qemu_put_be32(f, config.max_nr_ports);
 
     /* The ports map */
     max_nr_ports = s->serial.max_virtserial_ports;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 51/97] block-backend: Set werror/rerror defaults in blk_new()
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (49 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 50/97] virtio: do not take address of packed members Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 52/97] target/arm: Correct condition for v8M callee stack push Michael Roth
                   ` (47 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Kevin Wolf

From: Kevin Wolf <kwolf@redhat.com>

Currently, the default values for werror and rerror have to be set
explicitly with blk_set_on_error() by the callers of blk_new(). The only
caller actually doing this is blockdev_init(), which is called for
BlockBackends created using -drive.

In particular, anonymous BlockBackends created with
-device ...,drive=<node-name> didn't get the correct default set and
instead defaulted to the integer value 0 (= BLOCKDEV_ON_ERROR_REPORT).
This is the intended default for rerror anyway, but the default for
werror should be BLOCKDEV_ON_ERROR_ENOSPC.

Set the defaults in blk_new() instead so that they apply no matter what
way the BlockBackend was created.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit cb53460b708db3617ab73248374d071d5552c263)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/block-backend.c      | 3 +++
 tests/qemu-iotests/067.out | 1 +
 2 files changed, 4 insertions(+)

diff --git a/block/block-backend.c b/block/block-backend.c
index f2f75a977d..1b27a68ae7 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -324,6 +324,9 @@ BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm)
     blk->shared_perm = shared_perm;
     blk_set_enable_write_cache(blk, true);
 
+    blk->on_read_error = BLOCKDEV_ON_ERROR_REPORT;
+    blk->on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
+
     block_acct_init(&blk->stats);
 
     notifier_list_init(&blk->remove_bs_notifiers);
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
index 2e71cff3ce..b10c71db03 100644
--- a/tests/qemu-iotests/067.out
+++ b/tests/qemu-iotests/067.out
@@ -385,6 +385,7 @@ Testing: -device virtio-scsi -device scsi-cd,id=cd0
 {
     "return": [
         {
+            "io-status": "ok",
             "device": "",
             "locked": false,
             "removable": true,
-- 
2.17.1

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

* [Qemu-devel] [PATCH 52/97] target/arm: Correct condition for v8M callee stack push
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (50 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 51/97] block-backend: Set werror/rerror defaults in blk_new() Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 53/97] nbd/server: fix NBD_CMD_CACHE Michael Roth
                   ` (46 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Maydell

From: Peter Maydell <peter.maydell@linaro.org>

In v7m_exception_taken() we were incorrectly using a
"LR bit EXCRET.ES is 1" check when it should be 0
(compare the pseudocode ExceptionTaken() function).
This meant we didn't stack the callee-saved registers
when tailchaining from a NonSecure to a Secure exception.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002145940.30931-1-peter.maydell@linaro.org
(cherry picked from commit 7b73a1ca05b33d42278ce29cea4652e22d408165)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/arm/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 7ee614c04f..cae2b2649d 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6858,7 +6858,7 @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
                  * not already saved.
                  */
                 if (lr & R_V7M_EXCRET_DCRS_MASK &&
-                    !(dotailchain && (lr & R_V7M_EXCRET_ES_MASK))) {
+                    !(dotailchain && !(lr & R_V7M_EXCRET_ES_MASK))) {
                     push_failed = v7m_push_callee_stack(cpu, lr, dotailchain,
                                                         ignore_stackfaults);
                 }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 53/97] nbd/server: fix NBD_CMD_CACHE
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (51 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 52/97] target/arm: Correct condition for v8M callee stack push Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 54/97] intel_iommu: introduce vtd_reset_caches() Michael Roth
                   ` (45 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Vladimir Sementsov-Ogievskiy, Eric Blake

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

We should not go to structured-read branch on CACHE command, fix that.

Bug introduced in bc37b06a5cde24 "nbd/server: introduce NBD_CMD_CACHE"
with the whole feature and affects 3.0.0 release.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
CC: qemu-stable@nongnu.org
Message-Id: <20181003144738.70670-1-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: commit message typo fix]
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 2f454defc23e1be78f2a96bad2877ce7829f61b4)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 nbd/server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nbd/server.c b/nbd/server.c
index 12f721482d..adcba66aa9 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -2138,7 +2138,8 @@ static coroutine_fn int nbd_do_cmd_read(NBDClient *client, NBDRequest *request,
     }
 
     if (client->structured_reply && !(request->flags & NBD_CMD_FLAG_DF) &&
-        request->len) {
+        request->len && request->type != NBD_CMD_CACHE)
+    {
         return nbd_co_send_sparse_read(client, request->handle, request->from,
                                        data, request->len, errp);
     }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 54/97] intel_iommu: introduce vtd_reset_caches()
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (52 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 53/97] nbd/server: fix NBD_CMD_CACHE Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 55/97] intel_iommu: better handling of dmar state switch Michael Roth
                   ` (44 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Xu, Michael S . Tsirkin

From: Peter Xu <peterx@redhat.com>

Provide the function and use it in vtd_init().  Used to reset both
context entry cache and iotlb cache for the whole IOMMU unit.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 06aba4ca52fd2c8718b8ba486f22f0aa7c99ed55)
*functional dep. for 2cc9ddcceb
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/i386/intel_iommu.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 0a8cd4e9cc..f66e93ed2c 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -227,6 +227,14 @@ static void vtd_reset_iotlb(IntelIOMMUState *s)
     vtd_iommu_unlock(s);
 }
 
+static void vtd_reset_caches(IntelIOMMUState *s)
+{
+    vtd_iommu_lock(s);
+    vtd_reset_iotlb_locked(s);
+    vtd_reset_context_cache_locked(s);
+    vtd_iommu_unlock(s);
+}
+
 static uint64_t vtd_get_iotlb_key(uint64_t gfn, uint16_t source_id,
                                   uint32_t level)
 {
@@ -3123,10 +3131,7 @@ static void vtd_init(IntelIOMMUState *s)
         s->cap |= VTD_CAP_CM;
     }
 
-    vtd_iommu_lock(s);
-    vtd_reset_context_cache_locked(s);
-    vtd_reset_iotlb_locked(s);
-    vtd_iommu_unlock(s);
+    vtd_reset_caches(s);
 
     /* Define registers with default values and bit semantics */
     vtd_define_long(s, DMAR_VER_REG, 0x10UL, 0, 0);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 55/97] intel_iommu: better handling of dmar state switch
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (53 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 54/97] intel_iommu: introduce vtd_reset_caches() Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 56/97] nbd: fix NBD_FLAG_SEND_CACHE value Michael Roth
                   ` (43 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Xu, Michael S . Tsirkin

From: Peter Xu <peterx@redhat.com>

QEMU is not handling the global DMAR switch well, especially when from
"on" to "off".

Let's first take the example of system reset.

Assuming that a guest has IOMMU enabled.  When it reboots, we will drop
all the existing DMAR mappings to handle the system reset, however we'll
still keep the existing memory layouts which has the IOMMU memory region
enabled.  So after the reboot and before the kernel reloads again, there
will be no mapping at all for the host device.  That's problematic since
any software (for example, SeaBIOS) that runs earlier than the kernel
after the reboot will assume the IOMMU is disabled, so any DMA from the
software will fail.

For example, a guest that boots on an assigned NVMe device might fail to
find the boot device after a system reboot/reset and we'll be able to
observe SeaBIOS errors if we capture the debugging log:

  WARNING - Timeout at nvme_wait:144!

Meanwhile, we should see DMAR errors on the host of that NVMe device.
It's the DMA fault that caused a NVMe driver timeout.

The correct fix should be that we do proper switching of device DMA
address spaces when system resets, which will setup correct memory
regions and notify the backend of the devices.  This might not affect
much on non-assigned devices since QEMU VT-d emulation will assume a
default passthrough mapping if DMAR is not enabled in the GCMD
register (please refer to vtd_iommu_translate).  However that's required
for an assigned devices, since that'll rebuild the correct GPA to HPA
mapping that is needed for any DMA operation during guest bootstrap.

Besides the system reset, we have some other places that might change
the global DMAR status and we'd better do the same thing there.  For
example, when we change the state of GCMD register, or the DMAR root
pointer.  Do the same refresh for all these places.  For these two
places we'll also need to explicitly invalidate the context entry cache
and iotlb cache.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1625173
CC: QEMU Stable <qemu-stable@nongnu.org>
Reported-by: Cong Li <coli@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
--
v2:
- do the same for GCMD write, or root pointer update [Alex]
- test is carried out by me this time, by observing the
  vtd_switch_address_space tracepoint after system reboot
v3:
- rewrite commit message as suggested by Alex
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 2cc9ddccebcaa48b3debfc279a83761fcbb7616c)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/i386/intel_iommu.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index f66e93ed2c..4dfa9d5e2b 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -37,6 +37,8 @@
 #include "kvm_i386.h"
 #include "trace.h"
 
+static void vtd_address_space_refresh_all(IntelIOMMUState *s);
+
 static void vtd_define_quad(IntelIOMMUState *s, hwaddr addr, uint64_t val,
                             uint64_t wmask, uint64_t w1cmask)
 {
@@ -1426,7 +1428,7 @@ static void vtd_context_global_invalidate(IntelIOMMUState *s)
         vtd_reset_context_cache_locked(s);
     }
     vtd_iommu_unlock(s);
-    vtd_switch_address_space_all(s);
+    vtd_address_space_refresh_all(s);
     /*
      * From VT-d spec 6.5.2.1, a global context entry invalidation
      * should be followed by a IOTLB global invalidation, so we should
@@ -1711,6 +1713,8 @@ static void vtd_handle_gcmd_srtp(IntelIOMMUState *s)
     vtd_root_table_setup(s);
     /* Ok - report back to driver */
     vtd_set_clear_mask_long(s, DMAR_GSTS_REG, 0, VTD_GSTS_RTPS);
+    vtd_reset_caches(s);
+    vtd_address_space_refresh_all(s);
 }
 
 /* Set Interrupt Remap Table Pointer */
@@ -1743,7 +1747,8 @@ static void vtd_handle_gcmd_te(IntelIOMMUState *s, bool en)
         vtd_set_clear_mask_long(s, DMAR_GSTS_REG, VTD_GSTS_TES, 0);
     }
 
-    vtd_switch_address_space_all(s);
+    vtd_reset_caches(s);
+    vtd_address_space_refresh_all(s);
 }
 
 /* Handle Interrupt Remap Enable/Disable */
@@ -3022,6 +3027,12 @@ static void vtd_address_space_unmap_all(IntelIOMMUState *s)
     }
 }
 
+static void vtd_address_space_refresh_all(IntelIOMMUState *s)
+{
+    vtd_address_space_unmap_all(s);
+    vtd_switch_address_space_all(s);
+}
+
 static int vtd_replay_hook(IOMMUTLBEntry *entry, void *private)
 {
     memory_region_notify_one((IOMMUNotifier *)private, entry);
@@ -3194,11 +3205,7 @@ static void vtd_reset(DeviceState *dev)
     IntelIOMMUState *s = INTEL_IOMMU_DEVICE(dev);
 
     vtd_init(s);
-
-    /*
-     * When device reset, throw away all mappings and external caches
-     */
-    vtd_address_space_unmap_all(s);
+    vtd_address_space_refresh_all(s);
 }
 
 static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
-- 
2.17.1

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

* [Qemu-devel] [PATCH 56/97] nbd: fix NBD_FLAG_SEND_CACHE value
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (54 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 55/97] intel_iommu: better handling of dmar state switch Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 57/97] migration: Stop postcopy fault thread before notifying Michael Roth
                   ` (42 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-stable, Denis V. Lunev, Vladimir Sementsov-Ogievskiy,
	Valery Vdovin, Eric Blake, Paolo Bonzini

From: "Denis V. Lunev" <den@openvz.org>

Commit bc37b06a5 added NBD_CMD_CACHE support, but used the wrong value
for NBD_FLAG_SEND_CACHE flag for negotiation. That commit picked bit 8,
which had already been assigned by the NBD specification to mean
NBD_FLAG_CAN_MULTI_CONN, and which was already implemented in the
Linux kernel as a part of stable userspace-kernel API since 4.10:

"bit 8, NBD_FLAG_CAN_MULTI_CONN: Indicates that the server operates
entirely without cache, or that the cache it uses is shared among all
connections to the given device. In particular, if this flag is
present, then the effects of NBD_CMD_FLUSH and NBD_CMD_FLAG_FUA
MUST be visible across all connections when the server sends its reply
to that command to the client. In the absense of this flag, clients
SHOULD NOT multiplex their commands over more than one connection to
the export.
...
bit 10, NBD_FLAG_SEND_CACHE: documents that the server understands
NBD_CMD_CACHE; however, note that server implementations exist
which support the command without advertising this bit, and
conversely that this bit does not guarantee that the command will
succeed or have an impact."

Consequences:
- a client trying to use NBD_CMD_CACHE per the NBD spec will not
see the feature as available from a qemu 3.0 server (not fatal,
clients already have to be prepared for caching to not exist)
- a client accidentally coded to the qemu 3.0 bit value instead
of following the spec may interpret NBD_CMD_CACHE as being available
when it is not (probably not fatal, the spec says the server should
gracefully fail unknown commands, and that clients of NBD_CMD_CACHE
should be prepared for failure even when the feature is advertised);
such clients are unlikely (perhaps only in unreleased Virtuozzo code),
and will disappear over time
- a client prepared to use multiple connections based on
NBD_FLAG_CAN_MULTI_CONN may cause data corruption when it assumes
that caching is consistent when in reality qemu 3.0 did not have
a consistent cache. Partially mitigated by using read-only
connections (where nothing needs to be flushed, so caching is
indeed consistent) or when using qemu-nbd with the default -e 1
(at most one client at a time); visible only when using -e 2 or
more for a writable export.

Thus the commit fixes negotiation flag in QEMU according to the
specification.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
CC: Valery Vdovin <valery.vdovin@acronis.com>
CC: Eric Blake <eblake@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: qemu-stable@nongnu.org
Message-Id: <20181004100313.4253-1-den@openvz.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: enhance commit message, add defines for unimplemented flags]
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit df91328adab8490367776d2b21b35d790a606120)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 include/block/nbd.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/block/nbd.h b/include/block/nbd.h
index 4638c839f5..a53b0cfae0 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -135,7 +135,9 @@ typedef struct NBDExtent {
 #define NBD_FLAG_SEND_TRIM         (1 << 5) /* Send TRIM (discard) */
 #define NBD_FLAG_SEND_WRITE_ZEROES (1 << 6) /* Send WRITE_ZEROES */
 #define NBD_FLAG_SEND_DF           (1 << 7) /* Send DF (Do not Fragment) */
-#define NBD_FLAG_SEND_CACHE        (1 << 8) /* Send CACHE (prefetch) */
+#define NBD_FLAG_CAN_MULTI_CONN    (1 << 8) /* Multi-client cache consistent */
+#define NBD_FLAG_SEND_RESIZE       (1 << 9) /* Send resize */
+#define NBD_FLAG_SEND_CACHE        (1 << 10) /* Send CACHE (prefetch) */
 
 /* New-style handshake (global) flags, sent from server to client, and
    control what will happen during handshake phase. */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 57/97] migration: Stop postcopy fault thread before notifying
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (55 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 56/97] nbd: fix NBD_FLAG_SEND_CACHE value Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 58/97] vhost-scsi: prevent using uninitialized vqs Michael Roth
                   ` (41 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Ilya Maximets, Dr . David Alan Gilbert

From: Ilya Maximets <i.maximets@samsung.com>

POSTCOPY_NOTIFY_INBOUND_END handlers will remove userfault fds
from the postcopy_remote_fds array which could be still in
use by the fault thread. Let's stop the thread before
notification to avoid possible accessing wrong memory.

Fixes: 46343570c06e ("vhost+postcopy: Wire up POSTCOPY_END notify")
Cc: qemu-stable@nongnu.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Message-Id: <20181008160536.6332-2-i.maximets@samsung.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
(cherry picked from commit 55d0fe8254984321a126efd8db358f754737aa63)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 migration/postcopy-ram.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 932f188949..d6cc99fee1 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -519,6 +519,12 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)
     if (mis->have_fault_thread) {
         Error *local_err = NULL;
 
+        /* Let the fault thread quit */
+        atomic_set(&mis->fault_thread_quit, 1);
+        postcopy_fault_thread_notify(mis);
+        trace_postcopy_ram_incoming_cleanup_join();
+        qemu_thread_join(&mis->fault_thread);
+
         if (postcopy_notify(POSTCOPY_NOTIFY_INBOUND_END, &local_err)) {
             error_report_err(local_err);
             return -1;
@@ -527,11 +533,6 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)
         if (qemu_ram_foreach_migratable_block(cleanup_range, mis)) {
             return -1;
         }
-        /* Let the fault thread quit */
-        atomic_set(&mis->fault_thread_quit, 1);
-        postcopy_fault_thread_notify(mis);
-        trace_postcopy_ram_incoming_cleanup_join();
-        qemu_thread_join(&mis->fault_thread);
 
         trace_postcopy_ram_incoming_cleanup_closeuf();
         close(mis->userfault_fd);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 58/97] vhost-scsi: prevent using uninitialized vqs
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (56 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 57/97] migration: Stop postcopy fault thread before notifying Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs Michael Roth
                   ` (40 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, yuchenlin, Forrest Liu, Michael S . Tsirkin

From: yuchenlin <yuchenlin@synology.com>

There are 3 virtqueues (ctrl, event and cmd) for virtio scsi device,
but seabios will only set the physical address for the 3rd one (cmd).
Then in vhost_virtqueue_start(), virtio_queue_get_desc_addr()
will be 0 for ctrl and event vq.

In this case, ctrl and event vq are not initialized.
vhost_verify_ring_mappings may use uninitialized vhost_virtqueue
such that vhost_verify_ring_part_mapping returns ENOMEM.

When encountered this problem, we got the following logs:

    qemu-system-x86_64: Unable to map available ring for ring 0
    qemu-system-x86_64: Verify ring failure on region 0

Signed-off-by: Forrest Liu <forrestl@synology.com>
Signed-off-by: yuchenlin <yuchenlin@synology.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/scsi/vhost-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 9c1bea8ff3..a5eb2800a2 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -183,7 +183,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
     }
 
     vsc->dev.nvqs = VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
-    vsc->dev.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs);
+    vsc->dev.vqs = g_new0(struct vhost_virtqueue, vsc->dev.nvqs);
     vsc->dev.vq_index = 0;
     vsc->dev.backend_features = 0;
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (57 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 58/97] vhost-scsi: prevent using uninitialized vqs Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 21:19   ` Max Filippov
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 60/97] make-release: add skiboot .version file Michael Roth
                   ` (39 subsequent siblings)
  98 siblings, 1 reply; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Max Filippov

From: Max Filippov <jcmvbkbc@gmail.com>

Now that xtensa_count_regs does the right thing, remove manual
initialization of these fields from the affected configurations and let
xtensa_finalize_config initialize them. Add XTREG_END to terminate
register lists.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
(cherry picked from commit 7da9111e77b9cdb3a927dcd47642b7ffff9de636)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/xtensa/core-dc232b.c                | 2 --
 target/xtensa/core-dc232b/gdb-config.inc.c | 1 +
 target/xtensa/core-dc233c.c                | 2 --
 target/xtensa/core-dc233c/gdb-config.inc.c | 1 +
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/target/xtensa/core-dc232b.c b/target/xtensa/core-dc232b.c
index 7131337840..7851bcb636 100644
--- a/target/xtensa/core-dc232b.c
+++ b/target/xtensa/core-dc232b.c
@@ -40,8 +40,6 @@
 static XtensaConfig dc232b __attribute__((unused)) = {
     .name = "dc232b",
     .gdb_regmap = {
-        .num_regs = 120,
-        .num_core_regs = 52,
         .reg = {
 #include "core-dc232b/gdb-config.inc.c"
         }
diff --git a/target/xtensa/core-dc232b/gdb-config.inc.c b/target/xtensa/core-dc232b/gdb-config.inc.c
index 13aba5edec..d87168628b 100644
--- a/target/xtensa/core-dc232b/gdb-config.inc.c
+++ b/target/xtensa/core-dc232b/gdb-config.inc.c
@@ -259,3 +259,4 @@
           0, 0, 0, 0, 0, 0)
   XTREG(119, 476, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15,
           0, 0, 0, 0, 0, 0)
+  XTREG_END
diff --git a/target/xtensa/core-dc233c.c b/target/xtensa/core-dc233c.c
index d701e3f5de..8853bfd4d0 100644
--- a/target/xtensa/core-dc233c.c
+++ b/target/xtensa/core-dc233c.c
@@ -40,8 +40,6 @@
 static XtensaConfig dc233c __attribute__((unused)) = {
     .name = "dc233c",
     .gdb_regmap = {
-        .num_regs = 121,
-        .num_core_regs = 52,
         .reg = {
 #include "core-dc233c/gdb-config.inc.c"
         }
diff --git a/target/xtensa/core-dc233c/gdb-config.inc.c b/target/xtensa/core-dc233c/gdb-config.inc.c
index b632341b28..7e8963227f 100644
--- a/target/xtensa/core-dc233c/gdb-config.inc.c
+++ b/target/xtensa/core-dc233c/gdb-config.inc.c
@@ -143,3 +143,4 @@ XTREG(117, 468, 32, 4, 4, 0x000c, 0x0006, -2, 8, 0x0100, a12,         0, 0, 0, 0
 XTREG(118, 472, 32, 4, 4, 0x000d, 0x0006, -2, 8, 0x0100, a13,         0, 0, 0, 0, 0, 0)
 XTREG(119, 476, 32, 4, 4, 0x000e, 0x0006, -2, 8, 0x0100, a14,         0, 0, 0, 0, 0, 0)
 XTREG(120, 480, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15,         0, 0, 0, 0, 0, 0)
+XTREG_END
-- 
2.17.1

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

* [Qemu-devel] [PATCH 60/97] make-release: add skiboot .version file
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (58 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 61/97] net: drop too large packet early Michael Roth
                   ` (38 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Maydell

This is needed to build skiboot from tarball-distributed sources
since the git data the make_release.sh script relies on to generate
it is not available.

Cc: qemu-stable@nongnu.org
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20181109161352.29873-1-mdroth@linux.vnet.ibm.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 3fccd3f26ef3c0c76a06c138b17af6d55a5d9904)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 scripts/make-release | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/make-release b/scripts/make-release
index 04fa9defdc..c14f75b12c 100755
--- a/scripts/make-release
+++ b/scripts/make-release
@@ -19,6 +19,7 @@ pushd ${destination}
 git checkout "v${version}"
 git submodule update --init
 (cd roms/seabios && git describe --tags --long --dirty > .version)
+(cd roms/skiboot && ./make_version.sh > .version)
 # FIXME: The following line is a workaround for avoiding filename collisions
 # when unpacking u-boot sources on case-insensitive filesystems. Once we
 # update to something with u-boot commit 610eec7f0 we can drop this line.
-- 
2.17.1

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

* [Qemu-devel] [PATCH 61/97] net: drop too large packet early
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (59 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 60/97] make-release: add skiboot .version file Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 62/97] fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled Michael Roth
                   ` (37 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Jason Wang, Li Qiang, Peter Maydell

From: Jason Wang <jasowang@redhat.com>

We try to detect and drop too large packet (>INT_MAX) in 1592a9947036
("net: ignore packet size greater than INT_MAX") during packet
delivering. Unfortunately, this is not sufficient as we may hit
another integer overflow when trying to queue such large packet in
qemu_net_queue_append_iov():

- size of the allocation may overflow on 32bit
- packet->size is integer which may overflow even on 64bit

Fixing this by moving the check to qemu_sendv_packet_async() which is
the entrance of all networking codes and reduce the limit to
NET_BUFSIZE to be more conservative. This works since:

- For the callers that call qemu_sendv_packet_async() directly, they
  only care about if zero is returned to determine whether to prevent
  the source from producing more packets. A callback will be triggered
  if peer can accept more then source could be enabled. This is
  usually used by high speed networking implementation like virtio-net
  or netmap.
- For the callers that call qemu_sendv_packet() that calls
  qemu_sendv_packet_async() indirectly, they often ignore the return
  value. In this case qemu will just the drop packets if peer can't
  receive.

Qemu will copy the packet if it was queued. So it was safe for both
kinds of the callers to assume the packet was sent.

Since we move the check from qemu_deliver_packet_iov() to
qemu_sendv_packet_async(), it would be safer to make
qemu_deliver_packet_iov() static to prevent any external user in the
future.

This is a revised patch of CVE-2018-17963.

Cc: qemu-stable@nongnu.org
Cc: Li Qiang <liq3ea@163.com>
Fixes: 1592a9947036 ("net: ignore packet size greater than INT_MAX")
Reported-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20181204035347.6148-2-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 25c01bd19d0e4b66f357618aeefda1ef7a41e21a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 include/net/net.h |  6 ------
 net/net.c         | 28 +++++++++++++++++-----------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/net/net.h b/include/net/net.h
index 1425960f76..3e4638b8c6 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -169,12 +169,6 @@ void qemu_check_nic_model(NICInfo *nd, const char *model);
 int qemu_find_nic_model(NICInfo *nd, const char * const *models,
                         const char *default_model);
 
-ssize_t qemu_deliver_packet_iov(NetClientState *sender,
-                            unsigned flags,
-                            const struct iovec *iov,
-                            int iovcnt,
-                            void *opaque);
-
 void print_net_client(Monitor *mon, NetClientState *nc);
 void hmp_info_network(Monitor *mon, const QDict *qdict);
 void net_socket_rs_init(SocketReadState *rs,
diff --git a/net/net.c b/net/net.c
index 46db72811b..f8275843fb 100644
--- a/net/net.c
+++ b/net/net.c
@@ -231,6 +231,11 @@ static void qemu_net_client_destructor(NetClientState *nc)
 {
     g_free(nc);
 }
+static ssize_t qemu_deliver_packet_iov(NetClientState *sender,
+                                       unsigned flags,
+                                       const struct iovec *iov,
+                                       int iovcnt,
+                                       void *opaque);
 
 static void qemu_net_client_setup(NetClientState *nc,
                                   NetClientInfo *info,
@@ -705,22 +710,18 @@ static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov,
     return ret;
 }
 
-ssize_t qemu_deliver_packet_iov(NetClientState *sender,
-                                unsigned flags,
-                                const struct iovec *iov,
-                                int iovcnt,
-                                void *opaque)
+static ssize_t qemu_deliver_packet_iov(NetClientState *sender,
+                                       unsigned flags,
+                                       const struct iovec *iov,
+                                       int iovcnt,
+                                       void *opaque)
 {
     NetClientState *nc = opaque;
-    size_t size = iov_size(iov, iovcnt);
     int ret;
 
-    if (size > INT_MAX) {
-        return size;
-    }
 
     if (nc->link_down) {
-        return size;
+        return iov_size(iov, iovcnt);
     }
 
     if (nc->receive_disabled) {
@@ -745,10 +746,15 @@ ssize_t qemu_sendv_packet_async(NetClientState *sender,
                                 NetPacketSent *sent_cb)
 {
     NetQueue *queue;
+    size_t size = iov_size(iov, iovcnt);
     int ret;
 
+    if (size > NET_BUFSIZE) {
+        return size;
+    }
+
     if (sender->link_down || !sender->peer) {
-        return iov_size(iov, iovcnt);
+        return size;
     }
 
     /* Let filters handle the packet first */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 62/97] fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (60 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 61/97] net: drop too large packet early Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 63/97] qemu-img: Fix typo Michael Roth
                   ` (36 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Mark Cave-Ayland, Kevin Wolf

From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Commit c8a35f1cf0f "fdc: use IsaDma interface instead of global DMA_*
functions" accidentally introduced a segfault in fdctrl_stop_transfer() for
non-DMA transfers.

If fdctrl->dma_chann has not been configured then the fdctrl->dma interface
reference isn't initialised during isabus_fdc_realize(). Unfortunately
fdctrl_stop_transfer() unconditionally references the DMA interface when
finishing the transfer causing a NULL pointer dereference.

Fix the issue by adding a check in fdctrl_stop_transfer() so that the DMA
interface reference and release method is only invoked if fdctrl->dma_chann
has been set.

(This issue was discovered by Martin testing a recent change in the NetBSD
installer under qemu-system-sparc)

Cc: qemu-stable@nongnu.org
Reported-by: Martin Husemann <martin@duskware.de>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 441f6692ecc14859b77af2ac6d8f55e6f1354d3b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/block/fdc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 2e9c1e1e2f..6f19f127a5 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -1617,7 +1617,7 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0,
     fdctrl->fifo[5] = cur_drv->sect;
     fdctrl->fifo[6] = FD_SECTOR_SC;
     fdctrl->data_dir = FD_DIR_READ;
-    if (!(fdctrl->msr & FD_MSR_NONDMA)) {
+    if (fdctrl->dma_chann != -1 && !(fdctrl->msr & FD_MSR_NONDMA)) {
         IsaDmaClass *k = ISADMA_GET_CLASS(fdctrl->dma);
         k->release_DREQ(fdctrl->dma, fdctrl->dma_chann);
     }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 63/97] qemu-img: Fix typo
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (61 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 62/97] fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 64/97] qemu-img: Fix leak Michael Roth
                   ` (35 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Max Reitz, Kevin Wolf

From: Max Reitz <mreitz@redhat.com>

Fixes: d402b6a21a825a5c07aac9251990860723d49f5d
Reported-by: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit f0998879e049dad19beed881a1c56643ce536384)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qemu-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-img.c b/qemu-img.c
index b12f4cd19b..cb4a73e5f9 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -261,7 +261,7 @@ static int print_block_option_help(const char *filename, const char *fmt)
             return 1;
         }
         if (!proto_drv->create_opts) {
-            error_report("Protocal driver '%s' does not support image creation",
+            error_report("Protocol driver '%s' does not support image creation",
                          proto_drv->format_name);
             return 1;
         }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 64/97] qemu-img: Fix leak
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (62 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 63/97] qemu-img: Fix typo Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 65/97] fmops: fix off-by-one in AR_TABLE and DR_TABLE array size Michael Roth
                   ` (34 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Max Reitz, Kevin Wolf

From: Max Reitz <mreitz@redhat.com>

create_opts was leaked here.  This is not too bad since the process is
about to exit anyway, but relying on that does not make the code nicer
to read.

Fixes: d402b6a21a825a5c07aac9251990860723d49f5d
Reported-by: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 3ecd5a4f19fd9a497490a91aaa96e76a5edadd2c)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qemu-img.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qemu-img.c b/qemu-img.c
index cb4a73e5f9..4799e097dc 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -263,6 +263,7 @@ static int print_block_option_help(const char *filename, const char *fmt)
         if (!proto_drv->create_opts) {
             error_report("Protocol driver '%s' does not support image creation",
                          proto_drv->format_name);
+            qemu_opts_free(create_opts);
             return 1;
         }
         create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 65/97] fmops: fix off-by-one in AR_TABLE and DR_TABLE array size
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (63 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 64/97] qemu-img: Fix leak Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 66/97] vfio-helpers: Fix qemu_vfio_open_pci() crash Michael Roth
                   ` (33 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Gerd Hoffmann, P J P

From: Gerd Hoffmann <kraxel@redhat.com>

Cc: P J P <ppandit@redhat.com>
Reported-by: Wangjunqing <wangjunqing@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20181030082340.17170-1-kraxel@redhat.com
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 57ac4a7a28fef81b80b547c64d26681edc4a2cda)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/audio/fmopl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index e7e578a48e..e008e72d7a 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -72,8 +72,8 @@ typedef struct fm_opl_f {
 	/* Rhythm sention */
 	uint8_t rhythm;		/* Rhythm mode , key flag */
 	/* time tables */
-	int32_t AR_TABLE[75];	/* atttack rate tables */
-	int32_t DR_TABLE[75];	/* decay rate tables   */
+	int32_t AR_TABLE[76];	/* attack rate tables  */
+	int32_t DR_TABLE[76];	/* decay rate tables   */
 	uint32_t FN_TABLE[1024];  /* fnumber -> increment counter */
 	/* LFO */
 	int32_t *ams_table;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 66/97] vfio-helpers: Fix qemu_vfio_open_pci() crash
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (64 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 65/97] fmops: fix off-by-one in AR_TABLE and DR_TABLE array size Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 67/97] i2c: Move typedef of bitbang_i2c_interface to i2c.h Michael Roth
                   ` (32 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Markus Armbruster, Peter Maydell

From: Markus Armbruster <armbru@redhat.com>

qemu_vfio_open_common() initializes s->lock only after passing s to
qemu_vfio_dma_map() via qemu_vfio_init_ramblock().
qemu_vfio_dma_map() tries to lock the uninitialized lock and crashes.

Fix by initializing s->lock first.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1645840
Fixes: 418026ca43bc2626db092d7558258f9594366f28
Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20181127084143.1113-1-armbru@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 549b50a31d28f2687a47e827a1e17300784a2c44)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 util/vfio-helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index 1d9272efa4..cccc9cd42e 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -411,13 +411,13 @@ static int qemu_vfio_init_ramblock(const char *block_name, void *host_addr,
 
 static void qemu_vfio_open_common(QEMUVFIOState *s)
 {
+    qemu_mutex_init(&s->lock);
     s->ram_notifier.ram_block_added = qemu_vfio_ram_block_added;
     s->ram_notifier.ram_block_removed = qemu_vfio_ram_block_removed;
     ram_block_notifier_add(&s->ram_notifier);
     s->low_water_mark = QEMU_VFIO_IOVA_MIN;
     s->high_water_mark = QEMU_VFIO_IOVA_MAX;
     qemu_ram_foreach_block(qemu_vfio_init_ramblock, s);
-    qemu_mutex_init(&s->lock);
 }
 
 /**
-- 
2.17.1

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

* [Qemu-devel] [PATCH 67/97] i2c: Move typedef of bitbang_i2c_interface to i2c.h
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (65 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 66/97] vfio-helpers: Fix qemu_vfio_open_pci() crash Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 68/97] i2c: Add a length check to the SMBus write handling Michael Roth
                   ` (31 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, BALATON Zoltan, Thomas Huth

From: BALATON Zoltan <balaton@eik.bme.hu>

Clang 3.4 considers duplicate typedef in ppc4xx_i2c.h and
bitbang_i2c.h an error even if they are identical. Move it to a common
place to allow building with this clang version.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 2b4c1125ac3db2734222ff43c25388a16aca4a99)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/i2c/bitbang_i2c.h        | 2 --
 include/hw/i2c/i2c.h        | 2 ++
 include/hw/i2c/ppc4xx_i2c.h | 3 ---
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/i2c/bitbang_i2c.h b/hw/i2c/bitbang_i2c.h
index 3a7126d5de..9443021710 100644
--- a/hw/i2c/bitbang_i2c.h
+++ b/hw/i2c/bitbang_i2c.h
@@ -3,8 +3,6 @@
 
 #include "hw/i2c/i2c.h"
 
-typedef struct bitbang_i2c_interface bitbang_i2c_interface;
-
 #define BITBANG_I2C_SDA 0
 #define BITBANG_I2C_SCL 1
 
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index 5dc166158b..cf4c45a98f 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -82,6 +82,8 @@ int i2c_recv(I2CBus *bus);
 
 DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
 
+typedef struct bitbang_i2c_interface bitbang_i2c_interface;
+
 /* lm832x.c */
 void lm832x_key_event(DeviceState *dev, int key, int state);
 
diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h
index 0891a9c948..b3450bacf7 100644
--- a/include/hw/i2c/ppc4xx_i2c.h
+++ b/include/hw/i2c/ppc4xx_i2c.h
@@ -31,9 +31,6 @@
 #include "hw/sysbus.h"
 #include "hw/i2c/i2c.h"
 
-/* from hw/i2c/bitbang_i2c.h */
-typedef struct bitbang_i2c_interface bitbang_i2c_interface;
-
 #define TYPE_PPC4xx_I2C "ppc4xx-i2c"
 #define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 68/97] i2c: Add a length check to the SMBus write handling
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (66 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 67/97] i2c: Move typedef of bitbang_i2c_interface to i2c.h Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 69/97] nbd/server: Advertise all contexts in response to bare LIST Michael Roth
                   ` (30 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Corey Minyard, Peter Maydell

From: Corey Minyard <cminyard@mvista.com>

Avoid an overflow.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: QEMU Stable <qemu-stable@nongnu.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 629457a13080052c575779e1fd9f5eb5ee6b8ad9)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/i2c/smbus.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c
index 587ce1ab7f..639ff90b65 100644
--- a/hw/i2c/smbus.c
+++ b/hw/i2c/smbus.c
@@ -193,7 +193,11 @@ static int smbus_i2c_send(I2CSlave *s, uint8_t data)
     switch (dev->mode) {
     case SMBUS_WRITE_DATA:
         DPRINTF("Write data %02x\n", data);
-        dev->data_buf[dev->data_len++] = data;
+        if (dev->data_len >= sizeof(dev->data_buf)) {
+            BADF("Too many bytes sent\n");
+        } else {
+            dev->data_buf[dev->data_len++] = data;
+        }
         break;
     default:
         BADF("Unexpected write in state %d\n", dev->mode);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 69/97] nbd/server: Advertise all contexts in response to bare LIST
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (67 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 68/97] i2c: Add a length check to the SMBus write handling Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 70/97] nbd/client: Make x-dirty-bitmap more reliable Michael Roth
                   ` (29 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Eric Blake

From: Eric Blake <eblake@redhat.com>

The NBD spec, and even our code comment, says that if the client
asks for NBD_OPT_LIST_META_CONTEXT with 0 queries, then we should
reply with (a possibly-compressed representation of) ALL contexts
that we are willing to let them try.  But commit 3d068aff forgot
to advertise qemu:dirty-bitmap:FOO.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181130023232.3079982-2-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
(cherry picked from commit e31d802479df9daff1994a7ed1e36bbc5bb19d03)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 nbd/server.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nbd/server.c b/nbd/server.c
index adcba66aa9..2193e16c68 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -978,6 +978,7 @@ static int nbd_negotiate_meta_queries(NBDClient *client,
     if (client->opt == NBD_OPT_LIST_META_CONTEXT && !nb_queries) {
         /* enable all known contexts */
         meta->base_allocation = true;
+        meta->bitmap = !!meta->exp->export_bitmap;
     } else {
         for (i = 0; i < nb_queries; ++i) {
             ret = nbd_negotiate_meta_query(client, meta, errp);
-- 
2.17.1

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

* [Qemu-devel] [PATCH 70/97] nbd/client: Make x-dirty-bitmap more reliable
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (68 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 69/97] nbd/server: Advertise all contexts in response to bare LIST Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 71/97] nbd/client: Send NBD_CMD_DISC if open fails after connect Michael Roth
                   ` (28 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Eric Blake

From: Eric Blake <eblake@redhat.com>

The implementation of x-dirty-bitmap in qemu 3.0 (commit 216ee365)
silently falls back to treating the server as not supporting
NBD_CMD_BLOCK_STATUS if a requested meta_context name was not
negotiated, which in turn means treating the _entire_ image as
data. Since our hack relied on using 'qemu-img map' to view
which portions of the image were dirty by seeing what the
redirected bdrv_block_status() treats as holes, this means
that our fallback treats the entire image as clean.  Better
would have been to treat the entire image as dirty, or to fail
to connect because the user's request for a specific context
could not be honored. This patch goes with the latter.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181130023232.3079982-3-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
(cherry picked from commit 47829c40794160debdb33b4a042d182e776876d4)
*avoid context dep. on 6c2e581d
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/nbd-client.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/block/nbd-client.c b/block/nbd-client.c
index 9686ecbd5e..f8c42a6996 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -992,6 +992,11 @@ int nbd_client_init(BlockDriverState *bs,
         logout("Failed to negotiate with the NBD server\n");
         return ret;
     }
+    if (x_dirty_bitmap && !client->info.base_allocation) {
+        error_setg(errp, "requested x-dirty-bitmap %s not found",
+                   x_dirty_bitmap);
+        return -EINVAL;
+    }
     if (client->info.flags & NBD_FLAG_READ_ONLY &&
         !bdrv_is_read_only(bs)) {
         error_setg(errp,
-- 
2.17.1

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

* [Qemu-devel] [PATCH 71/97] nbd/client: Send NBD_CMD_DISC if open fails after connect
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (69 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 70/97] nbd/client: Make x-dirty-bitmap more reliable Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 72/97] mirror: fix dead-lock Michael Roth
                   ` (27 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Eric Blake

From: Eric Blake <eblake@redhat.com>

If nbd_client_init() fails after we are already connected,
then the server will spam logs with:

Disconnect client, due to: Unexpected end-of-file before all bytes were read

unless we gracefully disconnect before closing the connection.

Ways to trigger this:

$ opts=driver=nbd,export=foo,server.type=inet,server.host=localhost,server.port=10809
$  qemu-img map --output=json --image-opts $opts,read-only=off
$  qemu-img map --output=json --image-opts $opts,x-dirty-bitmap=nosuch:

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181130023232.3079982-4-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
(cherry picked from commit c688e6ca7b41a105241054853d250df64addbf8f)
*drop functional dep. on 6c2e581d4d7
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/nbd-client.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/block/nbd-client.c b/block/nbd-client.c
index f8c42a6996..1b7b5b0a88 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -995,13 +995,15 @@ int nbd_client_init(BlockDriverState *bs,
     if (x_dirty_bitmap && !client->info.base_allocation) {
         error_setg(errp, "requested x-dirty-bitmap %s not found",
                    x_dirty_bitmap);
-        return -EINVAL;
+        ret = -EINVAL;
+        goto fail;
     }
     if (client->info.flags & NBD_FLAG_READ_ONLY &&
         !bdrv_is_read_only(bs)) {
         error_setg(errp,
                    "request for write access conflicts with read-only export");
-        return -EACCES;
+        ret = -EACCES;
+        goto fail;
     }
     if (client->info.flags & NBD_FLAG_SEND_FUA) {
         bs->supported_write_flags = BDRV_REQ_FUA;
@@ -1029,4 +1031,17 @@ int nbd_client_init(BlockDriverState *bs,
 
     logout("Established connection with NBD server\n");
     return 0;
+
+ fail:
+    /*
+     * We have connected, but must fail for other reasons. The
+     * connection is still blocking; send NBD_CMD_DISC as a courtesy
+     * to the server.
+     */
+    {
+        NBDRequest request = { .type = NBD_CMD_DISC };
+
+        nbd_send_request(client->ioc ?: QIO_CHANNEL(sioc), &request);
+        return ret;
+    }
 }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 72/97] mirror: fix dead-lock
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (70 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 71/97] nbd/client: Send NBD_CMD_DISC if open fails after connect Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 73/97] iotests: simple mirror test with kvm on 1G image Michael Roth
                   ` (26 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Vladimir Sementsov-Ogievskiy, Kevin Wolf

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Let start from the beginning:

Commit b9e413dd375 (in 2.9)
"block: explicitly acquire aiocontext in aio callbacks that need it"
added pairs of aio_context_acquire/release to mirror_write_complete and
mirror_read_complete, when they were aio callbacks for blk_aio_* calls.

Then, commit 2e1990b26e5 (in 3.0) "block/mirror: Convert to coroutines"
dropped these blk_aio_* calls, than mirror_write_complete and
mirror_read_complete are not callbacks more, and don't need additional
aiocontext acquiring. Furthermore, mirror_read_complete calls
blk_co_pwritev inside these pair of aio_context_acquire/release, which
leads to the following dead-lock with mirror:

 (gdb) info thr
   Id   Target Id         Frame
   3    Thread (LWP 145412) "qemu-system-x86" syscall ()
   2    Thread (LWP 145416) "qemu-system-x86" __lll_lock_wait ()
 * 1    Thread (LWP 145411) "qemu-system-x86" __lll_lock_wait ()

 (gdb) bt
 #0  __lll_lock_wait ()
 #1  _L_lock_812 ()
 #2  __GI___pthread_mutex_lock
 #3  qemu_mutex_lock_impl (mutex=0x561032dce420 <qemu_global_mutex>,
     file=0x5610327d8654 "util/main-loop.c", line=236) at
     util/qemu-thread-posix.c:66
 #4  qemu_mutex_lock_iothread_impl
 #5  os_host_main_loop_wait (timeout=480116000) at util/main-loop.c:236
 #6  main_loop_wait (nonblocking=0) at util/main-loop.c:497
 #7  main_loop () at vl.c:1892
 #8  main

Printing contents of qemu_global_mutex, I see that "__owner = 145416",
so, thr1 is main loop, and now it wants BQL, which is owned by thr2.

 (gdb) thr 2
 (gdb) bt
 #0  __lll_lock_wait ()
 #1  _L_lock_870 ()
 #2  __GI___pthread_mutex_lock
 #3  qemu_mutex_lock_impl (mutex=0x561034d25dc0, ...
 #4  aio_context_acquire (ctx=0x561034d25d60)
 #5  dma_blk_cb
 #6  dma_blk_io
 #7  dma_blk_read
 #8  ide_dma_cb
 #9  bmdma_cmd_writeb
 #10 bmdma_write
 #11 memory_region_write_accessor
 #12 access_with_adjusted_size
 #15 flatview_write
 #16 address_space_write
 #17 address_space_rw
 #18 kvm_handle_io
 #19 kvm_cpu_exec
 #20 qemu_kvm_cpu_thread_fn
 #21 qemu_thread_start
 #22 start_thread
 #23 clone ()

Printing mutex in fr 2, I see "__owner = 145411", so thr2 wants aio
context mutex, which is owned by thr1. Classic dead-lock.

Then, let's check that aio context is hold by mirror coroutine: just
print coroutine stack of first tracked request in mirror job target:

 (gdb) [...]
 (gdb) qemu coroutine 0x561035dd0860
 #0  qemu_coroutine_switch
 #1  qemu_coroutine_yield
 #2  qemu_co_mutex_lock_slowpath
 #3  qemu_co_mutex_lock
 #4  qcow2_co_pwritev
 #5  bdrv_driver_pwritev
 #6  bdrv_aligned_pwritev
 #7  bdrv_co_pwritev
 #8  blk_co_pwritev
 #9  mirror_read_complete () at block/mirror.c:232
 #10 mirror_co_read () at block/mirror.c:370
 #11 coroutine_trampoline
 #12 __start_context

Yes it is mirror_read_complete calling blk_co_pwritev after acquiring
aio context.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit d12ade5732c4d2d293735a39b4bd943da8d64db6)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block/mirror.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/block/mirror.c b/block/mirror.c
index dd5ca02b09..b097853983 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -198,7 +198,6 @@ static void coroutine_fn mirror_write_complete(MirrorOp *op, int ret)
 {
     MirrorBlockJob *s = op->s;
 
-    aio_context_acquire(blk_get_aio_context(s->common.blk));
     if (ret < 0) {
         BlockErrorAction action;
 
@@ -208,15 +207,14 @@ static void coroutine_fn mirror_write_complete(MirrorOp *op, int ret)
             s->ret = ret;
         }
     }
+
     mirror_iteration_done(op, ret);
-    aio_context_release(blk_get_aio_context(s->common.blk));
 }
 
 static void coroutine_fn mirror_read_complete(MirrorOp *op, int ret)
 {
     MirrorBlockJob *s = op->s;
 
-    aio_context_acquire(blk_get_aio_context(s->common.blk));
     if (ret < 0) {
         BlockErrorAction action;
 
@@ -227,12 +225,11 @@ static void coroutine_fn mirror_read_complete(MirrorOp *op, int ret)
         }
 
         mirror_iteration_done(op, ret);
-    } else {
-        ret = blk_co_pwritev(s->target, op->offset,
-                             op->qiov.size, &op->qiov, 0);
-        mirror_write_complete(op, ret);
+        return;
     }
-    aio_context_release(blk_get_aio_context(s->common.blk));
+
+    ret = blk_co_pwritev(s->target, op->offset, op->qiov.size, &op->qiov, 0);
+    mirror_write_complete(op, ret);
 }
 
 /* Clip bytes relative to offset to not exceed end-of-file */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 73/97] iotests: simple mirror test with kvm on 1G image
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (71 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 72/97] mirror: fix dead-lock Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 74/97] iotests: make 235 work on s390 (and others) Michael Roth
                   ` (25 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-stable, Vladimir Sementsov-Ogievskiy, Max Reitz, Kevin Wolf

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

This test is broken without previous commit fixing dead-lock in mirror.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Acked-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit db5e8210adbafe9c6383d8364345a8c545d38e62)
*drop context deps from test groups not in 3.0
*modify expected QMP output to match encoding for 3.0
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 tests/qemu-iotests/235     | 76 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/235.out |  3 ++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 80 insertions(+)
 create mode 100755 tests/qemu-iotests/235
 create mode 100644 tests/qemu-iotests/235.out

diff --git a/tests/qemu-iotests/235 b/tests/qemu-iotests/235
new file mode 100755
index 0000000000..da044ed34e
--- /dev/null
+++ b/tests/qemu-iotests/235
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+#
+# Simple mirror test
+#
+# Copyright (c) 2018 Virtuozzo International GmbH. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+import sys
+import os
+import iotests
+from iotests import qemu_img_create, qemu_io, file_path, log
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts'))
+
+from qemu import QEMUMachine
+
+# Note:
+# This test was added to check that mirror dead-lock was fixed (see previous
+# commit before this test addition).
+# And it didn't reproduce if at least one of the following:
+# 1. use small image size
+# 2. use raw format (not qcow2)
+# 3. drop kvm and use iotests.VM() (maybe, because of qtest) (however, it still
+#    reproduces, if just drop kvm, but gdb failed to produce full backtraces
+#    for me)
+# 4. add iothread
+
+size = 1 * 1024 * 1024 * 1024
+
+iotests.verify_image_format(supported_fmts=['qcow2'])
+
+disk = file_path('disk')
+
+# prepare source image
+qemu_img_create('-f', iotests.imgfmt, '-o', 'preallocation=metadata', disk,
+                str(size))
+
+vm = QEMUMachine(iotests.qemu_prog)
+vm.add_args('-machine', 'pc,accel=kvm')
+vm.add_args('-drive', 'id=src,file=' + disk)
+vm.launch()
+
+log(vm.qmp('object-add', qom_type='throttle-group', id='tg0',
+           props={ 'x-bps-total': size }))
+
+log(vm.qmp('blockdev-add',
+           **{ 'node-name': 'target',
+               'driver': 'throttle',
+               'throttle-group': 'tg0',
+               'file': {
+                   'driver': 'null-co',
+                   'size': size
+                } }))
+
+log(vm.qmp('blockdev-mirror', device='src', target='target', sync='full'))
+
+try:
+    vm.event_wait('BLOCK_JOB_READY', timeout=10.0)
+except:
+    vm.shutdown()
+    raise
+
+vm.shutdown()
diff --git a/tests/qemu-iotests/235.out b/tests/qemu-iotests/235.out
new file mode 100644
index 0000000000..db7882d4cc
--- /dev/null
+++ b/tests/qemu-iotests/235.out
@@ -0,0 +1,3 @@
+{u'return': {}}
+{u'return': {}}
+{u'return': {}}
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 31f6e77dcb..d098120afa 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -227,3 +227,4 @@
 227 auto quick
 229 auto quick
 231 auto quick
+235 auto quick
-- 
2.17.1

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

* [Qemu-devel] [PATCH 74/97] iotests: make 235 work on s390 (and others)
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (72 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 73/97] iotests: simple mirror test with kvm on 1G image Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 75/97] Changes requirement for "vsubsbs" instruction Michael Roth
                   ` (24 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Christian Borntraeger, Kevin Wolf

From: Christian Borntraeger <borntraeger@de.ibm.com>

"-machine pc" will not work all architectures. Lets fall back to the
default machine by not specifying it.

In addition we also need to specify -no-shutdown on s390 as qemu will
exit otherwise.

Cc: qemu-stable@nongnu.org
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 2c26e648e4350079b0c86a6627b2d3566c3709c0)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 tests/qemu-iotests/235 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/235 b/tests/qemu-iotests/235
index da044ed34e..d6edd97ab4 100755
--- a/tests/qemu-iotests/235
+++ b/tests/qemu-iotests/235
@@ -49,7 +49,9 @@ qemu_img_create('-f', iotests.imgfmt, '-o', 'preallocation=metadata', disk,
                 str(size))
 
 vm = QEMUMachine(iotests.qemu_prog)
-vm.add_args('-machine', 'pc,accel=kvm')
+vm.add_args('-machine', 'accel=kvm')
+if iotests.qemu_default_machine == 's390-ccw-virtio':
+        vm.add_args('-no-shutdown')
 vm.add_args('-drive', 'id=src,file=' + disk)
 vm.launch()
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 75/97] Changes requirement for "vsubsbs" instruction
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (73 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 74/97] iotests: make 235 work on s390 (and others) Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 76/97] pcie: set link state inactive/active after hot unplug/plug Michael Roth
                   ` (23 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Paul A. Clarke, Leonardo Bras, David Gibson

From: "Paul A. Clarke" <pc@us.ibm.com>

Changes requirement for "vsubsbs" instruction, which has been supported
since ISA 2.03. (Please see section 5.9.1.2 of ISA 2.03)

Reported-by: Paul A. Clarke <pc@us.ibm.com>
Signed-off-by: Paul A. Clarke <pc@us.ibm.com>
Signed-off-by: Leonardo Bras <leonardo@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
(cherry picked from commit fcfbc18d00b10335310c9665edd6e04f2d152be8)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/ppc/translate/vmx-ops.inc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-ops.inc.c
index 139f80cb24..84e05fb827 100644
--- a/target/ppc/translate/vmx-ops.inc.c
+++ b/target/ppc/translate/vmx-ops.inc.c
@@ -143,7 +143,7 @@ GEN_VXFORM(vaddsws, 0, 14),
 GEN_VXFORM_DUAL(vsububs, bcdadd, 0, 24, PPC_ALTIVEC, PPC_NONE),
 GEN_VXFORM_DUAL(vsubuhs, bcdsub, 0, 25, PPC_ALTIVEC, PPC_NONE),
 GEN_VXFORM(vsubuws, 0, 26),
-GEN_VXFORM_DUAL(vsubsbs, bcdtrunc, 0, 28, PPC_NONE, PPC2_ISA300),
+GEN_VXFORM_DUAL(vsubsbs, bcdtrunc, 0, 28, PPC_ALTIVEC, PPC2_ISA300),
 GEN_VXFORM(vsubshs, 0, 29),
 GEN_VXFORM_DUAL(vsubsws, xpnd04_2, 0, 30, PPC_ALTIVEC, PPC_NONE),
 GEN_VXFORM_207(vadduqm, 0, 4),
-- 
2.17.1

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

* [Qemu-devel] [PATCH 76/97] pcie: set link state inactive/active after hot unplug/plug
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (74 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 75/97] Changes requirement for "vsubsbs" instruction Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 77/97] pc:piix4: Update smbus I/O space after a migration Michael Roth
                   ` (22 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-stable, Zheng Xiang, Zheng Xiang, Wang Haibin, Michael S . Tsirkin

From: Zheng Xiang <zhengxiang9@huawei.com>

When VM boots from the latest version of linux kernel, after
hot-unpluging virtio-blk disks which are hotplugged into
pcie-root-port, the VM's dmesg log shows:

[  151.046242] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0001 from Slot Status
[  151.046365] pciehp 0000:00:05.0:pcie004: Slot(0-3): Attention button pressed
[  151.046369] pciehp 0000:00:05.0:pcie004: Slot(0-3): Powering off due to button press
[  151.046420] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  151.046425] pciehp 0000:00:05.0:pcie004: pciehp_green_led_blink: SLOTCTRL a8 write cmd 200
[  151.046464] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  151.046468] pciehp 0000:00:05.0:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd c0
[  156.163421] pciehp 0000:00:05.0:pcie004: pciehp_get_power_status: SLOTCTRL a8 value read 2f1
[  156.163427] pciehp 0000:00:05.0:pcie004: pciehp_unconfigure_device: domain:bus:dev = 0000:06:00
[  156.198736] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  156.198772] pciehp 0000:00:05.0:pcie004: pciehp_power_off_slot: SLOTCTRL a8 write cmd 400
[  157.224124] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0018 from Slot Status
[  157.224194] pciehp 0000:00:05.0:pcie004: pciehp_green_led_off: SLOTCTRL a8 write cmd 300
[  157.224220] pciehp 0000:00:05.0:pcie004: pciehp_check_link_active: lnk_status = 2011
[  157.224223] pciehp 0000:00:05.0:pcie004: Slot(0-3): Link Up
[  157.224233] pciehp 0000:00:05.0:pcie004: pciehp_get_power_status: SLOTCTRL a8 value read 7f1
[  157.224281] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  157.224285] pciehp 0000:00:05.0:pcie004: pciehp_power_on_slot: SLOTCTRL a8 write cmd 0
[  157.224300] pciehp 0000:00:05.0:pcie004: __pciehp_link_set: lnk_ctrl = 0
[  157.224336] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  157.224339] pciehp 0000:00:05.0:pcie004: pciehp_green_led_blink: SLOTCTRL a8 write cmd 200
[  159.739294] pci 0000:06:00.0 id reading try 50 times with interval 20 ms to get ffffffff
[  159.739315] pciehp 0000:00:05.0:pcie004: pciehp_check_link_status: lnk_status = 2011
[  159.739318] pciehp 0000:00:05.0:pcie004: Failed to check link status
[  159.739371] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  159.739394] pciehp 0000:00:05.0:pcie004: pciehp_power_off_slot: SLOTCTRL a8 write cmd 400
[  160.771426] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  160.771452] pciehp 0000:00:05.0:pcie004: pciehp_green_led_off: SLOTCTRL a8 write cmd 300
[  160.771495] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  160.771499] pciehp 0000:00:05.0:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd 40
[  160.771535] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status
[  160.771539] pciehp 0000:00:05.0:pcie004: pciehp_green_led_off: SLOTCTRL a8 write cmd 300

After analyzing the log information, it seems that qemu doesn't
change the Link Status from active to inactive after hot-unplug.
This results in the abnormal log after the linux kernel commit
d331710ea78fea merged.

Furthermore, If I hotplug the same virtio-blk disk after hot-unplug,
the virtio-blk would turn on and then back off.

So this patch set the Link Status inactive after hot-unplug and
active after hot-plug.

Signed-off-by: Zheng Xiang <zhengxiang9@huawei.com>
Signed-off-by: Zheng Xiang <xiang.zheng@linaro.org>
Cc: Wang Haibin <wanghaibin.wang@huawei.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 2f2b18f60bf17453b4c01197a9316615a3c1f1de)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/pci/pcie.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 6c91bd44a0..66b73b87c8 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -345,6 +345,10 @@ void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
     if (!dev->hotplugged) {
         pci_word_test_and_set_mask(exp_cap + PCI_EXP_SLTSTA,
                                    PCI_EXP_SLTSTA_PDS);
+        if (pci_dev->cap_present & QEMU_PCIE_LNKSTA_DLLLA) {
+            pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA,
+                                       PCI_EXP_LNKSTA_DLLLA);
+        }
         return;
     }
 
@@ -355,6 +359,10 @@ void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
     if (pci_get_function_0(pci_dev)) {
         pci_word_test_and_set_mask(exp_cap + PCI_EXP_SLTSTA,
                                    PCI_EXP_SLTSTA_PDS);
+        if (pci_dev->cap_present & QEMU_PCIE_LNKSTA_DLLLA) {
+            pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA,
+                                       PCI_EXP_LNKSTA_DLLLA);
+        }
         pcie_cap_slot_event(PCI_DEVICE(hotplug_dev),
                             PCI_EXP_HP_EV_PDC | PCI_EXP_HP_EV_ABP);
     }
@@ -531,6 +539,10 @@ void pcie_cap_slot_write_config(PCIDevice *dev,
 
         pci_word_test_and_clear_mask(exp_cap + PCI_EXP_SLTSTA,
                                      PCI_EXP_SLTSTA_PDS);
+        if (dev->cap_present & QEMU_PCIE_LNKSTA_DLLLA) {
+            pci_word_test_and_clear_mask(exp_cap + PCI_EXP_LNKSTA,
+                                         PCI_EXP_LNKSTA_DLLLA);
+        }
         pci_word_test_and_set_mask(exp_cap + PCI_EXP_SLTSTA,
                                        PCI_EXP_SLTSTA_PDC);
     }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 77/97] pc:piix4: Update smbus I/O space after a migration
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (75 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 76/97] pcie: set link state inactive/active after hot unplug/plug Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 78/97] hw/s390x: Fix bad mask in time2tod() Michael Roth
                   ` (21 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Corey Minyard, Igor Mammedov, Michael S . Tsirkin

From: Corey Minyard <cminyard@mvista.com>

Otherwise it won't be set up correctly and won't work after
miigration.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 2b4e573c7c7b9a698ba6931ba456bbd8d3d8c84c)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/acpi/piix4.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 6404af5f33..7ae6d14b46 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -173,6 +173,7 @@ static int vmstate_acpi_post_load(void *opaque, int version_id)
     PIIX4PMState *s = opaque;
 
     pm_io_space_update(s);
+    smbus_io_space_update(s);
     return 0;
 }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 78/97] hw/s390x: Fix bad mask in time2tod()
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (76 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 77/97] pc:piix4: Update smbus I/O space after a migration Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 79/97] linux-user: write(fd, NULL, 0) parity with linux's treatment of same Michael Roth
                   ` (20 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Thomas Huth, Cornelia Huck

From: Thomas Huth <thuth@redhat.com>

Since "s390x/tcg: avoid overflows in time2tod/tod2time", the
time2tod() function tries to deal with the 9 uppermost bits in the
time value, but uses the wrong mask for this: 0xff80000000000000 should
be used instead of 0xff10000000000000 here.

Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
Cc: qemu-stable@nongnu.org
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1544792887-14575-1-git-send-email-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
[CH: tweaked commit message]
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit aba7a5a2de3dba5917024df25441f715b9249e31)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 include/hw/s390x/tod.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
index 413c0d7c02..442f45b2f5 100644
--- a/include/hw/s390x/tod.h
+++ b/include/hw/s390x/tod.h
@@ -50,7 +50,7 @@ typedef struct S390TODClass {
 /* Converts ns to s390's clock format */
 static inline uint64_t time2tod(uint64_t ns)
 {
-    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
+    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
 }
 
 /* Converts s390's clock format to ns */
-- 
2.17.1

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

* [Qemu-devel] [PATCH 79/97] linux-user: write(fd, NULL, 0) parity with linux's treatment of same
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (77 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 78/97] hw/s390x: Fix bad mask in time2tod() Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 80/97] linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0 Michael Roth
                   ` (19 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-stable, Tony Garnock-Jones, Tony Garnock-Jones, Laurent Vivier

From: Tony Garnock-Jones <tony.garnock-jones@glasgow.ac.uk>

Bring linux-user write(2) handling into line with linux for the case
of a 0-byte write with a NULL buffer. Based on a patch originally
written by Zhuowei Zhang.

Addresses https://bugs.launchpad.net/qemu/+bug/1716292.

>From Zhuowei Zhang's patch (https://lists.gnu.org/archive/html/qemu-devel/2017-09/msg08073.html):

    Linux returns success for the special case of calling write with a
    zero-length NULL buffer: compiling and running

    int main() {
       ssize_t ret = write(STDOUT_FILENO, NULL, 0);
       fprintf(stderr, "write returned %ld\n", ret);
       return 0;
    }

    gives "write returned 0" when run directly, but "write returned
    -1" in QEMU.

    This commit checks for this situation and returns success if
    found.

Subsequent discussion raised the following questions (and my answers):

 - Q. Should TARGET_NR_read pass through to safe_read in this
      situation too?
   A. I'm wary of changing unrelated code to the specific problem I'm
      addressing. TARGET_NR_read is already consistent with Linux for
      this case.

 - Q. Do pread64/pwrite64 need to be changed similarly?
   A. Experiment suggests not: both linux and linux-user yield -1 for
      NULL 0-length reads/writes.

Signed-off-by: Tony Garnock-Jones <tonygarnockjones@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180908182205.GB409@mornington.dcs.gla.ac.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
(cherry picked from commit 58cfa6c2e6eb51b23cc98f81d16136b3ca929b31)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 linux-user/syscall.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5a4af76c03..1477509cf2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8077,6 +8077,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         }
         break;
     case TARGET_NR_write:
+        if (arg2 == 0 && arg3 == 0) {
+            return get_errno(safe_write(arg1, 0, 0));
+        }
         if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
             goto efault;
         if (fd_trans_target_to_host_data(arg1)) {
-- 
2.17.1

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

* [Qemu-devel] [PATCH 80/97] linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (78 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 79/97] linux-user: write(fd, NULL, 0) parity with linux's treatment of same Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 81/97] s390x: Return specification exception for unimplemented diag 308 subcodes Michael Roth
                   ` (18 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Maydell, Laurent Vivier

From: Peter Maydell <peter.maydell@linaro.org>

Linux returns success if pwrite64() or pread64() are called with a
zero length NULL buffer, but QEMU was returning -TARGET_EFAULT.

This is the same bug that we fixed in commit 58cfa6c2e6eb51b23cc9
for the write syscall, and long before that in 38d840e6790c29f59
for the read syscall.

Fixes: https://bugs.launchpad.net/qemu/+bug/1810433

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190108184900.9654-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
(cherry picked from commit 2bd3f8998e1e7dcd9afc29fab252fb9936f9e956)
*drop functional dep. on 2852aafd9d
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 linux-user/syscall.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1477509cf2..0859739e9d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10910,8 +10910,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             arg4 = arg5;
             arg5 = arg6;
         }
-        if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0)))
-            goto efault;
+        if (arg2 == 0 && arg3 == 0) {
+            /* Special-case NULL buffer and zero length, which should succeed */
+            p = 0;
+        } else {
+            p = lock_user(VERIFY_WRITE, arg2, arg3, 0);
+            if (!p) {
+                goto efault;
+            }
+        }
         ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
         unlock_user(p, arg2, ret);
         break;
@@ -10920,8 +10927,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             arg4 = arg5;
             arg5 = arg6;
         }
-        if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
-            goto efault;
+        if (arg2 == 0 && arg3 == 0) {
+            /* Special-case NULL buffer and zero length, which should succeed */
+            p = 0;
+        } else {
+            p = lock_user(VERIFY_READ, arg2, arg3, 1);
+            if (!p) {
+                goto efault;
+            }
+        }
         ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
         unlock_user(p, arg2, 0);
         break;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 81/97] s390x: Return specification exception for unimplemented diag 308 subcodes
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (79 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 80/97] linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0 Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 82/97] exec.c: Don't reallocate IOMMUNotifiers that are in use Michael Roth
                   ` (17 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Janosch Frank, Cornelia Huck

From: Janosch Frank <frankja@linux.ibm.com>

The architecture specifies specification exceptions for all
unavailable subcodes.

The presence of subcodes is indicated by checking some query subcode.
For example 6 will indicate that 3-6 are available. So future systems
might call new subcodes to check for new features. This should not
trigger a hw error, instead we return the architectured specification
exception.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Cc: qemu-stable@nongnu.org
Message-Id: <20190111113657.66195-3-frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit 37dbd1f4d4805edcd18d94eb202bb3461b3cd52d)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 target/s390x/diag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/diag.c b/target/s390x/diag.c
index acb0f3d4af..aafa740f61 100644
--- a/target/s390x/diag.c
+++ b/target/s390x/diag.c
@@ -130,7 +130,7 @@ out:
         }
         return;
     default:
-        hw_error("Unhandled diag308 subcode %" PRIx64, subcode);
+        s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra);
         break;
     }
 }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 82/97] exec.c: Don't reallocate IOMMUNotifiers that are in use
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (80 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 81/97] s390x: Return specification exception for unimplemented diag 308 subcodes Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 83/97] tpm: Zero-init structure to avoid uninitialized variables in valgrind log Michael Roth
                   ` (16 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Peter Maydell

From: Peter Maydell <peter.maydell@linaro.org>

The tcg_register_iommu_notifier() code has a GArray of
TCGIOMMUNotifier structs which it has registered by passing
memory_region_register_iommu_notifier() a pointer to the embedded
IOMMUNotifier field. Unfortunately, if we need to enlarge the
array via g_array_set_size() this can cause a realloc(), which
invalidates the pointer that memory_region_register_iommu_notifier()
put into the MemoryRegion's iommu_notify list. This can result
in segfaults.

Switch the GArray to holding pointers to the TCGIOMMUNotifier
structs, so that we can individually allocate and free them.

Cc: qemu-stable@nongnu.org
Fixes: 1f871c5e6b0f30644a60a ("exec.c: Handle IOMMUs in address_space_translate_for_iotlb()")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190128174241.5860-1-peter.maydell@linaro.org
(cherry picked from commit 5601be3b01d73e21c09331599e2ce62df016ff94)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 exec.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/exec.c b/exec.c
index 4f5df07b6a..9bafcb155a 100644
--- a/exec.c
+++ b/exec.c
@@ -690,7 +690,7 @@ static void tcg_register_iommu_notifier(CPUState *cpu,
     int i;
 
     for (i = 0; i < cpu->iommu_notifiers->len; i++) {
-        notifier = &g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier, i);
+        notifier = g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i);
         if (notifier->mr == mr && notifier->iommu_idx == iommu_idx) {
             break;
         }
@@ -698,7 +698,8 @@ static void tcg_register_iommu_notifier(CPUState *cpu,
     if (i == cpu->iommu_notifiers->len) {
         /* Not found, add a new entry at the end of the array */
         cpu->iommu_notifiers = g_array_set_size(cpu->iommu_notifiers, i + 1);
-        notifier = &g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier, i);
+        notifier = g_new0(TCGIOMMUNotifier, 1);
+        g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i) = notifier;
 
         notifier->mr = mr;
         notifier->iommu_idx = iommu_idx;
@@ -730,8 +731,9 @@ static void tcg_iommu_free_notifier_list(CPUState *cpu)
     TCGIOMMUNotifier *notifier;
 
     for (i = 0; i < cpu->iommu_notifiers->len; i++) {
-        notifier = &g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier, i);
+        notifier = g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i);
         memory_region_unregister_iommu_notifier(notifier->mr, &notifier->n);
+        g_free(notifier);
     }
     g_array_free(cpu->iommu_notifiers, true);
 }
@@ -1000,7 +1002,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
         vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);
     }
 
-    cpu->iommu_notifiers = g_array_new(false, true, sizeof(TCGIOMMUNotifier));
+    cpu->iommu_notifiers = g_array_new(false, true, sizeof(TCGIOMMUNotifier *));
 #endif
 }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 83/97] tpm: Zero-init structure to avoid uninitialized variables in valgrind log
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (81 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 82/97] exec.c: Don't reallocate IOMMUNotifiers that are in use Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 84/97] tpm: use loop iterator to set sts data field Michael Roth
                   ` (15 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Stefan Berger

From: Stefan Berger <stefanb@linux.ibm.com>

Zero-init the ptm_loc structure so that we don't have fields that
are not initialised.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
(cherry picked from commit eff1fe9fd0cebe2293eea9597616f792b6b5ad18)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/tpm/tpm_emulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
index 10bc20dbec..70f4b10284 100644
--- a/hw/tpm/tpm_emulator.c
+++ b/hw/tpm/tpm_emulator.c
@@ -166,6 +166,7 @@ static int tpm_emulator_set_locality(TPMEmulator *tpm_emu, uint8_t locty_number,
 
     trace_tpm_emulator_set_locality(locty_number);
 
+    memset(&loc, 0, sizeof(loc));
     loc.u.req.loc = locty_number;
     if (tpm_emulator_ctrlcmd(tpm_emu, CMD_SET_LOCALITY, &loc,
                              sizeof(loc), sizeof(loc)) < 0) {
-- 
2.17.1

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

* [Qemu-devel] [PATCH 84/97] tpm: use loop iterator to set sts data field
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (82 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 83/97] tpm: Zero-init structure to avoid uninitialized variables in valgrind log Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 85/97] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid Michael Roth
                   ` (14 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Prasad J Pandit, Stefan Berger

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

When TIS request is done, set 'sts' data field across all localities.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
(cherry picked from commit 6a50bb98f24929c9fc69e9197eb21c142e061fbd)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/tpm/tpm_tis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 12f5c9a759..d9322692ee 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -295,7 +295,7 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
 
     if (s->cmd.selftest_done) {
         for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
-            s->loc[locty].sts |= TPM_TIS_STS_SELFTEST_DONE;
+            s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
         }
     }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 85/97] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (83 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 84/97] tpm: use loop iterator to set sts data field Michael Roth
@ 2019-04-01 20:59 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 86/97] tpm: Make sure the locality received from backend " Michael Roth
                   ` (13 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 20:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Stefan Berger, Stefan Berger

From: Stefan Berger <stefanb@linux.vnet.ibm.com>

Make sure that the new locality passed to tpm_tis_prep_abort()
is valid.

Add a comment to aborting_locty that it may be any locality, including
TPM_TIS_NO_LOCALITY.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit e92b63ea610201bd743343fc6b11e6c39c8d3515)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/tpm/tpm_tis.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index d9322692ee..9a795ce96c 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -263,7 +263,9 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty)
 {
     uint8_t busy_locty;
 
-    s->aborting_locty = locty;
+    assert(TPM_TIS_IS_VALID_LOCTY(newlocty));
+
+    s->aborting_locty = locty; /* may also be TPM_TIS_NO_LOCALITY */
     s->next_locty = newlocty;  /* locality after successful abort */
 
     /*
-- 
2.17.1

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

* [Qemu-devel] [PATCH 86/97] tpm: Make sure the locality received from backend is valid
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (84 preceding siblings ...)
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 85/97] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 87/97] block: Fix invalidate_cache error path for parent activation Michael Roth
                   ` (12 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Stefan Berger, Stefan Berger

From: Stefan Berger <stefanb@linux.vnet.ibm.com>

Make sure that the locality passed from the backend to
tpm_tis_request_completed() is valid.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit a639f96111eadb3b8e3021fd3f27e2948ad1c640)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/tpm/tpm_tis.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 9a795ce96c..1554026788 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -295,6 +295,8 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
     uint8_t locty = s->cmd.locty;
     uint8_t l;
 
+    assert(TPM_TIS_IS_VALID_LOCTY(locty));
+
     if (s->cmd.selftest_done) {
         for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
             s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 87/97] block: Fix invalidate_cache error path for parent activation
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (85 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 86/97] tpm: Make sure the locality received from backend " Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 88/97] acpi: Make TPM 2.0 with TIS available as MSFT0101 Michael Roth
                   ` (11 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Kevin Wolf

From: Kevin Wolf <kwolf@redhat.com>

bdrv_co_invalidate_cache() clears the BDRV_O_INACTIVE flag before
actually activating a node so that the correct permissions etc. are
taken. In case of errors, the flag must be restored so that the next
call to bdrv_co_invalidate_cache() retries activation.

Restoring the flag was missing in the error path for a failed
parent->role->activate() call. The consequence is that this attempt to
activate all images correctly fails because we still set errp, however
on the next attempt BDRV_O_INACTIVE is already clear, so we return
success without actually retrying the failed action.

An example where this is observable in practice is migration to a QEMU
instance that has a raw format block node attached to a guest device
with share-rw=off (the default) while another process holds
BLK_PERM_WRITE for the same image. In this case, all activation steps
before parent->role->activate() succeed because raw can tolerate other
writers to the image. Only the parent callback (in particular
blk_root_activate()) tries to implement the share-rw=on property and
requests exclusive write permissions. This fails when the migration
completes and correctly displays an error. However, a manual 'cont' will
incorrectly resume the VM without calling blk_root_activate() again.

This case is described in more detail in the following bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1531888

Fix this by correctly restoring the BDRV_O_INACTIVE flag in the error
path.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 78fc3b3a26c145eebcdee992988644974b243a74)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 block.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block.c b/block.c
index a7f6a13a74..50b9bd695d 100644
--- a/block.c
+++ b/block.c
@@ -4395,6 +4395,7 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,
         if (parent->role->activate) {
             parent->role->activate(parent, &local_err);
             if (local_err) {
+                bs->open_flags |= BDRV_O_INACTIVE;
                 error_propagate(errp, local_err);
                 return;
             }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 88/97] acpi: Make TPM 2.0 with TIS available as MSFT0101
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (86 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 87/97] block: Fix invalidate_cache error path for parent activation Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 89/97] hw/rdma: another clang compilation fix Michael Roth
                   ` (10 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Stefan Berger, Michael S . Tsirkin

From: Stefan Berger <stefanb@linux.ibm.com>

This is a backport of rev 24cf5413aa0 to 3.0.x and 3.1.x.

This patch makes the a TPM 2.0 with TIS interface available under the
HID 'MSF0101'. This is supported by Linux and also Windows now
recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/i386/acpi-build.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 1599caa7c5..31ed0e16a2 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2134,8 +2134,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
 
             if (TPM_IS_TIS(tpm_find())) {
-                dev = aml_device("ISA.TPM");
-                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+                if (misc->tpm_version == TPM_VERSION_2_0) {
+                    dev = aml_device("TPM");
+                    aml_append(dev, aml_name_decl("_HID",
+                                                  aml_string("MSFT0101")));
+                } else {
+                    dev = aml_device("ISA.TPM");
+                    aml_append(dev, aml_name_decl("_HID",
+                                                  aml_eisaid("PNP0C31")));
+                }
+
                 aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
                 crs = aml_resource_template();
                 aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
-- 
2.17.1

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

* [Qemu-devel] [PATCH 89/97] hw/rdma: another clang compilation fix
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (87 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 88/97] acpi: Make TPM 2.0 with TIS available as MSFT0101 Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 90/97] slirp: check sscanf result when emulating ident Michael Roth
                   ` (9 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Marcel Apfelbaum

From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

Configuring QEMU with:
   configure --target-list="x86_64-softmmu" --cc=clang --enable-pvrdma
Results in:
   qemu/hw/rdma/rdma_rm_defs.h:108:3: error: redefinition of typedef 'RdmaDeviceResources' is a C11 feature [-Werror,-Wtypedef-redefinition]
   } RdmaDeviceResources;
     ^
   qemu/hw/rdma/rdma_backend_defs.h:24:36: note: previous definition is here
   typedef struct RdmaDeviceResources RdmaDeviceResources;

Fix by removing one of the 'typedef' definitions.

Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Message-Id: <20190214154053.15050-1-marcel.apfelbaum@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Kamal Heib <kamalheib1@gmail.com>
Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
(cherry picked from commit 59f911938fbaa6a5eff1146c8a4d74e1c55ecc2b)
*drop context dep. on c2dd117b385
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/rdma/rdma_rm_defs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h
index 226011176d..f098d91813 100644
--- a/hw/rdma/rdma_rm_defs.h
+++ b/hw/rdma/rdma_rm_defs.h
@@ -89,7 +89,7 @@ typedef struct RdmaRmPort {
     enum ibv_port_state state;
 } RdmaRmPort;
 
-typedef struct RdmaDeviceResources {
+struct RdmaDeviceResources {
     RdmaRmPort ports[MAX_PORTS];
     RdmaRmResTbl pd_tbl;
     RdmaRmResTbl mr_tbl;
@@ -98,6 +98,6 @@ typedef struct RdmaDeviceResources {
     RdmaRmResTbl cq_tbl;
     RdmaRmResTbl cqe_ctx_tbl;
     GHashTable *qp_hash; /* Keeps mapping between real and emulated */
-} RdmaDeviceResources;
+};
 
 #endif
-- 
2.17.1

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

* [Qemu-devel] [PATCH 90/97] slirp: check sscanf result when emulating ident
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (88 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 89/97] hw/rdma: another clang compilation fix Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 91/97] tpm_tis: fix loop that cancels any seizure by a lower locality Michael Roth
                   ` (8 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, William Bowling, secalert, Samuel Thibault

From: William Bowling <will@wbowling.info>

When emulating ident in tcp_emu, if the strchr checks passed but the
sscanf check failed, two uninitialized variables would be copied and
sent in the reply, so move this code inside the if(sscanf()) clause.

Signed-off-by: William Bowling <will@wbowling.info>
Cc: qemu-stable@nongnu.org
Cc: secalert@redhat.com
Message-Id: <1551476756-25749-1-git-send-email-will@wbowling.info>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
(cherry picked from commit d3222975c7d6cda9e25809dea05241188457b113)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 slirp/tcp_subr.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 8d0f94b75f..473c8b04e6 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -662,12 +662,12 @@ tcp_emu(struct socket *so, struct mbuf *m)
 							break;
 						}
 					}
+					so_rcv->sb_cc = snprintf(so_rcv->sb_data,
+								 so_rcv->sb_datalen,
+								 "%d,%d\r\n", n1, n2);
+					so_rcv->sb_rptr = so_rcv->sb_data;
+					so_rcv->sb_wptr = so_rcv->sb_data + so_rcv->sb_cc;
 				}
-                                so_rcv->sb_cc = snprintf(so_rcv->sb_data,
-                                                         so_rcv->sb_datalen,
-                                                         "%d,%d\r\n", n1, n2);
-				so_rcv->sb_rptr = so_rcv->sb_data;
-				so_rcv->sb_wptr = so_rcv->sb_data + so_rcv->sb_cc;
 			}
 			m_free(m);
 			return 0;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 91/97] tpm_tis: fix loop that cancels any seizure by a lower locality
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (89 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 90/97] slirp: check sscanf result when emulating ident Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 92/97] bitmap: Update count after a merge Michael Roth
                   ` (7 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Liam Merwick, Liam Merwick, Stefan Berger

From: Liam Merwick <liam.merwick@oracle.com>

In tpm_tis_mmio_write() if the requesting locality is seizing
access, any seizure by a lower locality is cancelled.  However the
loop doing the seizure had an off-by-one error and the locality
immediately preceding the requesting locality was not being cleared.
This is fixed by adjusting the test in the for loop to check the
localities up to the requesting locality.

Signed-off-by: Liam Merwick <Liam.Merwick@oracle.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
(cherry picked from commit 37b55d67c0f001b20b7831db3f9f24f1d453e1de)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/tpm/tpm_tis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 1554026788..fb08b483bc 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -620,7 +620,7 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
                 }
 
                 /* cancel any seize by a lower locality */
-                for (l = 0; l < locty - 1; l++) {
+                for (l = 0; l < locty; l++) {
                     s->loc[l].access &= ~TPM_TIS_ACCESS_SEIZE;
                 }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 92/97] bitmap: Update count after a merge
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (90 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 91/97] tpm_tis: fix loop that cancels any seizure by a lower locality Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 93/97] qga: update docs with systemd suspend support info Michael Roth
                   ` (6 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Eric Blake, John Snow

From: Eric Blake <eblake@redhat.com>

We need an accurate count of the number of bits set in a bitmap
after a merge. In particular, since the merge operation short-circuits
a merge from an empty source, if you have bitmaps A, B, and C where
B started empty, then merge C into B, and B into A, an inaccurate
count meant that A did not get the contents of C.

In the worst case, we may falsely regard the bitmap as empty when
it has had new writes merged into it.

Fixes: be58721db
CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20181002233314.30159-1-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
(cherry picked from commit d1dde7149e376d72b422a529ec4bf3ed47f3ba30)
*drop functional dep. on fa000f2f
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 util/hbitmap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/util/hbitmap.c b/util/hbitmap.c
index bcd304041a..f686e8015f 100644
--- a/util/hbitmap.c
+++ b/util/hbitmap.c
@@ -754,6 +754,9 @@ bool hbitmap_merge(HBitmap *a, const HBitmap *b)
         }
     }
 
+    /* Recompute the dirty count */
+    a->count = hb_count_between(a, 0, a->size - 1);
+
     return true;
 }
 
-- 
2.17.1

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

* [Qemu-devel] [PATCH 93/97] qga: update docs with systemd suspend support info
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (91 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 92/97] bitmap: Update count after a merge Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 94/97] nvme: fix out-of-bounds access to the CMB Michael Roth
                   ` (5 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Daniel Henrique Barboza

From: Daniel Henrique Barboza <danielhb413@gmail.com>

Commit 067927d62e ("qga: systemd hibernate/suspend/hybrid-sleep
support") failed to update qapi-schema.json after adding systemd
hibernate/suspend/hybrid-sleep capabilities to guest-suspend-* QGA
commands.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit bb6c8d407e49d7b805ac52fe46abf4d8d5262046)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/qapi-schema.json | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index dfbc4a5e32..6a472476a2 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -532,12 +532,12 @@
 #
 # Suspend guest to disk.
 #
-# This command tries to execute the scripts provided by the pm-utils package.
-# If it's not available, the suspend operation will be performed by manually
-# writing to a sysfs file.
+# This command attempts to suspend the guest using three strategies, in this
+# order:
 #
-# For the best results it's strongly recommended to have the pm-utils
-# package installed in the guest.
+# - systemd hibernate
+# - pm-utils (via pm-hibernate)
+# - manual write into sysfs
 #
 # This command does NOT return a response on success. There is a high chance
 # the command succeeded if the VM exits with a zero exit status or, when
@@ -560,12 +560,12 @@
 #
 # Suspend guest to ram.
 #
-# This command tries to execute the scripts provided by the pm-utils package.
-# If it's not available, the suspend operation will be performed by manually
-# writing to a sysfs file.
+# This command attempts to suspend the guest using three strategies, in this
+# order:
 #
-# For the best results it's strongly recommended to have the pm-utils
-# package installed in the guest.
+# - systemd suspend
+# - pm-utils (via pm-suspend)
+# - manual write into sysfs
 #
 # IMPORTANT: guest-suspend-ram requires QEMU to support the 'system_wakeup'
 # command.  Thus, it's *required* to query QEMU for the presence of the
@@ -592,7 +592,10 @@
 #
 # Save guest state to disk and suspend to ram.
 #
-# This command requires the pm-utils package to be installed in the guest.
+# This command attempts to suspend the guest by executing, in this order:
+#
+# - systemd hybrid-sleep
+# - pm-utils (via pm-suspend-hybrid)
 #
 # IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'system_wakeup'
 # command.  Thus, it's *required* to query QEMU for the presence of the
-- 
2.17.1

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

* [Qemu-devel] [PATCH 94/97] nvme: fix out-of-bounds access to the CMB
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (92 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 93/97] qga: update docs with systemd suspend support info Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 95/97] 9p: fix QEMU crash when renaming files Michael Roth
                   ` (4 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-stable, Paolo Bonzini, Keith Busch, qemu-block, Kevin Wolf

From: Paolo Bonzini <pbonzini@redhat.com>

Because the CMB BAR has a min_access_size of 2, if you read the last
byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one
error.  This is CVE-2018-16847.

Another way to fix this might be to register the CMB as a RAM memory
region, which would also be more efficient.  However, that might be a
change for big-endian machines; I didn't think this through and I don't
know how real hardware works.  Add a basic testcase for the CMB in case
somebody does this change later on.

Cc: Keith Busch <keith.busch@intel.com>
Cc: qemu-block@nongnu.org
Reported-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Tested-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 87ad860c622cc8f8916b5232bd8728c08f938fce)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/block/nvme.c        |  2 +-
 tests/Makefile.include |  2 +-
 tests/nvme-test.c      | 68 +++++++++++++++++++++++++++++++++++-------
 3 files changed, 60 insertions(+), 12 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 5e508ab1b3..5f304bd098 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1192,7 +1192,7 @@ static const MemoryRegionOps nvme_cmb_ops = {
     .write = nvme_cmb_write,
     .endianness = DEVICE_LITTLE_ENDIAN,
     .impl = {
-        .min_access_size = 2,
+        .min_access_size = 1,
         .max_access_size = 8,
     },
 };
diff --git a/tests/Makefile.include b/tests/Makefile.include
index a49282704e..91af385e2f 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -821,7 +821,7 @@ tests/test-hmp$(EXESUF): tests/test-hmp.o
 tests/machine-none-test$(EXESUF): tests/machine-none-test.o
 tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
-tests/nvme-test$(EXESUF): tests/nvme-test.o
+tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y)
 tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
 tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
 tests/ac97-test$(EXESUF): tests/ac97-test.o
diff --git a/tests/nvme-test.c b/tests/nvme-test.c
index 7674a446e4..2700ba838a 100644
--- a/tests/nvme-test.c
+++ b/tests/nvme-test.c
@@ -8,25 +8,73 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "libqtest.h"
+#include "libqos/libqos-pc.h"
+
+static QOSState *qnvme_start(const char *extra_opts)
+{
+    QOSState *qs;
+    const char *arch = qtest_get_arch();
+    const char *cmd = "-drive id=drv0,if=none,file=null-co://,format=raw "
+                      "-device nvme,addr=0x4.0,serial=foo,drive=drv0 %s";
+
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        qs = qtest_pc_boot(cmd, extra_opts ? : "");
+        global_qtest = qs->qts;
+        return qs;
+    }
+
+    g_printerr("nvme tests are only available on x86\n");
+    exit(EXIT_FAILURE);
+}
+
+static void qnvme_stop(QOSState *qs)
+{
+    qtest_shutdown(qs);
+}
 
-/* Tests only initialization so far. TODO: Replace with functional tests */
 static void nop(void)
 {
+    QOSState *qs;
+
+    qs = qnvme_start(NULL);
+    qnvme_stop(qs);
 }
 
-int main(int argc, char **argv)
+static void nvmetest_cmb_test(void)
 {
-    int ret;
+    const int cmb_bar_size = 2 * MiB;
+    QOSState *qs;
+    QPCIDevice *pdev;
+    QPCIBar bar;
 
-    g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/nvme/nop", nop);
+    qs = qnvme_start("-global nvme.cmb_size_mb=2");
+    pdev = qpci_device_find(qs->pcibus, QPCI_DEVFN(4,0));
+    g_assert(pdev != NULL);
+
+    qpci_device_enable(pdev);
+    bar = qpci_iomap(pdev, 2, NULL);
+
+    qpci_io_writel(pdev, bar, 0, 0xccbbaa99);
+    g_assert_cmpint(qpci_io_readb(pdev, bar, 0), ==, 0x99);
+    g_assert_cmpint(qpci_io_readw(pdev, bar, 0), ==, 0xaa99);
+
+    /* Test partially out-of-bounds accesses.  */
+    qpci_io_writel(pdev, bar, cmb_bar_size - 1, 0x44332211);
+    g_assert_cmpint(qpci_io_readb(pdev, bar, cmb_bar_size - 1), ==, 0x11);
+    g_assert_cmpint(qpci_io_readw(pdev, bar, cmb_bar_size - 1), !=, 0x2211);
+    g_assert_cmpint(qpci_io_readl(pdev, bar, cmb_bar_size - 1), !=, 0x44332211);
+    g_free(pdev);
 
-    qtest_start("-drive id=drv0,if=none,file=null-co://,format=raw "
-                "-device nvme,drive=drv0,serial=foo");
-    ret = g_test_run();
+    qnvme_stop(qs);
+}
 
-    qtest_end();
+int main(int argc, char **argv)
+{
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/nvme/nop", nop);
+    qtest_add_func("/nvme/cmb_test", nvmetest_cmb_test);
 
-    return ret;
+    return g_test_run();
 }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 95/97] 9p: fix QEMU crash when renaming files
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (93 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 94/97] nvme: fix out-of-bounds access to the CMB Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 96/97] usb-mtp: outlaw slashes in filenames Michael Roth
                   ` (3 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Greg Kurz, P J P

From: Greg Kurz <groug@kaod.org>

When using the 9P2000.u version of the protocol, the following shell
command line in the guest can cause QEMU to crash:

    while true; do rm -rf aa; mkdir -p a/b & touch a/b/c & mv a aa; done

With 9P2000.u, file renaming is handled by the WSTAT command. The
v9fs_wstat() function calls v9fs_complete_rename(), which calls
v9fs_fix_path() for every fid whose path is affected by the change.
The involved calls to v9fs_path_copy() may race with any other access
to the fid path performed by some worker thread, causing a crash like
shown below:

Thread 12 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
0x0000555555a25da2 in local_open_nofollow (fs_ctx=0x555557d958b8, path=0x0,
 flags=65536, mode=0) at hw/9pfs/9p-local.c:59
59          while (*path && fd != -1) {
(gdb) bt
#0  0x0000555555a25da2 in local_open_nofollow (fs_ctx=0x555557d958b8,
 path=0x0, flags=65536, mode=0) at hw/9pfs/9p-local.c:59
#1  0x0000555555a25e0c in local_opendir_nofollow (fs_ctx=0x555557d958b8,
 path=0x0) at hw/9pfs/9p-local.c:92
#2  0x0000555555a261b8 in local_lstat (fs_ctx=0x555557d958b8,
 fs_path=0x555556b56858, stbuf=0x7fff84830ef0) at hw/9pfs/9p-local.c:185
#3  0x0000555555a2b367 in v9fs_co_lstat (pdu=0x555557d97498,
 path=0x555556b56858, stbuf=0x7fff84830ef0) at hw/9pfs/cofile.c:53
#4  0x0000555555a1e9e2 in v9fs_stat (opaque=0x555557d97498)
 at hw/9pfs/9p.c:1083
#5  0x0000555555e060a2 in coroutine_trampoline (i0=-669165424, i1=32767)
 at util/coroutine-ucontext.c:116
#6  0x00007fffef4f5600 in __start_context () at /lib64/libc.so.6
#7  0x0000000000000000 in  ()
(gdb)

The fix is to take the path write lock when calling v9fs_complete_rename(),
like in v9fs_rename().

Impact:  DoS triggered by unprivileged guest users.

Fixes: CVE-2018-19489
Cc: P J P <ppandit@redhat.com>
Reported-by: zhibin hu <noirfate@gmail.com>
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Greg Kurz <groug@kaod.org>
(cherry picked from commit 1d20398694a3b67a388d955b7a945ba4aa90a8a8)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/9pfs/9p.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index eef289e394..88e523f8dd 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -2840,6 +2840,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
     struct stat stbuf;
     V9fsFidState *fidp;
     V9fsPDU *pdu = opaque;
+    V9fsState *s = pdu->s;
 
     v9fs_stat_init(&v9stat);
     err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2905,7 +2906,9 @@ static void coroutine_fn v9fs_wstat(void *opaque)
         }
     }
     if (v9stat.name.size != 0) {
+        v9fs_path_write_lock(s);
         err = v9fs_complete_rename(pdu, fidp, -1, &v9stat.name);
+        v9fs_path_unlock(s);
         if (err < 0) {
             goto out;
         }
-- 
2.17.1

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

* [Qemu-devel] [PATCH 96/97] usb-mtp: outlaw slashes in filenames
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (94 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 95/97] 9p: fix QEMU crash when renaming files Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 97/97] usb-mtp: use O_NOFOLLOW and O_CLOEXEC Michael Roth
                   ` (2 subsequent siblings)
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Slash is unix directory separator, so they are not allowed in filenames.
Note this also stops the classic escape via "../".

Fixes: CVE-2018-16867
Reported-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181203101045.27976-3-kraxel@redhat.com
(cherry picked from commit c52d46e041b42bb1ee6f692e00a0abe37a9659f6)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/usb/dev-mtp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 1ded7ac9a3..899c8a36ab 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1667,6 +1667,12 @@ static void usb_mtp_write_metadata(MTPState *s)
 
     utf16_to_str(dataset->length, dataset->filename, filename);
 
+    if (strchr(filename, '/')) {
+        usb_mtp_queue_result(s, RES_PARAMETER_NOT_SUPPORTED, d->trans,
+                             0, 0, 0, 0);
+        return;
+    }
+
     o = usb_mtp_object_lookup_name(p, filename, dataset->length);
     if (o != NULL) {
         next_handle = o->handle;
-- 
2.17.1

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

* [Qemu-devel] [PATCH 97/97] usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (95 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 96/97] usb-mtp: outlaw slashes in filenames Michael Roth
@ 2019-04-01 21:00 ` Michael Roth
  2019-04-02 16:22 ` [Qemu-devel] [Qemu-stable] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Cole Robinson
  2019-04-04 22:31   ` Philippe Mathieu-Daudé
  98 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-01 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Gerd Hoffmann, Prasad J Pandit, Bandan Das

From: Gerd Hoffmann <kraxel@redhat.com>

Open files and directories with O_NOFOLLOW to avoid symlinks attacks.
While being at it also add O_CLOEXEC.

usb-mtp only handles regular files and directories and ignores
everything else, so users should not see a difference.

Because qemu ignores symlinks, carrying out a successful symlink attack
requires swapping an existing file or directory below rootdir for a
symlink and winning the race against the inotify notification to qemu.

Fixes: CVE-2018-16872
Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: Bandan Das <bsd@redhat.com>
Reported-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Message-id: 20181213122511.13853-1-kraxel@redhat.com
(cherry picked from commit bab9df35ce73d1c8e19a37e2737717ea1c984dc1)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/usb/dev-mtp.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 899c8a36ab..f4223fb9de 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -649,13 +649,18 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)
 {
     struct dirent *entry;
     DIR *dir;
+    int fd;
 
     if (o->have_children) {
         return;
     }
     o->have_children = true;
 
-    dir = opendir(o->path);
+    fd = open(o->path, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
+    if (fd < 0) {
+        return;
+    }
+    dir = fdopendir(fd);
     if (!dir) {
         return;
     }
@@ -1003,7 +1008,7 @@ static MTPData *usb_mtp_get_object(MTPState *s, MTPControl *c,
 
     trace_usb_mtp_op_get_object(s->dev.addr, o->handle, o->path);
 
-    d->fd = open(o->path, O_RDONLY);
+    d->fd = open(o->path, O_RDONLY | O_CLOEXEC | O_NOFOLLOW);
     if (d->fd == -1) {
         usb_mtp_data_free(d);
         return NULL;
@@ -1027,7 +1032,7 @@ static MTPData *usb_mtp_get_partial_object(MTPState *s, MTPControl *c,
                                         c->argv[1], c->argv[2]);
 
     d = usb_mtp_data_alloc(c);
-    d->fd = open(o->path, O_RDONLY);
+    d->fd = open(o->path, O_RDONLY | O_CLOEXEC | O_NOFOLLOW);
     if (d->fd == -1) {
         usb_mtp_data_free(d);
         return NULL;
@@ -1608,7 +1613,7 @@ static void usb_mtp_write_data(MTPState *s)
                                  0, 0, 0, 0);
             goto done;
         }
-        d->fd = open(path, O_CREAT | O_WRONLY, mask);
+        d->fd = open(path, O_CREAT | O_WRONLY | O_CLOEXEC | O_NOFOLLOW, mask);
         if (d->fd == -1) {
             usb_mtp_queue_result(s, RES_STORE_FULL, d->trans,
                                  0, 0, 0, 0);
-- 
2.17.1

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

* Re: [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
  2019-04-01 20:59 ` [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs Michael Roth
@ 2019-04-01 21:19   ` Max Filippov
  2019-04-01 23:28     ` Michael Roth
  0 siblings, 1 reply; 111+ messages in thread
From: Max Filippov @ 2019-04-01 21:19 UTC (permalink / raw)
  To: Michael Roth; +Cc: qemu-devel, qemu-stable

Hi Michael,

On Mon, Apr 1, 2019 at 2:04 PM Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> From: Max Filippov <jcmvbkbc@gmail.com>
>
> Now that xtensa_count_regs does the right thing, remove manual
> initialization of these fields from the affected configurations and let
> xtensa_finalize_config initialize them. Add XTREG_END to terminate
> register lists.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> (cherry picked from commit 7da9111e77b9cdb3a927dcd47642b7ffff9de636)
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

I'm curious why this change was picked for stable, it wasn't marked for it.
I'm pretty sure it's not going to work without the corresponding change
in the xtensa_count_regs, which is pretty big.

-- 
Thanks.
-- Max

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

* Re: [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
  2019-04-01 21:19   ` Max Filippov
@ 2019-04-01 23:28     ` Michael Roth
  2019-04-01 23:42       ` Max Filippov
  0 siblings, 1 reply; 111+ messages in thread
From: Michael Roth @ 2019-04-01 23:28 UTC (permalink / raw)
  To: Max Filippov; +Cc: qemu-devel, qemu-stable

Quoting Max Filippov (2019-04-01 16:19:59)
> Hi Michael,
> 
> On Mon, Apr 1, 2019 at 2:04 PM Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> > From: Max Filippov <jcmvbkbc@gmail.com>
> >
> > Now that xtensa_count_regs does the right thing, remove manual
> > initialization of these fields from the affected configurations and let
> > xtensa_finalize_config initialize them. Add XTREG_END to terminate
> > register lists.
> >
> > Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> > (cherry picked from commit 7da9111e77b9cdb3a927dcd47642b7ffff9de636)
> > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> 
> I'm curious why this change was picked for stable, it wasn't marked for it.
> I'm pretty sure it's not going to work without the corresponding change
> in the xtensa_count_regs, which is pretty big.

Looks like an earlier patch was tagged for stable:

  https://patchwork.kernel.org/patch/10666423/

Since patches are often referred to qemu-stable via actual email Cc: and
often don't get tagged in the commit I don't rely too much on the
"Cc: qemu-stable@nongnu.org" tags in the commit messages currently.

I should probably take note next time a tag is explicitly removed from the
final commit though, but the safest way to avoid this if a patch ends up
getting Cc'd to qemu-stable at some point is to reply to the patch on why
it should be kept out, since I'll usually see those.

I'll make sure to back the patch out, thanks for checking!

> 
> -- 
> Thanks.
> -- Max
> 

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

* Re: [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
  2019-04-01 23:28     ` Michael Roth
@ 2019-04-01 23:42       ` Max Filippov
  0 siblings, 0 replies; 111+ messages in thread
From: Max Filippov @ 2019-04-01 23:42 UTC (permalink / raw)
  To: Michael Roth; +Cc: qemu-devel, qemu-stable

On Mon, Apr 1, 2019 at 4:28 PM Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> > I'm curious why this change was picked for stable, it wasn't marked for it.
> Looks like an earlier patch was tagged for stable:
...
> Since patches are often referred to qemu-stable via actual email Cc: and
> often don't get tagged in the commit I don't rely too much on the
> "Cc: qemu-stable@nongnu.org" tags in the commit messages currently.

Oh, I see.

> I should probably take note next time a tag is explicitly removed from the
> final commit though, but the safest way to avoid this if a patch ends up
> getting Cc'd to qemu-stable at some point is to reply to the patch on why
> it should be kept out, since I'll usually see those.

Ok, will do it next time.

-- 
Thanks.
-- Max

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

* Re: [Qemu-devel] [Qemu-stable] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
  2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
                   ` (96 preceding siblings ...)
  2019-04-01 21:00 ` [Qemu-devel] [PATCH 97/97] usb-mtp: use O_NOFOLLOW and O_CLOEXEC Michael Roth
@ 2019-04-02 16:22 ` Cole Robinson
  2019-04-04 21:28   ` Michael Roth
  2019-04-04 22:31   ` Philippe Mathieu-Daudé
  98 siblings, 1 reply; 111+ messages in thread
From: Cole Robinson @ 2019-04-02 16:22 UTC (permalink / raw)
  To: Michael Roth, qemu-devel; +Cc: qemu-stable

On 4/1/19 4:58 PM, Michael Roth wrote:
> Hi everyone,                                                                                              
> 
> The following new patches are queued for QEMU stable v3.0.1:
> 
>   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> 
> The release is planned for 2019-04-11:
> 
>   https://wiki.qemu.org/Planning/3.0
> 
> Please respond here or CC qemu-stable@nongnu.org on any patches you
> think should be included in the release.
> 
> Note that this update falls outside the normal stable release support
> window (~1 development cycle), but is being release now since it was
> delayed from its intended release date.
> 
> Thanks!
> 

Here's some extra patches we are carrying in Fedora 29

https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-15746
6f2231e9b0 seccomp: use SIGSYS signal instead of killing the thread
bda08a5764 seccomp: prefer SCMP_ACT_KILL_PROCESS if available
d0699bd37c configure: require libseccomp 2.2.0
70dfabeaa7 seccomp: set the seccomp filter to all threads

https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-18849
e58ccf0396 lsi53c895a: check message length value is valid

https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-6778
a907458ad8 slirp: check data length while emulating ident function

https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-18954
d07945e78e ppc/pnv: check size before data buffer access

https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-19364
5b76ef50f6 9p: write lock path in v9fs_co_open2()
5b3c77aa58 9p: take write lock on fid path updates (CVE-2018-19364)

Thanks,
Cole

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

* Re: [Qemu-devel] [Qemu-stable] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
  2019-04-02 16:22 ` [Qemu-devel] [Qemu-stable] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Cole Robinson
@ 2019-04-04 21:28   ` Michael Roth
  0 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-04 21:28 UTC (permalink / raw)
  To: Cole Robinson, qemu-devel; +Cc: qemu-stable

Quoting Cole Robinson (2019-04-02 11:22:59)
> On 4/1/19 4:58 PM, Michael Roth wrote:
> > Hi everyone,                                                                                              
> > 
> > The following new patches are queued for QEMU stable v3.0.1:
> > 
> >   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> > 
> > The release is planned for 2019-04-11:
> > 
> >   https://wiki.qemu.org/Planning/3.0
> > 
> > Please respond here or CC qemu-stable@nongnu.org on any patches you
> > think should be included in the release.
> > 
> > Note that this update falls outside the normal stable release support
> > window (~1 development cycle), but is being release now since it was
> > delayed from its intended release date.
> > 
> > Thanks!
> > 
> 
> Here's some extra patches we are carrying in Fedora 29
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-15746
> 6f2231e9b0 seccomp: use SIGSYS signal instead of killing the thread
> bda08a5764 seccomp: prefer SCMP_ACT_KILL_PROCESS if available
> d0699bd37c configure: require libseccomp 2.2.0
> 70dfabeaa7 seccomp: set the seccomp filter to all threads
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-18849
> e58ccf0396 lsi53c895a: check message length value is valid
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-6778
> a907458ad8 slirp: check data length while emulating ident function
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-18954
> d07945e78e ppc/pnv: check size before data buffer access
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-19364
> 5b76ef50f6 9p: write lock path in v9fs_co_open2()
> 5b3c77aa58 9p: take write lock on fid path updates (CVE-2018-19364)

Thank you for the suggestions so far. I've applied these patches and
backed out:

  target/xtensa: drop num_[core_]regs from dc232b/dc233c configs

Changes have been pushed to staging tree:

  https://github.com/mdroth/qemu/commits/stable-3.0-staging

> 
> Thanks,
> Cole
> 

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

* Re: [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-04 22:31   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 111+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-04-04 22:31 UTC (permalink / raw)
  To: Michael Roth, qemu-devel
  Cc: qemu-stable, Daniel P. Berrangé,
	Kevin Wolf, Markus Armbruster, Peter Lieven, Hannes Reinecke,
	Michael Tokarev, Gerd Hoffmann, Yuval Shaia, Marcel Apfelbaum,
	Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 14655 bytes --]

On 4/1/19 10:58 PM, Michael Roth wrote:
> Hi everyone,                                                                                              
> 
> The following new patches are queued for QEMU stable v3.0.1:
> 
>   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> 
> The release is planned for 2019-04-11:
> 
>   https://wiki.qemu.org/Planning/3.0
> 
> Please respond here or CC qemu-stable@nongnu.org on any patches you
> think should be included in the release.
> 
> Note that this update falls outside the normal stable release support
> window (~1 development cycle), but is being release now since it was
> delayed from its intended release date.
> 
> Thanks!
> 
> ----------------------------------------------------------------
> Alberto Garcia (1):
>       block: Fix use after free error in bdrv_open_inherit()
> 
> BALATON Zoltan (1):
>       i2c: Move typedef of bitbang_i2c_interface to i2c.h
> 
> Bharata B Rao (1):
>       spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn
> 
> Christian Borntraeger (1):
>       iotests: make 235 work on s390 (and others)
> 
> Corey Minyard (2):
>       i2c: Add a length check to the SMBus write handling
>       pc:piix4: Update smbus I/O space after a migration
> 
> Daniel Henrique Barboza (1):
>       qga: update docs with systemd suspend support info
> 
> Daniel P. Berrangé (1):
>       qemu-img: fix regression copying secrets during convert
> 
> Denis V. Lunev (1):
>       nbd: fix NBD_FLAG_SEND_CACHE value
> 
> Eduardo Habkost (1):
>       i386: Disable TOPOEXT by default on "-cpu host"
> 
> Eric Blake (4):
>       nbd/server: Advertise all contexts in response to bare LIST
>       nbd/client: Make x-dirty-bitmap more reliable
>       nbd/client: Send NBD_CMD_DISC if open fails after connect
>       bitmap: Update count after a merge
> 
> Fam Zheng (5):
>       nvme: Fix nvme_init error handling
>       aio-posix: Don't count ctx->notifier as progress when polling
>       aio: Do aio_notify_accept only during blocking aio_poll
>       slirp: Add sanity check for str option length
>       job: Fix nested aio_poll() hanging in job_txn_apply
> 
> Gerd Hoffmann (3):
>       fmops: fix off-by-one in AR_TABLE and DR_TABLE array size
>       usb-mtp: outlaw slashes in filenames
>       usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
> 
> Greg Kurz (1):
>       9p: fix QEMU crash when renaming files
> 
> Igor Mammedov (1):
>       pc: acpi: revert back to 1 SRAT entry for hotpluggable area
> 
> Ilya Maximets (1):
>       migration: Stop postcopy fault thread before notifying
> 
> Janosch Frank (1):
>       s390x: Return specification exception for unimplemented diag 308 subcodes
> 
> Jason Wang (5):
>       ne2000: fix possible out of bound access in ne2000_receive
>       rtl8139: fix possible out of bound access
>       pcnet: fix possible buffer overflow
>       net: ignore packet size greater than INT_MAX
>       net: drop too large packet early
> 
> Jeff Cody (6):
>       block: for jobs, do not clear user_paused until after the resume
>       block: iotest to catch abort on forced blockjob cancel
>       block/rbd: pull out qemu_rbd_convert_options
>       block/rbd: Attempt to parse legacy filenames
>       block/rbd: add iotest for rbd legacy keyvalue filename parsing
>       block/rbd: add deprecation documentation for filename keyvalue pairs
> 
> Kevin Wolf (4):
>       block/qapi: Fix memory leak in qmp_query_blockstats()
>       mirror: Fail gracefully for source == target
>       block-backend: Set werror/rerror defaults in blk_new()
>       block: Fix invalidate_cache error path for parent activation
> 
> Liam Merwick (1):
>       tpm_tis: fix loop that cancels any seizure by a lower locality
> 
> Marc-André Lureau (1):
>       monitor: fix oob command leak
> 
> Marcel Apfelbaum (1):
>       hw/rdma: another clang compilation fix
> 
> Mark Cave-Ayland (1):
>       fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled
> 
> Markus Armbruster (1):
>       vfio-helpers: Fix qemu_vfio_open_pci() crash
> 
> Max Filippov (3):
>       target/xtensa: fix FPU2000 bugs
>       target/xtensa: fix s32c1i TCGMemOp flags
>       target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
> 
> Max Reitz (2):
>       qemu-img: Fix typo
>       qemu-img: Fix leak
> 
> Michael Roth (1):
>       make-release: add skiboot .version file
> 
> Michael S. Tsirkin (1):
>       tests: update acpi expected files
> 
> Paolo Bonzini (3):
>       virtio: update MemoryRegionCaches when guest negotiates features
>       virtio: do not take address of packed members
>       nvme: fix out-of-bounds access to the CMB
> 
> Paul A. Clarke (1):
>       Changes requirement for "vsubsbs" instruction
> 
> Peter Maydell (4):
>       virt: Suppress external aborts on virt-2.10 and earlier
>       target/arm: Correct condition for v8M callee stack push
>       linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0
>       exec.c: Don't reallocate IOMMUNotifiers that are in use
> 
> Peter Wu (1):
>       vnc: fix memleak of the "vnc-worker-output" name
> 
> Peter Xu (2):
>       intel_iommu: introduce vtd_reset_caches()
>       intel_iommu: better handling of dmar state switch
> 
> Prasad J Pandit (1):
>       tpm: use loop iterator to set sts data field
> 
> Prasad Singamsetty (1):
>       kvm: add call to qemu_add_opts() for -overcommit option
> 
> Richard Henderson (16):
>       target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw
>       target/arm: Fix typo in do_sat_addsub_64
>       target/arm: Reorganize SVE WHILE
>       target/arm: Fix typo in helper_sve_movz_d
>       target/arm: Fix typo in helper_sve_ld1hss_r
>       target/arm: Fix sign-extension in sve do_ldr/do_str
>       target/arm: Fix offset for LD1R instructions
>       target/arm: Fix offset scaling for LD_zprr and ST_zprr
>       target/arm: Reformat integer register dump
>       target/arm: Dump SVE state if enabled
>       target/arm: Add sve-max-vq cpu property to -cpu max
>       target/arm: Adjust FPCR_MASK for FZ16
>       target/arm: Ignore float_flag_input_denormal from fp_status_f16
>       target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h
>       target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half
>       target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs
> 
> Stefan Berger (4):
>       tpm: Zero-init structure to avoid uninitialized variables in valgrind log
>       tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
>       tpm: Make sure the locality received from backend is valid
>       acpi: Make TPM 2.0 with TIS available as MSFT0101
> 
> Thomas Huth (1):
>       hw/s390x: Fix bad mask in time2tod()
> 
> Tony Garnock-Jones (1):
>       linux-user: write(fd, NULL, 0) parity with linux's treatment of same
> 
> Vladimir Sementsov-Ogievskiy (4):
>       nbd/server: fix bitmap export
>       nbd/server: fix NBD_CMD_CACHE
>       mirror: fix dead-lock
>       iotests: simple mirror test with kvm on 1G image
> 
> William Bowling (1):
>       slirp: check sscanf result when emulating ident
> 
> Yury Kotov (1):
>       vhost: fix invalid downcast
> 
> Zheng Xiang (1):
>       pcie: set link state inactive/active after hot unplug/plug
> 
> liujunjie (1):
>       clean up callback when del virtqueue
> 
> yuchenlin (1):
>       vhost-scsi: prevent using uninitialized vqs
> 
>  block.c                                    |   2 +
>  block/block-backend.c                      |   3 +
>  block/mirror.c                             |  18 ++---
>  block/nbd-client.c                         |  22 +++++-
>  block/nvme.c                               |  37 ++++------
>  block/qapi.c                               |   3 +-
>  block/rbd.c                                |  90 ++++++++++++++++++++----
>  exec.c                                     |  10 +--
>  hw/9pfs/9p.c                               |   3 +
>  hw/acpi/piix4.c                            |   1 +
>  hw/arm/virt.c                              |   2 +
>  hw/audio/fmopl.h                           |   4 +-
>  hw/block/fdc.c                             |   2 +-
>  hw/block/nvme.c                            |   2 +-
>  hw/char/virtio-serial-bus.c                |   6 +-
>  hw/i2c/bitbang_i2c.h                       |   2 -
>  hw/i2c/smbus.c                             |   6 +-
>  hw/i386/acpi-build.c                       |  85 ++++++-----------------
>  hw/i386/intel_iommu.c                      |  34 ++++++---
>  hw/net/ne2000.c                            |   4 +-
>  hw/net/pcnet.c                             |   4 +-
>  hw/net/rtl8139.c                           |   8 +--
>  hw/pci/pcie.c                              |  12 ++++
>  hw/ppc/spapr_cpu_core.c                    |  62 +++++++++--------
>  hw/rdma/rdma_rm_defs.h                     |   4 +-
>  hw/scsi/vhost-scsi.c                       |   2 +-
>  hw/tpm/tpm_emulator.c                      |   1 +
>  hw/tpm/tpm_tis.c                           |  10 ++-
>  hw/usb/dev-mtp.c                           |  19 ++++--
>  hw/virtio/vhost.c                          |   4 +-
>  hw/virtio/virtio.c                         |  17 ++++-
>  include/block/nbd.h                        |   4 +-
>  include/hw/i2c/i2c.h                       |   2 +
>  include/hw/i2c/ppc4xx_i2c.h                |   3 -
>  include/hw/s390x/tod.h                     |   2 +-
>  include/net/net.h                          |   6 --
>  job.c                                      |  20 ++----
>  linux-user/syscall.c                       |  44 +++++++++---
>  migration/postcopy-ram.c                   |  11 +--
>  monitor.c                                  |   2 +
>  nbd/server.c                               |   9 ++-
>  net/net.c                                  |  23 +++++--
>  net/slirp.c                                |   9 +++
>  qemu-deprecated.texi                       |  15 ++++
>  qemu-img.c                                 |  35 +++++-----
>  qga/qapi-schema.json                       |  25 ++++---
>  scripts/make-release                       |   1 +
>  slirp/bootp.c                              |  32 ++++++---
>  slirp/tcp_subr.c                           |  10 +--
>  target/arm/cpu.c                           |   6 +-
>  target/arm/cpu.h                           |   5 +-
>  target/arm/cpu64.c                         |  29 ++++++++
>  target/arm/helper.c                        |  55 +++++++++------
>  target/arm/sve_helper.c                    |  23 +++----
>  target/arm/translate-a64.c                 | 106 ++++++++++++++++++++++++-----
>  target/arm/translate-sve.c                 |  81 +++++++++++++---------
>  target/i386/cpu.c                          |   6 ++
>  target/ppc/translate/vmx-ops.inc.c         |   2 +-
>  target/s390x/diag.c                        |   2 +-
>  target/xtensa/core-dc232b.c                |   2 -
>  target/xtensa/core-dc232b/gdb-config.inc.c |   1 +
>  target/xtensa/core-dc233c.c                |   2 -
>  target/xtensa/core-dc233c/gdb-config.inc.c |   1 +
>  target/xtensa/translate.c                  |   8 +--
>  tests/Makefile.include                     |   2 +-
>  tests/acpi-test-data/pc/DSDT               | Bin 5144 -> 5131 bytes
>  tests/acpi-test-data/pc/DSDT.bridge        | Bin 7003 -> 6990 bytes
>  tests/acpi-test-data/pc/DSDT.cphp          | Bin 5607 -> 5594 bytes
>  tests/acpi-test-data/pc/DSDT.dimmpxm       | Bin 6803 -> 6790 bytes
>  tests/acpi-test-data/pc/DSDT.ipmikcs       | Bin 5216 -> 5203 bytes
>  tests/acpi-test-data/pc/DSDT.memhp         | Bin 6509 -> 6496 bytes
>  tests/acpi-test-data/pc/DSDT.numamem       | Bin 5150 -> 5137 bytes
>  tests/acpi-test-data/pc/SRAT.dimmpxm       | Bin 472 -> 392 bytes
>  tests/acpi-test-data/pc/SRAT.memhp         | Bin 264 -> 264 bytes
>  tests/acpi-test-data/q35/DSDT              | Bin 7828 -> 7815 bytes
>  tests/acpi-test-data/q35/DSDT.bridge       | Bin 7845 -> 7832 bytes
>  tests/acpi-test-data/q35/DSDT.cphp         | Bin 8291 -> 8278 bytes
>  tests/acpi-test-data/q35/DSDT.dimmpxm      | Bin 9487 -> 9474 bytes
>  tests/acpi-test-data/q35/DSDT.ipmibt       | Bin 7903 -> 7890 bytes
>  tests/acpi-test-data/q35/DSDT.memhp        | Bin 9193 -> 9180 bytes
>  tests/acpi-test-data/q35/DSDT.numamem      | Bin 7834 -> 7821 bytes
>  tests/acpi-test-data/q35/SRAT.dimmpxm      | Bin 472 -> 392 bytes
>  tests/acpi-test-data/q35/SRAT.memhp        | Bin 264 -> 264 bytes
>  tests/nvme-test.c                          |  68 +++++++++++++++---
>  tests/qemu-iotests/041                     |   6 ++
>  tests/qemu-iotests/041.out                 |   4 +-
>  tests/qemu-iotests/067.out                 |   1 +
>  tests/qemu-iotests/229                     |  95 ++++++++++++++++++++++++++
>  tests/qemu-iotests/229.out                 |  23 +++++++
>  tests/qemu-iotests/231                     |  62 +++++++++++++++++
>  tests/qemu-iotests/231.out                 |   9 +++
>  tests/qemu-iotests/235                     |  78 +++++++++++++++++++++
>  tests/qemu-iotests/235.out                 |   3 +
>  tests/qemu-iotests/group                   |   3 +
>  ui/vnc-jobs.c                              |   3 +-
>  util/aio-posix.c                           |   7 +-
>  util/aio-win32.c                           |   3 +-
>  util/hbitmap.c                             |   3 +
>  util/vfio-helpers.c                        |   2 +-
>  vl.c                                       |   1 +
>  100 files changed, 1033 insertions(+), 401 deletions(-)
>  create mode 100755 tests/qemu-iotests/229
>  create mode 100644 tests/qemu-iotests/229.out
>  create mode 100755 tests/qemu-iotests/231
>  create mode 100644 tests/qemu-iotests/231.out
>  create mode 100755 tests/qemu-iotests/235
>  create mode 100644 tests/qemu-iotests/235.out

I'm not sure about 4c257911dcc7c4189768e9651755c849ce9db4e8
"i386: remove the 'INTEL_PT' CPUID bit from named CPU models"

What about 334c43e2c342e878311c66b4e62343f0a7c2c6be?
"qemu-img: fix error reporting for -object"

Also ade0075523478fa015afd5c6f6cc70681687818d:
"contrib/rdmacm-mux: Fix out-of-bounds risk"

And 3fd2092fd11b9e4220a08eca0663cc59178a6c3f:
"hw/usb: fix mistaken de-initialization of CCID state"

Eventually:
https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg00843.html
"megasas: fix mapped frame size"

Regards,

Phil.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-04 22:31   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 111+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-04-04 22:31 UTC (permalink / raw)
  To: Michael Roth, qemu-devel
  Cc: Kevin Wolf, Hannes Reinecke, Michael Tokarev, Peter Lieven,
	qemu-stable, Yuval Shaia, Markus Armbruster, Gerd Hoffmann,
	Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 14655 bytes --]

On 4/1/19 10:58 PM, Michael Roth wrote:
> Hi everyone,                                                                                              
> 
> The following new patches are queued for QEMU stable v3.0.1:
> 
>   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> 
> The release is planned for 2019-04-11:
> 
>   https://wiki.qemu.org/Planning/3.0
> 
> Please respond here or CC qemu-stable@nongnu.org on any patches you
> think should be included in the release.
> 
> Note that this update falls outside the normal stable release support
> window (~1 development cycle), but is being release now since it was
> delayed from its intended release date.
> 
> Thanks!
> 
> ----------------------------------------------------------------
> Alberto Garcia (1):
>       block: Fix use after free error in bdrv_open_inherit()
> 
> BALATON Zoltan (1):
>       i2c: Move typedef of bitbang_i2c_interface to i2c.h
> 
> Bharata B Rao (1):
>       spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn
> 
> Christian Borntraeger (1):
>       iotests: make 235 work on s390 (and others)
> 
> Corey Minyard (2):
>       i2c: Add a length check to the SMBus write handling
>       pc:piix4: Update smbus I/O space after a migration
> 
> Daniel Henrique Barboza (1):
>       qga: update docs with systemd suspend support info
> 
> Daniel P. Berrangé (1):
>       qemu-img: fix regression copying secrets during convert
> 
> Denis V. Lunev (1):
>       nbd: fix NBD_FLAG_SEND_CACHE value
> 
> Eduardo Habkost (1):
>       i386: Disable TOPOEXT by default on "-cpu host"
> 
> Eric Blake (4):
>       nbd/server: Advertise all contexts in response to bare LIST
>       nbd/client: Make x-dirty-bitmap more reliable
>       nbd/client: Send NBD_CMD_DISC if open fails after connect
>       bitmap: Update count after a merge
> 
> Fam Zheng (5):
>       nvme: Fix nvme_init error handling
>       aio-posix: Don't count ctx->notifier as progress when polling
>       aio: Do aio_notify_accept only during blocking aio_poll
>       slirp: Add sanity check for str option length
>       job: Fix nested aio_poll() hanging in job_txn_apply
> 
> Gerd Hoffmann (3):
>       fmops: fix off-by-one in AR_TABLE and DR_TABLE array size
>       usb-mtp: outlaw slashes in filenames
>       usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
> 
> Greg Kurz (1):
>       9p: fix QEMU crash when renaming files
> 
> Igor Mammedov (1):
>       pc: acpi: revert back to 1 SRAT entry for hotpluggable area
> 
> Ilya Maximets (1):
>       migration: Stop postcopy fault thread before notifying
> 
> Janosch Frank (1):
>       s390x: Return specification exception for unimplemented diag 308 subcodes
> 
> Jason Wang (5):
>       ne2000: fix possible out of bound access in ne2000_receive
>       rtl8139: fix possible out of bound access
>       pcnet: fix possible buffer overflow
>       net: ignore packet size greater than INT_MAX
>       net: drop too large packet early
> 
> Jeff Cody (6):
>       block: for jobs, do not clear user_paused until after the resume
>       block: iotest to catch abort on forced blockjob cancel
>       block/rbd: pull out qemu_rbd_convert_options
>       block/rbd: Attempt to parse legacy filenames
>       block/rbd: add iotest for rbd legacy keyvalue filename parsing
>       block/rbd: add deprecation documentation for filename keyvalue pairs
> 
> Kevin Wolf (4):
>       block/qapi: Fix memory leak in qmp_query_blockstats()
>       mirror: Fail gracefully for source == target
>       block-backend: Set werror/rerror defaults in blk_new()
>       block: Fix invalidate_cache error path for parent activation
> 
> Liam Merwick (1):
>       tpm_tis: fix loop that cancels any seizure by a lower locality
> 
> Marc-André Lureau (1):
>       monitor: fix oob command leak
> 
> Marcel Apfelbaum (1):
>       hw/rdma: another clang compilation fix
> 
> Mark Cave-Ayland (1):
>       fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled
> 
> Markus Armbruster (1):
>       vfio-helpers: Fix qemu_vfio_open_pci() crash
> 
> Max Filippov (3):
>       target/xtensa: fix FPU2000 bugs
>       target/xtensa: fix s32c1i TCGMemOp flags
>       target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
> 
> Max Reitz (2):
>       qemu-img: Fix typo
>       qemu-img: Fix leak
> 
> Michael Roth (1):
>       make-release: add skiboot .version file
> 
> Michael S. Tsirkin (1):
>       tests: update acpi expected files
> 
> Paolo Bonzini (3):
>       virtio: update MemoryRegionCaches when guest negotiates features
>       virtio: do not take address of packed members
>       nvme: fix out-of-bounds access to the CMB
> 
> Paul A. Clarke (1):
>       Changes requirement for "vsubsbs" instruction
> 
> Peter Maydell (4):
>       virt: Suppress external aborts on virt-2.10 and earlier
>       target/arm: Correct condition for v8M callee stack push
>       linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0
>       exec.c: Don't reallocate IOMMUNotifiers that are in use
> 
> Peter Wu (1):
>       vnc: fix memleak of the "vnc-worker-output" name
> 
> Peter Xu (2):
>       intel_iommu: introduce vtd_reset_caches()
>       intel_iommu: better handling of dmar state switch
> 
> Prasad J Pandit (1):
>       tpm: use loop iterator to set sts data field
> 
> Prasad Singamsetty (1):
>       kvm: add call to qemu_add_opts() for -overcommit option
> 
> Richard Henderson (16):
>       target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw
>       target/arm: Fix typo in do_sat_addsub_64
>       target/arm: Reorganize SVE WHILE
>       target/arm: Fix typo in helper_sve_movz_d
>       target/arm: Fix typo in helper_sve_ld1hss_r
>       target/arm: Fix sign-extension in sve do_ldr/do_str
>       target/arm: Fix offset for LD1R instructions
>       target/arm: Fix offset scaling for LD_zprr and ST_zprr
>       target/arm: Reformat integer register dump
>       target/arm: Dump SVE state if enabled
>       target/arm: Add sve-max-vq cpu property to -cpu max
>       target/arm: Adjust FPCR_MASK for FZ16
>       target/arm: Ignore float_flag_input_denormal from fp_status_f16
>       target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h
>       target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half
>       target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs
> 
> Stefan Berger (4):
>       tpm: Zero-init structure to avoid uninitialized variables in valgrind log
>       tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
>       tpm: Make sure the locality received from backend is valid
>       acpi: Make TPM 2.0 with TIS available as MSFT0101
> 
> Thomas Huth (1):
>       hw/s390x: Fix bad mask in time2tod()
> 
> Tony Garnock-Jones (1):
>       linux-user: write(fd, NULL, 0) parity with linux's treatment of same
> 
> Vladimir Sementsov-Ogievskiy (4):
>       nbd/server: fix bitmap export
>       nbd/server: fix NBD_CMD_CACHE
>       mirror: fix dead-lock
>       iotests: simple mirror test with kvm on 1G image
> 
> William Bowling (1):
>       slirp: check sscanf result when emulating ident
> 
> Yury Kotov (1):
>       vhost: fix invalid downcast
> 
> Zheng Xiang (1):
>       pcie: set link state inactive/active after hot unplug/plug
> 
> liujunjie (1):
>       clean up callback when del virtqueue
> 
> yuchenlin (1):
>       vhost-scsi: prevent using uninitialized vqs
> 
>  block.c                                    |   2 +
>  block/block-backend.c                      |   3 +
>  block/mirror.c                             |  18 ++---
>  block/nbd-client.c                         |  22 +++++-
>  block/nvme.c                               |  37 ++++------
>  block/qapi.c                               |   3 +-
>  block/rbd.c                                |  90 ++++++++++++++++++++----
>  exec.c                                     |  10 +--
>  hw/9pfs/9p.c                               |   3 +
>  hw/acpi/piix4.c                            |   1 +
>  hw/arm/virt.c                              |   2 +
>  hw/audio/fmopl.h                           |   4 +-
>  hw/block/fdc.c                             |   2 +-
>  hw/block/nvme.c                            |   2 +-
>  hw/char/virtio-serial-bus.c                |   6 +-
>  hw/i2c/bitbang_i2c.h                       |   2 -
>  hw/i2c/smbus.c                             |   6 +-
>  hw/i386/acpi-build.c                       |  85 ++++++-----------------
>  hw/i386/intel_iommu.c                      |  34 ++++++---
>  hw/net/ne2000.c                            |   4 +-
>  hw/net/pcnet.c                             |   4 +-
>  hw/net/rtl8139.c                           |   8 +--
>  hw/pci/pcie.c                              |  12 ++++
>  hw/ppc/spapr_cpu_core.c                    |  62 +++++++++--------
>  hw/rdma/rdma_rm_defs.h                     |   4 +-
>  hw/scsi/vhost-scsi.c                       |   2 +-
>  hw/tpm/tpm_emulator.c                      |   1 +
>  hw/tpm/tpm_tis.c                           |  10 ++-
>  hw/usb/dev-mtp.c                           |  19 ++++--
>  hw/virtio/vhost.c                          |   4 +-
>  hw/virtio/virtio.c                         |  17 ++++-
>  include/block/nbd.h                        |   4 +-
>  include/hw/i2c/i2c.h                       |   2 +
>  include/hw/i2c/ppc4xx_i2c.h                |   3 -
>  include/hw/s390x/tod.h                     |   2 +-
>  include/net/net.h                          |   6 --
>  job.c                                      |  20 ++----
>  linux-user/syscall.c                       |  44 +++++++++---
>  migration/postcopy-ram.c                   |  11 +--
>  monitor.c                                  |   2 +
>  nbd/server.c                               |   9 ++-
>  net/net.c                                  |  23 +++++--
>  net/slirp.c                                |   9 +++
>  qemu-deprecated.texi                       |  15 ++++
>  qemu-img.c                                 |  35 +++++-----
>  qga/qapi-schema.json                       |  25 ++++---
>  scripts/make-release                       |   1 +
>  slirp/bootp.c                              |  32 ++++++---
>  slirp/tcp_subr.c                           |  10 +--
>  target/arm/cpu.c                           |   6 +-
>  target/arm/cpu.h                           |   5 +-
>  target/arm/cpu64.c                         |  29 ++++++++
>  target/arm/helper.c                        |  55 +++++++++------
>  target/arm/sve_helper.c                    |  23 +++----
>  target/arm/translate-a64.c                 | 106 ++++++++++++++++++++++++-----
>  target/arm/translate-sve.c                 |  81 +++++++++++++---------
>  target/i386/cpu.c                          |   6 ++
>  target/ppc/translate/vmx-ops.inc.c         |   2 +-
>  target/s390x/diag.c                        |   2 +-
>  target/xtensa/core-dc232b.c                |   2 -
>  target/xtensa/core-dc232b/gdb-config.inc.c |   1 +
>  target/xtensa/core-dc233c.c                |   2 -
>  target/xtensa/core-dc233c/gdb-config.inc.c |   1 +
>  target/xtensa/translate.c                  |   8 +--
>  tests/Makefile.include                     |   2 +-
>  tests/acpi-test-data/pc/DSDT               | Bin 5144 -> 5131 bytes
>  tests/acpi-test-data/pc/DSDT.bridge        | Bin 7003 -> 6990 bytes
>  tests/acpi-test-data/pc/DSDT.cphp          | Bin 5607 -> 5594 bytes
>  tests/acpi-test-data/pc/DSDT.dimmpxm       | Bin 6803 -> 6790 bytes
>  tests/acpi-test-data/pc/DSDT.ipmikcs       | Bin 5216 -> 5203 bytes
>  tests/acpi-test-data/pc/DSDT.memhp         | Bin 6509 -> 6496 bytes
>  tests/acpi-test-data/pc/DSDT.numamem       | Bin 5150 -> 5137 bytes
>  tests/acpi-test-data/pc/SRAT.dimmpxm       | Bin 472 -> 392 bytes
>  tests/acpi-test-data/pc/SRAT.memhp         | Bin 264 -> 264 bytes
>  tests/acpi-test-data/q35/DSDT              | Bin 7828 -> 7815 bytes
>  tests/acpi-test-data/q35/DSDT.bridge       | Bin 7845 -> 7832 bytes
>  tests/acpi-test-data/q35/DSDT.cphp         | Bin 8291 -> 8278 bytes
>  tests/acpi-test-data/q35/DSDT.dimmpxm      | Bin 9487 -> 9474 bytes
>  tests/acpi-test-data/q35/DSDT.ipmibt       | Bin 7903 -> 7890 bytes
>  tests/acpi-test-data/q35/DSDT.memhp        | Bin 9193 -> 9180 bytes
>  tests/acpi-test-data/q35/DSDT.numamem      | Bin 7834 -> 7821 bytes
>  tests/acpi-test-data/q35/SRAT.dimmpxm      | Bin 472 -> 392 bytes
>  tests/acpi-test-data/q35/SRAT.memhp        | Bin 264 -> 264 bytes
>  tests/nvme-test.c                          |  68 +++++++++++++++---
>  tests/qemu-iotests/041                     |   6 ++
>  tests/qemu-iotests/041.out                 |   4 +-
>  tests/qemu-iotests/067.out                 |   1 +
>  tests/qemu-iotests/229                     |  95 ++++++++++++++++++++++++++
>  tests/qemu-iotests/229.out                 |  23 +++++++
>  tests/qemu-iotests/231                     |  62 +++++++++++++++++
>  tests/qemu-iotests/231.out                 |   9 +++
>  tests/qemu-iotests/235                     |  78 +++++++++++++++++++++
>  tests/qemu-iotests/235.out                 |   3 +
>  tests/qemu-iotests/group                   |   3 +
>  ui/vnc-jobs.c                              |   3 +-
>  util/aio-posix.c                           |   7 +-
>  util/aio-win32.c                           |   3 +-
>  util/hbitmap.c                             |   3 +
>  util/vfio-helpers.c                        |   2 +-
>  vl.c                                       |   1 +
>  100 files changed, 1033 insertions(+), 401 deletions(-)
>  create mode 100755 tests/qemu-iotests/229
>  create mode 100644 tests/qemu-iotests/229.out
>  create mode 100755 tests/qemu-iotests/231
>  create mode 100644 tests/qemu-iotests/231.out
>  create mode 100755 tests/qemu-iotests/235
>  create mode 100644 tests/qemu-iotests/235.out

I'm not sure about 4c257911dcc7c4189768e9651755c849ce9db4e8
"i386: remove the 'INTEL_PT' CPUID bit from named CPU models"

What about 334c43e2c342e878311c66b4e62343f0a7c2c6be?
"qemu-img: fix error reporting for -object"

Also ade0075523478fa015afd5c6f6cc70681687818d:
"contrib/rdmacm-mux: Fix out-of-bounds risk"

And 3fd2092fd11b9e4220a08eca0663cc59178a6c3f:
"hw/usb: fix mistaken de-initialization of CCID state"

Eventually:
https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg00843.html
"megasas: fix mapped frame size"

Regards,

Phil.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-05 20:28     ` Michael Roth
  0 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-05 20:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-stable, Daniel P. Berrangé,
	Kevin Wolf, Markus Armbruster, Peter Lieven, Hannes Reinecke,
	Michael Tokarev, Gerd Hoffmann, Yuval Shaia, Marcel Apfelbaum,
	Paolo Bonzini

Quoting Philippe Mathieu-Daudé (2019-04-04 17:31:31)
> On 4/1/19 10:58 PM, Michael Roth wrote:
> > Hi everyone,                                                                                              
> > 
> > The following new patches are queued for QEMU stable v3.0.1:
> > 
> >   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> > 
> > The release is planned for 2019-04-11:
> > 
> >   https://wiki.qemu.org/Planning/3.0
...
> 
> I'm not sure about 4c257911dcc7c4189768e9651755c849ce9db4e8
> "i386: remove the 'INTEL_PT' CPUID bit from named CPU models"

AFAICT this was only enabled by default via Icelake-*, Cascadelake-Server
models, which are only in 3.1+. I have it queued for 3.1.1 though.

> 
> What about 334c43e2c342e878311c66b4e62343f0a7c2c6be?
> "qemu-img: fix error reporting for -object"

Looks like this fixes a regression introduced in 3.1 with 7e1e0c11, I'll
make sure to queue it for 3.1.1 though.

> 
> Also ade0075523478fa015afd5c6f6cc70681687818d:
> "contrib/rdmacm-mux: Fix out-of-bounds risk"

Fixes regression introduced in 4.0 with a5d2f6f8773

> 
> And 3fd2092fd11b9e4220a08eca0663cc59178a6c3f:
> "hw/usb: fix mistaken de-initialization of CCID state"


Fixes regression introduced in 4.0 with 7dea29e4

> 
> Eventually:
> https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg00843.html
> "megasas: fix mapped frame size"

Hopefully it makes it in by rc3 next week, otherwise we'd need to delay
3.0.1 to pick it up. Will keep it eye on it.

Thanks for the suggestions!

> 
> Regards,
> 
> Phil.
> 

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

* Re: [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-05 20:28     ` Michael Roth
  0 siblings, 0 replies; 111+ messages in thread
From: Michael Roth @ 2019-04-05 20:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Kevin Wolf, Hannes Reinecke, Michael Tokarev, Peter Lieven,
	qemu-stable, Yuval Shaia, Markus Armbruster, Gerd Hoffmann,
	Paolo Bonzini

Quoting Philippe Mathieu-Daudé (2019-04-04 17:31:31)
> On 4/1/19 10:58 PM, Michael Roth wrote:
> > Hi everyone,                                                                                              
> > 
> > The following new patches are queued for QEMU stable v3.0.1:
> > 
> >   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> > 
> > The release is planned for 2019-04-11:
> > 
> >   https://wiki.qemu.org/Planning/3.0
...
> 
> I'm not sure about 4c257911dcc7c4189768e9651755c849ce9db4e8
> "i386: remove the 'INTEL_PT' CPUID bit from named CPU models"

AFAICT this was only enabled by default via Icelake-*, Cascadelake-Server
models, which are only in 3.1+. I have it queued for 3.1.1 though.

> 
> What about 334c43e2c342e878311c66b4e62343f0a7c2c6be?
> "qemu-img: fix error reporting for -object"

Looks like this fixes a regression introduced in 3.1 with 7e1e0c11, I'll
make sure to queue it for 3.1.1 though.

> 
> Also ade0075523478fa015afd5c6f6cc70681687818d:
> "contrib/rdmacm-mux: Fix out-of-bounds risk"

Fixes regression introduced in 4.0 with a5d2f6f8773

> 
> And 3fd2092fd11b9e4220a08eca0663cc59178a6c3f:
> "hw/usb: fix mistaken de-initialization of CCID state"


Fixes regression introduced in 4.0 with 7dea29e4

> 
> Eventually:
> https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg00843.html
> "megasas: fix mapped frame size"

Hopefully it makes it in by rc3 next week, otherwise we'd need to delay
3.0.1 to pick it up. Will keep it eye on it.

Thanks for the suggestions!

> 
> Regards,
> 
> Phil.
> 


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

* Re: [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-09  8:59     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 111+ messages in thread
From: Dr. David Alan Gilbert @ 2019-04-09  8:59 UTC (permalink / raw)
  To: Ilya Maximets; +Cc: mdroth, qemu-devel, qemu-stable

* Ilya Maximets (i.maximets@samsung.com) wrote:
> > Hi everyone,                                                                    
> >                           
> > 
> > The following new patches are queued for QEMU stable v3.0.1:
> > 
> >   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> > 
> > The release is planned for 2019-04-11:
> > 
> >   https://wiki.qemu.org/Planning/3.0
> > 
> > Please respond here or CC address@hidden on any patches you
> > think should be included in the release.
> > 
> > Note that this update falls outside the normal stable release support
> > window (~1 development cycle), but is being release now since it was
> > delayed from its intended release date.
> > 
> > Thanks!
> > 
> 
> [...]
> 
> > 
> > Ilya Maximets (1):
> >       migration: Stop postcopy fault thread before notifying
> 
> Hi.
> 
> Sorry for late response, but what about following two patches:
> 
>   c4f753859ae6 ("vhost-user: Fix userfaultfd leak")
>   5ce43896e167 ("vhost-user: Don't ask for reply on postcopy mem table set")
> 
> ?

OK with me.

Dave

> Best regards, Ilya Maximets.
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-09  8:59     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 111+ messages in thread
From: Dr. David Alan Gilbert @ 2019-04-09  8:59 UTC (permalink / raw)
  To: Ilya Maximets; +Cc: qemu-stable, mdroth, qemu-devel

* Ilya Maximets (i.maximets@samsung.com) wrote:
> > Hi everyone,                                                                    
> >                           
> > 
> > The following new patches are queued for QEMU stable v3.0.1:
> > 
> >   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> > 
> > The release is planned for 2019-04-11:
> > 
> >   https://wiki.qemu.org/Planning/3.0
> > 
> > Please respond here or CC address@hidden on any patches you
> > think should be included in the release.
> > 
> > Note that this update falls outside the normal stable release support
> > window (~1 development cycle), but is being release now since it was
> > delayed from its intended release date.
> > 
> > Thanks!
> > 
> 
> [...]
> 
> > 
> > Ilya Maximets (1):
> >       migration: Stop postcopy fault thread before notifying
> 
> Hi.
> 
> Sorry for late response, but what about following two patches:
> 
>   c4f753859ae6 ("vhost-user: Fix userfaultfd leak")
>   5ce43896e167 ("vhost-user: Don't ask for reply on postcopy mem table set")
> 
> ?

OK with me.

Dave

> Best regards, Ilya Maximets.
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


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

* [Qemu-devel]  [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-08 12:33   ` Ilya Maximets
  0 siblings, 0 replies; 111+ messages in thread
From: Ilya Maximets @ 2019-04-08 12:33 UTC (permalink / raw)
  To: mdroth; +Cc: qemu-devel, qemu-stable, dgilbert

> Hi everyone,                                                                    
>                           
> 
> The following new patches are queued for QEMU stable v3.0.1:
> 
>   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> 
> The release is planned for 2019-04-11:
> 
>   https://wiki.qemu.org/Planning/3.0
> 
> Please respond here or CC address@hidden on any patches you
> think should be included in the release.
> 
> Note that this update falls outside the normal stable release support
> window (~1 development cycle), but is being release now since it was
> delayed from its intended release date.
> 
> Thanks!
> 

[...]

> 
> Ilya Maximets (1):
>       migration: Stop postcopy fault thread before notifying

Hi.

Sorry for late response, but what about following two patches:

  c4f753859ae6 ("vhost-user: Fix userfaultfd leak")
  5ce43896e167 ("vhost-user: Don't ask for reply on postcopy mem table set")

?

Best regards, Ilya Maximets.

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

* [Qemu-devel]  [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08
@ 2019-04-08 12:33   ` Ilya Maximets
  0 siblings, 0 replies; 111+ messages in thread
From: Ilya Maximets @ 2019-04-08 12:33 UTC (permalink / raw)
  To: mdroth; +Cc: qemu-devel, dgilbert, qemu-stable

> Hi everyone,                                                                    
>                           
> 
> The following new patches are queued for QEMU stable v3.0.1:
> 
>   https://github.com/mdroth/qemu/commits/stable-3.0-staging
> 
> The release is planned for 2019-04-11:
> 
>   https://wiki.qemu.org/Planning/3.0
> 
> Please respond here or CC address@hidden on any patches you
> think should be included in the release.
> 
> Note that this update falls outside the normal stable release support
> window (~1 development cycle), but is being release now since it was
> delayed from its intended release date.
> 
> Thanks!
> 

[...]

> 
> Ilya Maximets (1):
>       migration: Stop postcopy fault thread before notifying

Hi.

Sorry for late response, but what about following two patches:

  c4f753859ae6 ("vhost-user: Fix userfaultfd leak")
  5ce43896e167 ("vhost-user: Don't ask for reply on postcopy mem table set")

?

Best regards, Ilya Maximets.


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

end of thread, other threads:[~2019-04-09  9:01 UTC | newest]

Thread overview: 111+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 20:58 [Qemu-devel] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 01/97] target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 02/97] target/arm: Fix typo in do_sat_addsub_64 Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 03/97] target/arm: Reorganize SVE WHILE Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 04/97] target/arm: Fix typo in helper_sve_movz_d Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 05/97] target/arm: Fix typo in helper_sve_ld1hss_r Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 06/97] target/arm: Fix sign-extension in sve do_ldr/do_str Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 07/97] target/arm: Fix offset for LD1R instructions Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 08/97] target/arm: Fix offset scaling for LD_zprr and ST_zprr Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 09/97] target/arm: Reformat integer register dump Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 10/97] target/arm: Dump SVE state if enabled Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 11/97] target/arm: Add sve-max-vq cpu property to -cpu max Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 12/97] spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 13/97] target/arm: Adjust FPCR_MASK for FZ16 Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 14/97] target/arm: Ignore float_flag_input_denormal from fp_status_f16 Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 15/97] target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 16/97] target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 17/97] block/qapi: Fix memory leak in qmp_query_blockstats() Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 18/97] mirror: Fail gracefully for source == target Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 19/97] qemu-img: fix regression copying secrets during convert Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 20/97] nvme: Fix nvme_init error handling Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 21/97] aio-posix: Don't count ctx->notifier as progress when polling Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 22/97] aio: Do aio_notify_accept only during blocking aio_poll Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 23/97] monitor: fix oob command leak Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 24/97] vnc: fix memleak of the "vnc-worker-output" name Michael Roth
2019-04-01 20:58 ` [Qemu-devel] [PATCH 25/97] i386: Disable TOPOEXT by default on "-cpu host" Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 26/97] block: for jobs, do not clear user_paused until after the resume Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 27/97] block: iotest to catch abort on forced blockjob cancel Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 28/97] virtio: update MemoryRegionCaches when guest negotiates features Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 29/97] target/xtensa: fix FPU2000 bugs Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 30/97] kvm: add call to qemu_add_opts() for -overcommit option Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 31/97] slirp: Add sanity check for str option length Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 32/97] vhost: fix invalid downcast Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 33/97] pc: acpi: revert back to 1 SRAT entry for hotpluggable area Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 34/97] tests: update acpi expected files Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 35/97] block: Fix use after free error in bdrv_open_inherit() Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 36/97] job: Fix nested aio_poll() hanging in job_txn_apply Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 37/97] target/xtensa: fix s32c1i TCGMemOp flags Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 38/97] nbd/server: fix bitmap export Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 39/97] clean up callback when del virtqueue Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 40/97] block/rbd: pull out qemu_rbd_convert_options Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 41/97] block/rbd: Attempt to parse legacy filenames Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 42/97] block/rbd: add iotest for rbd legacy keyvalue filename parsing Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 43/97] block/rbd: add deprecation documentation for filename keyvalue pairs Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 44/97] target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 45/97] ne2000: fix possible out of bound access in ne2000_receive Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 46/97] rtl8139: fix possible out of bound access Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 47/97] pcnet: fix possible buffer overflow Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 48/97] net: ignore packet size greater than INT_MAX Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 49/97] virt: Suppress external aborts on virt-2.10 and earlier Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 50/97] virtio: do not take address of packed members Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 51/97] block-backend: Set werror/rerror defaults in blk_new() Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 52/97] target/arm: Correct condition for v8M callee stack push Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 53/97] nbd/server: fix NBD_CMD_CACHE Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 54/97] intel_iommu: introduce vtd_reset_caches() Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 55/97] intel_iommu: better handling of dmar state switch Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 56/97] nbd: fix NBD_FLAG_SEND_CACHE value Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 57/97] migration: Stop postcopy fault thread before notifying Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 58/97] vhost-scsi: prevent using uninitialized vqs Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs Michael Roth
2019-04-01 21:19   ` Max Filippov
2019-04-01 23:28     ` Michael Roth
2019-04-01 23:42       ` Max Filippov
2019-04-01 20:59 ` [Qemu-devel] [PATCH 60/97] make-release: add skiboot .version file Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 61/97] net: drop too large packet early Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 62/97] fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 63/97] qemu-img: Fix typo Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 64/97] qemu-img: Fix leak Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 65/97] fmops: fix off-by-one in AR_TABLE and DR_TABLE array size Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 66/97] vfio-helpers: Fix qemu_vfio_open_pci() crash Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 67/97] i2c: Move typedef of bitbang_i2c_interface to i2c.h Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 68/97] i2c: Add a length check to the SMBus write handling Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 69/97] nbd/server: Advertise all contexts in response to bare LIST Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 70/97] nbd/client: Make x-dirty-bitmap more reliable Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 71/97] nbd/client: Send NBD_CMD_DISC if open fails after connect Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 72/97] mirror: fix dead-lock Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 73/97] iotests: simple mirror test with kvm on 1G image Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 74/97] iotests: make 235 work on s390 (and others) Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 75/97] Changes requirement for "vsubsbs" instruction Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 76/97] pcie: set link state inactive/active after hot unplug/plug Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 77/97] pc:piix4: Update smbus I/O space after a migration Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 78/97] hw/s390x: Fix bad mask in time2tod() Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 79/97] linux-user: write(fd, NULL, 0) parity with linux's treatment of same Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 80/97] linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0 Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 81/97] s390x: Return specification exception for unimplemented diag 308 subcodes Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 82/97] exec.c: Don't reallocate IOMMUNotifiers that are in use Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 83/97] tpm: Zero-init structure to avoid uninitialized variables in valgrind log Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 84/97] tpm: use loop iterator to set sts data field Michael Roth
2019-04-01 20:59 ` [Qemu-devel] [PATCH 85/97] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 86/97] tpm: Make sure the locality received from backend " Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 87/97] block: Fix invalidate_cache error path for parent activation Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 88/97] acpi: Make TPM 2.0 with TIS available as MSFT0101 Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 89/97] hw/rdma: another clang compilation fix Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 90/97] slirp: check sscanf result when emulating ident Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 91/97] tpm_tis: fix loop that cancels any seizure by a lower locality Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 92/97] bitmap: Update count after a merge Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 93/97] qga: update docs with systemd suspend support info Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 94/97] nvme: fix out-of-bounds access to the CMB Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 95/97] 9p: fix QEMU crash when renaming files Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 96/97] usb-mtp: outlaw slashes in filenames Michael Roth
2019-04-01 21:00 ` [Qemu-devel] [PATCH 97/97] usb-mtp: use O_NOFOLLOW and O_CLOEXEC Michael Roth
2019-04-02 16:22 ` [Qemu-devel] [Qemu-stable] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08 Cole Robinson
2019-04-04 21:28   ` Michael Roth
2019-04-04 22:31 ` [Qemu-devel] " Philippe Mathieu-Daudé
2019-04-04 22:31   ` Philippe Mathieu-Daudé
2019-04-05 20:28   ` Michael Roth
2019-04-05 20:28     ` Michael Roth
     [not found] <CGME20190408123341eucas1p2add7886160b2b66912413defd4544d1f@eucas1p2.samsung.com>
2019-04-08 12:33 ` Ilya Maximets
2019-04-08 12:33   ` Ilya Maximets
2019-04-09  8:59   ` Dr. David Alan Gilbert
2019-04-09  8:59     ` 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.