[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Ping²: [PATCH 4/4] x86/PV: remove unnecessary toggle_guest_pt() overhead


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Mon, 15 Jul 2019 08:44:23 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RBrOsPxLtdDQV5wpW2gxPK5RwKKhpbvgvAV+AlwtneM=; b=EqMbz/jqG+te69xmwKPJWA3LyQljqiBH7+iKL0dd9n1Vaq5kpMrtmtR1dXE8T8UgVrND6jq2sOucXT6JrRj1aOjT2IqURDaZE8mca9BYt3sKA+3fhW7qICb2nRPaa8ZDsypQ0GByVO2zNtofwT2kak/ntNEd9XEMVXuBfq0dzHxf7cj4RV0N9HE8mlKlQqP5OQT0mh9KHXOvXTkmBtnKhGmZxF0NDsfPkt8uv5zAV/aaTKLfyozWFcoLSzEWHFMIk24Yzw9kHUTgrqGPaBEWMF/jP212tW7fzbsWGuzbJn/P1dS9rkmL+hGYeTOfAQGfYg+0HCnId4jK8J+64oRwhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eopSLYljtQlLX/CSHcskY/PLrFEAm2ZAFnCvS7hwU2lhw+eAC7cYdiQjxh1bSTJ9tW2usPCPo18cKUhUrJj5jmuKamROY7r4rExM5BcscY1jKtOvABcnLsKcROxA1yay5/EYMXLBIoVsjE9CF+5BmGfQbh2nWOtmmXExUSaDNkn/s7CnoedNh22njTRnLClLx0iSahXVLBYhRvfTVyAa8FXzA80zYCHeil5ZdoPVLAIBzJPti0f4lpn0mD7BQZ0ycDFrZfVVj/4jaRE6aSO6qtfpD0SgerQGTXUS9T6Si/AdEvzLhj/qumAtqEad1S6BVRzYsoiqz8dwxmmCzrE/BQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 15 Jul 2019 09:07:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVOumArYBldtiar0aSnSi74B4hkg==
  • Thread-topic: Ping²: [PATCH 4/4] x86/PV: remove unnecessary toggle_guest_pt() overhead

>>> On 27.05.19 at 11:25,  wrote:
>>>> On 13.03.19 at 13:39,  wrote:
> > While the mere updating of ->pv_cr3 and ->root_pgt_changed aren't overly
> > expensive (but still needed only for the toggle_guest_mode() path), the
> > effect of the latter on the exit-to-guest path is not insignificant.
> > Move the logic into toggle_guest_mode().
> > 
> > Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> I think I did address the one concern you had.
> 
> Jan

https://lists.xenproject.org/archives/html/xen-devel/2019-04/msg00306.html
Ping?

> > --- a/xen/arch/x86/pv/domain.c
> > +++ b/xen/arch/x86/pv/domain.c
> > @@ -349,18 +349,10 @@ bool __init xpti_pcid_enabled(void)
> >  
> >  static void _toggle_guest_pt(struct vcpu *v)
> >  {
> > -    const struct domain *d = v->domain;
> > -    struct cpu_info *cpu_info = get_cpu_info();
> >      unsigned long cr3;
> >  
> >      v->arch.flags ^= TF_kernel_mode;
> >      update_cr3(v);
> > -    if ( d->arch.pv.xpti )
> > -    {
> > -        cpu_info->root_pgt_changed = true;
> > -        cpu_info->pv_cr3 = __pa(this_cpu(root_pgt)) |
> > -                           (d->arch.pv.pcid ? get_pcid_bits(v, true) : 0);
> > -    }
> >  
> >      /*
> >       * Don't flush user global mappings from the TLB. Don't tick TLB clock.
> > @@ -368,15 +360,11 @@ static void _toggle_guest_pt(struct vcpu
> >       * In shadow mode, though, update_cr3() may need to be accompanied by a
> >       * TLB flush (for just the incoming PCID), as the top level page table 
> > may
> >       * have changed behind our backs. To be on the safe side, suppress the
> > -     * no-flush unconditionally in this case. The XPTI CR3 write, if 
> > enabled,
> > -     * will then need to be a flushing one too.
> > +     * no-flush unconditionally in this case.
> >       */
> >      cr3 = v->arch.cr3;
> > -    if ( shadow_mode_enabled(d) )
> > -    {
> > +    if ( shadow_mode_enabled(v->domain) )
> >          cr3 &= ~X86_CR3_NOFLUSH;
> > -        cpu_info->pv_cr3 &= ~X86_CR3_NOFLUSH;
> > -    }
> >      write_cr3(cr3);
> >  
> >      if ( !(v->arch.flags & TF_kernel_mode) )
> > @@ -392,6 +380,8 @@ static void _toggle_guest_pt(struct vcpu
> >  
> >  void toggle_guest_mode(struct vcpu *v)
> >  {
> > +    const struct domain *d = v->domain;
> > +
> >      ASSERT(!is_pv_32bit_vcpu(v));
> >  
> >      /* %fs/%gs bases can only be stale if WR{FS,GS}BASE are usable. */
> > @@ -405,6 +395,21 @@ void toggle_guest_mode(struct vcpu *v)
> >      asm volatile ( "swapgs" );
> >  
> >      _toggle_guest_pt(v);
> > +
> > +    if ( d->arch.pv.xpti )
> > +    {
> > +        struct cpu_info *cpu_info = get_cpu_info();
> > +
> > +        cpu_info->root_pgt_changed = true;
> > +        cpu_info->pv_cr3 = __pa(this_cpu(root_pgt)) |
> > +                           (d->arch.pv.pcid ? get_pcid_bits(v, true) : 0);
> > +        /*
> > +         * As in _toggle_guest_pt() the XPTI CR3 write needs to be a TLB-
> > +         * flushing one too for shadow mode guests.
> > +         */
> > +        if ( shadow_mode_enabled(d) )
> > +            cpu_info->pv_cr3 &= ~X86_CR3_NOFLUSH;
> > +    }
> >  }
> >  
> >  void toggle_guest_pt(struct vcpu *v)
> > 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.