Message ID | mhng-f5d21762-1321-4d35-927c-d47e0749abc0@palmer-ri-x1c9 (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [GIT,PULL] RISC-V Fixes for 6.0-rc6 | expand |
On Fri, Sep 16, 2022 at 8:31 AM Palmer Dabbelt <palmer@rivosinc.com> 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. Linus
On Fri, 16 Sep 2022 13:09:21 PDT (-0700), Linus Torvalds wrote: > On Fri, Sep 16, 2022 at 8:31 AM Palmer Dabbelt <palmer@rivosinc.com> 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. Sorry about that, it's pretty brain-dead. I'd love to blame this one on the lack of sleep over the past week or two, but I'm a bit too tired to commit to that. Either way I'll go sort it out, but not for this week -- I don't think anything else was super critical, so it shouldn't be that big of a problem.