All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wl@xen.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [Xen-devel] [PATCH v5 7/7] x86/tlb: use Xen L0 assisted TLB flush when available
Date: Fri, 28 Feb 2020 18:00:44 +0100	[thread overview]
Message-ID: <aa482834-7454-9fcb-2aed-86f4c01b134e@suse.com> (raw)
In-Reply-To: <20200219174354.84726-8-roger.pau@citrix.com>

On 19.02.2020 18:43, Roger Pau Monne wrote:
> Use Xen's L0 HVMOP_flush_tlbs hypercall 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 -j32 xen` in
> shim mode with 32 vCPUs and HAP.
> 
> Using x2APIC and ALLBUT shorthand:
> real	4m35.973s
> user	4m35.110s
> sys	36m24.117s
> 
> Using L0 assisted flush:
> real    1m2.596s
> user    4m34.818s
> sys     5m16.374s
> 
> The implementation adds a new hook to hypervisor_ops so other
> enlightenments can also implement such assisted flush just by filling
> the hook. Note that the Xen implementation completely ignores the
> dirty CPU mask and the linear address passed in, and always performs a
> global TLB flush on all vCPUs.

This isn't because of an implementation choice of yours, but because
of how HVMOP_flush_tlbs works. I think the statement should somehow
express this. I also think it wants clarifying that using the
hypercall is indeed faster even in the case of single-page, single-
CPU flush (which I suspect may not be the case especially as vCPU
count grows). The stats above prove a positive overall effect, but
they don't say whether the effect could be even bigger by being at
least a little selective.

> @@ -73,6 +74,15 @@ void __init hypervisor_e820_fixup(struct e820map *e820)
>          ops.e820_fixup(e820);
>  }
>  
> +int hypervisor_flush_tlb(const cpumask_t *mask, const void *va,
> +                         unsigned int order)
> +{
> +    if ( ops.flush_tlb )
> +        return alternative_call(ops.flush_tlb, mask, va, order);
> +
> +    return -ENOSYS;
> +}

Please no new -ENOSYS anywhere (except in new ports' top level
hypercall handlers).

> @@ -256,6 +257,16 @@ void flush_area_mask(const cpumask_t *mask, const void *va, unsigned int flags)
>      if ( (flags & ~FLUSH_ORDER_MASK) &&
>           !cpumask_subset(mask, cpumask_of(cpu)) )
>      {
> +        if ( cpu_has_hypervisor &&
> +             !(flags & ~(FLUSH_TLB | FLUSH_TLB_GLOBAL | FLUSH_VA_VALID |
> +                         FLUSH_ORDER_MASK)) &&
> +             !hypervisor_flush_tlb(mask, va, (flags - 1) & FLUSH_ORDER_MASK) )
> +        {
> +            if ( tlb_clk_enabled )
> +                tlb_clk_enabled = false;

Why does this need doing here? Couldn't Xen guest setup code
clear the flag?

Jan

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

  reply	other threads:[~2020-02-28 17:00 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 17:43 [Xen-devel] [PATCH v5 0/7] x86: improve assisted tlb flush and use it in guest mode Roger Pau Monne
2020-02-19 17:43 ` [Xen-devel] [PATCH v5 1/7] x86/hvm: allow ASID flush when v != current Roger Pau Monne
2020-02-28 13:29   ` Jan Beulich
2020-02-28 15:27     ` Roger Pau Monné
2020-02-28 15:47       ` Jan Beulich
2020-02-28 16:20         ` Roger Pau Monné
2020-02-19 17:43 ` [Xen-devel] [PATCH v5 2/7] x86/paging: add TLB flush hooks Roger Pau Monne
2020-02-28 14:50   ` Jan Beulich
2020-02-28 16:19     ` Roger Pau Monné
2020-02-28 16:40       ` Jan Beulich
2020-02-19 17:43 ` [Xen-devel] [PATCH v5 3/7] x86/hap: improve hypervisor assisted guest TLB flush Roger Pau Monne
2020-02-28 13:58   ` Jan Beulich
2020-02-28 16:31     ` Roger Pau Monné
2020-02-28 16:44       ` Jan Beulich
2020-02-28 16:57         ` Roger Pau Monné
2020-02-28 17:02           ` Jan Beulich
2020-02-19 17:43 ` [Xen-devel] [PATCH v5 4/7] x86/tlb: introduce a flush guests TLB flag Roger Pau Monne
2020-02-28 16:14   ` Jan Beulich
2020-02-28 16:50     ` Roger Pau Monné
2020-03-02 10:31       ` Jan Beulich
2020-03-02 16:50         ` Roger Pau Monné
2020-03-03  8:50           ` Jan Beulich
2020-02-19 17:43 ` [Xen-devel] [PATCH v5 5/7] x86/tlb: allow disabling the TLB clock Roger Pau Monne
2020-02-28 16:25   ` Jan Beulich
2020-02-19 17:43 ` [Xen-devel] [PATCH v5 6/7] xen/guest: prepare hypervisor ops to use alternative calls Roger Pau Monne
2020-02-28 16:29   ` Jan Beulich
2020-02-28 16:52     ` Roger Pau Monné
2020-03-02 10:43       ` Jan Beulich
2020-03-02 11:48         ` Roger Pau Monné
2020-02-19 17:43 ` [Xen-devel] [PATCH v5 7/7] x86/tlb: use Xen L0 assisted TLB flush when available Roger Pau Monne
2020-02-28 17:00   ` Jan Beulich [this message]
2020-02-28 17:23     ` Roger Pau Monné
2020-03-02 10:52       ` 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=aa482834-7454-9fcb-2aed-86f4c01b134e@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --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.