On Fri, Sep 16, 2022 at 8:31 AM Palmer Dabbelt <palmer@xxxxxxxxxxxx> wrote:
I have one merge conflict as a result of a treewide fix, I'm getting some odd
output from just showing the merge (it's showing some of the fix too), but I
think the merge itself is OK. My fix is to keep the write lock
- mmap_read_lock(mm);
++ mmap_write_lock(mm);
+ ret = walk_page_range_novma(mm, start, end, &pageattr_ops, NULL,
+ &masks);
- mmap_read_unlock(mm);
++ mmap_write_unlock(mm);
Yes, thatr's the proper merge resolution.
HOWEVER.
Looking at the *callers* of this new __set_memory_mm(), this is all
completely bogus and broken.
In particular, fix_kernel_mem_early() does that call under rcu_read_lock().
You can't do that. Not with the read-lock, and not with the
write-lock. You simply cannot (and must not) block while in a
read-side critical section, and trying to take any sleeping lock -
whether for reading or for writing - is just completely wrong.
So I'm not doing this pull. The merge resolution is trivial, but the
code is simply wrong.