From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH v4 07/10] xen/arm: call gic_clear_lrs on entry to the hypervisor Date: Mon, 24 Mar 2014 12:24:36 +0000 Message-ID: References: <1395232325-19226-7-git-send-email-stefano.stabellini@eu.citrix.com> <1395407692.19839.59.camel@kazak.uk.xensource.com> <1395419943.25521.11.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395419943.25521.11.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: julien.grall@citrix.com, jtd@galois.com, xen-devel@lists.xensource.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, 21 Mar 2014, Ian Campbell wrote: > On Fri, 2014-03-21 at 16:34 +0000, Stefano Stabellini wrote: > > On Fri, 21 Mar 2014, Ian Campbell wrote: > > > On Wed, 2014-03-19 at 12:32 +0000, Stefano Stabellini wrote: > > > > > > Can this not be folded back into the patch which added this function? > > > > Yes, it can. > > > > > > > > This change is needed by other patches later on. It is going to make > > > > sure that the calculation in Xen of the highest priority interrupt > > > > currently inflight is correct and accurate and not based on stale data. > > > > > > Hrm, can we not do this on demand just at the point where we are about > > > to make such a calculation? There are going to be lots of hypervisor > > > entries which don't want to do anything at all with interrupts, aren't > > > there? > > > > The alternative would be calling gic_clear_lrs at the beginning of > > gic_inject and gic_events_need_delivery, that is called by > > local_events_need_delivery*. It could be called multiple times before > > returning to guest. > > We could probably invent some sort of "once per h/v entry" construct, > but ick. > > What I was actually thinking of though was to do it even further up -- > e.g. in the function which makes the interrupt pending in the first > place. I suppose that is called too infrequently though in the absence > of maintenance interrupts. Yes, that function would not be called often enough: in order to calculate correctly if events need delivery, we need to know the current value of GICV_PMR.Priority, that is aliased by GICH_VMCR and can be changed by the guest without traps, and the current active highest priority interrupt in the LRs. As a consequence I think that gic_events_need_delivery needs to be called at least once before returning to guest.