kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: zertsekel@gmail.com (Konstantin Zertsekel)
To: kernelnewbies@lists.kernelnewbies.org
Subject: pagetables used in interrupt context
Date: Wed, 22 Feb 2012 13:58:56 +0200	[thread overview]
Message-ID: <CADxo8WKASG3NQznNMYWDXmDLK3diouB1-iMMQZ10cTaDLEQjDQ@mail.gmail.com> (raw)
In-Reply-To: <CAKRO8zJHyDCpY7bJA--0KGWtM-DKErziUTz9-Kj021_Q-B6LGw@mail.gmail.com>

On Wed, Feb 22, 2012 at 4:18 AM, subin gangadharan
<subingangadharan@gmail.com> wrote:
>
> Thank you for clearing my doubt.
>
> On Mon, Feb 20, 2012 at 8:39 PM, Dave Hylands <dhylands@gmail.com> wrote:
> > Hi Subin,
> >
> > On Mon, Feb 20, 2012 at 6:47 PM, subin gangadharan
> > <subingangadharan@gmail.com> wrote:
> >> 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

  reply	other threads:[~2012-02-22 11:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21  2:47 pagetables used in interrupt context subin gangadharan
2012-02-21  3:39 ` Dave Hylands
2012-02-22  2:18   ` subin gangadharan
2012-02-22 11:58     ` Konstantin Zertsekel [this message]
2012-02-23 12:52     ` 卜弋天
2012-02-23 14:41       ` Subramaniam Appadodharana
2012-02-23 16:13         ` 卜弋天
2012-02-23 17:12           ` subin gangadharan
2012-02-24  5:59             ` 卜弋天
2012-02-24  9:41               ` Kosta Zertsekel
2012-02-24 17:39                 ` subin gangadharan
2012-02-27  1:42                   ` 弋天 卜
2012-02-27  4:29                     ` subin gangadharan
2012-02-24  8:01             ` is there any Android APK that generate the SIGBUG error because of ARM NEON instructions? 卜弋天

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=CADxo8WKASG3NQznNMYWDXmDLK3diouB1-iMMQZ10cTaDLEQjDQ@mail.gmail.com \
    --to=zertsekel@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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).