linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: roger.pau@citrix.com (Roger Pau Monné)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 16/20] block/xen-blkback: Make it running on 64KB page granularity
Date: Thu, 20 Aug 2015 10:14:11 +0200	[thread overview]
Message-ID: <55D58C53.1020601@citrix.com> (raw)
In-Reply-To: <1438966019-19322-17-git-send-email-julien.grall@citrix.com>

El 07/08/15 a les 18.46, Julien Grall ha escrit:
> The PV block protocol is using 4KB page granularity. The goal of this
> patch is to allow a Linux using 64KB page granularity behaving as a
> block backend on a non-modified Xen.
> 
> It's only necessary to adapt the ring size and the number of request per
> indirect frames. The rest of the code is relying on the grant table
> code.
> 
> Note that the grant table code is allocating a Linux page per grant
> which will result to waste 6OKB for every grant when Linux is using 64KB
> page granularity. This could be improved by sharing the page between
> multiple grants.
> 
> Signed-off-by: Julien Grall <julien.grall@citrix.com>

LGTM:

Acked-by: Roger Pau Monn? <roger.pau@citrix.com>

> ---
> 
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: "Roger Pau Monn?" <roger.pau@citrix.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> 
> Improvement such as support of 64KB grant is not taken into
> consideration in this patch because we have the requirement to run a
> Linux using 64KB pages on a non-modified Xen.
> 
> This has been tested only with a loop device. I plan to test passing
> hard drive partition but I didn't yet convert the swiotlb code.
> 
>     Changes in v3:
>         - Use DIV_ROUND_UP in INDIRECT_PAGES to avoid a line over 80
>         characters
> ---
>  drivers/block/xen-blkback/blkback.c |  5 +++--
>  drivers/block/xen-blkback/common.h  | 17 +++++++++++++----
>  drivers/block/xen-blkback/xenbus.c  |  9 ++++++---
>  3 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> index ced9677..d5cce8c 100644
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -961,7 +961,7 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
>  		seg[n].nsec = segments[i].last_sect -
>  			segments[i].first_sect + 1;
>  		seg[n].offset = (segments[i].first_sect << 9);
> -		if ((segments[i].last_sect >= (PAGE_SIZE >> 9)) ||
> +		if ((segments[i].last_sect >= (XEN_PAGE_SIZE >> 9)) ||
>  		    (segments[i].last_sect < segments[i].first_sect)) {
>  			rc = -EINVAL;
>  			goto unmap;
> @@ -1210,6 +1210,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
>  
>  	req_operation = req->operation == BLKIF_OP_INDIRECT ?
>  			req->u.indirect.indirect_op : req->operation;
> +
>  	if ((req->operation == BLKIF_OP_INDIRECT) &&
>  	    (req_operation != BLKIF_OP_READ) &&
>  	    (req_operation != BLKIF_OP_WRITE)) {
> @@ -1268,7 +1269,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
>  			seg[i].nsec = req->u.rw.seg[i].last_sect -
>  				req->u.rw.seg[i].first_sect + 1;
>  			seg[i].offset = (req->u.rw.seg[i].first_sect << 9);
> -			if ((req->u.rw.seg[i].last_sect >= (PAGE_SIZE >> 9)) ||
> +			if ((req->u.rw.seg[i].last_sect >= (XEN_PAGE_SIZE >> 9)) ||
>  			    (req->u.rw.seg[i].last_sect <
>  			     req->u.rw.seg[i].first_sect))
>  				goto fail_response;
> diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
> index 45a044a..68e87a0 100644
> --- a/drivers/block/xen-blkback/common.h
> +++ b/drivers/block/xen-blkback/common.h
> @@ -39,6 +39,7 @@
>  #include <asm/pgalloc.h>
>  #include <asm/hypervisor.h>
>  #include <xen/grant_table.h>
> +#include <xen/page.h>
>  #include <xen/xenbus.h>
>  #include <xen/interface/io/ring.h>
>  #include <xen/interface/io/blkif.h>
> @@ -51,12 +52,20 @@ extern unsigned int xen_blkif_max_ring_order;
>   */
>  #define MAX_INDIRECT_SEGMENTS 256
>  
> -#define SEGS_PER_INDIRECT_FRAME \
> -	(PAGE_SIZE/sizeof(struct blkif_request_segment))
> +/*
> + * Xen use 4K pages. The guest may use different page size (4K or 64K)

Please expand this comment to mention that it only applies to ARM, for
now on x86 the backend and the frontend always use the same page size.

Roger.

  reply	other threads:[~2015-08-20  8:14 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 16:46 [PATCH v3 00/20] xen/arm64: Add support for 64KB page Julien Grall
2015-08-07 16:46 ` [PATCH v3 01/20] net/xen-netback: xenvif_gop_frag_copy: move GSO check out of the loop Julien Grall
2015-08-08 13:59   ` Wei Liu
2015-08-07 16:46 ` [PATCH v3 02/20] arm/xen: Drop pte_mfn and mfn_pte Julien Grall
2015-08-10 10:10   ` Stefano Stabellini
2015-08-07 16:46 ` [PATCH v3 03/20] xen: Add Xen specific page definition Julien Grall
2015-08-10 10:46   ` Stefano Stabellini
2015-08-20  9:49   ` [Xen-devel] " David Vrabel
2015-08-07 16:46 ` [PATCH v3 04/20] xen/grant: Introduce helpers to split a page into grant Julien Grall
2015-08-10 10:44   ` Stefano Stabellini
2015-08-20  9:51   ` [Xen-devel] " David Vrabel
2015-08-28 14:29     ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 05/20] xen/grant: Add helper gnttab_page_grant_foreign_access_ref_one Julien Grall
2015-08-07 16:46 ` [PATCH v3 06/20] block/xen-blkfront: Split blkif_queue_request in 2 Julien Grall
2015-08-07 16:46 ` [PATCH v3 07/20] block/xen-blkfront: Store a page rather a pfn in the grant structure Julien Grall
2015-08-07 16:46 ` [PATCH v3 08/20] block/xen-blkfront: split get_grant in 2 Julien Grall
2015-08-20  7:33   ` Roger Pau Monné
2015-08-07 16:46 ` [PATCH v3 09/20] xen/biomerge: Don't allow biovec to be merge when Linux is not using 4KB page Julien Grall
2015-08-10 10:50   ` Stefano Stabellini
2015-08-10 11:24     ` [Xen-devel] " Julien Grall
2015-08-10 11:25       ` Stefano Stabellini
2015-08-10 11:32         ` Julien Grall
2015-08-10 12:41           ` David Vrabel
2015-08-07 16:46 ` [PATCH v3 10/20] xen/xenbus: Use Xen page definition Julien Grall
2015-08-07 16:46 ` [PATCH v3 11/20] tty/hvc: xen: Use xen " Julien Grall
2015-08-20  9:55   ` [Xen-devel] " David Vrabel
2015-08-28 15:03     ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 12/20] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux Julien Grall
2015-08-10 11:18   ` Stefano Stabellini
2015-08-10 11:31     ` Julien Grall
2015-08-10 12:55       ` Stefano Stabellini
2015-08-10 13:36         ` Julien Grall
2015-08-20  9:59   ` [Xen-devel] " David Vrabel
2015-08-28 15:10     ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 13/20] xen/events: fifo: Make it running on 64KB granularity Julien Grall
2015-08-07 16:46 ` [PATCH v3 14/20] xen/grant-table: " Julien Grall
2015-08-07 16:46 ` [PATCH v3 15/20] block/xen-blkfront: Make it running on 64KB page granularity Julien Grall
2015-08-20  8:10   ` Roger Pau Monné
2015-08-28 15:33     ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 16/20] block/xen-blkback: " Julien Grall
2015-08-20  8:14   ` Roger Pau Monné [this message]
2015-08-07 16:46 ` [PATCH v3 17/20] net/xen-netfront: " Julien Grall
2015-08-20 10:03   ` [Xen-devel] " David Vrabel
2015-08-07 16:46 ` [PATCH v3 18/20] net/xen-netback: " Julien Grall
2015-08-08 14:55   ` Wei Liu
2015-08-10  9:57     ` Julien Grall
2015-08-10 11:39       ` Wei Liu
2015-08-10 12:00         ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 19/20] xen/privcmd: Add support for Linux " Julien Grall
2015-08-10 12:03   ` Stefano Stabellini
2015-08-10 12:14     ` [Xen-devel] " David Vrabel
2015-08-10 12:57       ` Stefano Stabellini
2015-08-10 13:25         ` Julien Grall
2015-09-01 17:10     ` Julien Grall
2015-08-20 10:08   ` [Xen-devel] " David Vrabel
2015-08-07 16:46 ` [PATCH v3 20/20] arm/xen: Add support for " Julien Grall
2015-08-10 12:52   ` Stefano Stabellini
2015-08-07 17:11 ` [Xen-devel] [PATCH v3 00/20] xen/arm64: Add support for 64KB page Julien Grall
2015-08-20  0:40 ` Julien Grall
2015-08-20  8:15   ` Roger Pau Monné
2015-08-20 10:11   ` David Vrabel
2015-08-20 15:03     ` Julien Grall
2015-08-20 15:15       ` David Vrabel

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=55D58C53.1020601@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.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 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).