Patch Round-up for stable 3.0.1, freeze on 2019-04-08
Subsystems (2)
cover Patch Round-up for stable 3.0.1, freeze on 2019-04-08
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 [email protected] 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
PATCH 1/97 target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw
From: Richard Henderson <[email protected]>
The normal vector element is sign-extended before
comparing with the wide vector element.
Message-id: [email protected]
--- target/arm/sve_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
target/arm/sve_helper.c +6 -6
@@ -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, >)
Signature · 1 line
2.17.1
PATCH 2/97 target/arm: Fix typo in do_sat_addsub_64
In reply to Michael RothFrom: Richard Henderson <[email protected]>
Used the wrong temporary in the computation of subtractive overflow.
Message-id: [email protected]
--- target/arm/translate-sve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/translate-sve.c +1 -1
@@ -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. */
Signature · 1 line
2.17.1
PATCH 3/97 target/arm: Reorganize SVE WHILE
In reply to Michael RothFrom: Richard Henderson <[email protected]>
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.
Message-id: [email protected]
--- target/arm/sve_helper.c | 5 ---- target/arm/translate-sve.c | 49 +++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 22 deletions(-)
target/arm/sve_helper.c +0 -5
@@ -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;
target/arm/translate-sve.c +32 -17
83 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 4/97 target/arm: Fix typo in helper_sve_movz_d
In reply to Michael RothFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/sve_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/sve_helper.c +1 -1
@@ -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 ); } }
Signature · 1 line
2.17.1
PATCH 5/97 target/arm: Fix typo in helper_sve_ld1hss_r
In reply to Michael RothFrom: Richard Henderson <[email protected]>
--- target/arm/sve_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/sve_helper.c +1 -1
@@ -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, )
Signature · 1 line
2.17.1
PATCH 6/97 target/arm: Fix sign-extension in sve do_ldr/do_str
In reply to Michael RothFrom: Richard Henderson <[email protected]>
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.
--- target/arm/translate-sve.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
target/arm/translate-sve.c +8 -10
@@ -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;
Signature · 1 line
2.17.1
PATCH 7/97 target/arm: Fix offset for LD1R instructions
In reply to Michael RothFrom: Richard Henderson <[email protected]>
The immediate should be scaled by the size of the memory reference, not the size of the elements into which it is loaded.
--- target/arm/translate-sve.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/arm/translate-sve.c +2 -1
@@ -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]);
Signature · 1 line
2.17.1
PATCH 8/97 target/arm: Fix offset scaling for LD_zprr and ST_zprr
In reply to Michael RothFrom: Richard Henderson <[email protected]>
The scaling should be solely on the memory operation size; the number of registers being loaded does not come in to the initial computation.
--- target/arm/translate-sve.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
target/arm/translate-sve.c +2 -3
@@ -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); }
Signature · 1 line
2.17.1
PATCH 9/97 target/arm: Reformat integer register dump
In reply to Michael RothFrom: Richard Henderson <[email protected]>
With PC, there are 33 registers. Three per line lines up nicely without overflowing 80 columns.
--- target/arm/translate-a64.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
target/arm/translate-a64.c +6 -7
@@ -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" ); } }
Signature · 1 line
2.17.1
PATCH 10/97 target/arm: Dump SVE state if enabled
In reply to Michael RothFrom: Richard Henderson <[email protected]>
Also fold the FPCR/FPSR state onto the same line as PSTATE, and mention but do not dump disabled FPU state.
--- target/arm/translate-a64.c | 93 +++++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 11 deletions(-)
target/arm/translate-a64.c +82 -11
@@ -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)); } }
Signature · 1 line
2.17.1
PATCH 11/97 target/arm: Add sve-max-vq cpu property to -cpu max
In reply to Michael RothFrom: Richard Henderson <[email protected]>
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.
--- 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(-)
linux-user/syscall.c +13 -6
@@ -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);
target/arm/cpu.c +3 -3
@@ -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 )) {
target/arm/cpu.h +3 -0
@@ -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)
target/arm/cpu64.c +29 -0
@@ -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++) {
target/arm/helper.c +5 -2
@@ -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 ]); }
Signature · 1 line
2.17.1
PATCH 12/97 spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn
In reply to Michael RothFrom: Bharata B Rao <[email protected]>
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.
--- hw/ppc/spapr_cpu_core.c | 62 +++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 30 deletions(-)
hw/ppc/spapr_cpu_core.c +32 -30
@@ -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 ) {
Signature · 1 line
2.17.1
PATCH 13/97 target/arm: Adjust FPCR_MASK for FZ16
In reply to Michael RothFrom: Richard Henderson <[email protected]>
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.
Message-id: [email protected]
--- target/arm/cpu.h | 2 +- target/arm/helper.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
target/arm/cpu.h +1 -1
@@ -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 */
target/arm/helper.c +5 -0
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 14/97 target/arm: Ignore float_flag_input_denormal from fp_status_f16
In reply to Michael RothFrom: Richard Henderson <[email protected]>
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.
Message-id: [email protected]
--- target/arm/helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
target/arm/helper.c +5 -1
@@ -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; }
Signature · 1 line
2.17.1
PATCH 15/97 target/arm: Use fp_status_fp16 for do_fmpa_zpzzz_h
In reply to Michael RothFrom: Richard Henderson <[email protected]>
This makes float16_muladd correctly use FZ16 not FZ.
Message-id: [email protected]
--- target/arm/sve_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/sve_helper.c +1 -1
@@ -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 );
Signature · 1 line
2.17.1
PATCH 16/97 target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half
In reply to Michael RothFrom: Richard Henderson <[email protected]>
We were using the wrong flush-to-zero bit for the non-half input.
Message-id: [email protected]
--- target/arm/translate-sve.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/translate-sve.c +2 -2
@@ -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)
Signature · 1 line
2.17.1
PATCH 17/97 block/qapi: Fix memory leak in qmp_query_blockstats()
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
For BlockBackends that are skipped in query-blockstats, we would leak info since commit 567dcb31. Allocate info only later to avoid the memory leak.
--- block/qapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/qapi.c +2 -1
@@ -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;
Signature · 1 line
2.17.1
PATCH 18/97 mirror: Fail gracefully for source == target
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
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.
--- block/mirror.c | 5 +++++ tests/qemu-iotests/041 | 6 ++++++ tests/qemu-iotests/041.out | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-)
block/mirror.c +5 -0
@@ -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. */
tests/qemu-iotests/041 +6 -0
@@ -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
tests/qemu-iotests/041.out +2 -2
@@ -1,5 +1,5 @@ -..................................................................................... +........................................................................................ ---------------------------------------------------------------------- -Ran 85 tests +Ran 88 tests OK
Signature · 1 line
2.17.1
PATCH 19/97 qemu-img: fix regression copying secrets during convert
In reply to Michael RothFrom: Daniel P. Berrangé <[email protected]>
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 <[email protected]>
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.
--- qemu-img.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
qemu-img.c +15 -17
@@ -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++) {
Signature · 1 line
2.17.1
PATCH 20/97 nvme: Fix nvme_init error handling
In reply to Michael RothFrom: Fam Zheng <[email protected]>
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.
Message-Id: <[email protected]>
--- block/nvme.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-)
block/nvme.c +12 -25
@@ -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); }
Signature · 1 line
2.17.1
PATCH 21/97 aio-posix: Don't count ctx->notifier as progress when polling
In reply to Michael RothFrom: Fam Zheng <[email protected]>
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().
Message-Id: <[email protected]>
--- util/aio-posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
util/aio-posix.c +2 -1
@@ -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; }
Signature · 1 line
2.17.1
PATCH 22/97 aio: Do aio_notify_accept only during blocking aio_poll
In reply to Michael RothFrom: Fam Zheng <[email protected]>
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.
Message-Id: <[email protected]>
--- util/aio-posix.c | 4 ++-- util/aio-win32.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
util/aio-posix.c +2 -2
@@ -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++) {
util/aio-win32.c +2 -1
@@ -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; }
Signature · 1 line
2.17.1
PATCH 23/97 monitor: fix oob command leak
In reply to Michael RothFrom: Marc-André Lureau <[email protected]>
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)Message-Id: <[email protected]>
--- monitor.c | 2 ++ 1 file changed, 2 insertions(+)
monitor.c +2 -0
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 24/97 vnc: fix memleak of the "vnc-worker-output" name
In reply to Michael RothFrom: Peter Wu <[email protected]>
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:240Message-id: [email protected]
--- ui/vnc-jobs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ui/vnc-jobs.c +2 -1
@@ -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 */
Signature · 1 line
2.17.1
PATCH 25/97 i386: Disable TOPOEXT by default on "-cpu host"
In reply to Michael RothFrom: Eduardo Habkost <[email protected]>
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
Message-Id: <[email protected]>
--- target/i386/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)
target/i386/cpu.c +6 -0
@@ -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 = {
Signature · 1 line
2.17.1
PATCH 26/97 block: for jobs, do not clear user_paused until after the resume
In reply to Michael RothFrom: Jeff Cody <[email protected]>
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.
Message-id: bb183b77d8f2dd6bd67b8da559a90ac1e74b2052.1534868459.git.jcody@redhat.com
--- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
job.c +1 -1
@@ -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--; }
Signature · 1 line
2.17.1
PATCH 27/97 block: iotest to catch abort on forced blockjob cancel
In reply to Michael RothFrom: Jeff Cody <[email protected]>
Message-id: df317f617fbe5affcf699cb8560e7b0c2e028a64.1534868459.git.jcody@redhat.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
tests/qemu-iotests/229 new file +95 -0
@@ -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 [email protected] + +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
tests/qemu-iotests/229.out new file +23 -0
@@ -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
tests/qemu-iotests/group +1 -0
@@ -225,3 +225,4 @@ 225 rw auto quick 226 auto quick 227 auto quick +229 auto quick
Signature · 1 line
2.17.1
PATCH 28/97 virtio: update MemoryRegionCaches when guest negotiates features
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
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.
--- hw/virtio/virtio.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
hw/virtio/virtio.c +13 -2
@@ -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)
Signature · 1 line
2.17.1
PATCH 29/97 target/xtensa: fix FPU2000 bugs
In reply to Michael RothFrom: Max Filippov <[email protected]>
- 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.
translators")
--- target/xtensa/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/xtensa/translate.c +3 -3
@@ -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, }, };
Signature · 1 line
2.17.1
PATCH 30/97 kvm: add call to qemu_add_opts() for -overcommit option
In reply to Michael RothFrom: Prasad Singamsetty <[email protected]>
qemu command fails to process -overcommit option. Add the missing call to qemu_add_opts() in vl.c.
Message-Id: <[email protected]>
--- vl.c | 1 + 1 file changed, 1 insertion(+)
vl.c +1 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH 31/97 slirp: Add sanity check for str option length
In reply to Michael RothFrom: Fam Zheng <[email protected]>
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.
--- net/slirp.c | 9 +++++++++ slirp/bootp.c | 32 ++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-)
net/slirp.c +9 -0
@@ -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);
slirp/bootp.c +22 -10
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 32/97 vhost: fix invalid downcast
In reply to Michael RothFrom: Yury Kotov <[email protected]>
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.
--- hw/virtio/vhost.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/virtio/vhost.c +1 -3
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 33/97 pc: acpi: revert back to 1 SRAT entry for hotpluggable area
In reply to Michael RothFrom: Igor Mammedov <[email protected]>
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]).
--- hw/i386/acpi-build.c | 73 ++++++++------------------------------------ 1 file changed, 12 insertions(+), 61 deletions(-)
hw/i386/acpi-build.c +12 -61
@@ -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,
Signature · 1 line
2.17.1
PATCH 34/97 tests: update acpi expected files
In reply to Michael RothFrom: "Michael S. Tsirkin" <[email protected]>
--- 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(-)
tests/acpi-test-data/pc/DSDT binary +0 -0
tests/acpi-test-data/pc/DSDT.bridge binary +0 -0
tests/acpi-test-data/pc/DSDT.cphp binary +0 -0
tests/acpi-test-data/pc/DSDT.dimmpxm binary +0 -0
tests/acpi-test-data/pc/DSDT.ipmikcs binary +0 -0
tests/acpi-test-data/pc/DSDT.memhp binary +0 -0
tests/acpi-test-data/pc/DSDT.numamem binary +0 -0
tests/acpi-test-data/pc/SRAT.dimmpxm binary +0 -0
tests/acpi-test-data/pc/SRAT.memhp binary +0 -0
tests/acpi-test-data/q35/DSDT binary +0 -0
tests/acpi-test-data/q35/DSDT.bridge binary +0 -0
tests/acpi-test-data/q35/DSDT.cphp binary +0 -0
tests/acpi-test-data/q35/DSDT.dimmpxm binary +0 -0
tests/acpi-test-data/q35/DSDT.ipmibt binary +0 -0
tests/acpi-test-data/q35/DSDT.memhp binary +0 -0
tests/acpi-test-data/q35/DSDT.numamem binary +0 -0
tests/acpi-test-data/q35/SRAT.dimmpxm binary +0 -0
tests/acpi-test-data/q35/SRAT.memhp binary +0 -0
Signature · 1 line
2.17.1
PATCH 35/97 block: Fix use after free error in bdrv_open_inherit()
In reply to Michael RothFrom: Alberto Garcia <[email protected]>
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
--- block.c | 1 + 1 file changed, 1 insertion(+)
block.c +1 -0
@@ -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. */
Signature · 1 line
2.17.1
PATCH 36/97 job: Fix nested aio_poll() hanging in job_txn_apply
In reply to Michael RothFrom: Fam Zheng <[email protected]>
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.
--- job.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
job.c +5 -13
@@ -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); } }
Signature · 1 line
2.17.1
PATCH 37/97 target/xtensa: fix s32c1i TCGMemOp flags
In reply to Michael RothFrom: Max Filippov <[email protected]>
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.
--- target/xtensa/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/xtensa/translate.c +1 -1
@@ -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); }
Signature · 1 line
2.17.1
PATCH 38/97 nbd/server: fix bitmap export
In reply to Michael RothFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
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.
Message-Id: <[email protected]>
--- nbd/server.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
nbd/server.c +4 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH 39/97 clean up callback when del virtqueue
In reply to Michael RothFrom: liujunjie <[email protected]>
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.
--- hw/virtio/virtio.c | 2 ++ 1 file changed, 2 insertions(+)
hw/virtio/virtio.c +2 -0
@@ -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)
Signature · 1 line
2.17.1
PATCH 40/97 block/rbd: pull out qemu_rbd_convert_options
In reply to Michael RothFrom: Jeff Cody <[email protected]>
Code movement to pull the conversion from Qdict to BlockdevOptionsRbd into a helper function.
Message-id: 5b49a980f2cde6610ab1df41bb0277d00b5db893.1536704901.git.jcody@redhat.com
--- block/rbd.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
block/rbd.c +24 -12
@@ -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; }
Signature · 1 line
2.17.1
PATCH 41/97 block/rbd: Attempt to parse legacy filenames
In reply to Michael RothFrom: Jeff Cody <[email protected]>
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.
Message-id: 15b332e5432ad069441f7275a46080f465d789a0.1536704901.git.jcody@redhat.com
--- block/rbd.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-)
block/rbd.c +52 -2
@@ -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
Signature · 1 line
2.17.1
PATCH 42/97 block/rbd: add iotest for rbd legacy keyvalue filename parsing
In reply to Michael RothFrom: Jeff Cody <[email protected]>
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.
Message-id: f830580e339b974a83ed4870d11adcdc17f49a47.1536704901.git.jcody@redhat.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
tests/qemu-iotests/231 new file +62 -0
@@ -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 [email protected] + +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
tests/qemu-iotests/231.out new file +9 -0
@@ -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
tests/qemu-iotests/group +1 -0
@@ -226,3 +226,4 @@ 226 auto quick 227 auto quick 229 auto quick +231 auto quick
Signature · 1 line
2.17.1
PATCH 43/97 block/rbd: add deprecation documentation for filename keyvalue pairs
In reply to Michael RothFrom: Jeff Cody <[email protected]>
Message-id: 647f5b5ab7efd8bf567a504c832b1d2d6f719b23.1536704901.git.jcody@redhat.com
--- qemu-deprecated.texi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
qemu-deprecated.texi +15 -0
@@ -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)
Signature · 1 line
2.17.1
PATCH 44/97 target/arm: Fix cpu_get_tb_cpu_state() for non-SVE CPUs
In reply to Michael RothFrom: Richard Henderson <[email protected]>
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.
--- target/arm/helper.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-)
target/arm/helper.c +24 -21
@@ -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 )
Signature · 1 line
2.17.1
PATCH 45/97 ne2000: fix possible out of bound access in ne2000_receive
In reply to Michael RothFrom: Jason Wang <[email protected]>
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.
--- hw/net/ne2000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/ne2000.c +2 -2
@@ -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))
Signature · 1 line
2.17.1
PATCH 46/97 rtl8139: fix possible out of bound access
In reply to Michael RothFrom: Jason Wang <[email protected]>
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.
--- hw/net/rtl8139.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/net/rtl8139.c +4 -4
@@ -817,7 +817,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_tRTL8139State *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_tstatic 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_tif (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_tif (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;
Signature · 1 line
2.17.1
PATCH 47/97 pcnet: fix possible buffer overflow
In reply to Michael RothFrom: Jason Wang <[email protected]>
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.
--- hw/net/pcnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/pcnet.c +2 -2
@@ -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 */
Signature · 1 line
2.17.1
PATCH 48/97 net: ignore packet size greater than INT_MAX
In reply to Michael RothFrom: Jason Wang <[email protected]>
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()
--- net/net.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/net.c +6 -1
@@ -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) {
Signature · 1 line
2.17.1
PATCH 49/97 virt: Suppress external aborts on virt-2.10 and earlier
In reply to Michael RothFrom: Peter Maydell <[email protected]>
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.
Message-id: [email protected]
--- hw/arm/virt.c | 2 ++ 1 file changed, 2 insertions(+)
hw/arm/virt.c +2 -0
@@ -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 )
Signature · 1 line
2.17.1
PATCH 50/97 virtio: do not take address of packed members
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
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.
--- hw/char/virtio-serial-bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/char/virtio-serial-bus.c +3 -3
@@ -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;
Signature · 1 line
2.17.1
PATCH 51/97 block-backend: Set werror/rerror defaults in blk_new()
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
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.
--- block/block-backend.c | 3 +++ tests/qemu-iotests/067.out | 1 + 2 files changed, 4 insertions(+)
block/block-backend.c +3 -0
@@ -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);
tests/qemu-iotests/067.out +1 -0
@@ -385,6 +385,7 @@ Testing: -device virtio-scsi -device scsi-cd,id=cd0 { "return": [ { + "io-status": "ok", "device": "", "locked": false, "removable": true,
Signature · 1 line
2.17.1
PATCH 52/97 target/arm: Correct condition for v8M callee stack push
In reply to Michael RothFrom: Peter Maydell <[email protected]>
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.
Message-id: [email protected]
--- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/helper.c +1 -1
@@ -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); }
Signature · 1 line
2.17.1
PATCH 53/97 nbd/server: fix NBD_CMD_CACHE
In reply to Michael RothFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
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.
Message-Id: <[email protected]>
--- nbd/server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
nbd/server.c +2 -1
@@ -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); }
Signature · 1 line
2.17.1
PATCH 54/97 intel_iommu: introduce vtd_reset_caches()
In reply to Michael RothFrom: Peter Xu <[email protected]>
Provide the function and use it in vtd_init(). Used to reset both context entry cache and iotlb cache for the whole IOMMU unit.
*functional dep. for 2cc9ddcceb
--- hw/i386/intel_iommu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
hw/i386/intel_iommu.c +9 -4
@@ -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 );
Signature · 1 line
2.17.1
PATCH 55/97 intel_iommu: better handling of dmar state switch
In reply to Michael RothFrom: Peter Xu <[email protected]>
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.
--
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
--- hw/i386/intel_iommu.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
hw/i386/intel_iommu.c +14 -7
@@ -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)
Signature · 1 line
2.17.1
PATCH 56/97 nbd: fix NBD_FLAG_SEND_CACHE value
In reply to Michael RothFrom: "Denis V. Lunev" <[email protected]>
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.
Message-Id: <[email protected]>
--- include/block/nbd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/block/nbd.h +3 -1
@@ -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. */
Signature · 1 line
2.17.1
PATCH 57/97 migration: Stop postcopy fault thread before notifying
In reply to Michael RothFrom: Ilya Maximets <[email protected]>
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.
Message-Id: <[email protected]>
--- migration/postcopy-ram.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
migration/postcopy-ram.c +6 -5
@@ -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);
Signature · 1 line
2.17.1
PATCH 58/97 vhost-scsi: prevent using uninitialized vqs
In reply to Michael RothFrom: yuchenlin <[email protected]>
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
--- hw/scsi/vhost-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/vhost-scsi.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 59/97 target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
In reply to Michael RothFrom: Max Filippov <[email protected]>
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.
--- 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(-)
target/xtensa/core-dc232b.c +0 -2
@@ -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" }
target/xtensa/core-dc232b/gdb-config.inc.c +1 -0
@@ -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
target/xtensa/core-dc233c.c +0 -2
@@ -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" }
target/xtensa/core-dc233c/gdb-config.inc.c +1 -0
@@ -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
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
Hi Michael,
Quoted 10 lines · Michael Roth
From: Max Filippov <[email protected]>
Now that
xtensa_count_regsdoes the right thing, remove manual initialization of these fields from the affected configurations and letxtensa_finalize_configinitialize them. AddXTREG_ENDto terminate register lists.Signed-off-by Max Filippov <[email protected]>(cherry picked from commit 7da9111e77b9cdb3a927dcd47642b7ffff9de636)Signed-off-by Michael Roth <[email protected]>
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.
Signature · 2 lines
Thanks. -- Max
Re: [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
Quoting Max Filippov (2019-04-01 16:19:59)
Quoted 10 lines
Hi Michael,
Quoted 7 lines · Michael Roth
From: Max Filippov <[email protected]>
Now that
xtensa_count_regsdoes the right thing, remove manual initialization of these fields from the affected configurations and letxtensa_finalize_configinitialize them. AddXTREG_ENDto terminate register lists.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Max Filippov <[email protected]>(cherry picked from commit 7da9111e77b9cdb3a927dcd47642b7ffff9de636)Signed-off-by Michael Roth <[email protected]>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: [email protected]" 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!
Quoted 5 lines
Signature · 3 lines
-- Thanks. -- Max
Re: [Qemu-devel] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
Quoted 2 lines · Michael Roth
Quoted 1 line
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:
...
Quoted 3 lines
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: [email protected]" tags in the commit messages currently.
Oh, I see.
Quoted 4 lines
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.
Signature · 2 lines
Thanks. -- Max
PATCH 60/97 make-release: add skiboot .version file
In reply to Michael RothThis 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.
Message-id: [email protected]
--- scripts/make-release | 1 + 1 file changed, 1 insertion(+)
scripts/make-release +1 -0
@@ -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.
Signature · 1 line
2.17.1
PATCH 61/97 net: drop too large packet early
In reply to Michael RothFrom: Jason Wang <[email protected]>
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.
Message-id: [email protected]
--- include/net/net.h | 6 ------ net/net.c | 28 +++++++++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-)
include/net/net.h +0 -6
@@ -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,
net/net.c +17 -11
@@ -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 */
Signature · 1 line
2.17.1
PATCH 62/97 fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled
In reply to Michael RothFrom: Mark Cave-Ayland <[email protected]>
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)
--- hw/block/fdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/fdc.c +1 -1
@@ -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); }
Signature · 1 line
2.17.1
PATCH 63/97 qemu-img: Fix typo
In reply to Michael RothFrom: Max Reitz <[email protected]>
--- qemu-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-img.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 64/97 qemu-img: Fix leak
In reply to Michael RothFrom: Max Reitz <[email protected]>
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.
--- qemu-img.c | 1 + 1 file changed, 1 insertion(+)
qemu-img.c +1 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH 65/97 fmops: fix off-by-one in AR_TABLE and DR_TABLE array size
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Message-id: [email protected]
--- hw/audio/fmopl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/audio/fmopl.h +2 -2
@@ -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;
Signature · 1 line
2.17.1
PATCH 66/97 vfio-helpers: Fix qemu_vfio_open_pci() crash
In reply to Michael RothFrom: Markus Armbruster <[email protected]>
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
Message-id: [email protected]
--- util/vfio-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/vfio-helpers.c +1 -1
@@ -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); }/**
Signature · 1 line
2.17.1
PATCH 67/97 i2c: Move typedef of bitbang_i2c_interface to i2c.h
In reply to Michael RothFrom: BALATON Zoltan <[email protected]>
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.
--- 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(-)
hw/i2c/bitbang_i2c.h +0 -2
@@ -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
include/hw/i2c/i2c.h +2 -0
@@ -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);
include/hw/i2c/ppc4xx_i2c.h +0 -3
@@ -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)
Signature · 1 line
2.17.1
PATCH 68/97 i2c: Add a length check to the SMBus write handling
In reply to Michael RothFrom: Corey Minyard <[email protected]>
Avoid an overflow.
--- hw/i2c/smbus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/i2c/smbus.c +5 -1
@@ -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);
Signature · 1 line
2.17.1
PATCH 69/97 nbd/server: Advertise all contexts in response to bare LIST
In reply to Michael RothFrom: Eric Blake <[email protected]>
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.
Message-Id: <[email protected]>
--- nbd/server.c | 1 + 1 file changed, 1 insertion(+)
nbd/server.c +1 -0
@@ -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);
Signature · 1 line
2.17.1
PATCH 70/97 nbd/client: Make x-dirty-bitmap more reliable
In reply to Michael RothFrom: Eric Blake <[email protected]>
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.
Message-Id: <[email protected]>
*avoid context dep. on 6c2e581d
--- block/nbd-client.c | 5 +++++ 1 file changed, 5 insertions(+)
block/nbd-client.c +5 -0
@@ -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,
Signature · 1 line
2.17.1
PATCH 71/97 nbd/client: Send NBD_CMD_DISC if open fails after connect
In reply to Michael RothFrom: Eric Blake <[email protected]>
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:
Message-Id: <[email protected]>
*drop functional dep. on 6c2e581d4d7
--- block/nbd-client.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
block/nbd-client.c +17 -2
@@ -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; + } }
Signature · 1 line
2.17.1
PATCH 72/97 mirror: fix dead-lock
In reply to Michael RothFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
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 mainPrinting 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.
--- block/mirror.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
block/mirror.c +5 -8
@@ -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 */
Signature · 1 line
2.17.1
PATCH 73/97 iotests: simple mirror test with kvm on 1G image
In reply to Michael RothFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
This test is broken without previous commit fixing dead-lock in mirror.
*drop context deps from test groups not in 3.0 *modify expected QMP output to match encoding for 3.0
--- 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
tests/qemu-iotests/235 new file +76 -0
@@ -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()
tests/qemu-iotests/235.out new file +3 -0
@@ -0,0 +1,3 @@ +{u'return': {}} +{u'return': {}} +{u'return': {}}
tests/qemu-iotests/group +1 -0
@@ -227,3 +227,4 @@ 227 auto quick 229 auto quick 231 auto quick +235 auto quick
Signature · 1 line
2.17.1
PATCH 74/97 iotests: make 235 work on s390 (and others)
In reply to Michael RothFrom: Christian Borntraeger <[email protected]>
"-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.
--- tests/qemu-iotests/235 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/qemu-iotests/235 +3 -1
@@ -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()
Signature · 1 line
2.17.1
PATCH 75/97 Changes requirement for "vsubsbs" instruction
In reply to Michael RothFrom: "Paul A. Clarke" <[email protected]>
Changes requirement for "vsubsbs" instruction, which has been supported since ISA 2.03. (Please see section 5.9.1.2 of ISA 2.03)
--- target/ppc/translate/vmx-ops.inc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/translate/vmx-ops.inc.c +1 -1
@@ -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),
Signature · 1 line
2.17.1
PATCH 76/97 pcie: set link state inactive/active after hot unplug/plug
In reply to Michael RothFrom: Zheng Xiang <[email protected]>
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.
--- hw/pci/pcie.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/pci/pcie.c +12 -0
@@ -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 ); }
Signature · 1 line
2.17.1
PATCH 77/97 pc:piix4: Update smbus I/O space after a migration
In reply to Michael RothFrom: Corey Minyard <[email protected]>
Otherwise it won't be set up correctly and won't work after miigration.
--- hw/acpi/piix4.c | 1 + 1 file changed, 1 insertion(+)
hw/acpi/piix4.c +1 -0
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 78/97 hw/s390x: Fix bad mask in time2tod()
In reply to Michael RothFrom: Thomas Huth <[email protected]>
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.
Message-Id: <[email protected]>
--- include/hw/s390x/tod.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/s390x/tod.h +1 -1
@@ -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 */
Signature · 1 line
2.17.1
PATCH 79/97 linux-user: write(fd, NULL, 0) parity with linux's treatment of same
In reply to Michael RothFrom: Tony Garnock-Jones <[email protected]>
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.
Quoted 1 line
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.
Message-Id: <[email protected]>
--- linux-user/syscall.c | 3 +++ 1 file changed, 3 insertions(+)
linux-user/syscall.c +3 -0
@@ -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)) {
Signature · 1 line
2.17.1
PATCH 80/97 linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0
In reply to Michael RothFrom: Peter Maydell <[email protected]>
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.
Message-Id: <[email protected]>
*drop functional dep. on 2852aafd9d
--- linux-user/syscall.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
linux-user/syscall.c +18 -4
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 81/97 s390x: Return specification exception for unimplemented diag 308 subcodes
In reply to Michael RothFrom: Janosch Frank <[email protected]>
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.
Message-Id: <[email protected]>
--- target/s390x/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/diag.c +1 -1
@@ -130,7 +130,7 @@ out: }return ;default : -hw_error ("Unhandled diag308 subcode %" PRIx64, subcode); +s390_program_interrupt (env,PGM_SPECIFICATION ,ILEN_AUTO , ra);break ; } }
Signature · 1 line
2.17.1
PATCH 82/97 exec.c: Don't reallocate IOMMUNotifiers that are in use
In reply to Michael RothFrom: Peter Maydell <[email protected]>
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.
Message-id: [email protected]
--- exec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
exec.c +6 -4
@@ -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, ¬ifier->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 }
Signature · 1 line
2.17.1
PATCH 83/97 tpm: Zero-init structure to avoid uninitialized variables in valgrind log
In reply to Michael RothFrom: Stefan Berger <[email protected]>
Zero-init the ptm_loc structure so that we don't have fields that are not initialised.
--- hw/tpm/tpm_emulator.c | 1 + 1 file changed, 1 insertion(+)
hw/tpm/tpm_emulator.c +1 -0
@@ -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 ) {
Signature · 1 line
2.17.1
PATCH 84/97 tpm: use loop iterator to set sts data field
In reply to Michael RothFrom: Prasad J Pandit <[email protected]>
When TIS request is done, set 'sts' data field across all localities.
--- hw/tpm/tpm_tis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_tis.c +1 -1
@@ -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 ; } }
Signature · 1 line
2.17.1
PATCH 85/97 tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
In reply to Michael RothFrom: Stefan Berger <[email protected]>
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.
--- hw/tpm/tpm_tis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/tpm/tpm_tis.c +3 -1
@@ -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 */ /*
Signature · 1 line
2.17.1
PATCH 86/97 tpm: Make sure the locality received from backend is valid
In reply to Michael RothFrom: Stefan Berger <[email protected]>
Make sure that the locality passed from the backend to tpm_tis_request_completed() is valid.
--- hw/tpm/tpm_tis.c | 2 ++ 1 file changed, 2 insertions(+)
hw/tpm/tpm_tis.c +2 -0
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 87/97 block: Fix invalidate_cache error path for parent activation
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
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.
--- block.c | 1 + 1 file changed, 1 insertion(+)
block.c +1 -0
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 88/97 acpi: Make TPM 2.0 with TIS available as MSFT0101
In reply to Michael RothFrom: Stefan Berger <[email protected]>
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.
--- hw/i386/acpi-build.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
hw/i386/acpi-build.c +10 -2
@@ -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,
Signature · 1 line
2.17.1
PATCH 89/97 hw/rdma: another clang compilation fix
In reply to Michael RothFrom: Marcel Apfelbaum <[email protected]>
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.
Message-Id: <[email protected]>
*drop context dep. on c2dd117b385
--- hw/rdma/rdma_rm_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/rdma/rdma_rm_defs.h +2 -2
@@ -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
Signature · 1 line
2.17.1
PATCH 90/97 slirp: check sscanf result when emulating ident
In reply to Michael RothFrom: William Bowling <[email protected]>
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.
Message-Id: <[email protected]>
--- slirp/tcp_subr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
slirp/tcp_subr.c +5 -5
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 91/97 tpm_tis: fix loop that cancels any seizure by a lower locality
In reply to Michael RothFrom: Liam Merwick <[email protected]>
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.
--- hw/tpm/tpm_tis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_tis.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 92/97 bitmap: Update count after a merge
In reply to Michael RothFrom: Eric Blake <[email protected]>
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.
Message-id: [email protected]
*drop functional dep. on fa000f2f
--- util/hbitmap.c | 3 +++ 1 file changed, 3 insertions(+)
util/hbitmap.c +3 -0
@@ -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; }
Signature · 1 line
2.17.1
PATCH 93/97 qga: update docs with systemd suspend support info
In reply to Michael RothFrom: Daniel Henrique Barboza <[email protected]>
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.
--- qga/qapi-schema.json | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
qga/qapi-schema.json +14 -11
@@ -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
Signature · 1 line
2.17.1
PATCH 94/97 nvme: fix out-of-bounds access to the CMB
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
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.
--- hw/block/nvme.c | 2 +- tests/Makefile.include | 2 +- tests/nvme-test.c | 68 +++++++++++++++++++++++++++++++++++------- 3 files changed, 60 insertions(+), 12 deletions(-)
hw/block/nvme.c +1 -1
@@ -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, }, };
tests/Makefile.include +1 -1
@@ -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
tests/nvme-test.c +58 -10
83 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 95/97 9p: fix QEMU crash when renaming files
In reply to Michael RothFrom: Greg Kurz <[email protected]>
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.
--- hw/9pfs/9p.c | 3 +++ 1 file changed, 3 insertions(+)
hw/9pfs/9p.c +3 -0
@@ -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; }
Signature · 1 line
2.17.1
PATCH 96/97 usb-mtp: outlaw slashes in filenames
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Slash is unix directory separator, so they are not allowed in filenames. Note this also stops the classic escape via "../".
Message-id: [email protected]
--- hw/usb/dev-mtp.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/usb/dev-mtp.c +6 -0
@@ -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;
Signature · 1 line
2.17.1
PATCH 97/97 usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
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.
Message-id: [email protected]
--- hw/usb/dev-mtp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
hw/usb/dev-mtp.c +9 -4
@@ -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 );
Signature · 1 line
2.17.1
Quoted 10 lines · Michael Roth
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:
Quoted 9 lines
Please respond here or CC [email protected] 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-157466f2231e9b0 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-18849e58ccf0396 lsi53c895a: check message length value is valid
https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-6778a907458ad8 slirp: check data length while emulating ident function
https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-18954d07945e78e ppc/pnv: check size before data buffer access
https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-193645b76ef50f6 9p: write lock path in v9fs_co_open2() 5b3c77aa58 9p: take write lock on fid path updates (CVE-2018-19364)
Thanks,
Cole
Quoting Cole Robinson (2019-04-02 11:22:59)
Quoted 35 lines · Michael Roth
Quoted 10 lines
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:
Quoted 9 lines
Please respond here or CC [email protected] 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
6f2231e9b0seccomp: use SIGSYS signal instead of killing the threadbda08a5764seccomp: preferSCMP_ACT_KILL_PROCESSif availabled0699bd37cconfigure: require libseccomp 2.2.070dfabeaa7seccomp: set the seccomp filter to all threadshttps://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-18849
e58ccf0396lsi53c895a: check message length value is validhttps://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-6778
a907458ad8slirp: check data length while emulating ident function
Quoted 6 lines
https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-18954
d07945e78eppc/pnv: check size before data buffer accesshttps://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-19364
5b76ef50f69p: write lock path inv9fs_co_open2()5b3c77aa589p: 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
Quoted 4 lines
Thanks,
Cole
Quoted 306 lines · Michael Roth
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 [email protected] 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 inbdrv_open_inherit()BALATON Zoltan (1):
i2c: Move typedef ofbitbang_i2c_interfacetoi2c.hBharata B Rao (1):
spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefnChristian 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 migrationDaniel Henrique Barboza (1):
qga: update docs with systemd suspend support infoDaniel P. Berrangé (1):
qemu-img: fix regression copying secrets during convertDenis V. Lunev (1):
nbd: fixNBD_FLAG_SEND_CACHEvalueEduardo 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: SendNBD_CMD_DISCif open fails after connect
bitmap: Update count after a mergeFam Zheng (5):
nvme: Fixnvme_initerror handling
aio-posix: Don't countctx->notifieras progress when polling
aio: Doaio_notify_acceptonly during blockingaio_poll
slirp: Add sanity check for str option length
job: Fix nestedaio_poll()hanging injob_txn_applyGerd Hoffmann (3):
fmops: fix off-by-one inAR_TABLEandDR_TABLEarray size
usb-mtp: outlaw slashes in filenames
usb-mtp: useO_NOFOLLOWandO_CLOEXEC.Greg Kurz (1):
9p: fix QEMU crash when renaming filesIgor Mammedov (1):
pc: acpi: revert back to 1 SRAT entry for hotpluggable areaIlya Maximets (1):
migration: Stop postcopy fault thread before notifyingJanosch Frank (1):
s390x: Return specification exception for unimplemented diag 308 subcodesJason Wang (5):
ne2000: fix possible out of bound access inne2000_receive
rtl8139: fix possible out of bound access
pcnet: fix possible buffer overflow
net: ignore packet size greater thanINT_MAX
net: drop too large packet earlyJeff Cody (6):
block: for jobs, do not clearuser_pauseduntil after the resume
block: iotest to catch abort on forced blockjob cancel block/rbd: pull outqemu_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 pairsKevin Wolf (4):
block/qapi: Fix memory leak inqmp_query_blockstats()
mirror: Fail gracefully for source == target
block-backend: Set werror/rerror defaults inblk_new()
block: Fixinvalidate_cacheerror path for parent activationLiam Merwick (1):
tpm_tis: fix loop that cancels any seizure by a lower localityMarc-André Lureau (1):
monitor: fix oob command leakMarcel Apfelbaum (1):
hw/rdma: another clang compilation fixMark Cave-Ayland (1):
fdc: fix segfault infdctrl_stop_transfer()when DMA is disabledMarkus Armbruster (1):
vfio-helpers: Fixqemu_vfio_open_pci()crashMax Filippov (3):
target/xtensa: fix FPU2000 bugs
target/xtensa: fix s32c1i TCGMemOp flags target/xtensa: drop num_[core_]regs from dc232b/dc233c configsMax Reitz (2):
qemu-img: Fix typo
qemu-img: Fix leakMichael Roth (1):
make-release: add skiboot .version fileMichael S. Tsirkin (1):
tests: update acpi expected filesPaolo 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 CMBPaul A. Clarke (1):
Changes requirement for "vsubsbs" instructionPeter 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 0exec.c: Don't reallocate IOMMUNotifiers that are in usePeter Wu (1):
vnc: fix memleak of the "vnc-worker-output" namePeter Xu (2):
intel_iommu: introducevtd_reset_caches()
intel_iommu: better handling of dmar state switchPrasad J Pandit (1):
tpm: use loop iterator to set sts data fieldPrasad Singamsetty (1):
kvm: add call toqemu_add_opts()for -overcommit optionRichard Henderson (16):
target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw target/arm: Fix typo indo_sat_addsub_64
target/arm: Reorganize SVE WHILE
target/arm: Fix typo inhelper_sve_movz_d
target/arm: Fix typo inhelper_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 forLD_zprrandST_zprrtarget/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: AdjustFPCR_MASKfor FZ16
target/arm: Ignorefloat_flag_input_denormalfromfp_status_f16target/arm: Usefp_status_fp16fordo_fmpa_zpzzz_htarget/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half target/arm: Fixcpu_get_tb_cpu_state()for non-SVE CPUsStefan Berger (4):
tpm: Zero-init structure to avoid uninitialized variables in valgrind log
tpm: Make sure new locality passed totpm_tis_prep_abort()is valid
tpm: Make sure the locality received from backend is valid
acpi: Make TPM 2.0 with TIS available as MSFT0101Thomas 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 sameVladimir Sementsov-Ogievskiy (4):
nbd/server: fix bitmap export nbd/server: fixNBD_CMD_CACHE
mirror: fix dead-lock
iotests: simple mirror test with kvm on 1G imageWilliam Bowling (1):
slirp: check sscanf result when emulating identYury Kotov (1):
vhost: fix invalid downcastZheng Xiang (1):
pcie: set link state inactive/active after hot unplug/plugliujunjie (1):
clean up callback when del virtqueueyuchenlin (1):
vhost-scsi: prevent using uninitialized vqsblock.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 +-
Quoted 8 lines
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.
Quoting Philippe Mathieu-Daudé (2019-04-04 17:31:31)
Quoted 10 lines · Michael Roth
Quoted 9 lines
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:
...
Quoted 3 lines
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.
Quoted 3 lines
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.
Quoted 3 lines
Also
ade0075523478fa015afd5c6f6cc70681687818d:
"contrib/rdmacm-mux: Fix out-of-bounds risk"
Fixes regression introduced in 4.0 with a5d2f6f8773
Quoted 3 lines
And
3fd2092fd11b9e4220a08eca0663cc59178a6c3f:
"hw/usb: fix mistaken de-initialization of CCID state"
Fixes regression introduced in 4.0 with 7dea29e4
Quoted 4 lines
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!
Quoted 5 lines
Regards,
Phil.