From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754762AbbJGPBe (ORCPT ); Wed, 7 Oct 2015 11:01:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37835 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754601AbbJGPBc (ORCPT ); Wed, 7 Oct 2015 11:01:32 -0400 Date: Wed, 7 Oct 2015 17:01:29 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Steve Rutherford , stable@vger.kernel.org Subject: Re: [PATCH 2/2] KVM: x86: fix edge EOI and IOAPIC reconfig race Message-ID: <20151007150128.GC4508@potion.brq.redhat.com> References: <1439473570-13763-1-git-send-email-rkrcmar@redhat.com> <1439473570-13763-3-git-send-email-rkrcmar@redhat.com> <5614E5FC.7060207@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5614E5FC.7060207@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2015-10-07 11:29+0200, Paolo Bonzini: > On 13/08/2015 15:46, Radim Krčmář wrote: >> + if (kvm_x86_ops->sync_pir_to_irr(vcpu)) >> + kvm_make_request(KVM_REQ_EVENT, vcpu); >> + > > The call to sync_pir_to_irr belongs more in vcpu_scan_ioapic, I think. Will do so in v2. > More importantly, I think that KVM_REQ_EVENT is a latent bug for > kvm_vcpu_ioctl_get_lapic as well, so the call to kvm_make_request should > go in vmx_sync_pir_to_irr or in a new kvm_sync_pir_to_irr wrapper. True, thanks. I'll make the request in kvm_apic_update_irr (unless you'd prefer to have it in new kvm_sync_pir_to_irr). >> + (e->fields.trig_mode == IOAPIC_EDGE_TRIG && >> + kvm_apic_pending_eoi(vcpu, e->fields.vector))) > > Should we test again here that kvm_irq_has_notifier(ioapic->kvm, > KVM_IRQCHIP_IOAPIC, index), to avoid unnecessarily marking other > edge-triggered interrupts? Other edge-triggered interrupts are skipped by a previous condition: if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG || kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index) || index == RTC_GSI) [we're here] I think it is ok to ignore level-triggered RTC, but we do want to include edge-triggered.