[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc0cfb97-5a60-7e73-4f85-d8e6947c5e28@redhat.com>
Date: Fri, 10 Jan 2020 18:29:07 +0100
From: David Hildenbrand <david@...hat.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
stable <stable@...r.kernel.org>,
Vishal Verma <vishal.l.verma@...el.com>,
Pavel Tatashin <pasha.tatashin@...een.com>,
Michal Hocko <mhocko@...e.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Linux MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/memory_hotplug: Fix remove_memory() lockdep splat
>>> Why make someone dig for the reasons this lock is sufficient?
>>
>> I think 5 LOC of comment are too much for something that is documented
>> e.g., in Documentation/core-api/memory-hotplug.rst ("Locking
>> Internals"). But whatever you prefer.
>
> Sure, lets beef up that doc to clarify this case and refer to it.
Referring is a good idea. We should change the "is advised" for the device_online()
to a "is required" or similar. Back then I wasn't sure how it all worked in
detail...
>>>> I properly documented the semantics of
>>>> add_memory_block_devices()/remove_memory_block_devices() already (that
>>>> they need the device hotplug lock).
>>>
>>> I see that, but I prefer lockdep_assert_held() in the code rather than
>>> comments. I'll send a patch to fix that up.
>>
>> That won't work as early boot code from ACPI won't hold it while it adds
>> memory. And we decided (especially Michal :) ) to keep it like that.
>
> So then the comment is actively misleading for that case. I would
> expect an explicit _unlocked path for that case with a comment about
> why it's special. Is there already a comment to that effect somewhere?
>
__add_memory() - the locked variant - is called from the same ACPI location
either locked or unlocked. I added a comment back then after a longe
discussion with Michal:
drivers/acpi/scan.c:
/*
* Although we call __add_memory() that is documented to require the
* device_hotplug_lock, it is not necessary here because this is an
* early code when userspace or any other code path cannot trigger
* hotplug/hotunplug operations.
*/
It really is a special case, though.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists