qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Blue Swirl <blauwirbel@gmail.com>,
	khoa@us.ibm.com, Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	asias@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 10/11] dataplane: add virtio-blk data plane code
Date: Mon, 10 Dec 2012 14:06:02 +0100	[thread overview]
Message-ID: <20121210130602.GB12761@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <50C22FB7.1010606@redhat.com>

On Fri, Dec 07, 2012 at 07:04:39PM +0100, Kevin Wolf wrote:
> Am 05.12.2012 21:47, schrieb Stefan Hajnoczi:
> > virtio-blk-data-plane is a subset implementation of virtio-blk.  It only
> > handles read, write, and flush requests.  It does this using a dedicated
> > thread that executes an epoll(2)-based event loop and processes I/O
> > using Linux AIO.
> > 
> > This approach performs very well but can be used for raw image files
> > only.  The number of IOPS achieved has been reported to be several times
> > higher than the existing virtio-blk implementation.
> > 
> > Eventually it should be possible to unify virtio-blk-data-plane with the
> > main body of QEMU code once the block layer and hardware emulation is
> > able to run outside the global mutex.
> > 
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> > +static int process_request(IOQueue *ioq, struct iovec iov[],
> > +                           unsigned int out_num, unsigned int in_num,
> > +                           unsigned int head)
> > +{
> > +    VirtIOBlockDataPlane *s = container_of(ioq, VirtIOBlockDataPlane, ioqueue);
> > +    struct iovec *in_iov = &iov[out_num];
> > +    struct virtio_blk_outhdr outhdr;
> > +    QEMUIOVector *inhdr;
> > +    size_t in_size;
> > +
> > +    /* Copy in outhdr */
> > +    if (unlikely(iov_to_buf(iov, out_num, 0, &outhdr,
> > +                            sizeof(outhdr)) != sizeof(outhdr))) {
> > +        error_report("virtio-blk request outhdr too short");
> > +        return -EFAULT;
> > +    }
> > +    iov_discard(&iov, &out_num, sizeof(outhdr));
> > +
> > +    /* Grab inhdr for later */
> > +    in_size = iov_size(in_iov, in_num);
> > +    if (in_size < sizeof(struct virtio_blk_inhdr)) {
> > +        error_report("virtio_blk request inhdr too short");
> > +        return -EFAULT;
> > +    }
> > +    inhdr = g_slice_new(QEMUIOVector);
> > +    qemu_iovec_init(inhdr, 1);
> > +    qemu_iovec_concat_iov(inhdr, in_iov, in_num,
> > +            in_size - sizeof(struct virtio_blk_inhdr),
> > +            sizeof(struct virtio_blk_inhdr));
> > +    iov_discard(&in_iov, &in_num, -sizeof(struct virtio_blk_inhdr));
> > +
> > +    /* TODO Linux sets the barrier bit even when not advertised! */
> > +    outhdr.type &= ~VIRTIO_BLK_T_BARRIER;
> > +
> > +    struct iocb *iocb;
> > +    switch (outhdr.type & (VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_SCSI_CMD |
> > +                           VIRTIO_BLK_T_FLUSH)) {
> > +    case VIRTIO_BLK_T_IN:
> > +        iocb = ioq_rdwr(ioq, true, in_iov, in_num, outhdr.sector * 512);
> > +        break;
> > +
> > +    case VIRTIO_BLK_T_OUT:
> > +        iocb = ioq_rdwr(ioq, false, iov, out_num, outhdr.sector * 512);
> > +        break;
> > +
> > +    case VIRTIO_BLK_T_SCSI_CMD:
> > +        /* TODO support SCSI commands */
> > +        fail_request_early(s, head, inhdr, VIRTIO_BLK_S_UNSUPP);
> > +        return 0;
> > +
> > +    case VIRTIO_BLK_T_FLUSH:
> > +        /* TODO fdsync not supported by Linux AIO, do it synchronously here! */
> > +        fdatasync(s->fd);
> 
> We shouldn't ignore errors here.

Fixed, thanks.

Stefan

  reply	other threads:[~2012-12-10 13:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05 20:46 [Qemu-devel] [PATCH v5 00/11] virtio: virtio-blk data plane Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 01/11] raw-posix: add raw_get_aio_fd() for virtio-blk-data-plane Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 02/11] configure: add CONFIG_VIRTIO_BLK_DATA_PLANE Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 03/11] dataplane: add host memory mapping code Stefan Hajnoczi
2012-12-09  4:02   ` liu ping fan
2012-12-09 10:36     ` Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 04/11] dataplane: add virtqueue vring code Stefan Hajnoczi
2012-12-06 11:22   ` Michael S. Tsirkin
2012-12-06 12:53     ` Stefan Hajnoczi
2012-12-07 14:07   ` Kevin Wolf
2012-12-07 14:46     ` Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 05/11] dataplane: add event loop Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 06/11] dataplane: add Linux AIO request queue Stefan Hajnoczi
2012-12-07 14:21   ` Kevin Wolf
2012-12-10 13:05     ` Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 07/11] iov: add iov_discard() to remove data Stefan Hajnoczi
2012-12-06 11:36   ` Michael S. Tsirkin
2012-12-06 14:07     ` Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 08/11] test-iov: add iov_discard() testcase Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 09/11] iov: add qemu_iovec_concat_iov() Stefan Hajnoczi
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 10/11] dataplane: add virtio-blk data plane code Stefan Hajnoczi
2012-12-06  7:35   ` Paolo Bonzini
2012-12-06 14:03     ` Stefan Hajnoczi
2012-12-07  6:06     ` Stefan Hajnoczi
2012-12-07 10:51       ` Paolo Bonzini
2012-12-06 11:33   ` Michael S. Tsirkin
2012-12-07  5:43     ` Stefan Hajnoczi
2012-12-07 18:04   ` Kevin Wolf
2012-12-10 13:06     ` Stefan Hajnoczi [this message]
2012-12-05 20:47 ` [Qemu-devel] [PATCH v5 11/11] virtio-blk: add x-data-plane=on|off performance feature Stefan Hajnoczi
2012-12-06 11:38 ` [Qemu-devel] [PATCH v5 00/11] virtio: virtio-blk data plane Michael S. Tsirkin
2012-12-07  6:12   ` Stefan Hajnoczi
2012-12-07  2:43 ` Liu Yuan
2012-12-07  5:46   ` Stefan Hajnoczi

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=20121210130602.GB12761@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=asias@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=khoa@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).