From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: stefano.stabellini@eu.citrix.com
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
Jeremy.Fitzhardinge@citrix.com
Subject: Re: [PATCH 05/12] xen: add m2p override mechanism
Date: Mon, 10 Jan 2011 18:11:21 -0500 [thread overview]
Message-ID: <20110110231121.GB16550@dumpdata.com> (raw)
In-Reply-To: <1294655801-16230-5-git-send-email-stefano.stabellini@eu.citrix.com>
On Mon, Jan 10, 2011 at 10:36:34AM +0000, stefano.stabellini@eu.citrix.com wrote:
> From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
>
> Add a simple hashtable based mechanism to override some portions of the
> m2p, so that we can find out the pfn corresponding to an mfn of a
> granted page. In fact entries corresponding to granted pages in the m2p
> hold the original pfn value of the page in the source domain that
> granted it.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
> arch/x86/include/asm/xen/page.h | 16 ++++++-
> arch/x86/xen/p2m.c | 80 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 93 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
> index 8760cc6..50f0a0f 100644
> --- a/arch/x86/include/asm/xen/page.h
> +++ b/arch/x86/include/asm/xen/page.h
> @@ -42,6 +42,11 @@ extern unsigned int machine_to_phys_order;
> extern unsigned long get_phys_to_machine(unsigned long pfn);
> extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
>
> +extern void m2p_add_override(unsigned long mfn, struct page *page);
> +extern void m2p_remove_override(struct page *page);
> +extern struct page *m2p_find_override(unsigned long mfn);
> +extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
> +
> static inline unsigned long pfn_to_mfn(unsigned long pfn)
> {
> unsigned long mfn;
> @@ -72,9 +77,6 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
> if (xen_feature(XENFEAT_auto_translated_physmap))
> return mfn;
>
> - if (unlikely((mfn >> machine_to_phys_order) != 0))
> - return ~0;
> -
> pfn = 0;
> /*
> * The array access can fail (e.g., device space beyond end of RAM).
> @@ -83,6 +85,14 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
> */
> __get_user(pfn, &machine_to_phys_mapping[mfn]);
>
> + /*
> + * If this appears to be a foreign mfn (because the pfn
> + * doesn't map back to the mfn), then check the local override
> + * table to see if there's a better pfn to use.
> + */
> + if (get_phys_to_machine(pfn) != mfn)
Any reason to not use 'pfn_to_mfn' call instead? If we do want
to use the get_hhys_to_machine wouldn't be easier to just
check for 'FOREIGN_FRAME_BIT' set? Or is just mostly a copy-n-paste
of mfn_to_local_pfn?
Asking this b/c with some of my changes this will be triggered on
identity mappings. The reason being that the IDENTITY_FRAME_BIT
is still set when using get_phys_to_machine. However on the 'pfn_to_mfn'
call, that is cleared (along with the FOREIGN_FRAME_BIT)...
next prev parent reply other threads:[~2011-01-10 23:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-10 10:36 [PATCH v2 00/12] xen: allow usermode to map granted pages Stefano Stabellini
2011-01-10 10:36 ` [PATCH 01/12] xen: define gnttab_set_map_op/unmap_op stefano.stabellini
2011-01-10 10:36 ` [PATCH 02/12] xen/gntdev: allow usermode to map granted pages stefano.stabellini
2011-01-10 10:36 ` [PATCH 03/12] xen/gntdev: add VM_PFNMAP to vma stefano.stabellini
2011-01-10 10:36 ` [PATCH 04/12] xen: move p2m handling to separate file stefano.stabellini
2011-01-10 10:36 ` [PATCH 05/12] xen: add m2p override mechanism stefano.stabellini
2011-01-10 23:11 ` Konrad Rzeszutek Wilk [this message]
2011-01-11 12:44 ` Stefano Stabellini
2011-01-11 15:24 ` Konrad Rzeszutek Wilk
2011-01-10 10:36 ` [PATCH 06/12] xen: gntdev: move use of GNTMAP_contains_pte next to the map_op stefano.stabellini
2011-01-10 10:36 ` [PATCH 07/12] xen/gntdev: stop using "token" argument stefano.stabellini
2011-01-10 10:36 ` [PATCH 08/12] xen/gntdev: Fix circular locking dependency stefano.stabellini
2011-01-10 10:36 ` [PATCH 09/12] xen p2m: transparently change the p2m mappings in the m2p override stefano.stabellini
2011-01-10 10:36 ` [PATCH 10/12] xen: introduce gnttab_map_refs and gnttab_unmap_refs stefano.stabellini
2011-01-10 10:36 ` [PATCH 11/12] xen gntdev: use " stefano.stabellini
2011-01-10 10:36 ` [PATCH 12/12] xen p2m: clear the old pte when adding a page to m2p_override stefano.stabellini
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=20110110231121.GB16550@dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=Jeremy.Fitzhardinge@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®