Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759938AbcKCSSH (ORCPT ); Thu, 3 Nov 2016 14:18:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38632 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751311AbcKCSSG (ORCPT ); Thu, 3 Nov 2016 14:18:06 -0400 Subject: Re: [PATCH 2/5] KVM: x86: do not scan IRR twice on APICv vmentry To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <1476469291-5039-1-git-send-email-pbonzini@redhat.com> <1476469291-5039-3-git-send-email-pbonzini@redhat.com> <20161026195900.GC4212@potion> <00273a1a-ef5d-f814-3e02-24b4e855d229@redhat.com> <20161103150356.GE7771@potion> <20161103180753.GF7771@potion> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, yang.zhang.wz@gmail.com, feng.wu@intel.com, mst@redhat.com From: Paolo Bonzini Message-ID: <18e681d1-640f-8c56-dc05-acc7ca34cd45@redhat.com> Date: Thu, 3 Nov 2016 19:18:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161103180753.GF7771@potion> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 03 Nov 2016 18:18:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1305 Lines: 35 On 03/11/2016 19:07, Radim Krčmář wrote: > 2016-11-03 17:00+0100, Paolo Bonzini: >> On 03/11/2016 16:03, Radim Krčmář wrote: >>> 2016-11-03 14:30+0100, Paolo Bonzini: >>>> On 26/10/2016 21:59, Radim Krčmář wrote: >>>>> 2016-10-14 20:21+0200, Paolo Bonzini: >>>>>> Calling apic_find_highest_irr results in IRR being scanned twice, >>>>>> once in vmx_sync_pir_from_irr and once in apic_search_irr. Change >>>>>> sync_pir_from_irr to do the RVI write and kvm_apic_update_irr to >>>>>> compute the new RVI on the fly. >>>>>> >>>>>> Signed-off-by: Paolo Bonzini >>>>>> --- >>>>> >>>>> Reviewed-by: Radim Krčmář >>>> >>>> Nope, this breaks nested VMX exit on external interrupt. For now I'm >>>> testing only patch 1 and will push that one only to kvm/next. > > Which hypervisor is being nested? vmx.flat. :) > I think a bug is likely for hypervisors that don't enable > PIN_BASED_EXT_INTR_MASK. The bug would trigger when > kvm_cpu_has_interrupt() in vmx_check_nested_events() in > kvm_arch_vcpu_runnable() queues the interrupt ... > but I didn't see how this would have caused a problem. :) Ironically, _not_ enabling PIN_BASED_EXT_INTR_MASK and not using HALT activity state is the only case that passes of the four that vmx.flat tests. Paolo