Re: [PATCH v2 00/35] Speculative page faults

From: Sebastian Andrzej Siewior
Date: Tue Feb 01 2022 - 12:17:45 EST


On 2022-01-31 17:14:34 [-0800], Andrew Morton wrote:
> On Fri, 28 Jan 2022 05:09:31 -0800 Michel Lespinasse <michel@xxxxxxxxxxxxxx> wrote:
> > The next step is to walk down the existing page table tree to find the
> > current pte entry. This is done with interrupts disabled to avoid
> > races with munmap().
>
> Sebastian, could you please comment on this from the CONFIG_PREEMPT_RT
> point of view?

I applied the series on top of RT and gave it shot. Nothing out of the
ordinary happened so that is good.

>From browsing through the code:
- speculative_page_walk_begin() seems to disable interrupts.
There is a spin_trylock() invocation in that area. That is okay since
it is never invoked from in_IRQ(). But there should not be any regular
spin_lock() in such a section.

- We do have a seqcount API. So instead of mmap_seq_read_start() one
could use raw_read_seqcount(). The lockdep bits would also check if
the associated lock (in this case mmap_lock) is held in the write
path.

- The read side (mmap_seq_read_start()) does not attempt to stabilize
the counter (waiting for even) which is good. Otherwise special care
would be needed ;)

Sebastian