1. 10 8月, 2016 7 次提交
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160810' into staging · d578cca3
      Peter Maydell 提交于
      ppc patch queue for 2016-08-10
      
      Here are some more last minute PAPR and ppc related fixes for
      qemu-2.7.  One patch makes compressed memory dumps work with guest
      kernels using page sizes up to 64KiB.  This is important since most
      current pseries guests use a 64KiB default page size.  The remainder
      fix a regression with handling of CPU aliases which causes serious
      problem for libvirt.
      
      # gpg: Signature made Wed 10 Aug 2016 06:44:27 BST
      # gpg:                using RSA key 0x6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # 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: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.7-20160810:
        ppc/kvm: Register also a generic spapr CPU core family type
        ppc/kvm: Do not mess up the generic CPU family registration
        hw/ppc/spapr: Look up CPU alias names instead of hard-coding the aliases
        ppc: Introduce a function to look up CPU alias strings
        spapr: remove extra type variable
        ppc64: fix compressed dump with pseries kernel
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      d578cca3
    • T
      ppc/kvm: Register also a generic spapr CPU core family type · d11b268e
      Thomas Huth 提交于
      There is a regression with the "-cpu" parameter introduced by
      the spapr CPU hotplug code: We used to allow to specify a
      "CPU family" name with the "-cpu" parameter when running on KVM so
      that the user does not need to know the gory details of the exact
      CPU version of the host CPU. For example, it was possible to
      use "-cpu POWER8" on a POWER8E host CPU. This behavior does not
      work anymore with the new hot-pluggable spapr-cpu-core types.
      Since libvirt already heavily depends on the old behavior, this
      is quite a severe regression in the QEMU parameter interface.
      Let's fix it by supporting a CPU family type for the spapr-cpu-core
      on KVM, too.
      
      Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1363812Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      d11b268e
    • T
      ppc/kvm: Do not mess up the generic CPU family registration · 9c83fc2e
      Thomas Huth 提交于
      The code for registering the sPAPR CPU host core type has been
      added inbetween the generic CPU host core type and the generic
      CPU family type. That way the instance_init and the class_init
      information got lost when registering the generic CPU family
      type. Fix it by moving the generic family registration before
      the spapr cpu core registration code.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      9c83fc2e
    • T
      hw/ppc/spapr: Look up CPU alias names instead of hard-coding the aliases · 4babfaf0
      Thomas Huth 提交于
      Hard-coding the CPU alias names in the spapr_cores[] array has
      two big disadvantages:
      
      1) We register a real type with the CPU alias name in
         spapr_cpu_core_register_types() - this prevents us from registering
         a CPU family name in kvm_ppc_register_host_cpu_type() with the same
         name (as we do it for the non-hotpluggable CPU types).
      
      2) It's quite cumbersome to maintain the aliases here in sync with the
         ppc_cpu_aliases list from target-ppc/cpu-models.c.
      
      So let's simply add proper alias lookup to the spapr cpu core code,
      too (by checking whether the given model can be used directly, and
      if not by trying to look up the given model as an alias name instead).
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      4babfaf0
    • T
      ppc: Introduce a function to look up CPU alias strings · caf6316d
      Thomas Huth 提交于
      We will need this function to look up the aliases in the
      spapr-cpu-core code, too.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      caf6316d
    • C
      spapr: remove extra type variable · caebf378
      Cédric Le Goater 提交于
      The sPAPR CPU core typename is already available in the upper
      block. Let's use it and move the check upward also.
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      caebf378
    • L
      ppc64: fix compressed dump with pseries kernel · 760d88d1
      Laurent Vivier 提交于
      If we don't provide the page size in target-ppc:cpu_get_dump_info(),
      the default one (TARGET_PAGE_SIZE, 4KB) is used to create
      the compressed dump. It works fine with Macintosh, but not with
      pseries as the kernel default page size is 64KB.
      
      Without this patch, if we generate a compressed dump in the QEMU monitor:
      
          (qemu) dump-guest-memory -z qemu.dump
      
      This dump cannot be read by crash:
      
          # crash vmlinux qemu.dump
          ...
          WARNING: cannot translate vmemmap kernel virtual addresses:
                   commands requiring page structure contents will fail
          ...
      
      Page_size is used to determine the dumpfile's block size. The
      block size needs to be at least the page size, but a multiple of page
      size works fine too. For PPC64, linux supports either 4KB or 64KB software
      page size. So we define the page_size to 64KB.
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      760d88d1
  2. 09 8月, 2016 7 次提交
  3. 08 8月, 2016 26 次提交
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2016-08-08' into staging · 4977bb09
      Peter Maydell 提交于
      Monitor patches for 2016-08-08
      
      # gpg: Signature made Mon 08 Aug 2016 13:24:42 BST
      # gpg:                using RSA key 0x3870B400EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-monitor-2016-08-08:
        audio: clean up before monitor clean up
        monitor: fix crash when leaving qemu with spice audio
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      4977bb09
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · b8dc0fcf
      Peter Maydell 提交于
      More block layer patches for 2.7.0-rc2
      
      # gpg: Signature made Mon 08 Aug 2016 12:51:30 BST
      # gpg:                using RSA key 0x7F09B272C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream:
        iotests: fix 109
        mirror: finish earlier on error
        tests: Test blockjob IDs
        block/qdev: Let 'drive' property fall back to node name
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      b8dc0fcf
    • P
      Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160808' into staging · 684b6b26
      Peter Maydell 提交于
      One more s390x fix for a bug in the pci rework.
      
      # gpg: Signature made Mon 08 Aug 2016 11:49:34 BST
      # gpg:                using RSA key 0xDECF6B93C6F02FAF
      # gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
      # gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
      # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF
      
      * remotes/cohuck/tags/s390x-20160808:
        s390x/pci: fix null pointer bug
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      684b6b26
    • P
      hw/sparc/leon3: Don't call get_image_size() on a NULL pointer · 47dc0ec5
      Peter Maydell 提交于
      get_image_size() doesn't handle being passed a NULL pointer, so
      avoid doing that. Spotted by the clang ub sanitizer (which notices
      the attempt to pass NULL to open()).
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1470391439-28427-1-git-send-email-peter.maydell@linaro.org
      47dc0ec5
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-08-08' into staging · f5edfcfa
      Peter Maydell 提交于
      Error reporting patches for 2016-08-08
      
      # gpg: Signature made Mon 08 Aug 2016 08:14:49 BST
      # gpg:                using RSA key 0x3870B400EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-error-2016-08-08:
        error: Fix error_printf() calls lacking newlines
        vfio: Use error_report() instead of error_printf() for errors
        checkpatch: Fix newline detection in error_setg() & friends
        error: Strip trailing '\n' from error string arguments (again)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      f5edfcfa
    • M
      audio: clean up before monitor clean up · a384c205
      Marc-André Lureau 提交于
      Since aa5cb7f5, the chardevs are being cleaned up when leaving qemu,
      before the atexit() handlers. audio_cleanup() may use the monitor to
      notify of changes. For compatibility reasons, let's clean up audio
      before the monitor so it keeps emitting monitor events.
      
      The audio_atexit() function is made idempotent (so it can be called
      multiple times), and renamed to audio_cleanup(). Since coreaudio
      backend is using a 'isAtexit' code path, change it to check
      audio_is_cleaning_up() instead, so the path is taken during normal
      exit.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20160801112343.29082-3-marcandre.lureau@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      a384c205
    • 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
    • P
      Merge remote-tracking branch 'remotes/elmarco/tags/leaks-for-2.7-pull-request' into staging · 9efaf7f5
      Peter Maydell 提交于
      # gpg: Signature made Sun 07 Aug 2016 21:03:14 BST
      # gpg:                using RSA key 0xDAE8E10975969CE5
      # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
      # gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
      # 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: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5
      
      * remotes/elmarco/tags/leaks-for-2.7-pull-request:
        ahci: fix sglist leak on retry
        usb: free leaking path
        usb: free USBDevice.strings
        virtio-input: free config list
        qjson: free str
        ahci: free irqs array
        char: free MuxDriver when closing
        char: free the tcp connection data when closing
        numa: do not leak NumaOptions
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      9efaf7f5
    • V
      iotests: fix 109 · a752e478
      Vladimir Sementsov-Ogievskiy 提交于
      109 iotest is broken for raw after 0965a41e
      [mirror: double performance of the bulk stage if the disc is full]
      
      The problem is with finishing block-job with error: before specified
      patch mirror was not very async and it created one big request at disk
      start, this request finished with error and qemu produced
      BLOCK_JOB_COMPLETED with zero progress.
      
      After 0965a41e, mirror starts several smaller requests in parallel, when
      BLOCK_JOB_COMPLETED emited we have some successful non-zero progress.
      
      This patch solves the issue by filtering out progress from 109 test
      output.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a752e478
    • V
      mirror: finish earlier on error · dbaa7b57
      Vladimir Sementsov-Ogievskiy 提交于
      Stop to produce new async copy requests from mirror_iteration if
      critical error (error action = BLOCK_ERROR_ACTION_REPORT) detected.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      dbaa7b57
    • A
      tests: Test blockjob IDs · 9ef8112a
      Alberto Garcia 提交于
      Since 7f0317cf we have API to specify the ID of block jobs and we
      also guarantee that they are well-formed and unique.
      
      This patch adds tests to check some common scenarios.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      9ef8112a
    • K
      block/qdev: Let 'drive' property fall back to node name · bd7c4176
      Kevin Wolf 提交于
      If a qdev block device is created with an anonymous BlockBackend (i.e.
      a node name rather than a BB name was given for the drive property),
      qdev used to return an empty string when the property was read. This
      patch fixes it to return the node name instead.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      bd7c4176
    • Y
      s390x/pci: fix null pointer bug · 7fc0abf4
      Yi Min Zhao 提交于
      We should make sure that it's not NULL firstly.
      Signed-off-by: NYi Min Zhao <zyimin@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      7fc0abf4
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160808' into staging · cbda16c0
      Peter Maydell 提交于
      ppc patch queue 2016-08-08
      
      This batch has several last minute bug fixes to be merged for
      qemu-2.7.
      
      # gpg: Signature made Mon 08 Aug 2016 03:40:58 BST
      # gpg:                using RSA key 0x6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # 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: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.7-20160808:
        spapr: Fix undefined behaviour in spapr_tce_reset()
        macio: set res_count value to 0 after non-block ATAPI DMA transfers
        spapr: Correctly set query_hotpluggable_cpus hook based on machine version
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      cbda16c0
    • P
      Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20160805' into staging · cf5198d5
      Peter Maydell 提交于
      indirect register lowering
      
      # gpg: Signature made Fri 05 Aug 2016 17:34:53 BST
      # gpg:                using RSA key 0xAD1270CC4DD0279B
      # gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
      # gpg:                 aka "Richard Henderson <rth@redhat.com>"
      # gpg:                 aka "Richard Henderson <rth@twiddle.net>"
      # Primary key fingerprint: 9CB1 8DDA F8E8 49AD 2AFC  16A4 AD12 70CC 4DD0 279B
      
      * remotes/rth/tags/pull-tcg-20160805:
        tcg: Lower indirect registers in a separate pass
        tcg: Require liveness analysis
        tcg: Include liveness info in the dumps
        tcg: Compress dead_temps and mem_temps into a single array
        tcg: Fold life data into TCGOp
        tcg: Reorg TCGOp chaining
        tcg: Compress liveness data to 16 bits
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      cf5198d5
    • M
      error: Fix error_printf() calls lacking newlines · 7ea7d36e
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1470224274-31522-5-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      7ea7d36e
    • M
      vfio: Use error_report() instead of error_printf() for errors · fea1c099
      Markus Armbruster 提交于
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1470224274-31522-4-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      fea1c099
    • M
      checkpatch: Fix newline detection in error_setg() & friends · a47eb010
      Markus Armbruster 提交于
      Commit 5d596c24's regexp assumes the error message string is the first
      argument.  Correct for error_report(), wrong for all the others.
      Relax the regexp to match newline in anywhere.  This might cause
      additional false positives.
      
      While there, update the list of error_reporting functions.
      
      Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1470224274-31522-3-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      a47eb010
    • M
      error: Strip trailing '\n' from error string arguments (again) · df3c286c
      Markus Armbruster 提交于
      Commit 9af9e0fe, 6daf194d, be62a2eb and 312fd5f2 got rid of a bunch, but
      they keep coming back.  checkpatch.pl tries to flag them since commit
      5d596c24, but it's not very good at it.  Offenders tracked down with
      Coccinelle script scripts/coccinelle/err-bad-newline.cocci, an updated
      version of the script from commit 312fd5f2.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1470224274-31522-2-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      df3c286c
    • D
      spapr: Fix undefined behaviour in spapr_tce_reset() · 57c0eb1e
      David Gibson 提交于
      When a TCE table (sPAPR IOMMU context) is in disabled state (which is true
      by default for the 64-bit window), it has tcet->nb_table == 0 and
      tcet->table == NULL.  However, on system reset, spapr_tce_reset() executes,
      which unconditionally calls
              memset(tcet->table, 0, table_size);
      
      We get away with this in practice, because it's a zero length memset(),
      but memset() on a NULL pointer is undefined behaviour, so we should not
      call it in this case.
      Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      57c0eb1e
    • M
      macio: set res_count value to 0 after non-block ATAPI DMA transfers · 16275edb
      Mark Cave-Ayland 提交于
      res_count should be set to the number of outstanding bytes after a DBDMA
      request. Unfortunately this wasn't being set to zero by the non-block
      transfer codepath meaning drivers that checked the descriptor result for
      such requests (e.g reading the CDROM TOC) would assume from a non-zero result
      that the transfer had failed.
      Signed-off-by: NMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      16275edb
    • 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
    • M
      ahci: fix sglist leak on retry · 5839df7b
      Marc-André Lureau 提交于
      ahci-test /x86_64/ahci/io/dma/lba28/retry triggers the following leak:
      
      Direct leak of 16 byte(s) in 1 object(s) allocated from:
          #0 0x7fc4b2a25e20 in malloc (/lib64/libasan.so.3+0xc6e20)
          #1 0x7fc4993bce58 in g_malloc (/lib64/libglib-2.0.so.0+0x4ee58)
          #2 0x556a187d4b34 in ahci_populate_sglist hw/ide/ahci.c:896
          #3 0x556a187d8237 in ahci_dma_prepare_buf hw/ide/ahci.c:1367
          #4 0x556a187b5a1a in ide_dma_cb hw/ide/core.c:844
          #5 0x556a187d7eec in ahci_start_dma hw/ide/ahci.c:1333
          #6 0x556a187b650b in ide_start_dma hw/ide/core.c:921
          #7 0x556a187b61e6 in ide_sector_start_dma hw/ide/core.c:911
          #8 0x556a187b9e26 in cmd_write_dma hw/ide/core.c:1486
          #9 0x556a187bd519 in ide_exec_cmd hw/ide/core.c:2027
          #10 0x556a187d71c5 in handle_reg_h2d_fis hw/ide/ahci.c:1204
          #11 0x556a187d7681 in handle_cmd hw/ide/ahci.c:1254
          #12 0x556a187d168a in check_cmd hw/ide/ahci.c:510
          #13 0x556a187d0afc in ahci_port_write hw/ide/ahci.c:314
          #14 0x556a187d105d in ahci_mem_write hw/ide/ahci.c:435
          #15 0x556a1831d959 in memory_region_write_accessor /home/elmarco/src/qemu/memory.c:525
          #16 0x556a1831dc35 in access_with_adjusted_size /home/elmarco/src/qemu/memory.c:591
          #17 0x556a18323ce3 in memory_region_dispatch_write /home/elmarco/src/qemu/memory.c:1262
          #18 0x556a1828cf67 in address_space_write_continue /home/elmarco/src/qemu/exec.c:2578
          #19 0x556a1828d20b in address_space_write /home/elmarco/src/qemu/exec.c:2635
          #20 0x556a1828d92b in address_space_rw /home/elmarco/src/qemu/exec.c:2737
          #21 0x556a1828daf7 in cpu_physical_memory_rw /home/elmarco/src/qemu/exec.c:2746
          #22 0x556a183068d3 in cpu_physical_memory_write /home/elmarco/src/qemu/include/exec/cpu-common.h:72
          #23 0x556a18308194 in qtest_process_command /home/elmarco/src/qemu/qtest.c:382
          #24 0x556a18309999 in qtest_process_inbuf /home/elmarco/src/qemu/qtest.c:573
          #25 0x556a18309a4a in qtest_read /home/elmarco/src/qemu/qtest.c:585
          #26 0x556a18598b85 in qemu_chr_be_write_impl /home/elmarco/src/qemu/qemu-char.c:387
          #27 0x556a18598c52 in qemu_chr_be_write /home/elmarco/src/qemu/qemu-char.c:399
          #28 0x556a185a2afa in tcp_chr_read /home/elmarco/src/qemu/qemu-char.c:2902
          #29 0x556a18cbaf52 in qio_channel_fd_source_dispatch io/channel-watch.c:84
      
      Follow John Snow recommendation:
        Everywhere else ncq_err is used, it is accompanied by a list cleanup
        except for ncq_cb, which is the case you are fixing here.
      
        Move the sglist destruction inside of ncq_err and then delete it from
        the other two locations to keep it tidy.
      
        Call dma_buf_commit in ide_dma_cb after the early return. Though, this
        is also a little wonky because this routine does more than clear the
        list, but it is at the moment the centralized "we're done with the
        sglist" function and none of the other side effects that occur in
        dma_buf_commit will interfere with the reset that occurs from
        ide_restart_bh, I think
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      5839df7b
    • M
      usb: free leaking path · 9ef61724
      Marc-André Lureau 提交于
      qdev_get_dev_path() returns an allocated string, free it when no longer
      needed.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      9ef61724
    • M
      usb: free USBDevice.strings · ec507f11
      Marc-André Lureau 提交于
      The list is created during instance init and further populated with
      usb_desc_set_string(). Clear it when unrealizing the device.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      ec507f11
    • M
      virtio-input: free config list · 0137a557
      Marc-André Lureau 提交于
      Clear the list when finalizing. The list is created during realize with
      virtio_input_idstr_config() and later by further calls to
      virtio_input_init_config() and virtio_input_add_config().
      
      This leak can be reproduced with device-introspect-test -p
      /x86_64/device/introspect/concrete.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      0137a557