From: David Vrabel <david.vrabel@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: dcrisan@flexiant.com, xen-devel@lists.xensource.com,
Ian.Campbell@citrix.com, alex@alex.org.uk
Subject: Re: [PATCH v2 2/2] xen/m2p: use GNTTABOP_unmap_and_replace to reinstate the original mapping
Date: Mon, 22 Jul 2013 18:02:45 +0100 [thread overview]
Message-ID: <51ED65B5.1090705@citrix.com> (raw)
In-Reply-To: <1374510529-10395-2-git-send-email-stefano.stabellini@eu.citrix.com>
On 22/07/13 17:28, Stefano Stabellini wrote:
> GNTTABOP_unmap_grant_ref unmaps a grant and replaces it with a 0
> mapping instead of reinstating the original mapping.
> Doing so separately would be racy.
>
> To unmap a grant and reinstate the original mapping atomically we use
> GNTTABOP_unmap_and_replace.
> GNTTABOP_unmap_and_replace doesn't work with GNTMAP_contains_pte, so
> don't use it for kmaps. GNTTABOP_unmap_and_replace zeroes the mapping
> passed in new_addr so we have to reinstate it, however that is a
> per-cpu mapping only used for balloon trade pages, so we can be sure that
> it's not going to be accessed while the mapping is not valid.
This solves the problem of userspace accessing a disk image on an NFS
mount but what would blkback talking to an iSCSI LUN? Will that need
similar fixes to blkback? This series does not need to fix this now though.
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -161,6 +161,7 @@
> #include <asm/xen/page.h>
> #include <asm/xen/hypercall.h>
> #include <asm/xen/hypervisor.h>
> +#include <xen/balloon.h>
> #include <xen/grant_table.h>
>
> #include "multicalls.h"
> @@ -967,7 +968,9 @@ int m2p_remove_override(struct page *page,
> if (kmap_op != NULL) {
> if (!PageHighMem(page)) {
> struct multicall_space mcs;
> - struct gnttab_unmap_grant_ref *unmap_op;
> + struct gnttab_unmap_and_replace *unmap_op;
> + unsigned long trade_page_address = (unsigned long)
> + __va(page_to_pfn(get_balloon_trade_page()) << PAGE_SHIFT);
struct page *trade_page = get_balloon_trade_page();
unsigned long trade_page_address = page_address(trade_page);
(And the corresponding put_balloon_trade_page() once you've added it.)
Otherwise,
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
David
next prev parent reply other threads:[~2013-07-22 17:02 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-22 16:21 [PATCH v2 0/2] make ballooned out pages have a valid mapping at all times Stefano Stabellini
2013-07-22 16:28 ` [PATCH v2 1/2] xen/balloon: set a mapping for ballooned out pages Stefano Stabellini
2013-07-22 16:51 ` David Vrabel
2013-07-22 17:22 ` Ian Campbell
2013-07-22 17:26 ` David Vrabel
2013-07-22 17:32 ` Ian Campbell
2013-07-23 9:58 ` David Vrabel
2013-07-23 14:27 ` Ian Campbell
2013-07-23 15:03 ` David Vrabel
2013-07-23 17:04 ` Ian Campbell
2013-07-23 17:20 ` Stefano Stabellini
2013-07-23 17:33 ` David Vrabel
2013-07-23 12:49 ` Stefano Stabellini
2013-07-23 14:24 ` Ian Campbell
2013-07-23 13:58 ` Konrad Rzeszutek Wilk
2013-07-22 16:28 ` [PATCH v2 2/2] xen/m2p: use GNTTABOP_unmap_and_replace to reinstate the original mapping Stefano Stabellini
2013-07-22 17:02 ` David Vrabel [this message]
2013-07-23 10:35 ` Roger Pau Monné
2013-07-23 12:37 ` Stefano Stabellini
2013-07-23 12:47 ` Stefano Stabellini
2013-07-23 13:57 ` Konrad Rzeszutek Wilk
2013-07-23 14:23 ` Ian Campbell
2013-07-23 14:48 ` Alex Bligh
2013-07-23 14:51 ` Ian Campbell
2013-07-23 15:06 ` Alex Bligh
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=51ED65B5.1090705@citrix.com \
--to=david.vrabel@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=alex@alex.org.uk \
--cc=dcrisan@flexiant.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.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).