All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulina Szubarczyk <paulinaszubarczyk@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: roger.pau@citrix.com, wei.liu2@citrix.com,
	ian.jackson@eu.citrix.com, david.vrabel@citrix.com,
	sstabellini@kernel.org, anthony.perard@citrix.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 2/2] qdisk - hw/block/xen_disk: grant copy implementation
Date: Mon, 8 Aug 2016 13:44:38 +0200	[thread overview]
Message-ID: <57A870A6.5070306@gmail.com> (raw)
In-Reply-To: <1470146790-6168-3-git-send-email-paulinaszubarczyk@gmail.com>



On 08/02/2016 04:06 PM, Paulina Szubarczyk wrote:
> Copy data operated on during request from/to local buffers to/from
> the grant references.
>
> Before grant copy operation local buffers must be allocated what is
> done by calling ioreq_init_copy_buffers. For the 'read' operation,
> first, the qemu device invokes the read operation on local buffers
> and on the completion grant copy is called and buffers are freed.
> For the 'write' operation grant copy is performed before invoking
> write by qemu device.
>
> A new value 'feature_grant_copy' is added to recognize when the
> grant copy operation is supported by a guest.
>
> Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@gmail.com>
> ---
> Changes since v3:
> - qemu_memalign/qemu_free is used instead function allocating
>    memory from xc.
> - removed the get_buffer function instead there is a direct call
>    to qemu_memalign.
> - moved ioreq_copy for write operation to ioreq_runio_qemu_aio.
> - added struct xengnttab_grant_copy_segment_t and stub in
>    xen_common.h for version of xen earlier then 480.
> - added checking for version 480 to configure. The test repeats
>    all the operation that are required for version < 480 and
>    checks if xengnttab_grant_copy() is implemented.
>
> * I did not change the way of testing if grant_copy operation is
>    implemented. As far as I understand if the code from
>    gnttab_unimp.c is used then the gnttab device is unavailable
>    and the handler to gntdev would be invalid. But if the handler
>    is valid then the ioctl should return operation unimplemented
>    if the gntdev does not implement the operation.
> ---
>   configure                   |  56 +++++++++++++++++
>   hw/block/xen_disk.c         | 142 ++++++++++++++++++++++++++++++++++++++++++--
>   include/hw/xen/xen_common.h |  25 ++++++++
>   3 files changed, 218 insertions(+), 5 deletions(-)

>       /* qemu block driver */
>       DriveInfo           *dinfo;
>       BlockBackend        *blk;
> @@ -489,6 +492,95 @@ static int ioreq_map(struct ioreq *ioreq)
>       return 0;
>   }

>   static void qemu_aio_complete(void *opaque, int ret)
> @@ -511,8 +603,29 @@ static void qemu_aio_complete(void *opaque, int ret)
>           return;
>       }
>
> +    if (ioreq->blkdev->feature_grant_copy) {
> +        switch (ioreq->req.operation) {
> +        case BLKIF_OP_READ:
> +            /* in case of failure ioreq->aio_errors is increased */
> +            ioreq_copy(ioreq);

I would add a condition to invoke the grant copy only if the ret 
argument with which the callback from BlockBackend 
'qemu_aio_complete(void *opaque, int ret)' is called is equal to 0
to not unnecessary copy invalid data.

> +            free_buffers(ioreq);
> +            break;
> +        case BLKIF_OP_WRITE:
> +        case BLKIF_OP_FLUSH_DISKCACHE:
> +            if (!ioreq->req.nr_segments) {
> +                break;
> +            }
> +            free_buffers(ioreq);
> +            break;
> +        default:
> +            break;
> +        }
> +    }
> +
>       ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
> -    ioreq_unmap(ioreq);
> +    if (!ioreq->blkdev->feature_grant_copy) {
> +        ioreq_unmap(ioreq);
> +    }
>       ioreq_finish(ioreq);
>       switch (ioreq->req.operation) {
>       case BLKIF_OP_WRITE:

Paulina

  parent reply	other threads:[~2016-08-08 11:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 14:06 [Qemu-devel] [PATCH v4 0/2] qemu-qdisk: Implementation of grant copy operation Paulina Szubarczyk
2016-08-02 14:06 ` Paulina Szubarczyk
2016-08-02 14:06 ` [Qemu-devel] [PATCH v4 1/2] Interface for grant copy operation in libs Paulina Szubarczyk
2016-08-02 14:06   ` Paulina Szubarczyk
2016-08-03 14:36   ` David Vrabel
2016-08-03 14:36   ` [Qemu-devel] [Xen-devel] " David Vrabel
2016-08-04  9:42     ` David Vrabel
2016-08-04  9:42     ` [Qemu-devel] [Xen-devel] " David Vrabel
2016-08-04  9:38   ` Wei Liu
2016-08-04  9:38   ` [Qemu-devel] " Wei Liu
2016-08-04 10:27     ` Paulina Szubarczyk
2016-08-04 10:27       ` Paulina Szubarczyk
2016-08-02 14:06 ` [Qemu-devel] [PATCH v4 2/2] qdisk - hw/block/xen_disk: grant copy implementation Paulina Szubarczyk
2016-08-02 14:06   ` Paulina Szubarczyk
2016-08-08 11:11   ` [Qemu-devel] " Roger Pau Monné
2016-08-08 11:11     ` Roger Pau Monné
2016-08-08 11:34     ` Paulina Szubarczyk
2016-08-08 11:34     ` [Qemu-devel] " Paulina Szubarczyk
2016-08-08 11:44   ` Paulina Szubarczyk
2016-08-08 11:44   ` Paulina Szubarczyk [this message]
2016-08-09 16:56   ` [Qemu-devel] " Anthony PERARD
2016-08-09 16:56     ` Anthony PERARD
2016-08-09 17:34     ` [Qemu-devel] " Paulina Szubarczyk
2016-08-09 17:34       ` Paulina Szubarczyk
2016-08-10 10:29       ` Anthony PERARD
2016-08-10 10:29       ` [Qemu-devel] " Anthony PERARD

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=57A870A6.5070306@gmail.com \
    --to=paulinaszubarczyk@gmail.com \
    --cc=anthony.perard@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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.