[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190923181558.GI18195@linux.intel.com>
Date: Mon, 23 Sep 2019 11:15:58 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Andrea Arcangeli <aarcange@...hat.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
"Dr. David Alan Gilbert" <dgilbert@...hat.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Peter Xu <peterx@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 15/17] KVM: retpolines: x86: eliminate retpoline from
vmx.c exit handlers
On Mon, Sep 23, 2019 at 01:42:44PM -0400, Andrea Arcangeli wrote:
> On Mon, Sep 23, 2019 at 06:53:10PM +0200, Paolo Bonzini wrote:
> > On 23/09/19 18:37, Sean Christopherson wrote:
> > >> Would it be too much if we get rid of
> > >> kvm_vmx_exit_handlers completely replacing this code with one switch()?
> > > Hmm, that'd require redirects for nVMX functions since they are set at
> > > runtime. That isn't necessarily a bad thing. The approach could also be
> > > used if Paolo's idea of making kvm_vmx_max_exit_handlers const allows the
> > > compiler to avoid retpoline.
> >
> > But aren't switch statements also retpolin-ized if they use a jump table?
>
> See commit a9d57ef15cbe327fe54416dd194ee0ea66ae53a4.
>
> We disabled that feature or the kernel would potentially suffer the
> downsides of the exit handlers through pointer to functions for every
> switch statement in the kernel.
>
> In turn you can't make it run any faster by converting my "if" to a
> "switch" at least the "if" can deterministic control the order of what
> is more likely that we should also re-review, but the order of secondary
> effect, the important thing is to reduce the retpolines to zero during
> normal hrtimer guest runtime.
On the flip side, using a switch for the fast-path handlers gives the
compiler more flexibility to rearrange and combine checks. Of course that
doesn't mean the compiler will actually generate faster code for our
purposes :-)
Anyways, getting rid of the retpolines is much more important.
Powered by blists - more mailing lists