All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: andrew.cooper3@citrix.com, xen-devel@lists.xenproject.org,
	Dario Faggioli <dfaggioli@suse.com>
Subject: Re: [PATCH v3 5/7] xen/x86: disable global pages for domains with XPTI active
Date: Thu, 22 Mar 2018 19:18:44 +0100	[thread overview]
Message-ID: <795eaa2c-cb3a-da3e-15f6-9b38c434918e@suse.com> (raw)
In-Reply-To: <5AB3E82402000078001B5408@suse.com>

On 22/03/18 17:30, Jan Beulich wrote:
>>>> On 21.03.18 at 13:51, <jgross@suse.com> wrote:
>> Instead of flushing the TLB from global pages when switching address
>> spaces with XPTI being active just disable global pages via %cr4
>> completely when a domain subject to XPTI is active. This avoids the
>> need for extra TLB flushes as loading %cr3 will remove all TLB
>> entries.
> 
> I continue to be not entirely convinced of this move. I had an
> alternative in mind: Since retaining global pages is particularly
> relevant for switches between guest user and guest kernel
> modes, what if we made a shortcut from e.g. lstar_enter through
> switch_to_kernel to restore_all_guest without ever switching to
> the full page Xen tables?

With patch 7 of this series in mind I'm not convinced the extra effort
is really making sense. Today most processors do have PCID support so
for that old hardware I don't think we need to make the handling even
more complex.

> 
>> --- a/xen/arch/x86/mm.c
>> +++ b/xen/arch/x86/mm.c
>> @@ -508,18 +508,23 @@ void make_cr3(struct vcpu *v, mfn_t mfn)
>>  void write_ptbase(struct vcpu *v)
>>  {
>>      struct cpu_info *cpu_info = get_cpu_info();
>> +    unsigned long new_cr4;
>> +
>> +    new_cr4 = (is_pv_vcpu(v) && !is_idle_vcpu(v))
>> +              ? pv_guest_cr4_to_real_cr4(v) : mmu_cr4_features;
> 
> I'm not overly happy to see any new uses of mmu_cr4_features.
> This should really only be used for priming certain values imo,
> which isn't the case here (otoh pv_guest_cr4_to_real_cr4() does
> so too, and perhaps better wouldn't). Hence I wonder whether
> this shouldn't be read_cr4() | X86_CR4_PGE, not the least
> because we've just got rid of the blanket reversion to
> mmu_cr4_features in VMX code.

I do understand that using mmu_cr4_features isn't the best way to set
cr4. But I think it is a good idea to have a default value which should
normally be used instead of only switching various bits on and off.

In case cr4 is loaded with a strange value in some corner case that
value might be used from then on instead of being repaired by loading a
dedicated value at certain points in time, e.g. when doing a context
switch.

So maybe we should introduce cr4_default which is derived from
mmu_cr4_features? mmu_cr4_features would contain all bits which are
allowed on the current processor with the current command line options,
while cr4_default would be a subset of mmu_cr4_features.


Juergen

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

  parent reply	other threads:[~2018-03-22 18:18 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 12:51 [PATCH v3 0/7] xen/x86: various XPTI speedups Juergen Gross
2018-03-21 12:51 ` [PATCH v3 1/7] x86/xpti: avoid copying L4 page table contents when possible Juergen Gross
2018-03-22 14:31   ` Jan Beulich
     [not found]   ` <5AB3CC5502000078001B5254@suse.com>
2018-03-22 15:26     ` Juergen Gross
2018-03-22 15:42       ` Jan Beulich
2018-03-21 12:51 ` [PATCH v3 2/7] x86/xpti: don't flush TLB twice when switching to 64-bit pv context Juergen Gross
2018-03-22 14:50   ` Jan Beulich
2018-03-23 12:35     ` Juergen Gross
2018-03-21 12:51 ` [PATCH v3 3/7] xen/x86: support per-domain flag for xpti Juergen Gross
2018-03-22 15:26   ` Jan Beulich
     [not found]   ` <5AB3D92D02000078001B5326@suse.com>
2018-03-22 15:29     ` Juergen Gross
2018-03-22 15:44       ` Jan Beulich
     [not found]       ` <5AB3DD6A02000078001B538B@suse.com>
2018-03-22 18:05         ` Juergen Gross
2018-03-21 12:51 ` [PATCH v3 4/7] xen/x86: use invpcid for flushing the TLB Juergen Gross
2018-03-22 15:35   ` Jan Beulich
     [not found]   ` <5AB3DB5102000078001B5358@suse.com>
2018-03-22 18:03     ` Juergen Gross
2018-03-21 12:51 ` [PATCH v3 5/7] xen/x86: disable global pages for domains with XPTI active Juergen Gross
2018-03-22 16:30   ` Jan Beulich
     [not found]   ` <5AB3E82402000078001B5408@suse.com>
2018-03-22 18:18     ` Juergen Gross [this message]
2018-03-23  7:46       ` Jan Beulich
     [not found]       ` <5AB4BEED02000078001B563B@suse.com>
2018-03-23  7:58         ` Juergen Gross
2018-03-23  8:14           ` Jan Beulich
     [not found]           ` <5AB4C56602000078001B567F@suse.com>
2018-03-23  8:29             ` Juergen Gross
2018-03-23  8:51               ` Jan Beulich
2018-03-27  7:14     ` Juergen Gross
2018-03-27  7:23       ` Jan Beulich
     [not found]       ` <5ABA0DAF02000078001B6588@suse.com>
2018-03-27  7:37         ` Juergen Gross
2018-03-27  8:29           ` Juergen Gross
2018-03-27  8:33           ` Jan Beulich
     [not found]           ` <5ABA1DE202000078001B65FD@suse.com>
2018-03-27  8:44             ` Juergen Gross
2018-03-27  8:54               ` Jan Beulich
2018-03-21 12:51 ` [PATCH v3 6/7] xen/x86: use flag byte for decision whether xen_cr3 is valid Juergen Gross
2018-03-23  9:47   ` Jan Beulich
2018-03-21 12:51 ` [PATCH v3 7/7] xen/x86: use PCID feature Juergen Gross
2018-03-23 10:51   ` Jan Beulich
     [not found]   ` <5AB4EA4902000078001B577B@suse.com>
2018-03-23 11:29     ` Juergen Gross
2018-03-23 13:46       ` Jan Beulich
     [not found]       ` <5AB5136302000078001B58D9@suse.com>
2018-03-23 14:11         ` Juergen Gross
2018-03-23 15:58           ` Jan Beulich
     [not found]           ` <5AB5324C02000078001B59E7@suse.com>
2018-03-26  6:49             ` Juergen Gross
2018-03-26  8:28               ` Jan Beulich
     [not found]               ` <5AB8CB3902000078001B5F3A@suse.com>
2018-03-26  8:55                 ` Juergen Gross
2018-03-26 10:13                   ` Jan Beulich
     [not found]                   ` <5AB8E3DC02000078001B5FEB@suse.com>
2018-03-26 10:29                     ` Juergen Gross
2018-03-26 10:43                       ` Jan Beulich
     [not found]                       ` <5AB8EAE902000078001B6034@suse.com>
2018-03-26 12:04                         ` Juergen Gross
2018-03-26 12:19                           ` Jan Beulich
     [not found]                           ` <5AB9016002000078001B611E@suse.com>
2018-03-26 12:22                             ` Juergen Gross
2018-03-23 14:10 ` [PATCH v3 0/7] xen/x86: various XPTI speedups Dario Faggioli

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=795eaa2c-cb3a-da3e-15f6-9b38c434918e@suse.com \
    --to=jgross@suse.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dfaggioli@suse.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.