From: Juergen Gross <jgross@suse.com>
To: David Vrabel <david.vrabel@citrix.com>, xen-devel@lists.xenproject.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH 3/3] x86/xen: optimize get_phys_to_machine()
Date: Wed, 07 Jan 2015 16:18:06 +0100 [thread overview]
Message-ID: <54AD4E2E.2070103@suse.com> (raw)
In-Reply-To: <1420642048-12236-4-git-send-email-david.vrabel@citrix.com>
On 01/07/2015 03:47 PM, David Vrabel wrote:
> The page table walk is only needed to distinguish between identity and
> missing, both of which have INVALID_P2M_ENTRY.
As get_phys_to_machine is called by __pfn_to_mfn() only which already
checks for mfn == INVALID_P2M_ENTRY this optimization will have an
effect only in the early boot case with pfn >= xen_p2m_size.
I doubt this is necessary.
Juergen
>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
> arch/x86/xen/p2m.c | 30 ++++++++++++++++++------------
> 1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
> index edbc7a6..a848201 100644
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -405,8 +405,7 @@ void __init xen_vmalloc_p2m_tree(void)
>
> unsigned long get_phys_to_machine(unsigned long pfn)
> {
> - pte_t *ptep;
> - unsigned int level;
> + unsigned long mfn;
>
> if (unlikely(pfn >= xen_p2m_size)) {
> if (pfn < xen_max_p2m_pfn)
> @@ -414,19 +413,26 @@ unsigned long get_phys_to_machine(unsigned long pfn)
>
> return IDENTITY_FRAME(pfn);
> }
> +
> + mfn = xen_p2m_addr[pfn];
>
> - ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level);
> - BUG_ON(!ptep || level != PG_LEVEL_4K);
> + if (unlikely(mfn == INVALID_P2M_ENTRY)) {
> + pte_t *ptep;
> + unsigned int level;
>
> - /*
> - * The INVALID_P2M_ENTRY is filled in both p2m_*identity
> - * and in p2m_*missing, so returning the INVALID_P2M_ENTRY
> - * would be wrong.
> - */
> - if (pte_pfn(*ptep) == PFN_DOWN(__pa(p2m_identity)))
> - return IDENTITY_FRAME(pfn);
> + ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level);
> + BUG_ON(!ptep || level != PG_LEVEL_4K);
> +
> + /*
> + * The INVALID_P2M_ENTRY is filled in both p2m_*identity
> + * and in p2m_*missing, so returning the INVALID_P2M_ENTRY
> + * would be wrong.
> + */
> + if (pte_pfn(*ptep) == PFN_DOWN(__pa(p2m_identity)))
> + return IDENTITY_FRAME(pfn);
> + }
>
> - return xen_p2m_addr[pfn];
> + return mfn;
> }
> EXPORT_SYMBOL_GPL(get_phys_to_machine);
>
>
next prev parent reply other threads:[~2015-01-07 15:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-07 14:47 [PATCHv1 0/3] x86/xen: fixes and improvements to linear p2m David Vrabel
2015-01-07 14:47 ` [PATCH 1/3] x86/xen: don't count how many PFNs are identity mapped David Vrabel
2015-01-07 15:10 ` Juergen Gross
2015-01-07 14:47 ` [PATCH 2/3] x86/xen: add extra memory for remapped frames during setup David Vrabel
2015-01-07 15:12 ` Juergen Gross
2015-01-07 14:47 ` [PATCH 3/3] x86/xen: optimize get_phys_to_machine() David Vrabel
2015-01-07 15:18 ` Juergen Gross [this message]
2015-01-07 15:24 ` 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=54AD4E2E.2070103@suse.com \
--to=jgross@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@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.