qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] scsi-block: receive the right SCSI status on reads and writes
@ 2016-05-11 11:41 Paolo Bonzini
  2016-05-11 11:41 ` [Qemu-devel] [PATCH 1/4] scsi-disk: introduce a common base class Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Paolo Bonzini @ 2016-05-11 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: hare, vrozenfe, famz

scsi-block uses the block layer for reads and writes in order to avoid
allocating bounce buffers as big as the transferred data.  We know how
to split a large transfer to multiple reads and writes, and thus we can
use scsi-disk.c's existing code to do I/O in multiple chunks (for non-s/g
SCSI hosts) or through the DMA helpers (for s/g SCSI hosts).

Unfortunately, this has the side effect of eating the SCSI status except
in the very few cases where we can convert an errno code back to a SCSI
status.  It puts a big wrench in persistent reservations support in the
guest, for example.

Luckily, splitting a large transfer into multiple SBC commands is just as
easy, and this is what the last patch does.  It takes the original CDB,
patches in a modified starting sector and sector count, and executes the
SCSI command through blk_aio_ioctl.  It is also easy to pass a QEMUIOVector
to SG_IO, so that s/g SCSI hosts keep the performance.

The other patches are preparatory work.  Patch 2 modifies the DMA helpers
to make the API more flexible, because the SCSI subsystem would like to
have a SCSIRequest pointer passed to the I/O function instead of the
BlockBackend pointer.  Patches 1 and 3 introduce the two callbacks that
scsi-block can override.

This conflicts with Eric's work on the byte-based API; I plan to rebase it
once those patches are in.  In the meanwhile, I would especially appreciate
the review of patch 2.

Paolo Bonzini (4):
  scsi-disk: introduce a common base class
  dma-helpers: change BlockBackend to opaque value in DMAIOFunc
  scsi-disk: introduce dma_readv and dma_writev
  scsi-block: always use SG_IO

 dma-helpers.c        |  51 +++++++++---
 hw/ide/core.c        |  12 +--
 hw/ide/internal.h    |   4 +-
 hw/ide/macio.c       |   4 +-
 hw/scsi/scsi-disk.c  | 229 ++++++++++++++++++++++++++++++++++++++++++---------
 include/sysemu/dma.h |  11 +--
 6 files changed, 247 insertions(+), 64 deletions(-)

-- 
2.5.5

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

end of thread, other threads:[~2016-05-19 15:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-11 11:41 [Qemu-devel] [PATCH 0/4] scsi-block: receive the right SCSI status on reads and writes Paolo Bonzini
2016-05-11 11:41 ` [Qemu-devel] [PATCH 1/4] scsi-disk: introduce a common base class Paolo Bonzini
2016-05-11 11:41 ` [Qemu-devel] [PATCH 2/4] dma-helpers: change BlockBackend to opaque value in DMAIOFunc Paolo Bonzini
2016-05-17  2:40   ` Fam Zheng
2016-05-11 11:41 ` [Qemu-devel] [PATCH 3/4] scsi-disk: introduce dma_readv and dma_writev Paolo Bonzini
2016-05-19 15:11   ` Eric Blake
2016-05-19 15:13     ` Paolo Bonzini
2016-05-11 11:41 ` [Qemu-devel] [PATCH 4/4] scsi-block: always use SG_IO 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).