linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Isaev <vladimir.isaev@syntacore.com>
To: Palmer Dabbelt <palmer@rivosinc.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org,
	ajones@ventanamicro.com, conor.dooley@microchip.com
Subject: Re: [PATCH v4] riscv: Fix permissions for all mm's during mm init
Date: Mon, 19 Sep 2022 09:04:56 +0300	[thread overview]
Message-ID: <699b8e78-94e9-1581-8285-4c6bcc9fc425@syntacore.com> (raw)
In-Reply-To: <mhng-16e91ca9-0ee8-4103-845e-56e9b394cae0@palmer-ri-x1c9>

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@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);
>>>

  reply	other threads:[~2022-09-19  6:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHk-=wg0vQFgiBEuJKHzxrS8JB=CxJFNf5WgtaofRn+bqs65oA@mail.gmail.com>
2022-09-18 10:05 ` [PATCH v4] riscv: Fix permissions for all mm's during mm init Palmer Dabbelt
2022-09-19  6:04   ` Vladimir Isaev [this message]
2022-09-17 18:47 Vladimir Isaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=699b8e78-94e9-1581-8285-4c6bcc9fc425@syntacore.com \
    --to=vladimir.isaev@syntacore.com \
    --cc=ajones@ventanamicro.com \
    --cc=conor.dooley@microchip.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@rivosinc.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).