From: Andrea Arcangeli <aarcange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Peter Xu <peterx@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 15/17] KVM: retpolines: x86: eliminate retpoline from vmx.c exit handlers
Date: Mon, 23 Sep 2019 15:05:14 -0400 [thread overview]
Message-ID: <20190923190514.GB19996@redhat.com> (raw)
In-Reply-To: <7329012d-0b3b-ce86-f58d-3d2d5dc5a790@redhat.com>
On Mon, Sep 23, 2019 at 11:57:57AM +0200, Paolo Bonzini wrote:
> On 23/09/19 11:31, Vitaly Kuznetsov wrote:
> > +#ifdef CONFIG_RETPOLINE
> > + if (exit_reason == EXIT_REASON_MSR_WRITE)
> > + return handle_wrmsr(vcpu);
> > + else if (exit_reason == EXIT_REASON_PREEMPTION_TIMER)
> > + return handle_preemption_timer(vcpu);
> > + else if (exit_reason == EXIT_REASON_PENDING_INTERRUPT)
> > + return handle_interrupt_window(vcpu);
> > + else if (exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
> > + return handle_external_interrupt(vcpu);
> > + else if (exit_reason == EXIT_REASON_HLT)
> > + return handle_halt(vcpu);
> > + else if (exit_reason == EXIT_REASON_PAUSE_INSTRUCTION)
> > + return handle_pause(vcpu);
> > + else if (exit_reason == EXIT_REASON_MSR_READ)
> > + return handle_rdmsr(vcpu);
> > + else if (exit_reason == EXIT_REASON_CPUID)
> > + return handle_cpuid(vcpu);
> > + else if (exit_reason == EXIT_REASON_EPT_MISCONFIG)
> > + return handle_ept_misconfig(vcpu);
> > +#endif
> > return kvm_vmx_exit_handlers[exit_reason](vcpu);
>
> Most of these, while frequent, are already part of slow paths.
>
> I would keep only EXIT_REASON_MSR_WRITE, EXIT_REASON_PREEMPTION_TIMER,
> EXIT_REASON_EPT_MISCONFIG and add EXIT_REASON_IO_INSTRUCTION.
Intuition doesn't work great when it comes to CPU speculative
execution runtime. I can however run additional benchmarks to verify
your theory that keeping around frequent retpolines will still perform
ok.
> If you make kvm_vmx_exit_handlers const, can the compiler substitute for
> instance kvm_vmx_exit_handlers[EXIT_REASON_MSR_WRITE] with handle_wrmsr?
> Just thinking out loud, not sure if it's an improvement code-wise.
gcc gets right if you make it const, it calls kvm_emulate_wrmsr in
fact. However I don't think const will fly
with_vmx_hardware_setup()... in fact at runtime testing nested I just
got:
BUG: unable to handle page fault for address: ffffffffa00751e0
#PF: supervisor write access in kernel mode
#PF: error_code(0x0003) - permissions violation
PGD 2424067 P4D 2424067 PUD 2425063 PMD 7cc09067 PTE 80000000741cb161
Oops: 0003 [#1] SMP NOPTI
CPU: 1 PID: 4458 Comm: insmod Not tainted 5.3.0+ #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS ?-20190711_202441-buildvm-armv7-10.arm.fedoraproject.or4
RIP: 0010:nested_vmx_hardware_setup+0x29a/0x37a [kvm_intel]
Code: 41 ff c5 66 89 2c 85 20 92 0b a0 66 44 89 34 85 22 92 0b a0 49 ff c7 e9 e6 fe ff ff 44 89 2d 28 24 fc ff 48
RSP: 0018:ffffc90000257c18 EFLAGS: 00010246
RAX: ffffffffa001e0b0 RBX: ffffffffa0075140 RCX: 0000000000000000
RDX: ffff888078f60000 RSI: 0000000000002401 RDI: 0000000000000018
RBP: 0000000000006c08 R08: 0000000000001000 R09: 000000000007ffdc
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000006c08
R13: 0000000000000017 R14: 0000000000000268 R15: 0000000000000018
FS: 00007f7fb7ef0b80(0000) GS:ffff88807da40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffa00751e0 CR3: 0000000079620001 CR4: 0000000000160ee0
Call Trace:
hardware_setup+0x4df/0x5b2 [kvm_intel]
kvm_arch_hardware_setup+0x2f/0x27b [kvm_intel]
kvm_init+0x5d/0x26d [kvm_intel]
next prev parent reply other threads:[~2019-09-23 19:05 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 21:24 [PATCH 00/17] KVM monolithic v1 Andrea Arcangeli
2019-09-20 21:24 ` [PATCH 01/17] x86: spec_ctrl: fix SPEC_CTRL initialization after kexec Andrea Arcangeli
2019-09-23 10:22 ` Paolo Bonzini
2019-09-23 15:30 ` Sean Christopherson
2019-09-23 17:34 ` Andrea Arcangeli
2019-09-23 22:27 ` Sean Christopherson
2019-09-20 21:24 ` [PATCH 02/17] KVM: monolithic: x86: convert the kvm_x86_ops methods to external functions Andrea Arcangeli
2019-09-23 10:19 ` Paolo Bonzini
2019-09-23 16:13 ` Sean Christopherson
2019-09-23 16:51 ` Paolo Bonzini
2019-09-23 19:21 ` Andrea Arcangeli
2019-09-20 21:24 ` [PATCH 03/17] KVM: monolithic: x86: handle the request_immediate_exit variation Andrea Arcangeli
2019-09-23 22:35 ` Sean Christopherson
2019-09-23 23:06 ` Andrea Arcangeli
2019-09-23 23:45 ` Sean Christopherson
2019-09-24 0:24 ` Andrea Arcangeli
2019-09-20 21:24 ` [PATCH 04/17] KVM: monolithic: x86: convert the kvm_pmu_ops methods to external functions Andrea Arcangeli
2019-09-20 21:24 ` [PATCH 05/17] KVM: monolithic: x86: enable the kvm_x86_ops " Andrea Arcangeli
2019-09-20 21:24 ` [PATCH 06/17] KVM: monolithic: x86: enable the kvm_pmu_ops " Andrea Arcangeli
2019-09-20 21:24 ` [PATCH 07/17] KVM: monolithic: x86: adjust the section prefixes Andrea Arcangeli
2019-09-23 10:15 ` Paolo Bonzini
2019-09-25 12:13 ` Andrea Arcangeli
2019-09-25 12:32 ` Paolo Bonzini
2019-09-20 21:25 ` [PATCH 08/17] KVM: monolithic: adjust the section prefixes in the KVM common code Andrea Arcangeli
2019-09-20 21:25 ` [PATCH 09/17] KVM: monolithic: x86: remove kvm.ko Andrea Arcangeli
2019-09-20 21:25 ` [PATCH 10/17] KVM: monolithic: x86: use the external functions instead of kvm_x86_ops Andrea Arcangeli
2019-09-23 10:02 ` Paolo Bonzini
2019-09-20 21:25 ` [PATCH 11/17] KVM: monolithic: x86: remove exports Andrea Arcangeli
2019-09-20 21:25 ` [PATCH 12/17] KVM: monolithic: remove exports from KVM common code Andrea Arcangeli
2019-09-20 21:25 ` [PATCH 13/17] KVM: monolithic: x86: drop the kvm_pmu_ops structure Andrea Arcangeli
2019-09-23 10:21 ` Paolo Bonzini
2019-09-24 0:51 ` Andrea Arcangeli
2019-09-24 1:24 ` Paolo Bonzini
2019-09-20 21:25 ` [PATCH 14/17] KVM: monolithic: x86: inline more exit handlers in vmx.c Andrea Arcangeli
2019-09-23 10:19 ` Paolo Bonzini
2019-09-24 1:00 ` Andrea Arcangeli
2019-09-24 1:25 ` Paolo Bonzini
2019-09-24 1:55 ` Andrea Arcangeli
2019-09-24 2:56 ` Andrea Arcangeli
2019-09-25 7:52 ` Paolo Bonzini
2019-09-20 21:25 ` [PATCH 15/17] KVM: retpolines: x86: eliminate retpoline from vmx.c exit handlers Andrea Arcangeli
2019-09-23 9:31 ` Vitaly Kuznetsov
2019-09-23 9:57 ` Paolo Bonzini
2019-09-23 19:05 ` Andrea Arcangeli [this message]
2019-09-23 20:23 ` Sean Christopherson
2019-09-23 21:08 ` Andrea Arcangeli
2019-09-23 21:24 ` Sean Christopherson
2019-09-23 23:43 ` Andrea Arcangeli
2019-09-23 23:52 ` Sean Christopherson
2019-09-24 0:16 ` Paolo Bonzini
2019-09-24 0:35 ` Sean Christopherson
2019-09-24 0:37 ` Paolo Bonzini
2019-09-24 0:15 ` Paolo Bonzini
2019-09-24 0:38 ` Andrea Arcangeli
2019-09-24 0:46 ` Sean Christopherson
2019-09-24 21:46 ` Andrea Arcangeli
2019-09-25 7:50 ` Paolo Bonzini
2019-09-23 16:37 ` Sean Christopherson
2019-09-23 16:53 ` Paolo Bonzini
2019-09-23 17:42 ` Andrea Arcangeli
2019-09-23 18:15 ` Sean Christopherson
2019-09-23 19:12 ` Andrea Arcangeli
[not found] ` <E8FE7592-69C3-455E-8D80-A2D73BB2E14C@dinechin.org>
2019-09-25 20:51 ` Andrea Arcangeli
2019-09-23 16:28 ` Sean Christopherson
2019-09-20 21:25 ` [PATCH 16/17] KVM: retpolines: x86: eliminate retpoline from svm.c " Andrea Arcangeli
2019-09-23 10:01 ` Paolo Bonzini
2019-09-20 21:25 ` [PATCH 17/17] x86: retpolines: eliminate retpoline from msr event handlers Andrea Arcangeli
2019-09-23 15:39 ` [PATCH 00/17] KVM monolithic v1 Sean Christopherson
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=20190923190514.GB19996@redhat.com \
--to=aarcange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=vkuznets@redhat.com \
/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.