[lkml]   [2020]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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

>>>> 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:

* 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.


David / dhildenb

 \ /
  Last update: 2020-01-10 18:29    [W:0.056 / U:2.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site