1. 04 6月, 2019 3 次提交
    • K
      scsi-disk: Use qdev_prop_drive_iothread · 4f71fb43
      Kevin Wolf 提交于
      This makes use of qdev_prop_drive_iothread for scsi-disk so that the
      disk can be attached to a node that is already in the target AioContext.
      We need to check that the HBA actually supports iothreads, otherwise
      scsi-disk must make sure that the node is already in the main
      AioContext.
      
      This changes the error message for conflicting iothread settings.
      Previously, virtio-scsi produced the error message, now it comes from
      blk_set_aio_context(). Update a test case accordingly.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4f71fb43
    • K
      block: Add BlockBackend.ctx · d861ab3a
      Kevin Wolf 提交于
      This adds a new parameter to blk_new() which requires its callers to
      declare from which AioContext this BlockBackend is going to be used (or
      the locks of which AioContext need to be taken anyway).
      
      The given context is only stored and kept up to date when changing
      AioContexts. Actually applying the stored AioContext to the root node
      is saved for another commit.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d861ab3a
    • K
      block: Add Error to blk_set_aio_context() · 97896a48
      Kevin Wolf 提交于
      Add an Error parameter to blk_set_aio_context() and use
      bdrv_child_try_set_aio_context() internally to check whether all
      involved nodes can actually support the AioContext switch.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      97896a48
  2. 03 6月, 2019 3 次提交
    • L
      vhost-scsi: Allow user to enable migration · b3e89c94
      Liran Alon 提交于
      In order to perform a valid migration of a vhost-scsi device,
      the following requirements must be met:
      (1) The virtio-scsi device state needs to be saved & loaded.
      (2) The vhost backend must be stopped before virtio-scsi device state
      is saved:
        (2.1) Sync vhost backend state to virtio-scsi device state.
        (2.2) No further I/O requests are made by vhost backend to target
              SCSI device.
        (2.3) No further guest memory access takes place after VM is stopped.
      (3) Requests in-flight to target SCSI device are completed before
          migration handover.
      (4) Target SCSI device state needs to be saved & loaded into the
          destination host target SCSI device.
      
      Previous commit ("vhost-scsi: Add VMState descriptor")
      add support to save & load the device state using VMState.
      This meets requirement (1).
      
      When VM is stopped by migration thread (On Pre-Copy complete), the
      following code path is executed:
      migration_completion() -> vm_stop_force_state() -> vm_stop() ->
      do_vm_stop().
      
      do_vm_stop() calls first pause_all_vcpus() which pause all guest
      vCPUs and then call vm_state_notify().
      In case of vhost-scsi device, this will lead to the following code path
      to be executed:
      vm_state_notify() -> virtio_vmstate_change() ->
      virtio_set_status() -> vhost_scsi_set_status() -> vhost_scsi_stop().
      vhost_scsi_stop() then calls vhost_scsi_clear_endpoint() and
      vhost_scsi_common_stop().
      
      vhost_scsi_clear_endpoint() sends VHOST_SCSI_CLEAR_ENDPOINT ioctl to
      vhost backend which will reach kernel's vhost_scsi_clear_endpoint()
      which process all pending I/O requests and wait for them to complete
      (vhost_scsi_flush()). This meets requirement (3).
      
      vhost_scsi_common_stop() will stop the vhost backend.
      As part of this stop, dirty-bitmap is synced and vhost backend state is
      synced with virtio-scsi device state. As at this point guest vCPUs are
      already paused, this meets requirement (2).
      
      At this point we are left with requirement (4) which is target SCSI
      device specific and therefore cannot be done by QEMU. Which is the main
      reason why vhost-scsi adds a migration blocker.
      However, as this can be handled either by an external orchestrator or
      by using shared-storage (i.e. iSCSI), there is no reason to limit the
      orchestrator from being able to explictly specify it wish to enable
      migration even when VM have a vhost-scsi device.
      
      Considering all the above, this commit allows orchestrator to explictly
      specify that it is responsbile for taking care of requirement (4) and
      therefore vhost-scsi should not add a migration blocker.
      Reviewed-by: NNir Weiner <nir.weiner@oracle.com>
      Reviewed-by: NBijan Mottahedeh <bijan.mottahedeh@oracle.com>
      Signed-off-by: NLiran Alon <liran.alon@oracle.com>
      Message-Id: <20190416125912.44001-4-liran.alon@oracle.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      b3e89c94
    • N
      vhost-scsi: Add VMState descriptor · 4ea57425
      Nir Weiner 提交于
      As preparation of enabling migration of vhost-scsi device,
      define it’s VMState. Note, we keep the convention of
      verifying in the pre_save() method that the vhost backend
      must be stopped before attempting to save the device
      state. Similar to how it is done for vhost-vsock.
      Reviewed-by: NBijan Mottahedeh <bijan.mottahedeh@oracle.com>
      Reviewed-by: NLiran Alon <liran.alon@oracle.com>
      Signed-off-by: NNir Weiner <nir.weiner@oracle.com>
      Message-Id: <20190416125912.44001-3-liran.alon@oracle.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      4ea57425
    • N
      vhost-scsi: The vhost backend should be stopped when the VM is not running · c6d369fd
      Nir Weiner 提交于
      vhost-scsi doesn’t takes into account whether the VM is running or not in
      order to decide if it should start/stop vhost backend.
      This would lead to vhost backend still being active when VM's RunState
      suddenly change to stopped.
      
      An example of when this issue is encountered is when Live-Migration Pre-Copy
      phase completes. As in this case, VM state will be changed to stopped (while
      vhost backend is still active), which will result in
      virtio_vmstate_change() -> virtio_set_status() -> vhost_scsi_set_status()
      executed but vhost_scsi_set_status() will just return without stopping
      vhost backend.
      
      To handle this, change code to consider that vhost processing should be
      stopped when VM is not running. Similar to how it is done in vhost-vsock
      device at vhost_vsock_set_status().
      
      Fixes: 5e9be92d ("vhost-scsi: new device supporting the tcm_vhost Linux kernel module”)
      Reviewed-by: NBijan Mottahedeh <bijan.mottahedeh@oracle.com>
      Reviewed-by: NLiran Alon <liran.alon@oracle.com>
      Signed-off-by: NNir Weiner <nir.weiner@oracle.com>
      Message-Id: <20190416125912.44001-2-liran.alon@oracle.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      c6d369fd
  3. 30 5月, 2019 1 次提交
  4. 15 5月, 2019 1 次提交
  5. 23 3月, 2019 1 次提交
  6. 13 3月, 2019 1 次提交
  7. 12 3月, 2019 1 次提交
    • D
      spapr: Use CamelCase properly · ce2918cb
      David Gibson 提交于
      The qemu coding standard is to use CamelCase for type and structure names,
      and the pseries code follows that... sort of.  There are quite a lot of
      places where we bend the rules in order to preserve the capitalization of
      internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
      
      That was a bad idea - it frequently leads to names ending up with hard to
      read clusters of capital letters, and means they don't catch the eye as
      type identifiers, which is kind of the point of the CamelCase convention in
      the first place.
      
      In short, keeping type identifiers look like CamelCase is more important
      than preserving standard capitalization of internal "words".  So, this
      patch renames a heap of spapr internal type names to a more standard
      CamelCase.
      
      In addition to case changes, we also make some other identifier renames:
        VIOsPAPR* -> SpaprVio*
          The reverse word ordering was only ever used to mitigate the capital
          cluster, so revert to the natural ordering.
        VIOsPAPRVTYDevice -> SpaprVioVty
        VIOsPAPRVLANDevice -> SpaprVioVlan
          Brevity, since the "Device" didn't add useful information
        sPAPRDRConnector -> SpaprDrc
        sPAPRDRConnectorClass -> SpaprDrcClass
          Brevity, and makes it clearer this is the same thing as a "DRC"
          mentioned in many other places in the code
      
      This is 100% a mechanical search-and-replace patch.  It will, however,
      conflict with essentially any and all outstanding patches touching the
      spapr code.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ce2918cb
  8. 11 3月, 2019 10 次提交
  9. 08 3月, 2019 5 次提交
  10. 17 2月, 2019 1 次提交
  11. 05 2月, 2019 3 次提交
  12. 01 2月, 2019 5 次提交
  13. 15 1月, 2019 1 次提交
  14. 11 1月, 2019 4 次提交
    • P
      avoid TABs in files that only contain a few · 7d37435b
      Paolo Bonzini 提交于
      Most files that have TABs only contain a handful of them.  Change
      them to spaces so that we don't confuse people.
      
      disas, standard-headers, linux-headers and libdecnumber are imported
      from other projects and probably should be exempted from the check.
      Outside those, after this patch the following files still contain both
      8-space and TAB sequences at the beginning of the line.  Many of them
      have a majority of TABs, or were initially committed with all tabs.
      
          bsd-user/i386/target_syscall.h
          bsd-user/x86_64/target_syscall.h
          crypto/aes.c
          hw/audio/fmopl.c
          hw/audio/fmopl.h
          hw/block/tc58128.c
          hw/display/cirrus_vga.c
          hw/display/xenfb.c
          hw/dma/etraxfs_dma.c
          hw/intc/sh_intc.c
          hw/misc/mst_fpga.c
          hw/net/pcnet.c
          hw/sh4/sh7750.c
          hw/timer/m48t59.c
          hw/timer/sh_timer.c
          include/crypto/aes.h
          include/disas/bfd.h
          include/hw/sh4/sh.h
          libdecnumber/decNumber.c
          linux-headers/asm-generic/unistd.h
          linux-headers/linux/kvm.h
          linux-user/alpha/target_syscall.h
          linux-user/arm/nwfpe/double_cpdo.c
          linux-user/arm/nwfpe/fpa11_cpdt.c
          linux-user/arm/nwfpe/fpa11_cprt.c
          linux-user/arm/nwfpe/fpa11.h
          linux-user/flat.h
          linux-user/flatload.c
          linux-user/i386/target_syscall.h
          linux-user/ppc/target_syscall.h
          linux-user/sparc/target_syscall.h
          linux-user/syscall.c
          linux-user/syscall_defs.h
          linux-user/x86_64/target_syscall.h
          slirp/cksum.c
          slirp/if.c
          slirp/ip.h
          slirp/ip_icmp.c
          slirp/ip_icmp.h
          slirp/ip_input.c
          slirp/ip_output.c
          slirp/mbuf.c
          slirp/misc.c
          slirp/sbuf.c
          slirp/socket.c
          slirp/socket.h
          slirp/tcp_input.c
          slirp/tcpip.h
          slirp/tcp_output.c
          slirp/tcp_subr.c
          slirp/tcp_timer.c
          slirp/tftp.c
          slirp/udp.c
          slirp/udp.h
          target/cris/cpu.h
          target/cris/mmu.c
          target/cris/op_helper.c
          target/sh4/helper.c
          target/sh4/op_helper.c
          target/sh4/translate.c
          tcg/sparc/tcg-target.inc.c
          tests/tcg/cris/check_addo.c
          tests/tcg/cris/check_moveq.c
          tests/tcg/cris/check_swap.c
          tests/tcg/multiarch/test-mmap.c
          ui/vnc-enc-hextile-template.h
          ui/vnc-enc-zywrle.h
          util/envlist.c
          util/readline.c
      
      The following have only TABs:
      
          bsd-user/i386/target_signal.h
          bsd-user/sparc64/target_signal.h
          bsd-user/sparc64/target_syscall.h
          bsd-user/sparc/target_signal.h
          bsd-user/sparc/target_syscall.h
          bsd-user/x86_64/target_signal.h
          crypto/desrfb.c
          hw/audio/intel-hda-defs.h
          hw/core/uboot_image.h
          hw/sh4/sh7750_regnames.c
          hw/sh4/sh7750_regs.h
          include/hw/cris/etraxfs_dma.h
          linux-user/alpha/termbits.h
          linux-user/arm/nwfpe/fpopcode.h
          linux-user/arm/nwfpe/fpsr.h
          linux-user/arm/syscall_nr.h
          linux-user/arm/target_signal.h
          linux-user/cris/target_signal.h
          linux-user/i386/target_signal.h
          linux-user/linux_loop.h
          linux-user/m68k/target_signal.h
          linux-user/microblaze/target_signal.h
          linux-user/mips64/target_signal.h
          linux-user/mips/target_signal.h
          linux-user/mips/target_syscall.h
          linux-user/mips/termbits.h
          linux-user/ppc/target_signal.h
          linux-user/sh4/target_signal.h
          linux-user/sh4/termbits.h
          linux-user/sparc64/target_syscall.h
          linux-user/sparc/target_signal.h
          linux-user/x86_64/target_signal.h
          linux-user/x86_64/termbits.h
          pc-bios/optionrom/optionrom.h
          slirp/mbuf.h
          slirp/misc.h
          slirp/sbuf.h
          slirp/tcp.h
          slirp/tcp_timer.h
          slirp/tcp_var.h
          target/i386/svm.h
          target/sparc/asi.h
          target/xtensa/core-dc232b/xtensa-modules.inc.c
          target/xtensa/core-dc233c/xtensa-modules.inc.c
          target/xtensa/core-de212/core-isa.h
          target/xtensa/core-de212/xtensa-modules.inc.c
          target/xtensa/core-fsf/xtensa-modules.inc.c
          target/xtensa/core-sample_controller/core-isa.h
          target/xtensa/core-sample_controller/xtensa-modules.inc.c
          target/xtensa/core-test_kc705_be/core-isa.h
          target/xtensa/core-test_kc705_be/xtensa-modules.inc.c
          tests/tcg/cris/check_abs.c
          tests/tcg/cris/check_addc.c
          tests/tcg/cris/check_addcm.c
          tests/tcg/cris/check_addoq.c
          tests/tcg/cris/check_bound.c
          tests/tcg/cris/check_ftag.c
          tests/tcg/cris/check_int64.c
          tests/tcg/cris/check_lz.c
          tests/tcg/cris/check_openpf5.c
          tests/tcg/cris/check_sigalrm.c
          tests/tcg/cris/crisutils.h
          tests/tcg/cris/sys.c
          tests/tcg/i386/test-i386-ssse3.c
          ui/vgafont.h
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20181213223737.11793-3-pbonzini@redhat.com>
      Reviewed-by: NAleksandar Markovic <amarkovic@wavecomp.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NWainer dos Santos Moschetta <wainersm@redhat.com>
      Acked-by: NRichard Henderson <richard.henderson@linaro.org>
      Acked-by: NEric Blake <eblake@redhat.com>
      Acked-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NStefan Markovic <smarkovic@wavecomp.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7d37435b
    • P
      qemu/queue.h: simplify reverse access to QTAILQ · eae3eb3e
      Paolo Bonzini 提交于
      The new definition of QTAILQ does not require passing the headname,
      remove it.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      eae3eb3e
    • G
      scsi: esp: Defer command completion until previous interrupts have been handled · ea84a442
      Guenter Roeck 提交于
      The guest OS reads RSTAT, RSEQ, and RINTR, and expects those registers
      to reflect a consistent state. However, it is possible that the registers
      can change after RSTAT was read, but before RINTR is read, when
      esp_command_complete() is called.
      
      Guest OS		qemu
      --------		----
      [handle interrupt]
      Read RSTAT
      			esp_command_complete()
      			 RSTAT = STAT_ST
      			 esp_dma_done()
      			  RSTAT |= STAT_TC
      			  RSEQ = 0
      			  RINTR = INTR_BS
      
      Read RSEQ
      Read RINTR		RINTR = 0
      			RSTAT &= ~STAT_TC
      			RSEQ = SEQ_CD
      
      The guest OS would then try to handle INTR_BS combined with an old
      value of RSTAT. This sometimes resulted in lost events, spurious
      interrupts, guest OS confusion, and stalled SCSI operations.
      A typical guest error log (observed with various versions of Linux)
      looks as follows.
      
      scsi host1: Spurious irq, sreg=13.
      ...
      scsi host1: Aborting command [84531f10:2a]
      scsi host1: Current command [f882eea8:35]
      scsi host1: Queued command [84531f10:2a]
      scsi host1:  Active command [f882eea8:35]
      scsi host1: Dumping command log
      scsi host1: ent[15] CMD val[44] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[00] event[0c]
      scsi host1: ent[16] CMD val[01] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c]
      scsi host1: ent[17] CMD val[43] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c]
      scsi host1: ent[18] EVENT val[0d] sreg[92] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c]
      ...
      
      Defer handling command completion until previous interrupts have been
      handled to fix the problem.
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      ea84a442
    • G
      esp-pci: Fix status register write erase control · c2d6eeda
      Guenter Roeck 提交于
      Per AM53C974 datasheet, definition of "SCSI Bus and Control (SBAC)"
      register:
      
      Bit 24 'STATUS' Write Erase Control
      
      This bit controls the Write Erase feature on bits 3:1 and bit 6 of the DMA
      Status Register ((B)+54h). When this bit is programmed to '1', the state
      of bits 3:1 are preserved when read. Bits 3:1 are only cleared when a '1'
      is written to the corresponding bit location. For example, to clear bit 1,
      the value of '0000_0010b' should be written to the register. When the DMA
      Status Preserve bit is '0', bits 3:1 are cleared when read.
      
      The status register is currently defined to bit 12, not bit 24.
      Also, its implementation is reversed: The status is auto-cleared if
      the bit is set to 1, and must be cleared explicitly when the bit is
      set to 0. This results in spurious interrupts reported by the Linux
      kernel, and in some cases even results in stalled SCSI operations.
      
      Set SBAC_STATUS to bit 24 and reverse the logic to fix the problem.
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Message-Id: <1543442171-24863-1-git-send-email-linux@roeck-us.net>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c2d6eeda