From: Paolo Bonzini <pbonzini@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
David Woodhouse <dwmw@amazon.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>,
KarimAllah Ahmed <karahmed@amazon.de>,
sironi@amazon.de, the arch/x86 maintainers <x86@kernel.org>,
KVM list <kvm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] KVM: x86: Reduce retpoline performance impact in slot_handle_level_range()
Date: Mon, 5 Feb 2018 16:15:41 +0100 [thread overview]
Message-ID: <362dd50d-67ff-3802-e65d-68949cf80879@redhat.com> (raw)
In-Reply-To: <CA+55aFwg88mxuOiJSh+xLnAfqEwAC-ReB9rdNx+r8fy=FTSHJw@mail.gmail.com>
On 02/02/2018 19:50, Linus Torvalds wrote:
> On Fri, Feb 2, 2018 at 6:59 AM, David Woodhouse <dwmw@amazon.co.uk> wrote:
>> With retpoline, tight loops of "call this function for every XXX" are
>> very much pessimised by taking a prediction miss *every* time.
>>
>> This one showed up very high in our early testing, and it only has five
>> things it'll ever call so make it take an 'op' enum instead of a
>> function pointer and let's see how that works out...
> Umm. May I suggest a different workaround?
>
> Honestly, if this is so performance-critical, the *real* fix is to
> actually just mark all those "slot_handle_*()" functions as
> "always_inline".
I replied quickly from the phone before reading the rest of the
thread---yeah, always_inline is the way to go. I see the same
differences as Linus and David (slight improvement for slot_handle_*,
+1k if you add kvm_handle_hva and kvm_handle_hva_range).
At least for slot_handle_* it's a no-brainer. The others are basically
the MMU notifier implementation; in the perfect case it should actually
never be called (or at least it ought to be very rare), so I think we
can keep the indirect calls for now.
Paolo
prev parent reply other threads:[~2018-02-05 15:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 14:59 [PATCH] KVM: x86: Reduce retpoline performance impact in slot_handle_level_range() David Woodhouse
2018-02-02 15:43 ` Sironi, Filippo
2018-02-02 21:10 ` Paolo Bonzini
2018-02-02 21:14 ` David Woodhouse
2018-02-02 18:50 ` Linus Torvalds
2018-02-02 19:10 ` Linus Torvalds
2018-02-02 19:17 ` David Woodhouse
2018-02-02 21:23 ` Alan Cox
2018-02-03 14:46 ` David Woodhouse
2018-02-05 8:51 ` Peter Zijlstra
2018-02-05 8:55 ` Peter Zijlstra
2018-02-05 15:15 ` Paolo Bonzini [this message]
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=362dd50d-67ff-3802-e65d-68949cf80879@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=dwmw@amazon.co.uk \
--cc=karahmed@amazon.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=sironi@amazon.de \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox