Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1542777

Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT

From Radim Krčmář <rkrcmar@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT
Date 2016-12-15 15:40 +0100
Message-ID <sOFmp-6RD-37@gated-at.bofh.it> (permalink)
References <sOfrX-5qN-25@gated-at.bofh.it> <sOqdH-5Va-3@gated-at.bofh.it> <sOFmp-6RD-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2016-12-15 10:18+0300, Roman Kagan:
> On Wed, Dec 14, 2016 at 11:29:33PM +0100, Paolo Bonzini wrote:
>> On 14/12/2016 11:59, Denis Plotnikov wrote:
>> >  
>> >  	if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
>> >  	    && nested_exit_intr_ack_set(vcpu)) {
>> > -		int irq = kvm_cpu_get_interrupt(vcpu);
>> > +		int irq = kvm_cpu_get_interrupt(vcpu, true);
>> >  		WARN_ON(irq < 0);
>> 
>> I think this is not needed, because all nested vmexits end with a KVM_REQ_EVENT:

I also think that it can safely be false and we could drop the parameter
from kvm_cpu_get_interrupt().

(We have injected the highest priority interrupt and put it into ISR,
 raising PPR again to its level, so there should be nothing to do in
 KVM_REQ_EVENT due to any TPR changes.)

>>         /*
>>          * the KVM_REQ_EVENT optimization bit is only on for one entry, and if
>>          * we did not inject a still-pending event to L1 now because of
>>          * nested_run_pending, we need to re-enable this bit.
>>          */
>>         if (vmx->nested.nested_run_pending)
>>                 kvm_make_request(KVM_REQ_EVENT, vcpu);
> 
> IIRC .nested_run_pending indicates we're emulating vmlaunch/vmresume and
> should not vmexit to L1, so this is not exactly "all nested vmexits"...
> 
>> This would allow you to always pass false from kvm_cpu_get_interrupt to
>> kvm_get_apic_interrupt.  Not sure if the additional complication in vmx.c
>> is worth the simplification in lapic.c.  Radim, second opinion? :)

This patch goes for a minimal change in the non-nested case, so I would
leave nVMX optimizations for another patch.

One useless round of KVM_REQ_EVENT is not going change nested
performance by much and it is not the only thing we could improve wrt.
TPR ... I would just leave it for now and take care of it when we
 * don't to update PPR at all with APICv -- it is already correct
 * drop the KVM_REQ_EVENT with flex priority, because lower TPR cannot
   unmask an interrupt

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] KVM: x86: avoid redundant REQ_EVENT Denis Plotnikov <dplotnikov@virtuozzo.com> - 2016-12-14 12:00 +0100
  Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT Radim Krčmář <rkrcmar@redhat.com> - 2016-12-14 22:40 +0100
  Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT Paolo Bonzini <pbonzini@redhat.com> - 2016-12-14 23:30 +0100
    Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT Radim Krčmář <rkrcmar@redhat.com> - 2016-12-15 15:40 +0100
      Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT Paolo Bonzini <pbonzini@redhat.com> - 2016-12-15 15:40 +0100
        Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT Paolo Bonzini <pbonzini@redhat.com> - 2016-12-18 22:10 +0100

csiph-web