Thread (14 messages) 14 messages, 5 authors, 2012-02-27

pagetables used in interrupt context

From: Konstantin Zertsekel <hidden>
Date: 2012-02-22 11:58:56

On Wed, Feb 22, 2012 at 4:18 AM, subin gangadharan
[off-list ref] wrote:
Thank you for clearing my doubt.

On Mon, Feb 20, 2012 at 8:39 PM, Dave Hylands [off-list ref] wrote:
quoted
Hi Subin,

On Mon, Feb 20, 2012 at 6:47 PM, subin gangadharan
[off-list ref] wrote:
quoted
Hi All,

Please correct me if I am wrong. In linux each process will have its
own page tables, so when a interrupt happens processor will switch to
interrupt context
and execute the proper handler. So my doubt, if this is the case,
interrupt hanlder will be using the pagetables of the interrupted
process or is there a separate page table for this.
Yep - that's right. Conceptually you can imagine that the kernel page
tables are replicated in each process, so when the interrupt occurs,
the kernel mappings will always be in effect regardless of which task
is running. How this is actually achieved may vary from architecture
to architecture.
For example, in ARMv5 the sacred instruction that actually tells CPU
to use new page table is here:
(file arch/arm/mm/proc-feroceon.S)

ENTRY(cpu_feroceon_switch_mm)
	...
	mcr	p15, 0, r0, c2, c0, 0		@ load page table pointer
	...

For ARMv7 it is (arch/arm/mm/proc-v7-2level.S):

ENTRY(cpu_v7_switch_mm)
	...
	isb
1:	mcr	p15, 0, r0, c2, c0, 0		@ set TTB 0
	isb
	...

For x86 (arch/x86/include/asm/mmu_context.h):

static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
			     struct task_struct *tsk)
{
		/* Re-load page tables */
		load_cr3(next->pgd);
		...
}
--- KostaZ
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help