qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] block: Expose host block dev I/O size limit in scsi-block/scsi-generic
@ 2016-05-26  6:15 Fam Zheng
  2016-05-26  6:15 ` [Qemu-devel] [PATCH 1/2] raw-posix: Fetch max sectors for host block device from sysfs Fam Zheng
  2016-05-26  6:15 ` [Qemu-devel] [PATCH 2/2] scsi-generic: Merge block max xfer len in INQUIRY response Fam Zheng
  0 siblings, 2 replies; 8+ messages in thread
From: Fam Zheng @ 2016-05-26  6:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Max Reitz, Paolo Bonzini, qemu-block

Host devices passed through as scsi-block or scsi-generic may have a compound
maximum I/O limit (out of physical hardware limit, driver quirks and file
system configuration, etc) that is presented in the sysfs entry. SG_IOs we
issue should respect this. However the value is currently not discoverable by
guest, because the vHBA (virtio-scsi) would present an fixed emulated limit,
while the INQUIRY (vpd=0xb0, block limits page) response solely speaks for the
LUN itself, not the host kernel. The issue is observed on scsi passthrough of
host usb or dm-multipath disks, and it is not specific to certain device types.

The proposed solution is collecting the host sysfs limit in raw-posix driver
when a block device is used, and intercepting INQUIRY response to clip the
max xfer len field.

This fixes booting a SanDisk usb-key with an upstream kernel.  The usb disk
reports a nonsense large value in INQUIRY, while the host (usb quirk?) only
allows 120KB.


Fam Zheng (2):
  raw-posix: Fetch max sectors for host block device from sysfs
  scsi-generic: Merge block max xfer len in INQUIRY response

 block/raw-posix.c      | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 hw/scsi/scsi-generic.c | 12 ++++++++++++
 2 files changed, 59 insertions(+)

-- 
2.8.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-06-03  1:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-26  6:15 [Qemu-devel] [PATCH 0/2] block: Expose host block dev I/O size limit in scsi-block/scsi-generic Fam Zheng
2016-05-26  6:15 ` [Qemu-devel] [PATCH 1/2] raw-posix: Fetch max sectors for host block device from sysfs Fam Zheng
2016-06-02  6:52   ` Fam Zheng
2016-06-02 12:30   ` Max Reitz
2016-06-02 12:54     ` Kevin Wolf
2016-06-03  1:46       ` Fam Zheng
2016-05-26  6:15 ` [Qemu-devel] [PATCH 2/2] scsi-generic: Merge block max xfer len in INQUIRY response Fam Zheng
2016-05-26  7:59   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).