]> xenbits.xensource.com Git - xen.git/commit
x86/pass-through: avoid double IRQ unbind during domain cleanup
authorJan Beulich <jbeulich@suse.com>
Thu, 30 Apr 2020 08:40:59 +0000 (10:40 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 30 Apr 2020 08:40:59 +0000 (10:40 +0200)
commit5b58dad089880127674d460494d1a9d68109b3d7
treebd6e4d7c4b84b701e390d2564f0ecac83d3bb2bf
parent5af040ef8b572ffccb7e3530e617d4259a9ff724
x86/pass-through: avoid double IRQ unbind during domain cleanup

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()

Avoid recurring invocations of pirq_guest_unbind() by removing the pIRQ
from the tree being iterated after the first call there. In case such a
removed entry still has a softirq outstanding, record it and re-check
upon re-invocation.

Note that pirq_cleanup_check() gets relaxed beyond what's strictly
needed here, to avoid introducing an asymmetry there between HVM and PV
guests.

Reported-by: Varad Gautam <vrd@amazon.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Varad Gautam <vrd@amazon.de>
Reviewed-by: Paul Durrant <paul@xen.org>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/irq.c
xen/drivers/passthrough/pci.c
xen/include/asm-x86/hvm/irq.h