passthrough: simplify locking and logging
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 15 Nov 2019 18:59:30 +0000 (18:59 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 Nov 2019 19:18:31 +0000 (19:18 +0000)
commitcd7dedad8209753e0fc8a97e61d04b74912b53dc
tree0c46187ef249423ddfba254671ffe4a8cef86313
parent680d18763aef6a0b9cb90dcff8e59a6a91fbfb77
passthrough: simplify locking and logging

Dropping the pcidevs lock between calling device_assigned() and
assign_device() means that the latter has to do the same check as the
former for no obvious gain. Also, since long running operations under
pcidevs lock already drop the lock and return -ERESTART periodically there
is little point in immediately failing an assignment operation with
-ERESTART just because the pcidevs lock could not be acquired (for the
second time, having already blocked on acquiring the lock in
device_assigned()).

This patch instead acquires the lock once for assignment (or test assign)
operations directly in iommu_do_pci_domctl() and thus can remove the
duplicate domain ownership check in assign_device(). Whilst in the
neighbourhood, the patch also removes some debug logging from
assign_device() and deassign_device() and replaces it with proper error
logging, which allows error logging in iommu_do_pci_domctl() to be
removed.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/pci.c