qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: hare@suse.de, vrozenfe@redhat.com, famz@redhat.com
Subject: [Qemu-devel] [PATCH 0/4] scsi-block: receive the right SCSI status on reads and writes
Date: Wed, 11 May 2016 13:41:09 +0200	[thread overview]
Message-ID: <1462966873-30473-1-git-send-email-pbonzini@redhat.com> (raw)

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

             reply	other threads:[~2016-05-11 11:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 11:41 Paolo Bonzini [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462966873-30473-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=hare@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=vrozenfe@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).