From: Sean Christopherson <seanjc@google.com>
To: Bernhard Kauer <bk@alpico.io>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: drop the kvm_has_noapic_vcpu optimization
Date: Thu, 31 Oct 2024 09:24:29 -0700 [thread overview]
Message-ID: <ZyOvPYHrpgPbxUtX@google.com> (raw)
In-Reply-To: <Zxf4FeRtA3xzdZG3@mias.mediconcil.de>
On Tue, Oct 22, 2024, Bernhard Kauer wrote:
> On Tue, Oct 22, 2024 at 10:32:59AM -0700, Sean Christopherson wrote:
> > On Fri, Oct 18, 2024, Bernhard Kauer wrote:
> > > It used a static key to avoid loading the lapic pointer from
> > > the vcpu->arch structure. However, in the common case the load
> > > is from a hot cacheline and the CPU should be able to perfectly
> > > predict it. Thus there is no upside of this premature optimization.
> >
> > Do you happen to have performance numbers?
>
> Sure. I have some preliminary numbers as I'm still optimizing the
> round-trip time for tiny virtual machines.
>
> A hello-world micro benchmark on my AMD 6850U needs at least 331us. With
> the static keys it requires 579us. That is a 75% increase.
For the first VM only though, correct?
> Take the absolute values with a grain of salt as not all of my patches might
> be applicable to the general case.
>
> For the other side I don't have a relevant benchmark yet. But I doubt you
> would see anything even with a very high IRQ rate.
>
>
> > > The downside is that code patching including an IPI to all CPUs
> > > is required whenever the first VM without an lapic is created or
> > > the last is destroyed.
> >
> > In practice, this almost never happens though. Do you have a use case for
> > creating VMs without in-kernel local APICs?
>
> I switched from "full irqchip" to "no irqchip" due to a significant
> performance gain
Signifcant performance gain for what path? I'm genuinely curious. Unless your
VM doesn't need a timer and doesn't need interrupts of any kind, emulating the
local APIC in userspace is going to be much less performant.
> and the simplicity it promised.
Similar to above, unless you are not emulating a local APIC anywhere, disabling
KVM's in-kernel local APIC isn't a meaningful change in overall complexity.
> I might have to go to "split irqchip" mode for performance reasons but I
> didn't had time to look into it yet.
>
> So in the end I assume it will be a trade-off: Do I want to rely on these
> 3000 lines of kernel code to gain an X% performance increase, or not?
next prev parent reply other threads:[~2024-10-31 16:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 10:08 [PATCH] KVM: drop the kvm_has_noapic_vcpu optimization Bernhard Kauer
2024-10-21 7:43 ` Chao Gao
2024-10-22 17:32 ` Sean Christopherson
2024-10-22 19:08 ` Bernhard Kauer
2024-10-31 16:24 ` Sean Christopherson [this message]
2024-10-31 20:08 ` Bernhard Kauer
2024-10-31 23:29 ` Sean Christopherson
2024-11-01 8:55 ` Bernhard Kauer
2024-11-01 14:49 ` Sean Christopherson
2024-11-15 9:12 ` Bernhard Kauer
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=ZyOvPYHrpgPbxUtX@google.com \
--to=seanjc@google.com \
--cc=bk@alpico.io \
--cc=kvm@vger.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 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.