1. 04 8月, 2016 8 次提交
    • 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
    • E
      nbd: Fix bad flag detection on server · 5bee0f47
      Eric Blake 提交于
      Commit ab7c548e added a check for invalid flags, but used an
      early return on error instead of properly going through the
      cleanup label.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      
      Message-Id: <1469129688-22848-2-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5bee0f47
    • I
      i2c: fix migration regression introduced by broadcast support · 71ae65e5
      Igor Mammedov 提交于
      QEMU fails migration with following error:
      
      qemu-system-x86_64: Missing section footer for i2c_bus
      qemu-system-x86_64: load of migration failed: Invalid argument
      
      when migrating from:
        qemu-system-x86_64-v2.6.0 -m 256M rhel72.img -M pc-i440fx-2.6
      to
        qemu-system-x86_64-v2.7.0-rc0 -m 256M rhel72.img -M pc-i440fx-2.6
      
      Regression is added by commit 2293c27f (i2c: implement broadcast write)
      
      Fix it by dropping 'broadcast' VMState introduced by 2293c27f and
      reuse broadcast 0x00 address as broadcast flag in bus->saved_address.
      Then if there were ongoing broadcast at migration time, set
      bus->saved_address to it and at i2c_slave_post_load() time check
      for it instead of transfering and using 'broadcast' VMState.
      
      As result of reusing existing saved_address VMState, no compat
      glue will be needed to keep forward/backward compatiblity. which
      makes fix much less intrusive.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1469623198-177227-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      71ae65e5
    • P
      mptsas: really fix migration compatibility · 0b646f44
      Paolo Bonzini 提交于
      Commit 2e2aa316 removed internal flag msi_in_use, but it
      existed in vmstate.  Restore it for migration to older QEMU
      versions.
      Reported-by: NAmit Shah <amit.shah@redhat.com>
      Suggested-by: NAmit Shah <amit.shah@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Marcel Apfelbaum <marcel@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Amit Shah <amit.shah@redhat.com>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0b646f44
    • E
      qdist: return "(empty)" instead of NULL when printing an empty dist · 11b7b07f
      Emilio G. Cota 提交于
      Printf'ing a NULL string is undefined behaviour. Avoid it.
      Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Message-Id: <1469459025-23606-4-git-send-email-cota@braap.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      11b7b07f
    • E
      qdist: use g_renew and g_new instead of g_realloc and g_malloc. · 071d4054
      Emilio G. Cota 提交于
      This is safer against overflow.  g_renew is available in all
      version of glib, while g_realloc_n is only available in 2.24.
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Message-Id: <1469459025-23606-3-git-send-email-cota@braap.org>
      [Rewritten to use g_new/g_renew. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      071d4054
  2. 02 8月, 2016 10 次提交
    • E
      qdist: fix memory leak during binning · f9dbc19e
      Emilio G. Cota 提交于
      In qdist_bin__internal(), to->entries is initialized to a 1-element array,
      which we then leak when n == from->n. Fix it.
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Message-Id: <1469459025-23606-2-git-send-email-cota@braap.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f9dbc19e
    • D
      target-i386: fix typo in xsetbv implementation · ba03584f
      Dave Hansen 提交于
      QEMU 2.6 added support for the XSAVE family of instructions, which
      includes the XSETBV instruction which allows setting the XCR0
      register.
      
      But, when booting Linux kernels with XSAVE support enabled, I was
      getting very early crashes where the instruction pointer was set
      to 0x3.  I tracked it down to a jump instruction generated by this:
      
              gen_jmp_im(s->pc - pc_start);
      
      where s->pc is pointing to the instruction after XSETBV and pc_start
      is pointing _at_ XSETBV.  Subtract the two and you get 0x3.  Whoops.
      
      The fix is to replace this typo with the pattern found everywhere
      else in the file when folks want to end the translation buffer.
      
      Richard Henderson confirmed that this is a bug and that this is the
      correct fix.
      Signed-off-by: NDave Hansen <dave.hansen@linux.intel.com>
      Cc: qemu-stable@nongnu.org
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ba03584f
    • E
      qht: do not segfault when gathering stats from an uninitialized qht · 7266ae91
      Emilio G. Cota 提交于
      So far, QHT functions assume that the passed qht has previously been
      initialized--otherwise they segfault.
      
      This patch makes an exception for qht_statistics_init, with the goal
      of simplifying calling code. For instance, qht_statistics_init is
      called from the 'info jit' dump, and given that under KVM the TB qht
      is never initialized, we get a segfault. Thus, instead of complicating
      the 'info jit' code with additional checks, let's allow passing an
      uninitialized qht to qht_statistics_init.
      
      While at it, add a test for this to test-qht.
      
      Before the patch (for $ qemu -enable-kvm [...]):
      (qemu) info jit
      [...]
      direct jump count   0 (0%) (2 jumps=0 0%)
      Program received signal SIGSEGV, Segmentation fault.
      
      After the patch the "TB hash buckets", "TB hash occupancy"
      and "TB hash avg chain" lines are omitted.
      (qemu) info jit
      [...]
      direct jump count   0 (0%) (2 jumps=0 0%)
      TB hash buckets     0/0 (-nan% head buckets used)
      TB hash occupancy   nan% avg chain occ. Histogram: (null)
      TB hash avg chain   nan buckets. Histogram: (null)
      [...]
      
      Reported by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Message-Id: <1469205390-14369-1-git-send-email-cota@braap.org>
      [Extract printing statistics to an entirely separate function. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7266ae91
    • C
      util: Drop inet_listen() · 767db021
      Cao jin 提交于
      Since commit e65c67e4, inet_listen() is not used anymore, and all
      inet listen operation goes through QIOChannel.
      
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Signed-off-by: NCao jin <caoj.fnst@cn.fujitsu.com>
      Message-Id: <1469451771-1173-3-git-send-email-caoj.fnst@cn.fujitsu.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      767db021
    • C
      util: drop unix_nonblocking_connect() · f8ea7a86
      Cao jin 提交于
      It is never used; all nonblocking connect now goes through
      socket_connect(), which calls unix_connect_addr().
      
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NCao jin <caoj.fnst@cn.fujitsu.com>
      Message-Id: <1469097213-26441-3-git-send-email-caoj.fnst@cn.fujitsu.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f8ea7a86
    • C
      util: drop inet_nonblocking_connect() · 00432b69
      Cao jin 提交于
      It is never used; all nonblocking connect now goes through
      socket_connect(), which calls inet_connect_addr().
      
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NCao jin <caoj.fnst@cn.fujitsu.com>
      Message-Id: <1469097213-26441-2-git-send-email-caoj.fnst@cn.fujitsu.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      00432b69
    • P
      checkpatch: add check for bzero · 3f822cff
      Paolo Bonzini 提交于
      Tested-By: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3f822cff
    • I
      fix qemu exit on memory hotplug when allocation fails at prealloc time · 056b68af
      Igor Mammedov 提交于
      When adding hostmem backend at runtime, QEMU might exit with error:
        "os_mem_prealloc: Insufficient free host memory pages available to allocate guest RAM"
      
      It happens due to os_mem_prealloc() not handling errors gracefully.
      
      Fix it by passing errp argument so that os_mem_prealloc() could
      report error to callers and undo performed allocation when
      os_mem_prealloc() fails.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1469008443-72059-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      056b68af
    • G
      numa: set the memory backend "is_mapped" field · 0b217571
      Greg Kurz 提交于
      Commit 2aece63c "hostmem: detect host backend memory is being used properly"
      added a way to know if a memory backend is busy or available for use. It
      caused a slight regression if we pass the same backend to a NUMA node and
      to a pc-dimm device:
      
      -m 1G,slots=2,maxmem=2G \
      -object memory-backend-ram,size=1G,id=mem-mem1 \
      -device pc-dimm,id=dimm-mem1,memdev=mem-mem1 \
      -numa node,nodeid=0,memdev=mem-mem1
      
      Before commit 2aece63c, this would cause QEMU to print an error message and
      to exit gracefully:
      
      qemu-system-ppc64: -device pc-dimm,id=dimm-mem1,memdev=mem-mem1:
          can't use already busy memdev: mem-mem1
      
      Since commit 2aece63c, QEMU hits an assertion in the memory code:
      
      qemu-system-ppc64: memory.c:1934: memory_region_add_subregion_common:
          Assertion `!subregion->container' failed.
      Aborted
      
      This happens because pc-dimm devices don't use memory_region_is_mapped()
      anymore and cannot guess the backend is already used by a NUMA node.
      
      Let's revert to the previous behavior by turning the NUMA code to also
      call host_memory_backend_set_mapped() when it uses a backend.
      
      Fixes: 2aece63cSigned-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <146891691503.15642.9817215371777203794.stgit@bahia.lan>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0b217571
    • P
      util/qht: Document memory ordering assumptions · 34506b30
      Paolo Bonzini 提交于
      It is naturally expected that some memory ordering should be provided
      around qht_insert() and qht_lookup(). Document these assumptions in the
      header file and put some comments in the source to denote how that
      memory ordering requirements are fulfilled.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      [Sergey Fedorov: commit title and message provided;
      comment on qht_remove() elided]
      Signed-off-by: NSergey Fedorov <serge.fdrv@gmail.com>
      Message-Id: <20160715175852.30749-2-sergey.fedorov@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      34506b30
  3. 01 8月, 2016 2 次提交
  4. 29 7月, 2016 20 次提交