[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3] x86: irq: Do not BUG_ON multiple unbind calls for shared pirqs


  • To: Varad Gautam <vrd@xxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 29 Jan 2020 11:30:50 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Wed, 29 Jan 2020 10:31:16 +0000
  • Ironport-sdr: 0oiDpGE+FzdwaJgCHTFT6W5lcAVk6FqaqC3aZeqdrbN0RBroOqSQb6ubaBQ9cLkGN15mhBHAHz PQDK3LnCWi65OUA2XDTt9FkcvYcaZS7KqzADcL5I7DtHwNbjF9PAPVQCXnJ1HaNmiImbc6DE0P OD0kyIWaGX7txto8PG7xairLRfKIzgWUsADMhQHdOA6C3DTx3CgHh1mvuf+Hg6Fu+ikYkQWFTk 18NcWc8tv/yTEh2mWb+pRmckFV7v4ztvxTEI7UDbRFRIJRnM1eortgP5eTVWsrHbUJTJY5NffU 6so=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hello,

Thanks for the patch! Next time could you please try to reply to the
previous questions before sending a new version:

https://lists.xenproject.org/archives/html/xen-devel/2019-07/msg00257.html

On Wed, Jan 29, 2020 at 10:28:07AM +0100, Varad Gautam wrote:
> XEN_DOMCTL_destroydomain creates a continuation if domain_kill -ERESTARTS.
> In that scenario, it is possible to receive multiple _pirq_guest_unbind
> calls for the same pirq from domain_kill, if the pirq has not yet been
> removed from the domain's pirq_tree, as:
>   domain_kill()
>     -> domain_relinquish_resources()
>       -> pci_release_devices()
>         -> pci_clean_dpci_irq()
>           -> pirq_guest_unbind()
>             -> __pirq_guest_unbind()
> 
> For a shared pirq (nr_guests > 1), the first call would zap the current
> domain from the pirq's guests[] list, but the action handler is never freed
> as there are other guests using this pirq. As a result, on the second call,
> __pirq_guest_unbind searches for the current domain which has been removed
> from the guests[] list, and hits a BUG_ON.
> 
> Make __pirq_guest_unbind safe to be called multiple times by letting xen
> continue if a shared pirq has already been unbound from this guest. The
> PIRQ will be cleaned up from the domain's pirq_tree during the destruction
> in complete_domain_destroy anyways.

So AFAICT this is because pt_pirq_softirq_active() returns true in
pci_clean_dpci_irq() and hence the iteration is stopped and
hvm_domain_irq(d)->dpci is not set to NULL.

Would it be possible to clean the already processed IRQs from the
domain pirq_tree?

pci_clean_dpci_irq() already seems to free part of this structure, and
would be nicer IMO if we didn't leave cleaned up stuff behind on
ERESTART.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.