1. 04 8月, 2016 12 次提交
    • 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
    • P
      x86: ioapic: ignore level irq during processing · f99b86b9
      Peter Xu 提交于
      For level triggered interrupts, we will get Remote IRR bit cleared after
      guest kernel finished processing specific request. Before that, we
      should ignore the same interrupt from triggering again.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <1469974685-4144-1-git-send-email-peterx@redhat.com>
      [Push new "if" up so that it covers KVM split irqchip as well. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f99b86b9
    • 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
    • M
      fw_cfg: Make base type "fw_cfg" abstract · e061fa3c
      Markus Armbruster 提交于
      Missed when commit 5712db6a split off "fw_cfg_io" and "fw_cfg_mem".
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1469777353-9383-1-git-send-email-armbru@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e061fa3c
    • 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 16 次提交