On Mon, May 06, 2019 at 07:52:04PM +0100, Tom Murphy wrote: > +static int handle_deferred_device(struct device *dev) > +{ > + struct iommu_domain *domain; > + const struct iommu_ops *ops; > + > + if (!is_kdump_kernel()) > + return 0; > + > + domain = iommu_get_domain_for_dev(dev); > - dma_handle =__iommu_dma_map(dev, phys, size, > + if (unlikely(handle_deferred_device(dev))) > + return DMA_MAPPING_ERROR; > + > + dma_handle = __iommu_dma_map(dev, phys, size, __iommu_dma_map already looks up the domain, and as far as I can tell all callers need the handle_deferred_device call. Should we just move it to there and pass the domain from the caller? Also shouldn't the iommu_attach_device call inside handle_deferred_device also get an unlikely marker?