1. 20 10月, 2017 13 次提交
  2. 19 10月, 2017 18 次提交
  3. 18 10月, 2017 4 次提交
    • M
      scsi: reject configurations with logical block size > physical block size · 3da023b5
      Mark Kanda 提交于
      Logical block size of a SCSI disk should never be larger than
      physical block size. From an ATA/SCSI perspective, it makes no sense
      to have the logical block size greater than the physical block size,
      and it cannot even be effectively expressed in the command set. The
      whole point of adding the physical block size to the ATA/SCSI command
      set was to communicate a desire for a larger block size (than logical),
      while maintaining backwards compatibility with legacy 512 byte block
      size.
      
      When setting logical_block_size > physical_block_size, QEMU cannot express
      it in READ CAPACITY(16) output, and all it can do is set the physical
      block exponent to 0 (i.e. logical_block_size == physical_block_size).
      Reporting the error properly, however, is better.
      Signed-off-by: NMark Kanda <mark.kanda@oracle.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Message-Id: <1508185024-5840-1-git-send-email-mark.kanda@oracle.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3da023b5
    • M
      qdev: defer DEVICE_DEL event until instance_finalize() · f7b879e0
      Michael Roth 提交于
      DEVICE_DEL is currently emitted when a Device is unparented, as
      opposed to when it is finalized. The main design motivation for this
      seems to be that after unparent()/unrealize(), the Device is no
      longer visible to the guest, and thus the operation is complete
      from the perspective of management.
      
      However, there are cases where remaining host-side cleanup is also
      pertinent to management. The is generally handled by treating these
      resources as aspects of the "backend", which can be managed via
      separate interfaces/events, such as blockdev_add/del, netdev_add/del,
      object_add/del, etc, but some devices do not have this level of
      compartmentalization, namely vfio-pci, and possibly to lend themselves
      well to it.
      
      In the case of vfio-pci, the "backend" cleanup happens as part of
      the finalization of the vfio-pci device itself, in particular the
      cleanup of the VFIO group FD. Failing to wait for this cleanup can
      result in tools like libvirt attempting to rebind the device to
      the host while it's still being used by VFIO, which can result in
      host crashes or other misbehavior depending on the host driver.
      
      Deferring DEVICE_DEL still affords us the ability to manage backends
      explicitly, while also addressing cases like vfio-pci's, so we
      implement that approach here.
      
      An alternative proposal involving having VFIO emit a separate event
      to denote completion of host-side cleanup was discussed, but the
      prevailing opinion seems to be that it is not worth the added
      complexity, and leaves the issue open for other Device implementations
      to solve in the future.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <20171016222315.407-4-mdroth@linux.vnet.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f7b879e0
    • M
      Revert "qdev: Free QemuOpts when the QOM path goes away" · 2fc06c4a
      Michael Roth 提交于
      This reverts commit abed886e.
      
      This patch originally addressed an issue where a DEVICE_DELETED
      event could be emitted (in device_unparent()) before a Device's
      QemuOpts were cleaned up (in device_finalize()), leading to a
      "duplicate ID" error if management attempted to immediately add
      a device with the same ID in response to the DEVICE_DELETED event.
      
      An alternative will be implemented in a subsequent patch where we
      defer the DEVICE_DELETED event until device_finalize(), which would
      also prevent the race, so we revert the original fix in preparation.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <20171016222315.407-3-mdroth@linux.vnet.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2fc06c4a
    • M
      qdev: store DeviceState's canonical path to use when unparenting · 04162f8f
      Michael Roth 提交于
      device_unparent(dev, ...) is called when a device is unparented,
      either directly, or as a result of a parent device being
      finalized, and handles some final cleanup for the device. Part
      of this includes emiting a DEVICE_DELETED QMP event to notify
      management, which includes the device's path in the composition
      tree as provided by object_get_canonical_path().
      
      object_get_canonical_path() assumes the device is still connected
      to the machine/root container, and will assert otherwise, but
      in some situations this isn't the case:
      
      If the parent is finalized as a result of object_unparent(), it
      will still be attached to the composition tree at the time any
      children are unparented as a result of that same call to
      object_unparent(). However, in some cases, object_unparent()
      will complete without finalizing the parent device, due to
      lingering references that won't be released till some time later.
      One such example is if the parent has MemoryRegion children (which
      take a ref on their parent), who in turn have AddressSpace's (which
      take a ref on their regions), since those AddressSpaces get cleaned
      up asynchronously by the RCU thread.
      
      In this case qdev:device_unparent() may be called for a child Device
      that no longer has a path to the root/machine container, causing
      object_get_canonical_path() to assert.
      
      Fix this by storing the canonical path during realize() so the
      information will still be available for device_unparent() in such
      cases.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Tested-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <20171016222315.407-2-mdroth@linux.vnet.ibm.com>
      [Clear dev->canonical_path at the post_realize_fail label, which is
       cleaner.  Suggested by David Gibson. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      04162f8f
  4. 17 10月, 2017 5 次提交