[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4738a7e1-ec62-0b11-28df-e81c0f904f84@nvidia.com>
Date: Mon, 29 Mar 2021 22:17:41 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Alistair Popple <apopple@...dia.com>
CC: <akpm@...ux-foundation.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <david@...hat.com>,
<daniel.vetter@...ll.ch>, <dan.j.williams@...el.com>,
<gregkh@...uxfoundation.org>, <jglisse@...hat.com>,
<bsingharora@...il.com>, kernel test robot <oliver.sang@...el.com>
Subject: Re: [PATCH v3] kernel/resource: Fix locking in
request_free_mem_region
On 3/29/21 9:59 PM, Alistair Popple wrote:
...
>>> 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
Powered by blists - more mailing lists