]> Git Repo - qemu.git/log
qemu.git
6 years agoAdd missing bit for SSE instr in VEX decoding
Eugene Minibaev [Fri, 6 Apr 2018 13:41:52 +0000 (16:41 +0300)]
Add missing bit for SSE instr in VEX decoding

The 2-byte VEX prefix imples a leading 0Fh opcode byte.

Signed-off-by: Eugene Minibaev <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agomaint: Add .mailmap entries for patches claiming list authorship
Eric Blake [Mon, 26 Mar 2018 18:41:47 +0000 (13:41 -0500)]
maint: Add .mailmap entries for patches claiming list authorship

The list did not author any patches, but it does rewrite the
'From:' header of messages sent from any domain with restrictive
SPF policies that would otherwise prevent the message from reaching
all list recipients.  If a maintainer is not careful to undo the
list header rewrite, and the author did not include a manual
'From:' line in the body to fix the munged header, then 'git am'
happily attributes the patch to the list.  Add some mailmap
entries to correct the few that have escaped our attention; while
we also work on improving the tooling to catch the problem in
the future before a merge is even made.

Also improve the comments occurring in the file, including line
length improvements.

Signed-off-by: Eric Blake <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agodump: Fix build with newer gcc
Eric Blake [Tue, 27 Mar 2018 20:21:51 +0000 (15:21 -0500)]
dump: Fix build with newer gcc

gcc 8 on rawhide is picky enough to complain:

/home/dummy/qemu/dump.c: In function 'create_header32':
/home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Werror=stringop-truncation]
     strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But we already have SIG_LEN defined as the right length without needing
to do a strlen(), and memcpy() is better than strncpy() when we know
we do not want a trailing NUL byte.

Signed-off-by: Eric Blake <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agodevice-crash-test: Remove fixed isa-fdc entry
Thomas Huth [Fri, 16 Mar 2018 09:51:30 +0000 (10:51 +0100)]
device-crash-test: Remove fixed isa-fdc entry

Fixed by commit b3da551 ("fdc: Exit if ISA controller does not support DMA", 2018-03-16).

Signed-off-by: Thomas Huth <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoqemu-pr-helper: Write pidfile more often
Michal Privoznik [Tue, 3 Apr 2018 13:12:15 +0000 (15:12 +0200)]
qemu-pr-helper: Write pidfile more often

Let's write pidfile even if user did not request --daemon but
they requested just --pidfile. Libvirt will use exactly this.

Signed-off-by: Michal Privoznik <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoqemu-pr-helper: Daemonize before dropping privileges
Michal Privoznik [Tue, 3 Apr 2018 13:12:14 +0000 (15:12 +0200)]
qemu-pr-helper: Daemonize before dropping privileges

After we've dropped privileges it might be not possible to write
pidfile. For instance, if this binary is run as root (because
user wants it to write pidfile to some privileged location)
writing pidfile fails because privileges are dropped before we
even get to that.

Signed-off-by: Michal Privoznik <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agovirtio-serial: fix heapover-flow
linzhecheng [Wed, 28 Mar 2018 13:34:35 +0000 (21:34 +0800)]
virtio-serial: fix heapover-flow

Check device having the feature of VIRTIO_CONSOLE_F_EMERG_WRITE before
get config->emerg_wr. It is neccessary because sizeof(virtio_console_config)
is 8 byte if VirtIOSerial doesn't have the feature of
VIRTIO_CONSOLE_F_EMERG_WRITE(see virtio_serial_device_realize),
read/write emerg_wr will lead to heap-over-flow.

Signed-off-by: linzhecheng <[email protected]>
Message-Id: <20180328133435[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agokvmclock: fix clock_is_reliable on migration from QEMU < 2.9
Michael Chapman [Fri, 6 Apr 2018 05:34:06 +0000 (15:34 +1000)]
kvmclock: fix clock_is_reliable on migration from QEMU < 2.9

When migrating from a pre-2.9 QEMU, no clock_is_reliable flag is
transferred. We should assume that the source host has an unreliable
KVM_GET_CLOCK, rather than using whatever was determined locally, to
ensure that any drift from the TSC-based value calculated by the guest
is corrected.

Signed-off-by: Michael Chapman <[email protected]>
Message-Id: <20180406053406[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohw/dma/i82374: Avoid double creation of the 82374 controller
Philippe Mathieu-Daudé [Mon, 26 Mar 2018 15:34:37 +0000 (12:34 -0300)]
hw/dma/i82374: Avoid double creation of the 82374 controller

QEMU fails when used with the following command line:

    ./ppc64-softmmu/qemu-system-ppc64 -S -machine 40p -device i82374
    qemu-system-ppc64: hw/isa/isa-bus.c:110: isa_bus_dma: Assertion `!bus->dma[0] && !bus->dma[1]' failed.

The 40p machine type already creates the device i82374. If specified in the
command line, it will try to create it again, hence generating the error. The
function isa_bus_dma() isn't supposed to be called twice for the same bus.
Check the bus doesn't already have a DMA controller registered before creating
the device.

Fixes: https://bugs.launchpad.net/qemu/+bug/1721224
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20180326153441[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohw/scsi: support SCSI-2 passthrough without PI
Daniel Henrique Barboza [Tue, 27 Mar 2018 21:14:51 +0000 (18:14 -0300)]
hw/scsi: support SCSI-2 passthrough without PI

QEMU SCSI code makes assumptions about how the PROTECT and BYTCHK
works in the protocol, denying support for PI (Protection
Information) in case the guest OS requests it. However, in SCSI versions 2
and older, there is no PI concept in the protocol.

This means that when dealing with such devices:

- there is no PROTECT bit in byte 5 of the standard INQUIRY response. The
whole byte is marked as "Reserved";

- there is no RDPROTECT in byte 2 of READ. We have 'Logical Unit Number'
in this field instead;

- there is no VRPROTECT in byte 2 of VERIFY. We have 'Logical Unit Number'
in this field instead. This also means that the BYTCHK bit in this case
is not related to PI.

Since QEMU does not consider these changes, a SCSI passthrough using
a SCSI-2 device will not work. It will mistake these fields with
PI information and return Illegal Request SCSI SENSE thinking
that the driver is asking for PI support.

This patch fixes it by adding a new attribute called 'scsi_version'
that is read from the standard INQUIRY response of passthrough
devices. This allows for a version verification before applying
conditions related to PI that doesn't apply for older versions.

Reported-by: Dac Nguyen <[email protected]>
Signed-off-by: Daniel Henrique Barboza <[email protected]>
Message-Id: <20180327211451[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoscsi-disk: allow customizing the SCSI version
Paolo Bonzini [Thu, 5 Apr 2018 16:09:51 +0000 (18:09 +0200)]
scsi-disk: allow customizing the SCSI version

We would like to have different behavior for passthrough devices
depending on the SCSI version they expose.  To prepare for that,
allow the user of emulated devices to specify the desired SCSI
level, and adjust the emulation according to the property value.
The next patch will set the level for scsi-block and scsi-generic
devices.

Based on a patch by Daniel Henrique Barboza
<[email protected]>.

Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoscsi-disk: Don't enlarge min_io_size to max_io_size
Fam Zheng [Tue, 27 Mar 2018 16:41:41 +0000 (00:41 +0800)]
scsi-disk: Don't enlarge min_io_size to max_io_size

Some backends report big max_io_sectors. Making min_io_size the same
value in this case will make it impossible for guest to align memory,
therefore the disk may not be usable at all.

Do not enlarge them when they are zero.

Reported-by: David Gibson <[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
Message-Id: <20180327164141[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoconfigure: Add missing configure options to help text
Thomas Huth [Tue, 27 Mar 2018 15:09:30 +0000 (17:09 +0200)]
configure: Add missing configure options to help text

We forgot to mention --with-git, --libexecdir and --with-pkgversion
so far.

Signed-off-by: Thomas Huth <[email protected]>
Message-Id: <1522163370[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoi386/hyperv: error out if features requested but unsupported
Roman Kagan [Fri, 30 Mar 2018 17:02:09 +0000 (20:02 +0300)]
i386/hyperv: error out if features requested but unsupported

In order to guarantee compatibility on migration, QEMU should have
complete control over the features it announces to the guest via CPUID.

However, for a number of Hyper-V-related cpu properties, if the
corresponding feature is not supported by the underlying KVM, the
propery is silently ignored and the feature is not announced to the
guest.

Refuse to start with an error instead.

Signed-off-by: Roman Kagan <[email protected]>
Message-Id: <20180330170209[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoi386/hyperv: add hv-frequencies cpu property
Roman Kagan [Fri, 30 Mar 2018 17:02:08 +0000 (20:02 +0300)]
i386/hyperv: add hv-frequencies cpu property

In order to guarantee compatibility on migration, QEMU should have
complete control over the features it announces to the guest via CPUID.

However, the availability of Hyper-V frequency MSRs
(HV_X64_MSR_TSC_FREQUENCY and HV_X64_MSR_APIC_FREQUENCY) depends solely
on the support for them in the underlying KVM.

Introduce "hv-frequencies" cpu property (off by default) which gives
QEMU full control over whether these MSRs are announced.

While at this, drop the redundant check of the cpu tsc frequency, and
decouple this feature from hv-time.

Signed-off-by: Roman Kagan <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <20180330170209[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agotarget/i386: WHPX: set CPUID_EXT_HYPERVISOR bit
Justin Terry (VM) [Mon, 26 Mar 2018 17:06:58 +0000 (10:06 -0700)]
target/i386: WHPX: set CPUID_EXT_HYPERVISOR bit

Implements the CPUID trap for CPUID 1 to include the
CPUID_EXT_HYPERVISOR flag in the ECX results. This was preventing some
older linux kernels from booting when trying to access MSR's that dont
make sense when virtualized.

Signed-off-by: Justin Terry (VM) <[email protected]>
Message-Id: <20180326170658[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agomemfd: fix vhost-user-test on non-memfd capable host
Marc-André Lureau [Wed, 28 Mar 2018 12:18:04 +0000 (14:18 +0200)]
memfd: fix vhost-user-test on non-memfd capable host

On RHEL7, memfd is not supported, and vhost-user-test fails:
TEST: tests/vhost-user-test... (pid=10248)
  /x86_64/vhost-user/migrate:
  qemu-system-x86_64: -object memory-backend-memfd,id=mem,size=2M,: failed to create memfd
FAIL

There is a qemu_memfd_check() to prevent running memfd path, but it
also checks for fallback implementation. Let's specialize
qemu_memfd_check() to check memfd only, while qemu_memfd_alloc_check()
checks for the qemu_memfd_alloc() API.

Reported-by: Miroslav Rezanina <[email protected]>
Tested-by: Miroslav Rezanina <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Message-Id: <20180328121804[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
6 years agoscripts/checkpatch.pl: Bug fix
Su Hang [Mon, 26 Mar 2018 02:06:22 +0000 (10:06 +0800)]
scripts/checkpatch.pl: Bug fix

Commit 2b9aef6fcd96ba7ed8c1ee723e391901852d344c introduced a regression:
checkpatch.pl started complaining about the following valid pattern:
do {
     /* something */
} while (condition);

Fix the script to once again permit this pattern.

Signed-off-by: Su Hang <[email protected]>
Message-Id: <1522029982[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agotarget/i386: Fix andn instruction
Alexandro Sanchez Bach [Thu, 5 Apr 2018 12:40:58 +0000 (14:40 +0200)]
target/i386: Fix andn instruction

In commit 7073fbada733c8d10992f00772c9b9299d740e9b, the `andn` instruction
was implemented via `tcg_gen_andc` but passes the operands in the wrong
order:
- X86 defines `andn dest,src1,src2` as: dest = ~src1 & src2
- TCG defines `andc dest,src1,src2` as: dest = src1 & ~src2

The following simple test shows the issue:

    #include <stdio.h>
    #include <stdint.h>

    int main(void) {
        uint32_t ret = 0;
        __asm (
            "mov $0xFF00, %%ecx\n"
            "mov $0x0F0F, %%eax\n"
            "andn %%ecx, %%eax, %%ecx\n"
            "mov %%ecx, %0\n"
          : "=r" (ret));
        printf("%08X\n", ret);
        return 0;
    }

This patch fixes the problem by simply swapping the order of the two last
arguments in `tcg_gen_andc_tl`.

Reported-by: Alexandro Sanchez Bach <[email protected]>
Signed-off-by: Alexandro Sanchez Bach <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agosys_membarrier: fix up include directives
Bruce Rogers [Thu, 29 Mar 2018 15:10:18 +0000 (09:10 -0600)]
sys_membarrier: fix up include directives

Our rule right now is to use <> for external headers only.
util/sys_membarrier.c violates that. Fix it up.

Signed-off-by: Bruce Rogers <[email protected]>
Message-Id: <20180329151018[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoUpdate version for v2.12.0-rc2 release
Peter Maydell [Wed, 4 Apr 2018 19:37:20 +0000 (20:37 +0100)]
Update version for v2.12.0-rc2 release

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
Peter Maydell [Wed, 4 Apr 2018 16:48:18 +0000 (17:48 +0100)]
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging

# gpg: Signature made Wed 04 Apr 2018 17:07:57 BST
# gpg:                using RSA key BDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/block-pull-request:
  block/rbd: remove processed options from qdict

Signed-off-by: Peter Maydell <[email protected]>
6 years agoblock/rbd: remove processed options from qdict
Jeff Cody [Wed, 4 Apr 2018 15:40:45 +0000 (11:40 -0400)]
block/rbd: remove processed options from qdict

Commit 4bfb274 added some QAPIfication of option parsing in
qemu_rbd_open().  We need to remove all the options we processed,
otherwise in bdrv_open_inherit() we will think the remaining options are
invalid.

(This needs to go in 2.12 to avoid a regression that prevents rbd
from being opened.)

Suggested-by: Kevin Wolf <[email protected]>
Signed-off-by: Jeff Cody <[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
6 years agotcg: fix 16-byte vector operations detection
Laurent Vivier [Wed, 28 Mar 2018 13:31:52 +0000 (15:31 +0200)]
tcg: fix 16-byte vector operations detection

configure tries to detect if the compiler
supports 16-byte vector operations.

As stated in the comment of the detection
program, there is a problem with the system
compiler on GCC on Centos 7.

This program doesn't actually detect the problem
with GCC on RHEL7 on PPC64LE (Red Hat 4.8.5-28).

This patch updates the test to look more like
it is in QEMU helpers, and now detects the problem.

The error reported is:

  CC      ppc64-softmmu/accel/tcg/tcg-runtime-gvec.o
  ..//accel/tcg/tcg-runtime-gvec.c: In function ‘helper_gvec_shl8i’:
  ../accel/tcg/tcg-runtime-gvec.c:558:26: internal compiler error: in emit_move_insn, at expr.c:3495
           *(vec8 *)(d + i) = *(vec8 *)(a + i) << shift;
                            ^
Fixes: db43267 "tcg: Add generic vector expanders"
Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Miroslav Rezanina <[email protected]>
Message-id: 20180328133152[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Wed, 4 Apr 2018 13:00:07 +0000 (14:00 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Tue 03 Apr 2018 16:48:53 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <[email protected]>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  iotests: Test abnormally large size in compressed cluster descriptor
  qemu-iotests: Use ppc64 qemu_arch on ppc64le host
  iotests: Test preallocated truncate of 2G image
  block/file-posix: Fix fully preallocated truncate
  iotests: fix 208 for luks format
  iotests: Update 186 after commit ac64273c66ab136c44043259162
  iotests: Update 051 and 186 after commit 1454509726719e0933c
  block: handle invalid lseek returns gracefully
  gluster: Fix blockdev-add with server.N.type=unix

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
Peter Maydell [Wed, 4 Apr 2018 11:33:23 +0000 (12:33 +0100)]
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging

# gpg: Signature made Tue 03 Apr 2018 17:10:22 BST
# gpg:                using RSA key BDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/block-pull-request:
  gluster: Fix blockdev-add with server.N.type=unix
  blockjob: use qapi enum helpers
  blockjob: leak fix, remove from txn when failing early

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging
Peter Maydell [Wed, 4 Apr 2018 10:13:52 +0000 (11:13 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging

Fix memory leaks when using object_property_get_str()

# gpg: Signature made Tue 03 Apr 2018 15:00:10 BST
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <[email protected]>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-pull-request:
  sev/i386: fix memory leak in sev_guest_init()
  exec: fix memory leak in find_max_supported_pagesize()

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-2.12-pull-request...
Peter Maydell [Wed, 4 Apr 2018 08:36:14 +0000 (09:36 +0100)]
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-2.12-pull-request' into staging

# gpg: Signature made Tue 03 Apr 2018 11:33:31 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <[email protected]>"
# gpg:                 aka "Laurent Vivier <[email protected]>"
# gpg:                 aka "Laurent Vivier (Red Hat) <[email protected]>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-2.12-pull-request:
  linux-user: fix TARGET___O_TMPFILE for sparc
  linux-user: define TARGET_ARCH_HAS_KA_RESTORER
  linux-user: fix alpha signal emulation

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20180403' into staging
Peter Maydell [Tue, 3 Apr 2018 22:23:58 +0000 (23:23 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180403' into staging

- fix a memory leak in the ipl code introduced with this release
- increase timeout in the bios to avoid hangs during migration (and
  rebuild bios to activate the change)

# gpg: Signature made Tue 03 Apr 2018 09:28:30 BST
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20180403:
  pc-bios/s390-ccw: update image
  pc-bios/s390-ccw: Increase virtio timeout to 30 seconds
  hw/s390x: fix memory leak in s390_init_ipl_dev()

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/xtensa/tags/20180402-xtensa' into staging
Peter Maydell [Tue, 3 Apr 2018 18:02:46 +0000 (19:02 +0100)]
Merge remote-tracking branch 'remotes/xtensa/tags/20180402-xtensa' into staging

xtensa-specific fixes for linux-user:

- fix flushing registers for signal processing in call8 and call12 frames;
- fix PC value for restarted syscalls;
- fix sysv IPC structures;
- fix fadvise64 syscall;

generic fixes for linux-user:

- fix QEMU assertion in multithreaded application by calling cpu_copy
  under clone_lock;
- fix mq_getsetattr implementation;
- fix error propagation in clock_gettime;
- implement clock_settime.

# gpg: Signature made Mon 02 Apr 2018 18:07:08 BST
# gpg:                using RSA key 51F9CC91F83FA044
# gpg: Good signature from "Max Filippov <[email protected]>"
# gpg:                 aka "Max Filippov <[email protected]>"
# gpg:                 aka "Max Filippov <[email protected]>"
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044

* remotes/xtensa/tags/20180402-xtensa:
  target/xtensa: linux-user: fix fadvise64 call
  linux-user: implement clock_settime
  linux-user: fix error propagation in clock_gettime
  target/xtensa: linux-user: fix sysv IPC structures
  linux-user: fix mq_getsetattr implementation
  linux-user: call cpu_copy under clone_lock
  target/xtensa: linux-user: rewind pc for restarted syscall
  target/xtensa: fix flush_window_regs

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'mreitz/tags/pull-block-2018-04-03' into queue-block
Kevin Wolf [Tue, 3 Apr 2018 15:48:45 +0000 (17:48 +0200)]
Merge remote-tracking branch 'mreitz/tags/pull-block-2018-04-03' into queue-block

A fix for preallocated truncation, a new iotest, and a fix to make the iotests work more comfortably on ppc64

# gpg: Signature made Tue Apr  3 17:40:57 2018 CEST
# gpg:                using RSA key F407DB0061D5CF40
# gpg: Good signature from "Max Reitz <[email protected]>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2018-04-03:
  iotests: Test abnormally large size in compressed cluster descriptor
  qemu-iotests: Use ppc64 qemu_arch on ppc64le host
  iotests: Test preallocated truncate of 2G image
  block/file-posix: Fix fully preallocated truncate

Signed-off-by: Kevin Wolf <[email protected]>
6 years agoiotests: Test abnormally large size in compressed cluster descriptor
Alberto Garcia [Thu, 29 Mar 2018 12:07:45 +0000 (15:07 +0300)]
iotests: Test abnormally large size in compressed cluster descriptor

L2 entries for compressed clusters have a field that indicates the
number of sectors used to store the data in the image.

That's however not the size of the compressed data itself, just the
number of sectors where that data is located. The actual data size is
usually not a multiple of the sector size, and therefore cannot be
represented with this field.

The way it works is that QEMU reads all the specified sectors and
starts decompressing the data until there's enough to recover the
original uncompressed cluster. If there are any bytes left that
haven't been decompressed they are simply ignored.

One consequence of this is that even if the size field is larger than
it needs to be QEMU can handle it just fine: it will read more data
from disk but it will ignore the extra bytes.

This test creates an image with two compressed clusters that use 5
sectors (2.5 KB) each, increases the size field to the maximum (8192
sectors, or 4 MB) and verifies that the data can be read without
problems.

This test is important because while the decompressed data takes
exactly one cluster, the maximum value allowed in the compressed size
field is twice the cluster size. So although QEMU won't produce images
with such large values we need to make sure that it can handle them.

Another effect of increasing the size field is that it can make
it include data from the following host cluster(s). In this case
'qemu-img check' will detect that the refcounts are not correct, and
we'll need to rebuild them.

Additionally, this patch also tests that decreasing the size corrupts
the image since the original data can no longer be recovered. In this
case QEMU returns an error when trying to read the compressed data,
but 'qemu-img check' doesn't see anything wrong if the refcounts are
consistent.

One possible task for the future is to make 'qemu-img check' verify
the sizes of the compressed clusters, by trying to decompress the data
and checking that the size stored in the L2 entry is correct.

Signed-off-by: Alberto Garcia <[email protected]>
Message-id: 20180329120745[email protected]
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
6 years agoqemu-iotests: Use ppc64 qemu_arch on ppc64le host
Lukáš Doktor [Thu, 29 Mar 2018 11:20:53 +0000 (13:20 +0200)]
qemu-iotests: Use ppc64 qemu_arch on ppc64le host

The qemu target does not always correspond to the host machine type. For
example ppc64le machine target is ppc64. Let's introduce "qemu_arch"
variable to store the matching qemu architecture related to the current
architecture and use it when auto-detecting the default qemu binary.

Signed-off-by: Lukáš Doktor <[email protected]>
Message-id: 20180329112053[email protected]
Signed-off-by: Max Reitz <[email protected]>
6 years agoiotests: Test preallocated truncate of 2G image
Max Reitz [Wed, 28 Feb 2018 13:13:15 +0000 (14:13 +0100)]
iotests: Test preallocated truncate of 2G image

Signed-off-by: Max Reitz <[email protected]>
Message-id: 20180228131315[email protected]
Reviewed-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
6 years agoblock/file-posix: Fix fully preallocated truncate
Max Reitz [Wed, 28 Feb 2018 13:13:14 +0000 (14:13 +0100)]
block/file-posix: Fix fully preallocated truncate

Storing the lseek() result in an int results in it overflowing when the
file is at least 2 GB big.  Then, we have a 50 % chance of the result
being "negative" and thus thinking an error occurred when actually
everything went just fine.

So we should use the correct type for storing the result: off_t.

Reported-by: Daniel P. Berrange <[email protected]>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1549231
Cc: [email protected]
Signed-off-by: Max Reitz <[email protected]>
Message-id: 20180228131315[email protected]
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
6 years agoiotests: fix 208 for luks format
Vladimir Sementsov-Ogievskiy [Fri, 30 Mar 2018 14:44:12 +0000 (17:44 +0300)]
iotests: fix 208 for luks format

Support luks images creatins like in 205

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-04-02' into staging
Peter Maydell [Tue, 3 Apr 2018 14:59:50 +0000 (15:59 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-04-02' into staging

nbd patches for 2018-04-02

- Eric Blake: nbd: Fix 32-bit compilation on BLOCK_STATUS
- Eric Blake: nbd/client: Correctly handle bad server REP_META_CONTEXT
- Eric Blake: nbd: trace meta context negotiation

# gpg: Signature made Mon 02 Apr 2018 15:15:01 BST
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <[email protected]>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <[email protected]>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2018-04-02:
  nbd: trace meta context negotiation
  nbd/client: Correctly handle bad server REP_META_CONTEXT
  nbd: Fix 32-bit compilation on BLOCK_STATUS

Signed-off-by: Peter Maydell <[email protected]>
6 years agoiotests: Update 186 after commit ac64273c66ab136c44043259162
Alberto Garcia [Thu, 22 Mar 2018 14:45:51 +0000 (16:45 +0200)]
iotests: Update 186 after commit ac64273c66ab136c44043259162

Commit ac64273c66ab136c44 modified the output of iotest 186, changing
the QOM path of floppy drives from /machine/unattached/device[17] to
/machine/unattached/device[13].

Instead of updating the test output to reflect this change, this patch
adds a new filter that hides all QOM paths from the 'Attached to:'
line of the 'info block' command.

Signed-off-by: Alberto Garcia <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
6 years agoiotests: Update 051 and 186 after commit 1454509726719e0933c
Alberto Garcia [Thu, 22 Mar 2018 14:45:50 +0000 (16:45 +0200)]
iotests: Update 051 and 186 after commit 1454509726719e0933c

SCSI controllers are no longer created automatically for
-drive if=scsi, so this patch updates the tests that relied
on that.

Signed-off-by: Alberto Garcia <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Cc: Thomas Huth <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
6 years agogluster: Fix blockdev-add with server.N.type=unix
Kevin Wolf [Tue, 3 Apr 2018 11:08:10 +0000 (13:08 +0200)]
gluster: Fix blockdev-add with server.N.type=unix

The legacy command line interface gets the socket path from an option
called 'socket'. QAPI in contract uses SocketAddress, where the
corresponding option is called 'path'.

Fix the gluster block driver to accept both 'socket' and 'path', with
'path' being the preferred syntax.

https://bugzilla.redhat.com/show_bug.cgi?id=1545155

Cc: [email protected]
Signed-off-by: Kevin Wolf <[email protected]>
Message-id: 20180403110810[email protected]
Signed-off-by: Jeff Cody <[email protected]>
6 years agoblockjob: use qapi enum helpers
Marc-André Lureau [Tue, 27 Mar 2018 15:30:11 +0000 (17:30 +0200)]
blockjob: use qapi enum helpers

QAPI generator provide #define helpers for looking up enum string.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-id: 20180327153011[email protected]
Signed-off-by: Jeff Cody <[email protected]>
6 years agoblockjob: leak fix, remove from txn when failing early
Marc-André Lureau [Wed, 28 Mar 2018 14:09:26 +0000 (10:09 -0400)]
blockjob: leak fix, remove from txn when failing early

This fixes leaks found by ASAN such as:
  GTESTER tests/test-blockjob
=================================================================
==31442==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f88483cba38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x7f8845e1bd77 in g_malloc0 ../glib/gmem.c:129
    #2 0x7f8845e1c04b in g_malloc0_n ../glib/gmem.c:360
    #3 0x5584d2732498 in block_job_txn_new /home/elmarco/src/qemu/blockjob.c:172
    #4 0x5584d2739b28 in block_job_create /home/elmarco/src/qemu/blockjob.c:973
    #5 0x5584d270ae31 in mk_job /home/elmarco/src/qemu/tests/test-blockjob.c:34
    #6 0x5584d270b1c1 in do_test_id /home/elmarco/src/qemu/tests/test-blockjob.c:57
    #7 0x5584d270b65c in test_job_ids /home/elmarco/src/qemu/tests/test-blockjob.c:118
    #8 0x7f8845e40b69 in test_case_run ../glib/gtestutils.c:2255
    #9 0x7f8845e40f29 in g_test_run_suite_internal ../glib/gtestutils.c:2339
    #10 0x7f8845e40fd2 in g_test_run_suite_internal ../glib/gtestutils.c:2351
    #11 0x7f8845e411e9 in g_test_run_suite ../glib/gtestutils.c:2426
    #12 0x7f8845e3fe72 in g_test_run ../glib/gtestutils.c:1692
    #13 0x5584d270d6e2 in main /home/elmarco/src/qemu/tests/test-blockjob.c:377
    #14 0x7f8843641f29 in __libc_start_main (/lib64/libc.so.6+0x20f29)

Add an assert to make sure that the job doesn't have associated txn before free().

[Jeff Cody: N.B., used updated patch provided by John Snow]

Signed-off-by: Marc-André Lureau <[email protected]>
Signed-off-by: Jeff Cody <[email protected]>
6 years agoblock: handle invalid lseek returns gracefully
Jeff Cody [Tue, 3 Apr 2018 04:37:26 +0000 (00:37 -0400)]
block: handle invalid lseek returns gracefully

In commit 223a23c198787328ae75bc65d84edf5fde33c0b6, we implemented a
workaround in the gluster driver to handle invalid values returned for
SEEK_DATA or SEEK_HOLE.

In some instances, these same invalid values can be seen in the posix
file handler as well - for example, it has been reported on FUSE gluster
mounts.

Calling assert() for these invalid values is overly harsh; we can safely
return -EIO and allow this case to be treated as a "learned nothing"
case (e.g., D4 / H4, as commented in the code).

This patch does the same thing that 223a23c198787 did for gluster.c,
except in file-posix.c

Signed-off-by: Jeff Cody <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
6 years agogluster: Fix blockdev-add with server.N.type=unix
Kevin Wolf [Tue, 3 Apr 2018 10:58:32 +0000 (12:58 +0200)]
gluster: Fix blockdev-add with server.N.type=unix

The legacy command line interface gets the socket path from an option
called 'socket'. QAPI in contract uses SocketAddress, where the
corresponding option is called 'path'.

Fix the gluster block driver to accept both 'socket' and 'path', with
'path' being the preferred syntax.

https://bugzilla.redhat.com/show_bug.cgi?id=1545155

Cc: [email protected]
Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
6 years agolinux-user: fix TARGET___O_TMPFILE for sparc
Laurent Vivier [Mon, 2 Apr 2018 10:24:53 +0000 (12:24 +0200)]
linux-user: fix TARGET___O_TMPFILE for sparc

Signed-off-by: Laurent Vivier <[email protected]>
Message-Id: <20180402102453[email protected]>

6 years agolinux-user: define TARGET_ARCH_HAS_KA_RESTORER
Laurent Vivier [Mon, 2 Apr 2018 10:24:52 +0000 (12:24 +0200)]
linux-user: define TARGET_ARCH_HAS_KA_RESTORER

Sparc as an extended sigaction structure containing
the field ka_restorer used in place of sa_restorer.

Define TARGET_ARCH_HAS_KA_RESTORER and use it
with sparc.

Signed-off-by: Laurent Vivier <[email protected]>
Message-Id: <20180402102453[email protected]>

6 years agolinux-user: fix alpha signal emulation
Laurent Vivier [Sun, 1 Apr 2018 20:46:53 +0000 (22:46 +0200)]
linux-user: fix alpha signal emulation

setup_frame() doesn't set correctly the address of the trampoline code.
The offset of retcode array must be added to the stack frame address.

Signed-off-by: Laurent Vivier <[email protected]>
Message-Id: <20180401204653[email protected]>

6 years agopc-bios/s390-ccw: update image
Cornelia Huck [Thu, 29 Mar 2018 14:13:37 +0000 (10:13 -0400)]
pc-bios/s390-ccw: update image

Contains the following commits:
- pc-bios/s390-ccw: Move string arrays from bootmap header to .c file
- pc-bios/s390-ccw: Increase virtio timeout to 30 seconds

Signed-off-by: Cornelia Huck <[email protected]>
6 years agopc-bios/s390-ccw: Increase virtio timeout to 30 seconds
Thomas Huth [Thu, 29 Mar 2018 09:37:31 +0000 (11:37 +0200)]
pc-bios/s390-ccw: Increase virtio timeout to 30 seconds

The current timeout is set to only three seconds - and considering that
vring_wait_reply() or rather get_second() is not doing any rounding,
the real timeout is likely rather 2 seconds in most cases. When the
host is really badly loaded, it's possible that we hit this timeout by
mistake; it's even more likely if we run the guest in TCG mode instead
of KVM.

So let's increase the timeout to 30 seconds instead to ease this situation
(30 seconds is also the timeout that is used by the Linux SCSI subsystem
for example, so this seems to be a sane value for block IO timeout).

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1549079
Signed-off-by: Thomas Huth <[email protected]>
Message-Id: <1522316251[email protected]>
Acked-by: Christian Borntraeger <[email protected]>
[CH: tweaked commit message]
Signed-off-by: Cornelia Huck <[email protected]>
6 years agohw/s390x: fix memory leak in s390_init_ipl_dev()
Greg Kurz [Thu, 29 Mar 2018 09:10:06 +0000 (11:10 +0200)]
hw/s390x: fix memory leak in s390_init_ipl_dev()

The string returned by object_property_get_str() is dynamically allocated.

Fixes: 3c4e9baacf4d9
Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <152231460685.69730.14860451936216690693[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
6 years agosev/i386: fix memory leak in sev_guest_init()
Greg Kurz [Thu, 29 Mar 2018 09:10:21 +0000 (11:10 +0200)]
sev/i386: fix memory leak in sev_guest_init()

The string returned by object_property_get_str() is dynamically allocated.

Fixes: d8575c6c0242b
Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <152231462116.69730.14119625999092384450[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agoexec: fix memory leak in find_max_supported_pagesize()
Greg Kurz [Thu, 29 Mar 2018 09:09:46 +0000 (11:09 +0200)]
exec: fix memory leak in find_max_supported_pagesize()

The string returned by object_property_get_str() is dynamically allocated.

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <152231458624.69730.1752893648612848392[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agonbd: trace meta context negotiation
Eric Blake [Fri, 30 Mar 2018 13:09:50 +0000 (08:09 -0500)]
nbd: trace meta context negotiation

Having a more detailed log of the interaction between client and
server is invaluable in debugging how meta context negotiation
actually works.

Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180330130950.1931229[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
6 years agonbd/client: Correctly handle bad server REP_META_CONTEXT
Eric Blake [Thu, 29 Mar 2018 23:18:37 +0000 (18:18 -0500)]
nbd/client: Correctly handle bad server REP_META_CONTEXT

It's never a good idea to blindly read for size bytes as
returned by the server without first validating that the size
is within bounds; a malicious or buggy server could cause us
to hang or get out of sync from reading further messages.

It may be smarter to try and teach the client to cope with
unexpected context ids by silently ignoring them instead of
hanging up on the server, but for now, if the server doesn't
reply with exactly the one context we expect, it's easier to
just give up - however, if we give up for any reason other
than an I/O failure, we might as well try to politely tell
the server we are quitting rather than continuing.

Fix some typos in the process.

Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180329231837.1914680[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
6 years agonbd: Fix 32-bit compilation on BLOCK_STATUS
Eric Blake [Tue, 27 Mar 2018 21:05:17 +0000 (16:05 -0500)]
nbd: Fix 32-bit compilation on BLOCK_STATUS

iotests 123 and 209 fail on 32-bit platforms.  The culprit:
sizeof(extent) is wrong; we want sizeof(*extent).  But since
the struct is 8 bytes, it happened to work on 64-bit platforms
where the pointer is also 8 bytes (nasty).

Fixes: 78a33ab58
Reported-by: Max Reitz <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180327210517.1804242[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
6 years agotarget/xtensa: linux-user: fix fadvise64 call
Max Filippov [Sun, 1 Apr 2018 22:02:34 +0000 (15:02 -0700)]
target/xtensa: linux-user: fix fadvise64 call

fadvise64_64 on xtensa passes advice as the second argument and so must
be handled similar to PPC.

This fixes glibc testsuite tests posix/tst-posix_fadvise and
posix/tst-posix_fadvise64.

Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
6 years agolinux-user: implement clock_settime
Max Filippov [Sun, 1 Apr 2018 20:13:49 +0000 (13:13 -0700)]
linux-user: implement clock_settime

This fixes glibc testsuite test rt/tst-clock2.

Signed-off-by: Max Filippov <[email protected]>
6 years agolinux-user: fix error propagation in clock_gettime
Max Filippov [Sun, 1 Apr 2018 20:14:04 +0000 (13:14 -0700)]
linux-user: fix error propagation in clock_gettime

host_to_target_timespec may return error if target address could not be
locked, but it is ignored.
Propagate return value of host_to_target_timespec to the caller of
clock_gettime.

Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
6 years agotarget/xtensa: linux-user: fix sysv IPC structures
Max Filippov [Sun, 1 Apr 2018 17:00:05 +0000 (10:00 -0700)]
target/xtensa: linux-user: fix sysv IPC structures

- make target_ipc_perm fields match kernel definitions for xtensa;
- add target_semid64_ds with proper order of times and reserved fields
  for little/big endian specific for xtensa;
- add missing reserved fields after time fields to the target_shmid_ds;
- fix types of shm_cpid, shm_lpid and shm_nattch fields of
  target_shmid_ds to match kernel definitions for xtensa.

These changes fix guest ipcs output and fix glibc testsuite tests
sysvipc/test-sysvsem and sysvipc/test-sysvshm.

Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
6 years agolinux-user: fix mq_getsetattr implementation
Max Filippov [Sat, 31 Mar 2018 15:20:15 +0000 (08:20 -0700)]
linux-user: fix mq_getsetattr implementation

mq_getsetattr implementation does not set errno correctly in case of
error. Also in the presence of both 2nd and 3rd arguments it calls both
mq_getattr and mq_setattr, whereas only the latter call would suffice.

Don't call mq_getattr in the presence of the 2nd argument. Don't copy
output back to user in case of error. Use get_errno to set errno value.

This fixes test rt/tst-mqueue2 from the glibc testsuite.

Cc: Lionel Landwerlin <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Cc: Riku Voipio <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Laurent Vivier <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
6 years agolinux-user: call cpu_copy under clone_lock
Max Filippov [Fri, 30 Mar 2018 13:19:58 +0000 (06:19 -0700)]
linux-user: call cpu_copy under clone_lock

cpu_copy adds newly created CPU object to container/machine/unattached,
but does it w/o proper locking. As a result when multiple threads create
threads rapidly QEMU may abort with the following message:

  GLib-CRITICAL **: g_hash_table_iter_next: assertion
  'ri->version == ri->hash_table->version' failed

  ERROR:qemu/qom/object.c:1663:object_get_canonical_path_component:
  code should not be reached

E.g. this issue is observed when running glibc test nptl/tst-eintr1.
Move cpu_copy invocation under clone_lock to fix that.

Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
6 years agotarget/xtensa: linux-user: rewind pc for restarted syscall
Max Filippov [Wed, 28 Mar 2018 08:08:36 +0000 (01:08 -0700)]
target/xtensa: linux-user: rewind pc for restarted syscall

In case of syscall restart request set pc back to the syscall
instruction.

Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
6 years agotarget/xtensa: fix flush_window_regs
Max Filippov [Wed, 28 Mar 2018 07:25:22 +0000 (00:25 -0700)]
target/xtensa: fix flush_window_regs

flush_window_regs uses wrong stack frame to save overflow registers in
call8 and call12 frames, which results in wrong register values in
callers of a function that received a signal.
Reimplement flush_window_regs closely following window overflow
sequence.

Signed-off-by: Max Filippov <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/riscv/tags/riscv-qemu-2.12-critical-fixes'...
Peter Maydell [Sat, 31 Mar 2018 08:42:33 +0000 (09:42 +0100)]
Merge remote-tracking branch 'remotes/riscv/tags/riscv-qemu-2.12-critical-fixes' into staging

RISC-V: Critical fixes for QEMU 2.12

This series includes changes that are considered release critical,
such as floating point register file corruption under SMP Linux
due to incorrect handling of mstatus.FS.

This workaround will be replaced with a more comprehensive fix
for mstatus.FS handling in QEMU 2.13.

# gpg: Signature made Thu 29 Mar 2018 18:22:42 BST
# gpg:                using DSA key 6BF1D7B357EF3E4F
# gpg: Good signature from "Michael Clark <[email protected]>"
# gpg:                 aka "Michael Clark <[email protected]>"
# gpg:                 aka "Michael Clark <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 7C99 930E B17C D8BA 073D  5EFA 6BF1 D7B3 57EF 3E4F

* remotes/riscv/tags/riscv-qemu-2.12-critical-fixes:
  RISC-V: Workaround for critical mstatus.FS bug

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
Peter Maydell [Sat, 31 Mar 2018 07:39:08 +0000 (08:39 +0100)]
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Fri 30 Mar 2018 04:49:42 BST
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <[email protected]>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request:
  qemu-doc: Rework the network options chapter to make "-net" less prominent

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-03-29-1' into...
Peter Maydell [Fri, 30 Mar 2018 22:05:19 +0000 (23:05 +0100)]
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-03-29-1' into staging

Merge tpm 2018/03/29 v1

# gpg: Signature made Fri 30 Mar 2018 01:04:47 BST
# gpg:                using RSA key 75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-03-29-1:
  tests: Tests more flags of the CRB interface
  tpm: CRB: Enforce locality is requested before processing buffer
  tpm: CRB: Reset Granted flag when relinquishing locality
  tpm: CRB: set the Idle flag by default

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180329a' into...
Peter Maydell [Fri, 30 Mar 2018 18:58:17 +0000 (19:58 +0100)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180329a' into staging

Migration pull (small fixes)

A pair of two small fixes for 2.12.

# gpg: Signature made Thu 29 Mar 2018 14:55:17 BST
# gpg:                using RSA key 0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <[email protected]>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20180329a:
  migration: Don't activate block devices if using -S
  migration: fix pfd leak

Signed-off-by: Peter Maydell <[email protected]>
6 years agoqemu-doc: Rework the network options chapter to make "-net" less prominent
Thomas Huth [Mon, 12 Mar 2018 12:20:50 +0000 (13:20 +0100)]
qemu-doc: Rework the network options chapter to make "-net" less prominent

"-net" is clearly a legacy option. Yet we still use it in almost all
examples in the qemu documentation, and many other spots in the network
chapter. We should make it less prominent that users are not lured into
using it so often anymore. So instead of starting the network chapter with
"-net nic" and documenting "-net <backend>" below "-netdev <backend>"
everywhere, all the "-net" related documentation is now moved to the end
of the chapter. The new "-nic" option is moved to the beginning of the
chapter instead, with a new example that should demonstrate how "-nic"
can be used to shortcut "-device" with "-netdev". The examples in this
chapter are changed to use the "-device" and "-netdev" options or
"-nic" instead of "-net nic -net <backend>".

While we're at it, also remove a legacy remark about very old Linux
distributions. Also remove the "[...]" from the examples in this chapter
since we are not using this ellipsis in any other examples in our docu-
mentation.

Signed-off-by: Thomas Huth <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
6 years agotests: Tests more flags of the CRB interface
Stefan Berger [Wed, 28 Mar 2018 19:14:34 +0000 (15:14 -0400)]
tests: Tests more flags of the CRB interface

Test and modify more flags of the CRB interface.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
6 years agotpm: CRB: Enforce locality is requested before processing buffer
Stefan Berger [Wed, 28 Mar 2018 19:39:17 +0000 (15:39 -0400)]
tpm: CRB: Enforce locality is requested before processing buffer

Section 5.5.3.2.2 of the CRB specs states that use of the TPM
through the localty control method must first be requested,
otherwise the command will be dropped.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
6 years agotpm: CRB: Reset Granted flag when relinquishing locality
Stefan Berger [Wed, 28 Mar 2018 19:43:30 +0000 (15:43 -0400)]
tpm: CRB: Reset Granted flag when relinquishing locality

Reset the Granted flag when relinquishing a locality.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
6 years agotpm: CRB: set the Idle flag by default
Stefan Berger [Wed, 28 Mar 2018 20:53:10 +0000 (16:53 -0400)]
tpm: CRB: set the Idle flag by default

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
6 years agoRISC-V: Workaround for critical mstatus.FS bug
Michael Clark [Fri, 23 Mar 2018 23:49:07 +0000 (16:49 -0700)]
RISC-V: Workaround for critical mstatus.FS bug

This change is a workaround for a bug where mstatus.FS
is not correctly reporting dirty after operations that
modify floating point registers. This a critical bug
or RISC-V in QEMU as it results in floating point
register file corruption when running SMP Linux due to
task migration and possibly uniprocessor Linux if
more than one process is using the FPU.

This workaround will return dirty if mstatus.FS is
switched from off to initial or clean. According to
the specification it is legal for an implementation
to return only off, or dirty.

Cc: Palmer Dabbelt <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Alex Bennée <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Richard W.M. Jones <[email protected]>
Signed-off-by: Michael Clark <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
6 years agomigration: Don't activate block devices if using -S
Dr. David Alan Gilbert [Wed, 28 Mar 2018 17:02:07 +0000 (18:02 +0100)]
migration: Don't activate block devices if using -S

Activating the block devices causes the locks to be taken on
the backing file.  If we're running with -S and the destination libvirt
hasn't started the destination with 'cont', it's expecting the locks are
still untaken.

Don't activate the block devices if we're not going to autostart the VM;
'cont' already will do that anyway.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1560854
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20180328170207[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agomigration: fix pfd leak
Marc-André Lureau [Wed, 21 Mar 2018 11:36:44 +0000 (12:36 +0100)]
migration: fix pfd leak

Fix leak spotted by ASAN:

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7fe1abb80a38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x7fe1aaf1bf75 in g_malloc0 ../glib/gmem.c:124
    #2 0x7fe1aaf1c249 in g_malloc0_n ../glib/gmem.c:355
    #3 0x55f4841cfaa9 in postcopy_ram_fault_thread /home/elmarco/src/qemu/migration/postcopy-ram.c:596
    #4 0x55f48479447b in qemu_thread_start /home/elmarco/src/qemu/util/qemu-thread-posix.c:504
    #5 0x7fe1a043550a in start_thread (/lib64/libpthread.so.0+0x750a)

Regression introduced with commit 00fa4fc85b00f1a8a810068d158a7a66e88658eb.

Signed-off-by: Marc-André Lureau <[email protected]>
Message-Id: <20180321113644[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/riscv/tags/riscv-qemu-2.12-important-fixes...
Peter Maydell [Wed, 28 Mar 2018 21:13:38 +0000 (22:13 +0100)]
Merge remote-tracking branch 'remotes/riscv/tags/riscv-qemu-2.12-important-fixes' into staging

RISC-V: Important fixes for QEMU 2.12

This series includes changes that are considered important.
i.e. correct user-visible bugs that are exercised by common
operations such as -cpu list (CPU model changes) or -d in_asm
(fix for disassembly of addiw)

# gpg: Signature made Wed 28 Mar 2018 21:34:57 BST
# gpg:                using DSA key 6BF1D7B357EF3E4F
# gpg: Good signature from "Michael Clark <[email protected]>"
# gpg:                 aka "Michael Clark <[email protected]>"
# gpg:                 aka "Michael Clark <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 7C99 930E B17C D8BA 073D  5EFA 6BF1 D7B3 57EF 3E4F

* remotes/riscv/tags/riscv-qemu-2.12-important-fixes:
  RISC-V: Fix incorrect disassembly for addiw
  RISC-V: Convert cpu definition to future model

Signed-off-by: Peter Maydell <[email protected]>
6 years agoRISC-V: Fix incorrect disassembly for addiw
Michael Clark [Fri, 23 Mar 2018 08:07:01 +0000 (01:07 -0700)]
RISC-V: Fix incorrect disassembly for addiw

This fixes a bug in the disassembler constraints used
to lift instructions into pseudo-instructions, whereby
addiw instructions are always lifted to sext.w instead
of just lifting addiw with a zero immediate.

An associated fix has been made to the metadata used to
machine generate the disseasembler:

https://github.com/michaeljclark/riscv-meta/
commit/4a6b2f3898430768acfe201405224d2ea31e1477

Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Peter Maydell <[email protected]>
Signed-off-by: Michael Clark <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
6 years agoRISC-V: Convert cpu definition to future model
Michael Clark [Thu, 8 Mar 2018 22:12:31 +0000 (11:12 +1300)]
RISC-V: Convert cpu definition to future model

- Model borrowed from target/sh4/cpu.c
- Rewrote riscv_cpu_list to use object_class_get_list
- Dropped 'struct RISCVCPUInfo' and used TypeInfo array
- Replaced riscv_cpu_register_types with DEFINE_TYPES
- Marked base class as abstract
- Fixes -cpu list

Cc: Igor Mammedov <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Signed-off-by: Michael Clark <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180328' into staging
Peter Maydell [Wed, 28 Mar 2018 12:30:10 +0000 (13:30 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180328' into staging

Fix muluh_i64 and mulsh_i64 flags

# gpg: Signature made Wed 28 Mar 2018 05:46:45 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <[email protected]>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20180328:
  tcg: Mark muluh_i64 and mulsh_i64 as 64-bit ops

Signed-off-by: Peter Maydell <[email protected]>
6 years agotcg: Mark muluh_i64 and mulsh_i64 as 64-bit ops
Richard Henderson [Tue, 27 Mar 2018 03:37:24 +0000 (20:37 -0700)]
tcg: Mark muluh_i64 and mulsh_i64 as 64-bit ops

Failure to do so results in the tcg optimizer sign-extending
any constant fold from 32-bits.  This turns out to be visible
in the RISC-V testsuite using a host that emits these opcodes
(e.g. any non-x86_64).

Reported-by: Michael Clark <[email protected]>
Reviewed-by: Emilio G. Cota <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
6 years agoUpdate version for v2.12.0-rc1 release
Peter Maydell [Tue, 27 Mar 2018 21:04:23 +0000 (22:04 +0100)]
Update version for v2.12.0-rc1 release

Signed-off-by: Peter Maydell <[email protected]>
6 years agogdbstub: send a termination packet instead of crashing gdb
KONRAD Frederic [Tue, 20 Mar 2018 09:39:33 +0000 (10:39 +0100)]
gdbstub: send a termination packet instead of crashing gdb

Since the commit:
commit 4486e89c219c0d1b9bd8dfa0b1dd5b0d51ff2268
Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Mar 7 14:42:05 2018 +0000

    vl: introduce vm_shutdown()

GDB crashes when qemu exits (at least on sparc-softmmu):
Remote communication error.  Target disconnected.: Connection reset by peer.
Quitting: putpkt: write failed: Broken pipe.

So send a packet to exit GDB before we exit QEMU:
[Inferior 1 (Thread 0) exited normally]

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: KONRAD Frederic <[email protected]>
Message-id: 1521538773[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-qapi-2018-03-27-v2' into staging
Peter Maydell [Tue, 27 Mar 2018 18:20:57 +0000 (19:20 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-qapi-2018-03-27-v2' into staging

qapi patches for 2018-03-27, 2.12-rc1

- Marc-André Lureau: qmp-test: fix response leak
- Eric Blake: tests: Silence false positive warning on generated test name
- Laurent Vivier: 0/4 (partial) coccinelle: re-run scripts from scripst/coccinelle
- Peter Xu: 0/8 Monitor: some oob related patches (fixes, new param, tests)
- Satheesh Rajendran: hmp.c: Revert hmp_info_cpus output format change

# gpg: Signature made Tue 27 Mar 2018 16:18:36 BST
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <[email protected]>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <[email protected]>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-qapi-2018-03-27-v2:
  hmp.c: Revert hmp_info_cpus output format change
  tests: qmp-test: add test for new "x-oob"
  tests: Add parameter to qtest_init_without_qmp_handshake
  monitor: new parameter "x-oob"
  qmp: cleanup qmp queues properly
  tests: add oob-test for qapi-schema
  tests: let qapi-schema tests detect oob
  qapi: restrict allow-oob value to be "true"
  qmp: fix qmp_capabilities error regression
  qdict: remove useless cast
  error: Remove NULL checks on error_propagate() calls
  error: Strip trailing '\n' from error string arguments (again again)
  tests: Silence false positive warning on generated test name
  qmp-test: fix response leak

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Tue, 27 Mar 2018 16:11:33 +0000 (17:11 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Tue 27 Mar 2018 15:41:11 BST
# gpg:                using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <[email protected]>"
# gpg:                 aka "Stefan Hajnoczi <[email protected]>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  MAINTAINERS: add include/block/aio-wait.h
  coroutine: add test-aio coroutine queue chaining test case
  coroutine: avoid co_queue_wakeup recursion
  queue: add QSIMPLEQ_PREPEND()

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging
Peter Maydell [Tue, 27 Mar 2018 15:25:12 +0000 (16:25 +0100)]
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging

# gpg: Signature made Tue 27 Mar 2018 05:56:19 BST
# gpg:                using RSA key 7DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <[email protected]>"
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/ide-pull-request:
  macio: fix NULL pointer dereference when issuing IDE trim
  ide: fix invalid TRIM range abortion for macio

Signed-off-by: Peter Maydell <[email protected]>
6 years agohmp.c: Revert hmp_info_cpus output format change
Satheesh Rajendran [Tue, 27 Mar 2018 12:38:00 +0000 (18:08 +0530)]
hmp.c: Revert hmp_info_cpus output format change

Commit 137b5cb6 refactored 'info cpus' output, changing
'thread_id' to 'thread-id'.  While HMP is not a stable
interface, it is trivial to keep the spelling consistent
for test frameworks that have not yet updated to using QMP.

This patch just reverts back output format to 'thread_id'.

CC: Viktor Mihajlovski <[email protected]>
Signed-off-by: Satheesh Rajendran <[email protected]>
Message-Id: <20180327123800[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Acked-by: Dr. David Alan Gilbert <[email protected]>
[eblake: improve commit message]
Reviewed-by: Cornelia Huck <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agotests: qmp-test: add test for new "x-oob"
Peter Xu [Mon, 26 Mar 2018 06:39:01 +0000 (14:39 +0800)]
tests: qmp-test: add test for new "x-oob"

Test the new OOB capability. It's mostly the reverted OOB test
(see commit 4fd78ad7), but differs in that:

- It uses the new qtest_init_without_qmp_handshake() parameter to
  create the monitor with "x-oob"
- Squashed the capability tests on greeting message
- Don't use qtest_global any more, instead use self-maintained
  QTestState, which is the trend

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180326063901[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: rebase to qtest_init changes]
Reviewed-by: Marc-André Lureau <[email protected]>
Tested-by: Christian Borntraeger <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agotests: Add parameter to qtest_init_without_qmp_handshake
Eric Blake [Tue, 27 Mar 2018 01:36:19 +0000 (20:36 -0500)]
tests: Add parameter to qtest_init_without_qmp_handshake

Allow callers to choose whether to allow OOB support during a test;
for now, all existing callers pass false, but the next patch will
add a new caller.  Also, rewrite the monitor setup to be generic
(using the -qmp shorthand is insufficient for honoring the parameter).

Based on an idea by Peter Xu, in <20180326063901[email protected]>

Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180327013620.1644387[email protected]>
Tested-by: Christian Borntraeger <[email protected]>
Acked-by: Peter Xu <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
6 years agomonitor: new parameter "x-oob"
Peter Xu [Mon, 26 Mar 2018 06:38:56 +0000 (14:38 +0800)]
monitor: new parameter "x-oob"

Add new parameter to optionally enable Out-Of-Band for a QMP server.

An example command line:

  ./qemu-system-x86_64 -chardev stdio,id=char0 \
                       -mon chardev=char0,mode=control,x-oob=on

By default, Out-Of-Band is off.

It is not allowed if either MUX or non-QMP is detected, since
Out-Of-Band is currently only for QMP, and non-MUX chardev backends.

Note that the client STILL has to request 'oob' during qmp_capabilities;
in part because the x-oob command line option may disappear in the
future if we decide the capabilities negotiation is sufficient.

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180326063901[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
[eblake: enhance commit message]
Tested-by: Christian Borntraeger <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agoqmp: cleanup qmp queues properly
Peter Xu [Mon, 26 Mar 2018 06:38:55 +0000 (14:38 +0800)]
qmp: cleanup qmp queues properly

Marc-André Lureau reported that we can have this happen:

1. client1 connects, send command C1
2. client1 disconnects before getting response for C1
3. client2 connects, who might receive response of C1

However client2 should not receive remaining responses for client1.

Basically, we should clean up the request/response queue elements when:

- after a session is closed
- before destroying the queues

Some helpers are introduced to achieve that.  We need to make sure we're
with the lock when operating on those queues.  This also needed the
declaration of QMPRequest moved earlier.

Reported-by: Marc-André Lureau <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180326063901[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
[eblake: drop pointless qmp_response_free(), drop queue flush on connect
since a clean queue on disconnect is sufficient]
Tested-by: Christian Borntraeger <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agotests: add oob-test for qapi-schema
Peter Xu [Mon, 26 Mar 2018 06:38:59 +0000 (14:38 +0800)]
tests: add oob-test for qapi-schema

It simply tests the new OOB capability, and make sure the QAPISchema can
parse it correctly.

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180326063901[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agotests: let qapi-schema tests detect oob
Peter Xu [Mon, 26 Mar 2018 06:38:58 +0000 (14:38 +0800)]
tests: let qapi-schema tests detect oob

The allow_oob parameter was passed in but not used in tests.  Now
reflect that in the tests, so we need to touch up other command testers
with that new change.

Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180326063901[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agoqapi: restrict allow-oob value to be "true"
Peter Xu [Mon, 26 Mar 2018 06:38:57 +0000 (14:38 +0800)]
qapi: restrict allow-oob value to be "true"

It was missed in the first version of OOB series.  We should check this
to make sure we throw the right error when fault value is passed in.

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180326063901[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agoqmp: fix qmp_capabilities error regression
Peter Xu [Mon, 26 Mar 2018 06:38:54 +0000 (14:38 +0800)]
qmp: fix qmp_capabilities error regression

When someone sends a command before QMP handshake, the error used to be
like this:

 {"execute": "query-cpus"}
 {"error": {"class": "CommandNotFound", "desc":
            "Expecting capabilities negotiation with 'qmp_capabilities'"}}

While after cf869d5317 it becomes:

 {"execute": "query-cpus"}
 {"error": {"class": "CommandNotFound", "desc":
            "The command query-cpus has not been found"}}

Fix it back to the nicer one.

Fixes: cf869d5317 ("qmp: support out-of-band (oob) execution", 2018-03-19)
Reported-by: Marc-André Lureau <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180326063901[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: commit message grammar tweaks]
Signed-off-by: Eric Blake <[email protected]>
6 years agoqdict: remove useless cast
Laurent Vivier [Fri, 23 Mar 2018 14:32:01 +0000 (15:32 +0100)]
qdict: remove useless cast

Re-run Coccinelle script scripts/coccinelle/qobject.cocci

Signed-off-by: Laurent Vivier <[email protected]>
Message-Id: <20180323143202[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Acked-by: Dr. David Alan Gilbert <[email protected]>
Acked-by: Fam Zheng <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agoerror: Remove NULL checks on error_propagate() calls
Laurent Vivier [Fri, 23 Mar 2018 14:32:00 +0000 (15:32 +0100)]
error: Remove NULL checks on error_propagate() calls

Re-run Coccinelle patch
scripts/coccinelle/error_propagate_null.cocci

Signed-off-by: Laurent Vivier <[email protected]>
Message-Id: <20180323143202[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agoerror: Strip trailing '\n' from error string arguments (again again)
Laurent Vivier [Fri, 23 Mar 2018 14:31:59 +0000 (15:31 +0100)]
error: Strip trailing '\n' from error string arguments (again again)

Re-run Coccinelle script scripts/coccinelle/err-bad-newline.cocci,
and found new error_report() occurrences with '\n'.

Signed-off-by: Laurent Vivier <[email protected]>
Message-Id: <20180323143202[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agotests: Silence false positive warning on generated test name
Eric Blake [Fri, 23 Mar 2018 20:43:41 +0000 (15:43 -0500)]
tests: Silence false positive warning on generated test name

Running 'make check' on rawhide with gcc 8.0.1 fails:

tests/test-visitor-serialization.c: In function 'main':
tests/test-visitor-serialization.c:1127:34: error: '/primitives/' directive writing 12 bytes into a region of size between 1 and 128 [-Werror=format-overflow=]

The warning is a false positive (we have two buffers of size 128,
so yes, if we FULLY used the first buffer, then sprint'ing it into
the second will overflow the second).  But in practice, our first
buffer will not be longer than "/visitor/serialization/String",
so sizing it smaller is enough to let gcc see that we don't
overflow the second.

Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180323204341.1501664[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
6 years agoqmp-test: fix response leak
Marc-André Lureau [Mon, 26 Mar 2018 17:20:41 +0000 (19:20 +0200)]
qmp-test: fix response leak

Apparently introduced in commit a4f90923b520f1dc0a768634877eb412e5052c26.

Signed-off-by: Marc-André Lureau <[email protected]>
Message-Id: <20180326172041[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/xtensa/tags/20180326-xtensa' into staging
Peter Maydell [Tue, 27 Mar 2018 14:23:38 +0000 (15:23 +0100)]
Merge remote-tracking branch 'remotes/xtensa/tags/20180326-xtensa' into staging

target/xtensa fixes for 2.12:

- add .inc. to non-top level source file names under target/xtensa;
- fix #include <xtensa-isa.h> in the import_core.sh script;
- remove stray linux-user/xtensa/syscall.h;
- fix timers test.

# gpg: Signature made Mon 26 Mar 2018 22:40:20 BST
# gpg:                using RSA key 51F9CC91F83FA044
# gpg: Good signature from "Max Filippov <[email protected]>"
# gpg:                 aka "Max Filippov <[email protected]>"
# gpg:                 aka "Max Filippov <[email protected]>"
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044

* remotes/xtensa/tags/20180326-xtensa:
  target/xtensa: fix timers test
  linux-user/xtensa: remove stray syscall.h
  target/xtensa/import_core.sh: fix #include <xtensa-isa.h>
  target/xtensa: add .inc. to non-top level source file names

Signed-off-by: Peter Maydell <[email protected]>
This page took 0.099165 seconds and 4 git commands to generate.