1. 18 8月, 2016 1 次提交
    • E
      block: fix deadlock in bdrv_co_flush · ce83ee57
      Evgeny Yakovlev 提交于
      The following commit
          commit 3ff2f67a
          Author: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
          Date:   Mon Jul 18 22:39:52 2016 +0300
          block: ignore flush requests when storage is clean
      has introduced a regression.
      
      There is a problem that it is still possible for 2 requests to execute
      in non sequential fashion and sometimes this results in a deadlock
      when bdrv_drain_one/all are called for BDS with such stalled requests.
      
      1. Current flushed_gen and flush_started_gen is 1.
      2. Request 1 enters bdrv_co_flush to with write_gen 1 (i.e. the same
         as flushed_gen). It gets past flushed_gen != flush_started_gen and
         sets flush_started_gen to 1 (again, the same it was before).
      3. Request 1 yields somewhere before exiting bdrv_co_flush
      4. Request 2 enters bdrv_co_flush with write_gen 2. It gets past
         flushed_gen != flush_started_gen and sets flush_started_gen to 2.
      5. Request 2 runs to completion and sets flushed_gen to 2
      6. Request 1 is resumed, runs to completion and sets flushed_gen to 1.
         However flush_started_gen is now 2.
      
      From here on out flushed_gen is always != to flush_started_gen and all
      further requests will wait on flush_queue. This change replaces
      flush_started_gen with an explicitly tracked active flush request.
      Signed-off-by: NEvgeny Yakovlev <eyakovlev@virtuozzo.com>
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      Message-id: 1471457214-3994-2-git-send-email-den@openvz.org
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Fam Zheng <famz@redhat.com>
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Max Reitz <mreitz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      ce83ee57
  2. 16 8月, 2016 1 次提交
    • D
      virtio-gpu: fix missing log.h include file · 8afc224f
      Daniel P. Berrange 提交于
      The virtio-gpu.h file defines a macro VIRTIO_GPU_FILL_CMD
      which includes a call to qemu_log_mask, but does not
      include qemu/log.h. In a default configure, it is lucky
      and gets qemu/log.h indirectly due to the 'log' trace
      backend being enabled. If that trace backend is disabled
      though, eg
      
       ./configure --enable-trace-backends=nop
      
      Then the build will fail:
      
      In file included from /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:19:0:
      /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c: In function ‘virgl_cmd_create_resource_2d’:
      /home/berrange/src/virt/qemu/include/hw/virtio/virtio-gpu.h:138:13: error: implicit declaration of function ‘qemu_log_mask’ [-Werror=implicit-function-declaration]
                   qemu_log_mask(LOG_GUEST_ERROR,                              \
                   ^
      /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:34:5: note: in expansion of macro ‘VIRTIO_GPU_FILL_CMD’
           VIRTIO_GPU_FILL_CMD(c2d);
           ^~~~~~~~~~~~~~~~~~~
      /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:34:5: error: nested extern declaration of ‘qemu_log_mask’ [-Werror=nested-externs]
      In file included from /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:19:0:
      /home/berrange/src/virt/qemu/include/hw/virtio/virtio-gpu.h:138:27: error: ‘LOG_GUEST_ERROR’ undeclared (first use in this function)
                   qemu_log_mask(LOG_GUEST_ERROR,                              \
      
      [snip many more errors]
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1470648700-3474-1-git-send-email-berrange@redhat.com
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      8afc224f
  3. 15 8月, 2016 1 次提交
  4. 13 8月, 2016 2 次提交
  5. 11 8月, 2016 1 次提交
  6. 10 8月, 2016 2 次提交
    • P
      clang: Fix warning reg. expansion to 'defined' · 2368635d
      Pranith Kumar 提交于
      Clang produces the following warning. The warning is detailed here:
      https://reviews.llvm.org/D15866. Fix the warning.
      
      /home/pranith/devops/code/qemu/hw/display/qxl.c:507:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
          ^
      /home/pranith/devops/code/qemu/include/ui/qemu-spice.h:46:5: note: expanded from macro 'SPICE_NEEDS_SET_MM_TIME'
        (!defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06))
          ^
      /home/pranith/devops/code/qemu/hw/display/qxl.c:1074:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
          ^
      /home/pranith/devops/code/qemu/include/ui/qemu-spice.h:46:5: note: expanded from macro 'SPICE_NEEDS_SET_MM_TIME'
        (!defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06))
      Suggested-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NPranith Kumar <bobby.prani@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2368635d
    • P
      atomic: strip "const" from variables declared with typeof · 5927ed84
      Paolo Bonzini 提交于
      With the latest clang, we have the following warning:
      
          /home/pranith/devops/code/qemu/include/qemu/seqlock.h:62:21: warning: passing 'typeof (*&sl->sequence) *' (aka 'const unsigned int *') to parameter of type 'unsigned int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
              return unlikely(atomic_read(&sl->sequence) != start);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
          /home/pranith/devops/code/qemu/include/qemu/atomic.h:58:25: note: expanded from macro 'atomic_read'
              __atomic_load(ptr, &_val, __ATOMIC_RELAXED);     \
                                 ^~~~~
      
      Stripping const is a bit tricky due to promotions, but it is doable
      with either C11 _Generic or GCC extensions.  Use the latter.
      Reported-by: NPranith Kumar <bobby.prani@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      [pranith: Add conversion for bool type]
      Signed-off-by: NPranith Kumar <bobby.prani@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5927ed84
  7. 08 8月, 2016 2 次提交
    • M
      monitor: fix crash when leaving qemu with spice audio · 2ef45716
      Marc-André Lureau 提交于
      Since aa5cb7f5, the chardevs are being cleaned up when leaving
      qemu. However, the monitor has still references to them, which may
      lead to crashes when running atexit() and trying to send monitor
      events:
      
       #0  0x00007fffdb18f6f5 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
       #1  0x00007fffdb1912fa in __GI_abort () at abort.c:89
       #2  0x0000555555c263e7 in error_exit (err=22, msg=0x555555d47980 <__func__.13537> "qemu_mutex_lock") at util/qemu-thread-posix.c:39
       #3  0x0000555555c26488 in qemu_mutex_lock (mutex=0x5555567a2420) at util/qemu-thread-posix.c:66
       #4  0x00005555558c52db in qemu_chr_fe_write (s=0x5555567a2420, buf=0x55555740dc40 "{\"timestamp\": {\"seconds\": 1470041716, \"microseconds\": 989699}, \"event\": \"SPICE_DISCONNECTED\", \"data\": {\"server\": {\"port\": \"5900\", \"family\": \"ipv4\", \"host\": \"127.0.0.1\"}, \"client\": {\"port\": \"40272\", \"f"..., len=240) at qemu-char.c:280
       #5  0x0000555555787cad in monitor_flush_locked (mon=0x5555567bd9e0) at /home/elmarco/src/qemu/monitor.c:311
       #6  0x0000555555787e46 in monitor_puts (mon=0x5555567bd9e0, str=0x5555567a44ef "") at /home/elmarco/src/qemu/monitor.c:353
       #7  0x00005555557880fe in monitor_json_emitter (mon=0x5555567bd9e0, data=0x5555567c73a0) at /home/elmarco/src/qemu/monitor.c:401
       #8  0x00005555557882d2 in monitor_qapi_event_emit (event=QAPI_EVENT_SPICE_DISCONNECTED, qdict=0x5555567c73a0) at /home/elmarco/src/qemu/monitor.c:472
       #9  0x000055555578838f in monitor_qapi_event_queue (event=QAPI_EVENT_SPICE_DISCONNECTED, qdict=0x5555567c73a0, errp=0x7fffffffca88) at /home/elmarco/src/qemu/monitor.c:497
       #10 0x0000555555c15541 in qapi_event_send_spice_disconnected (server=0x5555571139d0, client=0x5555570d0db0, errp=0x5555566c0428 <error_abort>) at qapi-event.c:1038
       #11 0x0000555555b11bc6 in channel_event (event=3, info=0x5555570d6c00) at ui/spice-core.c:248
       #12 0x00007fffdcc9983a in adapter_channel_event (event=3, info=0x5555570d6c00) at reds.c:120
       #13 0x00007fffdcc99a25 in reds_handle_channel_event (reds=0x5555567a9d60, event=3, info=0x5555570d6c00) at reds.c:324
       #14 0x00007fffdcc7d4c4 in main_dispatcher_self_handle_channel_event (self=0x5555567b28b0, event=3, info=0x5555570d6c00) at main-dispatcher.c:175
       #15 0x00007fffdcc7d5b1 in main_dispatcher_channel_event (self=0x5555567b28b0, event=3, info=0x5555570d6c00) at main-dispatcher.c:194
       #16 0x00007fffdcca7674 in reds_stream_push_channel_event (s=0x5555570d9910, event=3) at reds-stream.c:354
       #17 0x00007fffdcca749b in reds_stream_free (s=0x5555570d9910) at reds-stream.c:323
       #18 0x00007fffdccb5dad in snd_disconnect_channel (channel=0x5555576a89a0) at sound.c:229
       #19 0x00007fffdccb9e57 in snd_detach_common (worker=0x555557739720) at sound.c:1589
       #20 0x00007fffdccb9f0e in snd_detach_playback (sin=0x5555569fe3f8) at sound.c:1602
       #21 0x00007fffdcca3373 in spice_server_remove_interface (sin=0x5555569fe3f8) at reds.c:3387
       #22 0x00005555558ff6e2 in line_out_fini (hw=0x5555569fe370) at audio/spiceaudio.c:152
       #23 0x00005555558f909e in audio_atexit () at audio/audio.c:1754
       #24 0x00007fffdb1941e8 in __run_exit_handlers (status=0, listp=0x7fffdb5175d8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
       #25 0x00007fffdb194235 in __GI_exit (status=<optimized out>) at exit.c:104
       #26 0x00007fffdb17b738 in __libc_start_main (main=0x5555558d7874 <main>, argc=67, argv=0x7fffffffcf48, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffcf38) at ../csu/libc-start.c:323
      
      Add a monitor_cleanup() functions to remove all the monitors before
      cleaning up the chardev. Note that we are "losing" some events that
      used to be sent during atexit().
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20160801112343.29082-2-marcandre.lureau@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      2ef45716
    • D
      spapr: Correctly set query_hotpluggable_cpus hook based on machine version · 3c0c47e3
      David Gibson 提交于
      Prior to c8721d35 "spapr: Error out when CPU hotplug is attempted on older
      pseries machines", attempting to use query-hotpluggable-cpus on pseries-2.6
      and earlier machine types would SEGV.
      
      That change fixed that, but due to some unexpected interactions in init
      order and a brown-paper-bag worthy failure to test, it accidentally
      disabled query-hotpluggable-cpus for all pseries machine types, including
      the current one which should allow it.
      
      In fact, query_hotpluggable_cpus needs to be non-NULL when and only when
      the dr_cpu_enabled flag in sPAPRMachineClass is set, which makes
      dr_cpu_enabled itself redundant.
      
      This patch removes dr_cpu_enabled, instead directly setting
      query_hotpluggable_cpus from the machine class_init functions, and using
      that to determine the availability of CPU hotplug when necessary.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3c0c47e3
  8. 06 8月, 2016 3 次提交
  9. 04 8月, 2016 6 次提交
    • P
      linux-user: Use correct alignment for long long on i386 guests · d9fe91d8
      Peter Maydell 提交于
      For i386, the ABI specifies that 'long long' (8 byte values)
      need only be 4 aligned, but we were requiring them to be
      8-aligned. This meant we were laying out the target_epoll_event
      structure wrongly. Add a suitable ifdef to abitypes.h to
      specify the i386-specific alignment requirement.
      Reported-by: NIcenowy Zheng <icenowy@aosc.xyz>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      d9fe91d8
    • P
      x86: ioapic: add support for explicit EOI · 20fd4b7b
      Peter Xu 提交于
      Some old Linux kernels (upstream before v4.0), or any released RHEL
      kernels has problem in sending APIC EOI when IR is enabled. Meanwhile,
      many of them only support explicit EOI for IOAPIC, which is only
      introduced in IOAPIC version 0x20. This patch provide a way to boost
      QEMU IOAPIC to version 0x20, in order for QEMU to correctly receive EOI
      messages.
      
      Without boosting IOAPIC version to 0x20, kernels before commit d32932d
      ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces")
      will have trouble enabling both IR and level-triggered interrupt devices
      (like e1000).
      
      To upgrade IOAPIC to version 0x20, we need to specify:
      
        -global ioapic.version=0x20
      
      To be compatible with old systems, 0x11 will still be the default IOAPIC
      version. Here 0x11 and 0x20 are the only versions to be supported.
      
      One thing to mention: this patch only applies to emulated IOAPIC. It
      does not affect kernel IOAPIC behavior.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <1470059959-372-1-git-send-email-peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      20fd4b7b
    • I
      apic: fix broken migration for kvm-apic · 7298d4fd
      Igor Mammedov 提交于
      commit f6e98444 (apic: Use apic_id as apic's migration instance_id)
      breaks migration when in kernel irqchip is used for 2.6 and older
      machine types.
      
      It applies compat property only for userspace 'apic' type
      instead of applying it to all apic types inherited from
      'apic-common' type as it was supposed to do.
      
      Fix it by setting compat property 'legacy-instance-id' for
      'apic-common' type which affects inherited types (i.e. not
      only 'apic' but also 'kvm-apic' types)
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1469800542-11402-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7298d4fd
    • E
      block: Cater to iscsi with non-power-of-2 discard · b8d0a980
      Eric Blake 提交于
      Dell Equallogic iSCSI SANs have a very unusual advertised geometry:
      
      $ iscsi-inq -e 1 -c $((0xb0)) iscsi://XXX/0
      wsnz:0
      maximum compare and write length:1
      optimal transfer length granularity:0
      maximum transfer length:0
      optimal transfer length:0
      maximum prefetch xdread xdwrite transfer length:0
      maximum unmap lba count:30720
      maximum unmap block descriptor count:2
      optimal unmap granularity:30720
      ugavalid:1
      unmap granularity alignment:0
      maximum write same length:30720
      
      which says that both the maximum and the optimal discard size
      is 15M.  It is not immediately apparent if the device allows
      discard requests not aligned to the optimal size, nor if it
      allows discards at a finer granularity than the optimal size.
      
      I tried to find details in the SCSI Commands Reference Manual
      Rev. A on what valid values of maximum and optimal sizes are
      permitted, but while that document mentions a "Block Limits
      VPD Page", I couldn't actually find documentation of that page
      or what values it would have, or if a SCSI device has an
      advertisement of its minimal unmap granularity.  So it is not
      obvious to me whether the Dell Equallogic device is compliance
      with the SCSI specification.
      
      Fortunately, it is easy enough to support non-power-of-2 sizing,
      even if it means we are less efficient than truly possible when
      targetting that device (for example, it means that we refuse to
      unmap anything that is not a multiple of 15M and aligned to a
      15M boundary, even if the device truly does support a smaller
      granularity where unmapping actually works).
      Reported-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1469129688-22848-5-git-send-email-eblake@redhat.com>
      Acked-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b8d0a980
    • E
      osdep: Document differences in rounding macros · e9fd416e
      Eric Blake 提交于
      Make it obvious which macros are safe in which situations.
      
      Useful since QEMU_ALIGN_UP and ROUND_UP both purport to do
      the same thing, but differ on whether the alignment must be
      a power of 2.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1469129688-22848-4-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e9fd416e
    • E
      nbd: Limit nbdflags to 16 bits · 7423f417
      Eric Blake 提交于
      Rather than asserting that nbdflags is within range, just give
      it the correct type to begin with :)  nbdflags corresponds to
      the per-export portion of NBD Protocol "transmission flags", which
      is 16 bits in response to NBD_OPT_EXPORT_NAME and NBD_OPT_GO.
      
      Furthermore, upstream NBD has never passed the global flags to
      the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first
      introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually
      tried to OR the global flags with the transmission flags, with
      the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9
      caused all earlier NBD 3.x clients to treat every export as
      read-only; NBD 3.10 and later intentionally clip things to 16
      bits to pass only transmission flags).  Qemu should follow suit,
      since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE
      and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior
      during transmission.
      
      CC: qemu-stable@nongnu.org
      Signed-off-by: NEric Blake <eblake@redhat.com>
      
      Message-Id: <1469129688-22848-3-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7423f417
  10. 03 8月, 2016 1 次提交
  11. 02 8月, 2016 5 次提交
  12. 29 7月, 2016 4 次提交
  13. 27 7月, 2016 3 次提交
  14. 26 7月, 2016 2 次提交
  15. 22 7月, 2016 6 次提交