[PATCH v4] riscv: Fix permissions for all mm's during mm init

Vladimir Isaev vladimir.isaev at syntacore.com
Sun Sep 18 23:04:56 PDT 2022


18.09.2022 13:05, Palmer Dabbelt wrote:
> On Sat, 17 Sep 2022 11:58:48 PDT (-0700), Linus Torvalds wrote:
>> Sorry for html crud, I'm afk right now.
>>
>> But no, this does not help at all.
>>
>> Now you're doing a blocking semaphore operation under a spinning rwlock
>> instead.
>>
>> Which also is completely invalid.
>>
>> Your can't do blocking locks in atomic context, and it doesn't matter
>> whether the atomic context is a rcu read section or a spin lock.
> 
> OK, sorry for screwing up a second time.  I'll go try and make sure we get this right before sending anything up.  Vladimir: I'll just take this one over and send a v5, I'll find some time this week to make sure I can get it right this time.
> 
> Sorry for the mess!
Hi Palmer,

I think we can avoid using full __set_memory_mm for processes here, because all non-pgd leafs were
fixed by __set_memory_mm(&init_mm).

So all we need here is to fix mm.pgd in case if this pgd is a leaf, because we copy only pgd for userspace.

Thank you,
Vladimir Isaev
> 
>> Stop making random locking changes like this. And enable lockdep and the
>> lock verification that would have told you all this immediately.
>>
>>        Linus
>>
>>
>> On Sat, Sep 17, 2022, 11:48 Vladimir Isaev <vladimir.isaev at syntacore.com>
>> wrote:
>>
>>> );
>>> +
>>> +       read_lock(&tasklist_lock);
>>> +       for_each_process(t) {
>>> +               if (t->flags & PF_KTHREAD)
>>> +                       continue;
>>> +               for_each_thread(t, s) {
>>> +                       if (s->mm) {
>>> +                               __set_memory_mm(s->mm, start, end,
>>> set_mask,
>>> +                                               clear_mask);
>>> +                       }
>>> +               }
>>> +       }
>>> +       read_unlock(&tasklist_lock);
>>>



More information about the linux-riscv mailing list