Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754683AbbHFLz3 (ORCPT ); Thu, 6 Aug 2015 07:55:29 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:34245 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630AbbHFLz1 (ORCPT ); Thu, 6 Aug 2015 07:55:27 -0400 Subject: Re: [PATCH 5/9] KVM: x86: unify handling of interrupt window To: "Wu, Feng" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" References: <1438788228-34856-1-git-send-email-pbonzini@redhat.com> <1438788228-34856-6-git-send-email-pbonzini@redhat.com> Cc: Steve Rutherford , "rkrcmar@redhat.com" From: Paolo Bonzini X-Enigmail-Draft-Status: N1110 Message-ID: <55C34B2B.2050807@redhat.com> Date: Thu, 6 Aug 2015 13:55:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1408 Lines: 38 On 06/08/2015 08:50, Wu, Feng wrote: > Is it possible to adjust the code here and remove the later checking in x86.c? > In that case, we can avoid calling dm_request_for_irq_injection(vcpu) for > VM exit. No, see the dm_request_for_irq_injection() changes in patch 9. In that patch, you can get a IRQ window open vmexit under broader conditions (e.g. writing to the local APIC's LVT0 register). dm_request_for_irq_injection() is called just once, so it is inlined. After patch 9, it boils down to simply if (!vcpu->run->request_interrupt_window) return false; in the common case of in-kernel irqchip. So it costs just one memory access and a well-predicted branch. Paolo > Basically dm_request_for_irq_injection() did the following checks: > > - The same as in handle_interrupt_window() below: > > if (!irqchip_in_kernel(vcpu->kvm) && > vcpu->run->request_interrupt_window && > !kvm_cpu_has_interrupt(vcpu)) > > - kvm_arch_interrupt_allowed(vcpu), in which, most of the conditions > are guaranteed by interrupt window exits, the only one I am not sure > how to handle is ' to_vmx(vcpu)->nested.nested_run_pending'. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/