From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/6] KVM: Check for pending events before attempting injection Date: Thu, 29 Jul 2010 11:49:31 +0300 Message-ID: <4C51409B.6000305@redhat.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:47624 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754451Ab0G2Itd (ORCPT ); Thu, 29 Jul 2010 04:49:33 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6T8nWIf000539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Jul 2010 04:49:33 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6T8nW5s022101 for ; Thu, 29 Jul 2010 04:49:32 -0400 In-Reply-To: <20100728172227.GB26822@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: 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? -- error compiling committee.c: too many arguments to function