From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting Date: Mon, 4 Feb 2013 19:13:01 +0200 Message-ID: <20130204171301.GB10756@redhat.com> References: <20130130230311.GA19081@amt.cnet> <20130131094348.GN15004@redhat.com> <20130131133245.GB3179@amt.cnet> <20130131133837.GB23213@redhat.com> <20130131134443.GA4419@amt.cnet> <20130131135556.GC23213@redhat.com> <20130204005700.GA2705@amt.cnet> <20130204095553.GK23213@redhat.com> <20130204144345.GA11328@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Zhang, Yang Z" , "kvm@vger.kernel.org" , "Shan, Haitao" , "Zhang, Xiantao" , "Nakajima, Jun" , "Anvin, H Peter" To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1453 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753917Ab3BDRND (ORCPT ); Mon, 4 Feb 2013 12:13:03 -0500 Content-Disposition: inline In-Reply-To: <20130204144345.GA11328@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Feb 04, 2013 at 12:43:45PM -0200, Marcelo Tosatti wrote: > > > Any example how software relies on such two-interrupts-queued-in-IRR/ISR behaviour? > > Don't know about guests, but KVM relies on it to detect interrupt > > coalescing. So if interrupt is set in IRR but not in PIR interrupt will > > not be reported as coalesced, but it will be coalesced during PIR->IRR > > merge. > > Yes, so: > > 1. IRR=1, ISR=0, PIR=0. Event: set_irq, coalesced=no. > 2. IRR=0, ISR=1, PIR=0. Event: IRR->ISR transfer. > 3. vcpu outside of guest mode. > 4. IRR=1, ISR=1, PIR=0. Event: set_irq, coalesced=no. > 5. vcpu enters guest mode. > 6. IRR=1, ISR=1, PIR=1. Event: set_irq, coalesced=no. > 7. HW transfers PIR into IRR. > > set_irq return value at 7 is incorrect, interrupt event was _not_ > queued. Not sure I understand the flow of events in your description correctly. As I understand it at 4 set_irq() will return incorrect result. Basically when PIR is set to 1 while IRR has 1 for the vector the value of set_irq() will be incorrect. Frankly I do not see how it can be fixed without any race with present HW PIR design. -- Gleb.