Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933927AbcLNW3j (ORCPT ); Wed, 14 Dec 2016 17:29:39 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33429 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933465AbcLNW3h (ORCPT ); Wed, 14 Dec 2016 17:29:37 -0500 Subject: Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT To: Denis Plotnikov , rkagan@virtuozzo.com, den@virtuozzo.com, rkrcmar@redhat.com References: <20161214105908.322638-1-dplotnikov@virtuozzo.com> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: Date: Wed, 14 Dec 2016 23:29:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161214105908.322638-1-dplotnikov@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 907 Lines: 25 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: /* * 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); 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? :) Paolo