From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Juergen Gross <jgross@suse.com>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
david.vrabel@citrix.com, boris.ostrovsky@oracle.com,
x86@kernel.org, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com
Subject: Re: [PATCH V3 8/8] xen: Speed up set_phys_to_machine() by using read-only mappings
Date: Wed, 19 Nov 2014 15:39:14 -0500 [thread overview]
Message-ID: <20141119203914.GC18495@laptop.dumpdata.com> (raw)
In-Reply-To: <1415684626-18590-9-git-send-email-jgross@suse.com>
On Tue, Nov 11, 2014 at 06:43:46AM +0100, Juergen Gross wrote:
> Instead of checking at each call of set_phys_to_machine() whether a
> new p2m page has to be allocated due to writing an entry in a large
> invalid or identity area, just map those areas read only and react
> to a page fault on write by allocating the new page.
>
> This change will make the common path with no allocation much
> faster as it only requires a single write of the new mfn instead
> of walking the address translation tables and checking for the
> special cases.
>
> Suggested-by: David Vrabel <david.vrabel@citrix.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Clever!
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> arch/x86/xen/p2m.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
> index 7df446d..58cf04c 100644
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -70,6 +70,7 @@
>
> #include <asm/cache.h>
> #include <asm/setup.h>
> +#include <asm/uaccess.h>
>
> #include <asm/xen/page.h>
> #include <asm/xen/hypercall.h>
> @@ -313,9 +314,9 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m)
> paravirt_alloc_pte(&init_mm, __pa(p2m_identity_pte) >> PAGE_SHIFT);
> for (i = 0; i < PTRS_PER_PTE; i++) {
> set_pte(p2m_missing_pte + i,
> - pfn_pte(PFN_DOWN(__pa(p2m_missing)), PAGE_KERNEL));
> + pfn_pte(PFN_DOWN(__pa(p2m_missing)), PAGE_KERNEL_RO));
> set_pte(p2m_identity_pte + i,
> - pfn_pte(PFN_DOWN(__pa(p2m_identity)), PAGE_KERNEL));
> + pfn_pte(PFN_DOWN(__pa(p2m_identity)), PAGE_KERNEL_RO));
> }
>
> for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += chunk) {
> @@ -362,7 +363,7 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m)
> p2m_missing : p2m_identity;
> ptep = populate_extra_pte((unsigned long)(p2m + pfn));
> set_pte(ptep,
> - pfn_pte(PFN_DOWN(__pa(mfns)), PAGE_KERNEL));
> + pfn_pte(PFN_DOWN(__pa(mfns)), PAGE_KERNEL_RO));
> continue;
> }
>
> @@ -621,6 +622,9 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> return true;
> }
>
> + if (likely(!__put_user(mfn, xen_p2m_addr + pfn)))
> + return true;
> +
> ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level);
> BUG_ON(!ptep || level != PG_LEVEL_4K);
>
> @@ -630,9 +634,7 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> if (pte_pfn(*ptep) == PFN_DOWN(__pa(p2m_identity)))
> return mfn == IDENTITY_FRAME(pfn);
>
> - xen_p2m_addr[pfn] = mfn;
> -
> - return true;
> + return false;
> }
>
> bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> --
> 2.1.2
>
next prev parent reply other threads:[~2014-11-19 20:39 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-11 5:43 [PATCH V3 0/8] xen: Switch to virtual mapped linear p2m list Juergen Gross
2014-11-11 5:43 ` [PATCH V3 1/8] xen: Make functions static Juergen Gross
2014-11-11 10:21 ` [Xen-devel] " David Vrabel
2014-11-11 10:36 ` Juergen Gross
2014-11-11 10:50 ` David Vrabel
2014-11-11 10:55 ` Jürgen Groß
2014-11-11 5:43 ` [PATCH V3 2/8] xen: Delay remapping memory of pv-domain Juergen Gross
2014-11-11 11:45 ` [Xen-devel] " Andrew Cooper
2014-11-11 12:03 ` Juergen Gross
2014-11-12 21:45 ` Konrad Rzeszutek Wilk
2014-11-13 6:23 ` Juergen Gross
2014-11-13 19:56 ` Konrad Rzeszutek Wilk
2014-11-14 4:53 ` Juergen Gross
2014-11-14 11:16 ` [Xen-devel] " David Vrabel
2014-11-14 16:47 ` Konrad Rzeszutek Wilk
2014-11-14 17:14 ` Juergen Gross
2014-11-19 19:43 ` Konrad Rzeszutek Wilk
2014-11-20 4:59 ` Juergen Gross
2014-11-11 5:43 ` [PATCH V3 3/8] xen: Delay m2p_override initialization Juergen Gross
2014-11-11 10:29 ` [Xen-devel] " David Vrabel
2014-11-12 18:35 ` Konrad Rzeszutek Wilk
2014-11-11 5:43 ` [PATCH V3 4/8] xen: Delay invalidating extra memory Juergen Gross
2014-11-12 22:10 ` Konrad Rzeszutek Wilk
2014-11-13 6:49 ` Juergen Gross
2014-11-13 19:56 ` Konrad Rzeszutek Wilk
2014-11-11 5:43 ` [PATCH V3 5/8] x86: Introduce function to get pmd entry pointer Juergen Gross
2014-11-12 22:12 ` Konrad Rzeszutek Wilk
2014-11-13 6:54 ` Juergen Gross
2014-11-13 20:01 ` Konrad Rzeszutek Wilk
2014-11-11 5:43 ` [PATCH V3 6/8] xen: Hide get_phys_to_machine() to be able to tune common path Juergen Gross
2014-11-11 17:38 ` [Xen-devel] " David Vrabel
2014-11-12 22:18 ` Konrad Rzeszutek Wilk
2014-11-13 9:15 ` Juergen Gross
2014-11-13 13:51 ` Konrad Rzeszutek Wilk
2014-11-11 5:43 ` [PATCH V3 7/8] xen: switch to linear virtual mapped sparse p2m list Juergen Gross
2014-11-11 17:47 ` [Xen-devel] " David Vrabel
2014-11-13 9:21 ` Juergen Gross
2014-11-14 11:58 ` David Vrabel
2014-11-14 12:42 ` Juergen Gross
2014-11-19 20:38 ` Konrad Rzeszutek Wilk
2014-11-19 20:37 ` Konrad Rzeszutek Wilk
2014-11-11 5:43 ` [PATCH V3 8/8] xen: Speed up set_phys_to_machine() by using read-only mappings Juergen Gross
2014-11-11 17:48 ` [Xen-devel] " David Vrabel
2014-11-19 20:39 ` Konrad Rzeszutek Wilk [this message]
2014-11-19 20:41 ` [PATCH V3 0/8] xen: Switch to virtual mapped linear p2m list Konrad Rzeszutek Wilk
2014-11-20 5:08 ` Juergen Gross
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=20141119203914.GC18495@laptop.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--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
Powered by JetHome