All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 0/7] dma-helpers, scsi-block: use SG_IO for all I/O on scsi-block
Date: Mon, 23 May 2016 20:36:24 +0100	[thread overview]
Message-ID: <57435BB8.3000600@ilande.co.uk> (raw)
In-Reply-To: <1464008051-6429-1-git-send-email-pbonzini@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2367 bytes --]

On 23/05/16 13:54, Paolo Bonzini wrote:

> 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.
> 
> This rebases the patches on top of Eric's changes for byte-based
> BlockBackend access and fixes a few bugs I knew about in the RFC.
> 
> Patches 1, 5 and 6 are new.
> 
> Paolo
> 
> Paolo Bonzini (7):
>   dma-helpers: change interface to byte-based
>   dma-helpers: change BlockBackend to opaque value in DMAIOFunc
>   scsi-disk: introduce a common base class
>   scsi-disk: introduce dma_readv and dma_writev
>   scsi-disk: add need_fua_emulation to SCSIDiskClass
>   scsi-disk: introduce scsi_disk_req_check_error
>   scsi-block: always use SG_IO
> 
>  dma-helpers.c        |  54 +++++--
>  hw/block/nvme.c      |   6 +-
>  hw/ide/ahci.c        |   6 +-
>  hw/ide/core.c        |  20 ++-
>  hw/ide/internal.h    |   6 +-
>  hw/ide/macio.c       |   2 +-
>  hw/scsi/scsi-disk.c  | 409 +++++++++++++++++++++++++++++++++++++--------------
>  include/sysemu/dma.h |  20 +--
>  trace-events         |   2 +-
>  9 files changed, 371 insertions(+), 154 deletions(-)

Hi Paolo,

I thought I'd give this patchset a spin with a view to seeing whether I
could switch the macio device back to the now byte-based dma-helpers,
but came up with a couple of compile errors. Attached is the minor diff
I applied in order to get a successful compile (apologies for not being
inline, however I couldn't get my mail client to stop wrapping incorrectly).


ATB,

Mark.


[-- Attachment #2: dma-helpers-compile-fix.patch --]
[-- Type: text/x-diff, Size: 1050 bytes --]

diff --git a/dma-helpers.c b/dma-helpers.c
index 92c5d55..b521d84 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -192,7 +192,7 @@ static const AIOCBInfo dma_aiocb_info = {
 };
 
 BlockAIOCB *dma_blk_io(AioContext *ctx,
-    QEMUSGList *sg, uint64_t opaque,
+    QEMUSGList *sg, uint64_t offset,
     DMAIOFunc *io_func, void *io_func_opaque,
     BlockCompletionFunc *cb,
     void *opaque, DMADirection dir)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 02faa3a..f7a23fc 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -540,7 +540,6 @@ static void scsi_write_data(SCSIRequest *req)
     if (r->req.sg) {
         dma_acct_start(s->qdev.conf.blk, &r->acct, r->req.sg, BLOCK_ACCT_WRITE);
         r->req.resid -= r->req.sg->size;
-                                     scsi_dma_complete, r);
         r->req.aiocb = dma_blk_io(blk_get_aio_context(s->qdev.conf.blk),
                                   r->req.sg, r->sector << BDRV_SECTOR_BITS,
                                   sdc->dma_writev, r, scsi_dma_complete, r,

  parent reply	other threads:[~2016-05-23 19:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 12:54 [Qemu-devel] [PATCH v2 0/7] dma-helpers, scsi-block: use SG_IO for all I/O on scsi-block Paolo Bonzini
2016-05-23 12:54 ` [Qemu-devel] [PATCH 1/7] dma-helpers: change interface to byte-based Paolo Bonzini
2016-05-23 15:06   ` Eric Blake
2016-05-23 12:54 ` [Qemu-devel] [PATCH 2/7] dma-helpers: change BlockBackend to opaque value in DMAIOFunc Paolo Bonzini
2016-05-23 15:43   ` Eric Blake
2016-05-24  2:47   ` Fam Zheng
2016-05-24  7:05     ` Paolo Bonzini
2016-05-23 12:54 ` [Qemu-devel] [PATCH 3/7] scsi-disk: introduce a common base class Paolo Bonzini
2016-05-23 15:53   ` Eric Blake
2016-05-23 12:54 ` [Qemu-devel] [PATCH 4/7] scsi-disk: introduce dma_readv and dma_writev Paolo Bonzini
2016-05-23 16:09   ` Eric Blake
2016-06-01 19:07   ` Mark Cave-Ayland
2016-06-03  2:56     ` xiaoqiang zhao
2016-06-03  5:22       ` Mark Cave-Ayland
2016-06-03  6:07         ` xiaoqiang zhao
2016-05-23 12:54 ` [Qemu-devel] [PATCH 5/7] scsi-disk: add need_fua_emulation to SCSIDiskClass Paolo Bonzini
2016-05-23 16:34   ` Eric Blake
2016-05-24  3:04   ` Fam Zheng
2016-05-24  7:02     ` Paolo Bonzini
2016-05-23 12:54 ` [Qemu-devel] [PATCH 6/7] scsi-disk: introduce scsi_disk_req_check_error Paolo Bonzini
2016-05-23 19:16   ` Eric Blake
2016-05-23 12:54 ` [Qemu-devel] [PATCH 7/7] scsi-block: always use SG_IO Paolo Bonzini
2016-05-23 19:49   ` Eric Blake
2016-05-23 19:36 ` Mark Cave-Ayland [this message]
2016-05-24 22:59   ` [Qemu-devel] [PATCH v2 0/7] dma-helpers, scsi-block: use SG_IO for all I/O on scsi-block Mark Cave-Ayland
2016-05-25  8:45     ` Paolo Bonzini
2016-05-25  9:13       ` Mark Cave-Ayland
2016-05-25 10:11         ` Paolo Bonzini
2016-05-25 16:38 ` [Qemu-devel] [Qemu-block] " Kevin Wolf

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=57435BB8.3000600@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.