All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] xen/mm: do direct hypercall in xen_set_pte() if batching is unavailable
Date: Tue, 5 Jun 2012 12:07:46 -0400	[thread overview]
Message-ID: <20120605160746.GB24031@phenom.dumpdata.com> (raw)
In-Reply-To: <1338563694-21915-1-git-send-email-david.vrabel@citrix.com>

On Fri, Jun 01, 2012 at 04:14:54PM +0100, David Vrabel wrote:
> From: David Vrabel <david.vrabel@citrix.com>
> 
> In xen_set_pte() if batching is unavailable (because the caller is in
> an interrupt context such as handling a page fault) it would fall back
> to using native_set_pte() and trapping and emulating the PTE write.
> 
> On 32-bit guests this requires two traps for each PTE write (one for
> each dword of the PTE).  Instead, do one mmu_update hypercall
> directly.

OK.
> 
> This significantly improves page fault performance in 32-bit PV
> guests.

Nice!
> 
> lmbench3 test  Before    After     Improvement
> ----------------------------------------------
> lat_pagefault  3.18 us   2.32 us   27%
> lat_proc fork  356 us    313.3 us  11%
> 
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
>  arch/x86/xen/mmu.c |   16 ++++++++++++++--
>  1 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
> index b8e2794..3bf5dfa 100644
> --- a/arch/x86/xen/mmu.c
> +++ b/arch/x86/xen/mmu.c
> @@ -308,8 +308,20 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval)
>  
>  static inline void __xen_set_pte(pte_t *ptep, pte_t pteval)
>  {
> -	if (!xen_batched_set_pte(ptep, pteval))
> -		native_set_pte(ptep, pteval);
> +	if (!xen_batched_set_pte(ptep, pteval)) {
> +		/*
> +		 * Could call native_set_pte() here and trap and
> +		 * emulate the PTE write but with 32-bit guests this
> +		 * needs two traps (one for each of the two 32-bit
> +		 * words in the PTE) so do one hypercall directly
> +		 * instead.

Ouch.
> +		 */
> +		struct mmu_update u;
> +
> +		u.ptr = virt_to_machine(ptep).maddr | MMU_NORMAL_PT_UPDATE;
> +		u.val = pte_val_ma(pteval);
> +		HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF);
> +	}
>  }
>  
>  static void xen_set_pte(pte_t *ptep, pte_t pteval)
> -- 
> 1.7.2.5
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

  reply	other threads:[~2012-06-05 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 15:14 [PATCH] xen/mm: do direct hypercall in xen_set_pte() if batching is unavailable David Vrabel
2012-06-05 16:07 ` Konrad Rzeszutek Wilk [this message]
2012-06-10 10:23   ` Konrad Rzeszutek Wilk
2012-06-11 10:23     ` David Vrabel
2012-06-11 12:29       ` Konrad Rzeszutek Wilk
2012-06-13 16:10         ` 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=20120605160746.GB24031@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=david.vrabel@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 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.