From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 1/6] KVM: Check for pending events before attempting injection Date: Thu, 29 Jul 2010 12:44:06 -0300 Message-ID: <20100729154406.GA2441@amt.cnet> References: <1280236780-5847-1-git-send-email-avi@redhat.com> <1280236780-5847-2-git-send-email-avi@redhat.com> <20100728162119.GA25224@amt.cnet> <4C505B47.5090405@redhat.com> <20100728163713.GA26653@amt.cnet> <4C50608C.7020207@redhat.com> <20100728172227.GB26822@amt.cnet> <4C51409B.6000305@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:62137 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757840Ab0G2Ppq (ORCPT ); Thu, 29 Jul 2010 11:45:46 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6TFjju8026171 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Jul 2010 11:45:45 -0400 Content-Disposition: inline In-Reply-To: <4C51409B.6000305@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jul 29, 2010 at 11:49:31AM +0300, Avi Kivity wrote: > On 07/28/2010 08:22 PM, Marcelo Tosatti wrote: > > > >>>>>that needs reinjection (or an exception). > >>>>That can happen event now, no? A pending exception, interrupt comes > >>>>along, injection picks up the exception but leaves the interrupt. > >>>> > >>>>Now the situation can be more complicated: > >>>> > >>>>- pending exception > >>>>- injection > >>>>- interrupt, sets KVM_REQ_EVENT > >>>>- notices KVM_REQ_EVENT > >>>>- drops KVM_REQ_EVENT, cancels exception (made pending again) > >>>>- goes back > >>>>- injection (injects exception again, interrupt is pending) > >>>> > >>>>as far as I can tell, this is all fine. > >>>But you cleared KVM_REQ_EVENT. Which means you're not going to inject > >>>the pending interrupt on the next entry. > >>Doh. So we need to set KVM_REQ_EVENT again, after the final check > >>for vcpu->requests, to make sure we redo injection again. > >> > >>So we can make inject_pending_event() return true if there's more in > >>the queue, and if it did, re-raise KVM_REQ_EVENT just before entry? > >Yeah, that would do it. > > On second and third thoughts, that is unneeded. If an interrupt or > nmi is still pending after event injection, we will request an > interrupt or nmi window which will set KVM_REQ_EVENT. An exception > cannot be pending after an event injection since it is the highest > priority event. > > Yes? Yep. Userspace irqchip is still broken though. Can't see whats wrong with svm.