From: "Jan Beulich" Subject: Re: [for-xen-4.5 PATCH v2 2/2] dpci: Add ZOMBIE state to allow the softirq to finish with the dpci_pirq. Date: Fri, 21 Nov 2014 15:55:37 +0000 Message-ID: <546F6E890200007800049DF9@mail.emea.novell.com> References: <1416435695-23784-1-git-send-email-konrad.wilk@oracle.com> <1416435695-23784-3-git-send-email-konrad.wilk@oracle.com> <546DD6BF0200007800049471@smtp.nue.novell.com> <20141120195133.GE25423@laptop.dumpdata.com> <546EFD1502000078000499E3@smtp.nue.novell.com> <546F382F0200007800049B49@smtp.nue.novell.com> <20141121151407.GD2886@laptop.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XrqYc-0001iZ-Ag for xen-devel@lists.xenproject.org; Fri, 21 Nov 2014 15:55:38 +0000 In-Reply-To: <20141121151407.GD2886@laptop.dumpdata.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: andrew.cooper3@citrix.com, xen-devel@lists.xenproject.org, linux@eikelenboom.it List-Id: xen-devel@lists.xenproject.org >>> On 21.11.14 at 16:14, wrote: > On Fri, Nov 21, 2014 at 01:03:43PM +0100, Jan Beulich wrote: >> >>> On 21.11.14 at 12:50, wrote: >> > On November 21, 2014 2:51:33 AM EST, Jan Beulich wrote: >> >>>>> On 20.11.14 at 20:51, wrote: >> >>> @@ -669,7 +670,7 @@ static void hvm_dirq_assist(struct domain *d, >> >>struct hvm_pirq_dpci *pirq_dpci) >> >>> ASSERT(d->arch.hvm_domain.irq.dpci); >> >>> >> >>> spin_lock(&d->event_lock); >> >>> - if ( pirq_dpci->state ) >> >>> + if ( test_and_clear_bool(pirq_dpci->masked) ) >> >>> { >> >>> struct pirq *pirq = dpci_pirq(pirq_dpci); >> >>> const struct dev_intx_gsi_link *digl; >> >> >> >>So this now guards solely against the timeout enforced EOI? Why do >> >>you no longer need to guard against cancellation (i.e. why isn't this >> >>looking at both ->state and ->masked)? >> >> >> > >> > The previous state check was superfluous as the dpci_softirq would check for >> > the valid STATE_ before calling hvm_dirq_assist (and deal with cancellation). >> >> I thought so first too, but then how is the guarding against >> cancellation working now? > > Since there are two forms of cancellation, lets consider each one seperatly: > > 1). pt_irq_create_bind and pt_irq_destroy_bind. Each of them calling > pt_pirq_softirq_reset in the 'error' case or in the normal path of destruction. > When that happens the action handler for the IRQ is removed the moment we call > pirq_guest_unbind. As such we only have to deal with the potential outstanding > pirq_dpci waiting to be serviced. Since we did the 'pt_pirq_softirq_reset' > we have changed the state from STATE_SCHED to zero. That means dpci_softirq will > NOT go in: > if ( test_and_clear_bit(STATE_SCHED, &pirq_dpci->state) ) Unless the flag got set again in the meantime. Since the event lock is being acquired right before the line quoted above, _that_ is what needs closely looking at (and why I was asking about the deletion of the [at the first glance unnecessary] checking of ->state in hvm_dirq_assist()). Jan