Subject: Re: Page fault on vmalloc'ed memory

From: Paul Mackerras <[email-masked]>
Date: Fri, 7 May 2010 15:38:51 +1000

On Thu, May 06, 2010 at 12:28:44PM +0800, Li Yang wrote:

> The root cause of this oops might not be related with the vmalloc'ed
> area processing in Instruction Storage Interrupt.  But x86 does have
> the code for processing it while we don't.  Is it because we have
> nothing to do with the vmalloc'ed ISI on PowerPC architecture?

On PowerPC we always read the kernel page tables rooted at
swapper_pg_dir to get translations for kernel addresses (those above
KERNELBASE).  We can do that because it is kernel code (software) that
reads the Linux page tables.  On x86, it is hardware that reads the
Linux page tables, and it always reads the page tables for the current
process.  This means that the kernel part of each process's page
tables needs to contain copies of all the kernel PTEs on x86.  To
avoid having to set a PTE in every process's page tables when doing a
vmalloc or ioremap, x86 just creates them in swapper_pg_dir and then
creates them on demand in each process's page tables as needed.
That's why they have code to handle vmalloc faults in their page fault
handler.

Paul.