Re: [patch 1/2] x86_64 page fault NMI-safe

Andi Kleen
2010-07-14T23:09:21Z

> - at vmalloc time, when adding a new page directory entry, walk all
> the tens of thousands of existing page tables under a lock that
> guarantees that we don't add any new ones (ie it will lock out fork())
> and add the required pgd entry to them.
>
> - or just take the fault and do the "fill the page tables" on demand.
>
> Quite frankly, most of the time it's probably better to make that last
> choice (unless your hardware makes it easy to make the first choice,

Adding new PGDs should happen only very rarely (in fact
at most once per boot on i386-PAE36 with only 4 entries, most used by user
space), most of the time when you do a vmalloc it changes only lower level
tables.

The PGD for the kernel mappings is already set up. On x86-64 it can happen
more often in theory, but in practice it should be also extremly rare because
a PGD is so large.

That's why I'm not sure this problem even happened. It should
be extremly rare that you exactly add that PGD during the per cpu
allocation.

It can happen in theory, but for such a rare case take a lock
and walking everything should be fine.

-Andi