From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756947AbcBINzK (ORCPT ); Tue, 9 Feb 2016 08:55:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33881 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754974AbcBINzG (ORCPT ); Tue, 9 Feb 2016 08:55:06 -0500 Date: Tue, 9 Feb 2016 14:55:03 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH 1/3] KVM: APIC: remove unnecessary double checks on APIC existence Message-ID: <20160209135502.GA30378@potion.brq.redhat.com> References: <1454948146-35353-1-git-send-email-pbonzini@redhat.com> <1454948146-35353-2-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454948146-35353-2-git-send-email-pbonzini@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-02-08 17:15+0100, Paolo Bonzini: > Usually the in-kernel APIC's existence is checked in the caller. Do not > bother checking it again in lapic.c. > > Signed-off-by: Paolo Bonzini > --- > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, > @@ -1601,8 +1595,7 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, > > void kvm_lapic_set_eoi(struct kvm_vcpu *vcpu) > { > - if (kvm_vcpu_has_lapic(vcpu)) > - apic_reg_write(vcpu->arch.apic, APIC_EOI, 0); > + apic_reg_write(vcpu->arch.apic, APIC_EOI, 0); This is most likely going to bug on the following path: handle_apic_access -> kvm_lapic_set_eoi Before the change, handle_apic_access would just drop EOIs that should have gone to user space ... I'm not sure if we tested it, or the path is really never taken.