All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wl@xen.org>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wl@xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [Xen-devel] [PATCH 2/2] x86/tlb: use Xen L0 assisted TLB flush when available
Date: Wed, 25 Dec 2019 16:13:43 +0000	[thread overview]
Message-ID: <20191225161343.jfvh4vinirezfo7q@debian> (raw)
In-Reply-To: <20191224132616.47441-3-roger.pau@citrix.com>

On Tue, Dec 24, 2019 at 02:26:16PM +0100, Roger Pau Monne wrote:
> Use Xen's L0 HVMOP_flush_tlbs hypercall when available in order to
> perform flushes. This greatly increases the performance of tlb flushes
> when running with a high amount of vCPUs as a Xen guest, and is
> specially important when running in shim mode.
> 
> The following figures are from a PV guest running `make -j342 xen` in
> shim mode with 32 vCPUs.
> 
> Using x2APIC and ALLBUT shorthand:
> real	4m35.973s
> user	4m35.110s
> sys	36m24.117s
> 
> Using L0 assisted flush:
> real	1m17.391s
> user	4m42.413s
> sys	6m20.773s
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
>  xen/arch/x86/guest/xen/xen.c    | 11 +++++++++++
>  xen/arch/x86/smp.c              |  6 ++++++
>  xen/include/asm-x86/guest/xen.h |  7 +++++++
>  3 files changed, 24 insertions(+)
> 
> diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c
> index 6dbc5f953f..e6493caecf 100644
> --- a/xen/arch/x86/guest/xen/xen.c
> +++ b/xen/arch/x86/guest/xen/xen.c
> @@ -281,6 +281,17 @@ int xg_free_unused_page(mfn_t mfn)
>      return rangeset_remove_range(mem, mfn_x(mfn), mfn_x(mfn));
>  }
>  
> +int xg_flush_tlbs(void)
> +{
> +    int rc;
> +
> +    do {
> +        rc = xen_hypercall_hvm_op(HVMOP_flush_tlbs, NULL);
> +    } while ( rc == -ERESTART );
> +
> +    return rc;
> +}
> +

Is it possible to make this a hook in the hypervisor_op?

I can foresee there will be something similar for Hyper-V.

>  static void ap_resume(void *unused)
>  {
>      map_vcpuinfo();
> diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
> index 427c33db9d..a892db28c1 100644
> --- a/xen/arch/x86/smp.c
> +++ b/xen/arch/x86/smp.c
> @@ -15,6 +15,7 @@
>  #include <xen/perfc.h>
>  #include <xen/spinlock.h>
>  #include <asm/current.h>
> +#include <asm/guest.h>
>  #include <asm/smp.h>
>  #include <asm/mc146818rtc.h>
>  #include <asm/flushtlb.h>
> @@ -235,6 +236,11 @@ void flush_area_mask(const cpumask_t *mask, const void *va, unsigned int flags)
>      {
>          bool cpus_locked = false;
>  
> +        if ( xen_guest &&

Also it would be better to not expose xen_guest here. It is x86 generic
code after all.

I would probably introduce a function to tell if Xen is running
virtualised or not.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-12-25 16:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-24 13:26 [Xen-devel] [PATCH 0/2] x86: improve assisted tlb flush and use it in guest mode Roger Pau Monne
2019-12-24 13:26 ` [Xen-devel] [PATCH 1/2] x86/hvm: improve performance of HVMOP_flush_tlbs Roger Pau Monne
2019-12-27 14:52   ` Andrew Cooper
2019-12-31 12:10     ` Roger Pau Monné
2020-01-03 11:18       ` Jan Beulich
2020-01-03 15:17   ` Jan Beulich
2020-01-08 17:37     ` Roger Pau Monné
2019-12-24 13:26 ` [Xen-devel] [PATCH 2/2] x86/tlb: use Xen L0 assisted TLB flush when available Roger Pau Monne
2019-12-25 16:13   ` Wei Liu [this message]
2019-12-27 14:55   ` Andrew Cooper
2020-01-03 15:23   ` Jan Beulich

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=20191225161343.jfvh4vinirezfo7q@debian \
    --to=wl@xen.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@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.