Re: [PATCH v2 00/10] Refine the locking for dev->iommu_group

Marek Szyprowski
2023-08-08T14:03:11Z

Hi Jason,

On 08.08.2023 15:25, Jason Gunthorpe wrote:
> On Tue, Aug 08, 2023 at 03:08:30PM +0200, Marek Szyprowski wrote:
>>> Any of the drivers that use platform device as the iommu_device will
>>> have a problem, please try:
>>>
>>> https://lore.kernel.org/linux-iommu/ZNIz%2FNVLb6WqqvQx@nvidia.com/
>> I've checked and it doesn't help in my case. I will soon check why.
> Oh, I botched it. Forgot that the iommu_device->dev is the sysfs
> handle not the HW device. Maybe this:

This fixed the early lockup, but then system hangs again a bit later. It
looks that this device lock in __iommu_probe_device() is really
problematic, because __iommu_probe_device() is then called during the
iommu 'client device' probe on the probed device. Here is a complete
call stack:

unwind_backtrace from show_stack+0x10/0x14
show_stack from dump_stack_lvl+0x58/0x70
dump_stack_lvl from __iommu_probe_device+0x3d8/0x4b8
__iommu_probe_device from iommu_probe_device+0x10/0x40
iommu_probe_device from of_iommu_configure+0xf8/0x1c8
of_iommu_configure from of_dma_configure_id+0x188/0x450
of_dma_configure_id from platform_dma_configure+0x24/0x60
platform_dma_configure from really_probe+0xac/0x3d4
really_probe from __driver_probe_device+0xa0/0x1e8
__driver_probe_device from driver_probe_device+0x30/0xd0
driver_probe_device from __driver_attach+0x10c/0x190
__driver_attach from bus_for_each_dev+0x60/0xb4
bus_for_each_dev from bus_add_driver+0xe0/0x208
bus_add_driver from driver_register+0x7c/0x118
driver_register from exynos_drm_init+0xe0/0x14c
exynos_drm_init from do_one_initcall+0x6c/0x318
do_one_initcall from kernel_init_freeable+0x1c4/0x214
kernel_init_freeable from kernel_init+0x18/0x12c
kernel_init from ret_from_fork+0x14/0x2c

Any ideas?

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland