From: Ian Campbell <Ian.Campbell@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
xen-devel@lists.xenproject.org,
Jenny Herbert <jenny.herbert@citrix.com>,
Jenny Herbert <jennifer.herbert@citrix.com>,
David Vrabel <david.vrabel@citrix.com>
Subject: Re: [PATCH 06/12] xen: mark grant mapped pages as foreign
Date: Fri, 9 Jan 2015 16:19:36 +0000 [thread overview]
Message-ID: <1420820376.21186.39.camel@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1501091601290.3058@kaball.uk.xensource.com>
On Fri, 2015-01-09 at 16:03 +0000, Stefano Stabellini wrote:
> On Tue, 6 Jan 2015, David Vrabel wrote:
> > From: Jenny Herbert <jennifer.herbert@citrix.com>
> >
> > Use the "foreign" page flag to mark pages that have a grant map. Use
> > page->private to store information of the grant (the granting domain
> > and the grant reference).
> >
> > Signed-off-by: Jenny Herbert <jenny.herbert@citrix.com>
> > Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> > ---
> > arch/x86/xen/p2m.c | 50 ++++++++++++++++++++++++++++++++++++++-------
> > include/xen/grant_table.h | 13 ++++++++++++
> > 2 files changed, 56 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
> > index 0d70814..22624a3 100644
> > --- a/arch/x86/xen/p2m.c
> > +++ b/arch/x86/xen/p2m.c
> > @@ -648,6 +648,43 @@ bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> > return true;
> > }
> >
> > +static int
> > +init_page_grant_ref(struct page *p, domid_t domid, grant_ref_t grantref)
> > +{
> > +#ifdef CONFIG_X86_64
> > + uint64_t gref;
> > + uint64_t* gref_p = &gref;
> > +#else
> > + uint64_t* gref_p = kmalloc(sizeof(uint64_t), GFP_KERNEL);
> > + if (!gref)
> > + return -ENOMEM;
> > + uint64_t* gref = gref_p;
> > +#endif
> > +
> > + *gref_p = ((uint64_t) grantref << 32) | domid;
> > + p->private = gref;
> > +
> > + WARN_ON(PagePrivate(p));
> > + WARN_ON(PageForeign(p));
> > + SetPagePrivate(p);
> > + SetPageForeign(p);
> > + return 0;
> > +}
> > +
> > +static void
> > +clear_page_grant_ref(struct page *p)
> > +{
> > + WARN_ON(!PagePrivate(p));
> > + WARN_ON(!PageForeign(p));
> > +
> > +#ifndef CONFIG_X86_64
> > + kfree(p->private);
> > +#endif
> > + p->private = 0;
> > + ClearPagePrivate(p);
> > + ClearPageForeign(p);
> > +}
>
> Given that get_page_grant_ref is used by netback, these functions need
> to be made arch-independent, moved to an arch-independent code location
> and called appropriately.
... or stubbed out for arches which don't need this (which might include
arm*?).
next prev parent reply other threads:[~2015-01-09 16:19 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 18:57 [RFC PATCH 00/12] xen: fix many long-standing grant mapping bugs David Vrabel
2015-01-06 18:57 ` [PATCH 01/12] mm: allow for an alternate set of pages for userspace mappings David Vrabel
2015-01-06 18:57 ` [PATCH 02/12] mm: add 'foreign' alias for the 'pinned' page flag David Vrabel
2015-01-07 17:12 ` Konrad Rzeszutek Wilk
2015-01-06 18:57 ` [PATCH 03/12] xen/grant-table: pre-populate kernel unmap ops for xen_gnttab_unmap_refs() David Vrabel
2015-01-06 18:57 ` [PATCH 04/12] xen: remove scratch frames for ballooned pages and m2p override David Vrabel
2015-01-06 18:57 ` [PATCH 05/12] x86/xen: require ballooned pages for grant maps David Vrabel
2015-01-06 18:57 ` [PATCH 06/12] xen: mark grant mapped pages as foreign David Vrabel
2015-01-07 11:53 ` Ian Campbell
2015-01-09 16:03 ` Stefano Stabellini
2015-01-09 16:19 ` Ian Campbell [this message]
2015-01-09 16:39 ` David Vrabel
2015-01-09 16:46 ` Stefano Stabellini
2015-01-09 16:47 ` Ian Campbell
2015-01-06 18:57 ` [PATCH 07/12] xen-netback: use foreign page information from the pages themselves David Vrabel
2015-01-07 11:57 ` Ian Campbell
2015-01-06 18:57 ` [PATCH 08/12] xen/grant-table: add a mechanism to safely unmap pages that are in use David Vrabel
2015-01-07 12:00 ` Ian Campbell
2015-01-07 12:06 ` Ian Campbell
2015-01-07 13:07 ` David Vrabel
2015-01-07 13:24 ` Ian Campbell
2015-01-07 13:30 ` David Vrabel
2015-01-07 13:33 ` Ian Campbell
2015-01-09 16:11 ` Stefano Stabellini
2015-01-06 18:57 ` [PATCH 09/12] xen/gntdev: safely unmap grants in case they are still " David Vrabel
2015-01-06 18:57 ` [PATCH 10/12] xen-blkback: " David Vrabel
2015-01-06 18:57 ` [PATCH 11/12] xen/gntdev: mark userspace PTEs as special on x86 PV guests David Vrabel
2015-01-07 12:11 ` Ian Campbell
2015-01-07 13:23 ` David Vrabel
2015-01-07 13:32 ` Ian Campbell
2015-01-06 18:57 ` [PATCH 12/12] xen/gntdev: provide a set of pages for each VMA David Vrabel
2015-01-09 15:55 ` Stefano Stabellini
2015-01-09 16:05 ` Stefano Stabellini
2015-01-09 16:41 ` 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=1420820376.21186.39.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=jennifer.herbert@citrix.com \
--cc=jenny.herbert@citrix.com \
--cc=stefano.stabellini@eu.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.