All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Daniel De Graaf <dgdegra@tycho.nsa.gov>, axboe@kernel.dk
Cc: Xen-devel@lists.xensource.com
Subject: Re: [PATCH 4/6] xen/blkback: use grant-table.c hypercall wrappers
Date: Tue, 20 Dec 2011 10:58:25 -0500	[thread overview]
Message-ID: <20111220155825.GC1932@phenom.dumpdata.com> (raw)
In-Reply-To: <1323893534-436-5-git-send-email-dgdegra@tycho.nsa.gov>

On Wed, Dec 14, 2011 at 03:12:12PM -0500, Daniel De Graaf wrote:
> Now that the grant table hypercall wrappers support mappings without
> GNTMAP_contains_pte, they should be used instead of invoking the
> hypercalls manually.

Hey Jens,

Same deal with this patch as with the other one I sent. Part of a
patchset, and this particular code moves the mucking around to the
existing library that does the mucking around.

It can be applied seperatly so I can also just move this patch
to my "stable/for-jens.3.3" patch series if that would make it easier
for you?

Thanks!
> 
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> ---
>  drivers/block/xen-blkback/blkback.c |   29 ++++-------------------------
>  1 files changed, 4 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> index 15ec4db..1e256dc 100644
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -324,6 +324,7 @@ struct seg_buf {
>  static void xen_blkbk_unmap(struct pending_req *req)
>  {
>  	struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
> +	struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];
>  	unsigned int i, invcount = 0;
>  	grant_handle_t handle;
>  	int ret;
> @@ -335,25 +336,12 @@ static void xen_blkbk_unmap(struct pending_req *req)
>  		gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i),
>  				    GNTMAP_host_map, handle);
>  		pending_handle(req, i) = BLKBACK_INVALID_HANDLE;
> +		pages[invcount] = virt_to_page(vaddr(req, i));
>  		invcount++;
>  	}
>  
> -	ret = HYPERVISOR_grant_table_op(
> -		GNTTABOP_unmap_grant_ref, unmap, invcount);
> +	ret = gnttab_unmap_refs(unmap, pages, invcount, false);
>  	BUG_ON(ret);
> -	/*
> -	 * Note, we use invcount, so nr->pages, so we can't index
> -	 * using vaddr(req, i).
> -	 */
> -	for (i = 0; i < invcount; i++) {
> -		ret = m2p_remove_override(
> -			virt_to_page(unmap[i].host_addr), false);
> -		if (ret) {
> -			pr_alert(DRV_PFX "Failed to remove M2P override for %lx\n",
> -				 (unsigned long)unmap[i].host_addr);
> -			continue;
> -		}
> -	}
>  }
>  
>  static int xen_blkbk_map(struct blkif_request *req,
> @@ -381,7 +369,7 @@ static int xen_blkbk_map(struct blkif_request *req,
>  				  pending_req->blkif->domid);
>  	}
>  
> -	ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nseg);
> +	ret = gnttab_map_refs(map, NULL, &blkbk->pending_page(pending_req, 0), nseg);
>  	BUG_ON(ret);
>  
>  	/*
> @@ -401,15 +389,6 @@ static int xen_blkbk_map(struct blkif_request *req,
>  		if (ret)
>  			continue;
>  
> -		ret = m2p_add_override(PFN_DOWN(map[i].dev_bus_addr),
> -			blkbk->pending_page(pending_req, i), NULL);
> -		if (ret) {
> -			pr_alert(DRV_PFX "Failed to install M2P override for %lx (ret: %d)\n",
> -				 (unsigned long)map[i].dev_bus_addr, ret);
> -			/* We could switch over to GNTTABOP_copy */
> -			continue;
> -		}
> -
>  		seg[i].buf  = map[i].dev_bus_addr |
>  			(req->u.rw.seg[i].first_sect << 9);
>  	}
> -- 
> 1.7.7.4

  parent reply	other threads:[~2011-12-20 15:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 20:12 [PATCH v3 0/6] xen/{net, blk}back support for running in HVM Daniel De Graaf
2011-12-14 20:12 ` [PATCH 1/6] xenbus: Support HVM backends Daniel De Graaf
2011-12-15 14:13   ` David Vrabel
2011-12-15 14:38     ` Daniel De Graaf
2011-12-16 19:56   ` Konrad Rzeszutek Wilk
2011-12-19 17:51     ` Daniel De Graaf
2011-12-19 17:54       ` [PATCH 1/6 v2] " Daniel De Graaf
2011-12-19 18:16       ` [PATCH 1/6] " Konrad Rzeszutek Wilk
2011-12-19 18:46         ` Daniel De Graaf
2011-12-19 19:23           ` Konrad Rzeszutek Wilk
2011-12-19 19:55             ` [PATCH 1/6 v3] " Daniel De Graaf
2011-12-14 20:12 ` [PATCH 2/6] xenbus: Use grant-table wrapper functions Daniel De Graaf
2011-12-16 20:09   ` Konrad Rzeszutek Wilk
2011-12-14 20:12 ` [PATCH 3/6] xen/grant-table: Support mappings required by blkback Daniel De Graaf
2011-12-14 20:12 ` [PATCH 4/6] xen/blkback: use grant-table.c hypercall wrappers Daniel De Graaf
2011-12-16 20:17   ` Konrad Rzeszutek Wilk
2011-12-20 15:58   ` Konrad Rzeszutek Wilk [this message]
2011-12-14 20:12 ` [PATCH 5/6] xen/netback: Enable netback on HVM guests Daniel De Graaf
2011-12-19 10:33   ` Ian Campbell
2011-12-14 20:12 ` [PATCH 6/6] xen/blkback: Enable blkback " Daniel De Graaf
2011-12-20 15:45   ` Konrad Rzeszutek Wilk
2011-12-16 20:20 ` [PATCH v3 0/6] xen/{net, blk}back support for running in HVM Konrad Rzeszutek Wilk
2011-12-20 15:55 ` Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2011-10-18 20:26 [PATCH 0/5] " Daniel De Graaf
2011-10-20 15:35 ` [PATCH v2 0/6] " Daniel De Graaf
2011-10-20 15:35   ` [PATCH 4/6] xen/blkback: use grant-table.c hypercall wrappers Daniel De Graaf

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=20111220155825.GC1932@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=axboe@kernel.dk \
    --cc=dgdegra@tycho.nsa.gov \
    /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.