[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <362dd50d-67ff-3802-e65d-68949cf80879@redhat.com>
Date: Mon, 5 Feb 2018 16:15:41 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
David Woodhouse <dwmw@...zon.co.uk>
Cc: Thomas Gleixner <tglx@...utronix.de>,
KarimAllah Ahmed <karahmed@...zon.de>, sironi@...zon.de,
the arch/x86 maintainers <x86@...nel.org>,
KVM list <kvm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] KVM: x86: Reduce retpoline performance impact in
slot_handle_level_range()
On 02/02/2018 19:50, Linus Torvalds wrote:
> On Fri, Feb 2, 2018 at 6:59 AM, David Woodhouse <dwmw@...zon.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
Powered by blists - more mailing lists