Re: [PATCH v3] kernel/resource: Fix locking in request_free_mem_region
From: John Hubbard <jhubbard@nvidia.com>
Date: 2021-03-30 05:20:42
Also in:
lkml
From: John Hubbard <jhubbard@nvidia.com>
Date: 2021-03-30 05:20:42
Also in:
lkml
On 3/29/21 9:59 PM, Alistair Popple wrote: ...
quoted
quoted
res->desc = IORES_DESC_DEVICE_PRIVATE_MEMORY; + if (dev) { + dr->parent = &iomem_resource; + dr->start = addr; + dr->n = size; + devres_add(dev, dr); + } + + write_unlock(&resource_lock); + revoke_iomem(res);This is new, and not mentioned in the commit log, and therefore quite surprising. It seems like the right thing to do but it also seems like a different fix! I'm not saying that it should be a separate patch, but it does seem worth loudly mentioning in the commit log, yes?This isn't a different fix though, it is just about maintaining the original behaviour which called revoke_iomem() after dropping the lock. I inadvertently switched this around in the initial patch such that revoke_iomem() got called with the lock, leading to deadlock on x86 with CONFIG_IO_STRICT_DEVMEM=y. This does change the order of revoke_iomem() and devres_add() slightly, but as far as I can tell that shouldn't be an issue. Can call that out in the commit log.
Maybe that's why it looked like a change to me. I do think it's worth mentioning. thanks, -- John Hubbard NVIDIA