From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
kvm@vger.kernel.org, x86@kernel.org,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
Mohammed Gamal <mmorsy@redhat.com>,
Cathy Avery <cavery@redhat.com>, Bandan Das <bsd@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 7/7] x86/kvm: use Enlightened VMCS when running on Hyper-V
Date: Tue, 13 Mar 2018 20:12:42 +0100 [thread overview]
Message-ID: <20180313191242.GB13426@flask> (raw)
In-Reply-To: <87r2opcr6u.fsf@vitty.brq.redhat.com>
2018-03-12 15:19+0100, Vitaly Kuznetsov:
> Thomas Gleixner <tglx@linutronix.de> writes:
>
> > On Fri, 9 Mar 2018, Vitaly Kuznetsov wrote:
> >
> >> Enlightened VMCS is just a structure in memory, the main benefit
> >> besides avoiding somewhat slower VMREAD/VMWRITE is using clean field
> >> mask: we tell the underlying hypervisor which fields were modified
> >> since VMEXIT so there's no need to inspect them all.
> >>
> >> Tight CPUID loop test shows significant speedup:
> >> Before: 18890 cycles
> >> After: 8304 cycles
> >>
> >> Static key is being used to avoid performance penalty for non-Hyper-V
> >> deployments. Tests show we add around 3 (three) CPU cycles on each
> >> VMEXIT (1077.5 cycles before, 1080.7 cycles after for the same CPUID
> >> loop on bare metal). We can probably avoid one test/jmp in vmx_vcpu_run()
> >> but I don't see a clean way to use static key in assembly.
> >
> > STATIC_JUMP_IF_TRUE, STATIC_JUMP_IF_FALSE are your friends.
> >
>
> Thanks for the tip,
>
> with a single kernel user of these APIs it was easy to miss :-)
Indeed, I had no idea.
> Unfortunately, these APIs are only present if HAVE_JUMP_LABEL and
> (afaiu) we still care about KVM on !HAVE_JUMP_LABEL builds. It would be
> nice if we can make them behave the same way static_branch_likely() and
> friends do: compile into something else when !HAVE_JUMP_LABEL so we can
> avoid nasty #ifdefs in C code.
>
> That said I'd like to defer the question to KVM maintainers: Paolo,
> Radim, what would you like me to do? Use STATIC_JUMP_IF_TRUE/FALSE as
> they are, try to make them work for !HAVE_JUMP_LABEL and use them or
> maybe we can commit the series as-is and have it as a future
> optimization (e.g. when HAVE_JUMP_LABEL becomes mandatory)?
Please take a look into making a macro that uses STATIC_JUMP_IF_FALSE or
reads the value from provided static_key and does a test-jump, depending
on HAVE_JUMP_LABEL.
It doesn't need to be suited for general use, just something that moves
the ugliness away from vmx_vcpu_run.
(Although having it in jump_label.h would be great. I think the main
obstacle is clobbering of flags.)
If it were still looking horrible, I'm ok with the series as-is,
thanks.
next prev parent reply other threads:[~2018-03-13 19:13 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 14:02 [PATCH v3 0/7] Enlightened VMCS support for KVM on Hyper-V Vitaly Kuznetsov
2018-03-09 14:02 ` [PATCH v3 1/7] x86/hyper-v: move hyperv.h out of uapi Vitaly Kuznetsov
2018-03-13 22:46 ` Michael Kelley (EOSG)
2018-03-14 9:35 ` Vitaly Kuznetsov
2018-03-14 16:13 ` Christoph Hellwig
2018-03-14 16:42 ` Joshua R. Poulson
2018-03-15 7:31 ` Christoph Hellwig
2018-03-09 14:02 ` [PATCH v3 2/7] x86/hyper-v: move definitions from TLFS to hyperv-tlfs.h Vitaly Kuznetsov
2018-03-13 22:51 ` Michael Kelley (EOSG)
2018-03-09 14:02 ` [PATCH v3 3/7] x86/kvm: rename HV_X64_MSR_APIC_ASSIST_PAGE to HV_X64_MSR_VP_ASSIST_PAGE Vitaly Kuznetsov
2018-03-09 14:02 ` [PATCH v3 4/7] x86/hyper-v: allocate and use Virtual Processor Assist Pages Vitaly Kuznetsov
2018-03-13 23:08 ` Michael Kelley (EOSG)
2018-03-14 15:15 ` Thomas Gleixner
2018-03-15 10:10 ` Vitaly Kuznetsov
2018-03-15 11:45 ` Thomas Gleixner
2018-03-15 13:48 ` Peter Zijlstra
2018-03-15 13:57 ` Thomas Gleixner
2018-03-09 14:02 ` [PATCH v3 5/7] x86/hyper-v: define struct hv_enlightened_vmcs and clean field bits Vitaly Kuznetsov
2018-03-13 23:09 ` Michael Kelley (EOSG)
2018-03-09 14:02 ` [PATCH v3 6/7] x86/hyper-v: detect nested features Vitaly Kuznetsov
2018-03-13 23:11 ` Michael Kelley (EOSG)
2018-03-09 14:02 ` [PATCH v3 7/7] x86/kvm: use Enlightened VMCS when running on Hyper-V Vitaly Kuznetsov
2018-03-09 14:08 ` Thomas Gleixner
2018-03-12 14:19 ` Vitaly Kuznetsov
2018-03-13 19:12 ` Radim Krčmář [this message]
2018-03-14 17:20 ` Vitaly Kuznetsov
2018-03-14 14:54 ` Paolo Bonzini
2018-03-14 15:19 ` Thomas Gleixner
2018-03-14 17:22 ` Vitaly Kuznetsov
2018-03-14 19:59 ` Thomas Gleixner
2018-03-14 20:06 ` Peter Zijlstra
2018-03-14 14:53 ` Paolo Bonzini
2018-03-15 9:56 ` Vitaly Kuznetsov
2018-03-15 11:01 ` Paolo Bonzini
2018-03-15 15:19 ` Vitaly Kuznetsov
2018-03-15 17:02 ` Radim Krčmář
2018-03-15 17:28 ` Radim Krčmář
2018-03-15 18:04 ` Vitaly Kuznetsov
2018-03-15 19:28 ` Thomas Gleixner
2018-03-15 19:43 ` Radim Krčmář
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=20180313191242.GB13426@flask \
--to=rkrcmar@redhat.com \
--cc=Michael.H.Kelley@microsoft.com \
--cc=bsd@redhat.com \
--cc=cavery@redhat.com \
--cc=haiyangz@microsoft.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mmorsy@redhat.com \
--cc=pbonzini@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).