kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* pagetables used in interrupt context
@ 2012-02-21  2:47 subin gangadharan
  2012-02-21  3:39 ` Dave Hylands
  0 siblings, 1 reply; 14+ messages in thread
From: subin gangadharan @ 2012-02-21  2:47 UTC (permalink / raw)
  To: kernelnewbies

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.

-- 
With Regards
Subin Gangadharan

I am not afraid and I am also not afraid of being afraid.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  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
  0 siblings, 1 reply; 14+ messages in thread
From: Dave Hylands @ 2012-02-21  3:39 UTC (permalink / raw)
  To: kernelnewbies

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.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-21  3:39 ` Dave Hylands
@ 2012-02-22  2:18   ` subin gangadharan
  2012-02-22 11:58     ` Konstantin Zertsekel
  2012-02-23 12:52     ` 卜弋天
  0 siblings, 2 replies; 14+ messages in thread
From: subin gangadharan @ 2012-02-22  2:18 UTC (permalink / raw)
  To: kernelnewbies

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.
>
> --
> Dave Hylands
> Shuswap, BC, Canada
> http://www.davehylands.com



-- 
With Regards
Subin Gangadharan

I am not afraid and I am also not afraid of being afraid.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-22  2:18   ` subin gangadharan
@ 2012-02-22 11:58     ` Konstantin Zertsekel
  2012-02-23 12:52     ` 卜弋天
  1 sibling, 0 replies; 14+ messages in thread
From: Konstantin Zertsekel @ 2012-02-22 11:58 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-22  2:18   ` subin gangadharan
  2012-02-22 11:58     ` Konstantin Zertsekel
@ 2012-02-23 12:52     ` 卜弋天
  2012-02-23 14:41       ` Subramaniam Appadodharana
  1 sibling, 1 reply; 14+ messages in thread
From: 卜弋天 @ 2012-02-23 12:52 UTC (permalink / raw)
  To: kernelnewbies


Hi Subin:     for kernel version 2.6.35, ARM architecture, when interrupt occurs, kernel will change from USER/SVC mode to IRQ mode,backup some registers and change to SVC mode immediately, handle the real interrupt handler in SVC mode, which people say in interrupt context.    kernel will use the stack(interrupt context) of interrupted thread to handle the interrupt, and there is no MMU operation which do page table switch.    so the thread which is interrupted by interrupt, it's kernel mode stack will be choosed as the interrupt context of current interrupt.  > Date: Tue, 21 Feb 2012 19:18:32 -0700
> Subject: Re: pagetables used in interrupt context
> From: subingangadharan at gmail.com
> To: dhylands at gmail.com
> CC: kernelnewbies at kernelnewbies.org
> 
> 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.
> >
> > --
> > Dave Hylands
> > Shuswap, BC, Canada
> > http://www.davehylands.com
> 
> 
> 
> -- 
> With Regards
> Subin Gangadharan
> 
> I am not afraid and I am also not afraid of being afraid.
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120223/253c11e6/attachment.html 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-23 12:52     ` 卜弋天
@ 2012-02-23 14:41       ` Subramaniam Appadodharana
  2012-02-23 16:13         ` 卜弋天
  0 siblings, 1 reply; 14+ messages in thread
From: Subramaniam Appadodharana @ 2012-02-23 14:41 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Feb 23, 2012 at 6:52 AM, ??? <buyit@live.cn> wrote:
> Hi Subin:
>
>     for kernel version 2.6.35, ARM architecture, when interrupt occurs,
> kernel will change from USER/SVC mode to IRQ mode,backup some registers and
> change to SVC mode immediately, handle the real interrupt handler in SVC
> mode, which people say in interrupt context.
>     kernel will use the stack(interrupt context) of interrupted thread to
> handle the interrupt, and there is no MMU operation which do page table
> switch.
>     so the thread which is interrupted by interrupt, it's kernel mode stack
> will be choosed as the interrupt context of current interrupt.
>
Thanks ! thats a terse explanation! Can you please mention why we do
not have a IRQ stack (in terms of size of the stack) to do the
processing?
>
>> Date: Tue, 21 Feb 2012 19:18:32 -0700
>> Subject: Re: pagetables used in interrupt context
>> From: subingangadharan at gmail.com
>> To: dhylands at gmail.com
>> CC: kernelnewbies at kernelnewbies.org
>
>>
>> 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.
>> >
>> > --
>> > Dave Hylands
>> > Shuswap, BC, Canada
>> > http://www.davehylands.com
>>
>>
>>
>> --
>> With Regards
>> Subin Gangadharan
>>
>> I am not afraid and I am also not afraid of being afraid.
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-23 14:41       ` Subramaniam Appadodharana
@ 2012-02-23 16:13         ` 卜弋天
  2012-02-23 17:12           ` subin gangadharan
  0 siblings, 1 reply; 14+ messages in thread
From: 卜弋天 @ 2012-02-23 16:13 UTC (permalink / raw)
  To: kernelnewbies


Hi :     for ARM architecture, from the point of my view, interrupt can be handled in IRQ, SVC, or SYSTEM modes.    1.if kernel handles interrupt in IRQ mode, it can use separate specific stack of IRQ mode to handle interrupt,but it cannot support nest interupt, suppose you are running interrupt handler in IRQ mode, a new coming interrupt will corrupt the lr_irq which is used for current function.    2. if kernel handles interrupt in SYSTEM mode, the sequences will be : hardware interrupt occurs-->IRQ mode-->SYSTEM mode -->call interrupt handler.       kernel can support nest interrupt well by this way, the problem is SYSTEM mode use the same register with USER mode, which means kernel will use the  interrupted thread's user mode stack, this will leake information of kernel to user space, so it is not a good idea, although i did this for many years for OMAP chipset(the OS is not linux, it is mixed by REX and my own design.).    3. Linux kernel choose the last one, handle interrupt in SVC mode, which can support nest interrupt if it wants(2.6.35 does not support this). and it is very simple to use the interrupted thread's kernel mode stack as the interrupt context. if kernel use a specific stack which is for interrupt only, the sequences will be : hardware interrupt occurs-->IRQ mode-->SVC mode-->backup sp register of interrupted thread to it's TCB--->set sp register to be the specific kernel stack address-->call interrupt handler--->restore sp of interrupted thread--->return from interrupt.        this is a little complicated compared with the current design. so i agree with the current design.  Best Regards
 > Date: Thu, 23 Feb 2012 08:41:28 -0600
> Subject: Re: pagetables used in interrupt context
> From: c.a.subramaniam at gmail.com
> To: buyit at live.cn
> CC: dhylands at gmail.com; subingangadharan at gmail.com; kernelnewbies at kernelnewbies.org
> 
> On Thu, Feb 23, 2012 at 6:52 AM, ??? <buyit@live.cn> wrote:
> > Hi Subin:
> >
> >     for kernel version 2.6.35, ARM architecture, when interrupt occurs,
> > kernel will change from USER/SVC mode to IRQ mode,backup some registers and
> > change to SVC mode immediately, handle the real interrupt handler in SVC
> > mode, which people say in interrupt context.
> >     kernel will use the stack(interrupt context) of interrupted thread to
> > handle the interrupt, and there is no MMU operation which do page table
> > switch.
> >     so the thread which is interrupted by interrupt, it's kernel mode stack
> > will be choosed as the interrupt context of current interrupt.
> >
> Thanks ! thats a terse explanation! Can you please mention why we do
> not have a IRQ stack (in terms of size of the stack) to do the
> processing?
> >
> >> Date: Tue, 21 Feb 2012 19:18:32 -0700
> >> Subject: Re: pagetables used in interrupt context
> >> From: subingangadharan at gmail.com
> >> To: dhylands at gmail.com
> >> CC: kernelnewbies at kernelnewbies.org
> >
> >>
> >> 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.
> >> >
> >> > --
> >> > Dave Hylands
> >> > Shuswap, BC, Canada
> >> > http://www.davehylands.com
> >>
> >>
> >>
> >> --
> >> With Regards
> >> Subin Gangadharan
> >>
> >> I am not afraid and I am also not afraid of being afraid.
> >>
> >> _______________________________________________
> >> Kernelnewbies mailing list
> >> Kernelnewbies at kernelnewbies.org
> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120224/c4d76885/attachment.html 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-23 16:13         ` 卜弋天
@ 2012-02-23 17:12           ` subin gangadharan
  2012-02-24  5:59             ` 卜弋天
  2012-02-24  8:01             ` is there any Android APK that generate the SIGBUG error because of ARM NEON instructions? 卜弋天
  0 siblings, 2 replies; 14+ messages in thread
From: subin gangadharan @ 2012-02-23 17:12 UTC (permalink / raw)
  To: kernelnewbies

Hi ,

> can support nest interrupt if it wants(2.6.35 does not support this). and it
> is very simple to use the interrupted thread's kernel mode stack as the
> interrupt context. if kernel use a specific stack which is for interrupt

Thanks for the crystal clear explanation of the page table usage in
interrupt context. I have one more doubt, so in 2.6.35 as you said it
doesn't support
nested interrupt, does it mean that all other interrupts are
completely disabled, (I mean no other can interrupt the processor)
while executing an interrupt handler.



2012/2/23 ??? <buyit@live.cn>:
> Hi :
>
>     for ARM architecture, from the point of my view, interrupt can be
> handled in IRQ, SVC, or SYSTEM modes.
>     1.if kernel handles interrupt in IRQ mode, it can use separate specific
> stack of IRQ mode to handle interrupt,but it cannot support nest interupt,
> suppose you are running interrupt handler in IRQ mode, a new coming
> interrupt will corrupt the lr_irq which is used for current function.
>     2. if kernel handles interrupt in SYSTEM mode, the sequences will be :
> hardware interrupt occurs-->IRQ mode-->SYSTEM mode -->call
> interrupt handler.
>        kernel can support nest interrupt well by this way, the problem is
> SYSTEM mode use the same register with USER mode, which means kernel will
> use the  interrupted thread's user mode stack, this will leake information
> of kernel to user space, so it is not a good idea, although i did this for
> many years for OMAP chipset(the OS is not linux, it is mixed by REX and my
> own design.).
>     3. Linux kernel choose the last one, handle interrupt in SVC mode, which
> can support nest interrupt if it wants(2.6.35 does not support this). and it
> is very simple to use the interrupted thread's kernel mode stack as the
> interrupt context. if kernel use a specific stack which is for interrupt
> only, the sequences will be : hardware interrupt occurs-->IRQ mode-->SVC
> mode-->backup sp register of interrupted thread to it's TCB--->set sp
> register to be the specific kernel stack address-->call interrupt
> handler--->restore sp of interrupted thread--->return from interrupt.
>         this is a little complicated compared with the current design. so i
> agree with the current design.
>
>
> Best Regards
>
>> Date: Thu, 23 Feb 2012 08:41:28 -0600
>
>> Subject: Re: pagetables used in interrupt context
>> From: c.a.subramaniam at gmail.com
>> To: buyit at live.cn
>> CC: dhylands at gmail.com; subingangadharan at gmail.com;
>> kernelnewbies at kernelnewbies.org
>
>>
>> On Thu, Feb 23, 2012 at 6:52 AM, ??? <buyit@live.cn> wrote:
>> > Hi Subin:
>> >
>> > for kernel version 2.6.35, ARM architecture, when interrupt occurs,
>> > kernel will change from USER/SVC mode to IRQ mode,backup some registers
>> > and
>> > change to SVC mode immediately, handle the real interrupt handler in SVC
>> > mode, which people say in interrupt context.
>> > kernel will use the stack(interrupt context) of interrupted thread to
>> > handle the interrupt, and there is no MMU operation which do page table
>> > switch.
>> > so the thread which is interrupted by interrupt, it's kernel mode stack
>> > will be choosed as the interrupt context of current interrupt.
>> >
>> Thanks ! thats a terse explanation! Can you please mention why we do
>> not have a IRQ stack (in terms of size of the stack) to do the
>> processing?
>> >
>> >> Date: Tue, 21 Feb 2012 19:18:32 -0700
>> >> Subject: Re: pagetables used in interrupt context
>> >> From: subingangadharan at gmail.com
>> >> To: dhylands at gmail.com
>> >> CC: kernelnewbies at kernelnewbies.org
>> >
>> >>
>> >> 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.
>> >> >
>> >> > --
>> >> > Dave Hylands
>> >> > Shuswap, BC, Canada
>> >> > http://www.davehylands.com
>> >>
>> >>
>> >>
>> >> --
>> >> With Regards
>> >> Subin Gangadharan
>> >>
>> >> I am not afraid and I am also not afraid of being afraid.
>> >>
>> >> _______________________________________________
>> >> Kernelnewbies mailing list
>> >> Kernelnewbies at kernelnewbies.org
>> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>> > _______________________________________________
>> > Kernelnewbies mailing list
>> > Kernelnewbies at kernelnewbies.org
>> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
With Regards
Subin Gangadharan

I am not afraid and I am also not afraid of being afraid.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-23 17:12           ` subin gangadharan
@ 2012-02-24  5:59             ` 卜弋天
  2012-02-24  9:41               ` Kosta Zertsekel
  2012-02-24  8:01             ` is there any Android APK that generate the SIGBUG error because of ARM NEON instructions? 卜弋天
  1 sibling, 1 reply; 14+ messages in thread
From: 卜弋天 @ 2012-02-24  5:59 UTC (permalink / raw)
  To: kernelnewbies


Hi Subin:
 
     i am not familiar with other architecture, but for ARM, Linux Kernel 2.6.35, i checked the function handle_level_irq()and handle_edge_irq() in chip.c, both of them will call handle_IRQ_event() which is in handle.c. and the function handle_IRQ_event() will call the interrupt handler written by user. Kernel does not open interrupt(ARM CPSR I bit)when calling interrupt handler in handle_IRQ_event() function. this is only for top-half interrupt handling.  for bottom-half, it is no doubt that the interrupt will be opened.
 
     so if you register a interrupt by request_irq(), the interrupt handler will be called with irq disabled. i tested on Cortex-A9 dual core platform, it is right.
 

 

> Date: Thu, 23 Feb 2012 11:12:06 -0600
> Subject: Re: pagetables used in interrupt context
> From: subingangadharan at gmail.com
> To: buyit at live.cn
> CC: c.a.subramaniam at gmail.com; dhylands at gmail.com; kernelnewbies at kernelnewbies.org
> 
> Hi ,
> 
> > can support nest interrupt if it wants(2.6.35 does not support this). and it
> > is very simple to use the interrupted thread's kernel mode stack as the
> > interrupt context. if kernel use a specific stack which is for interrupt
> 
> Thanks for the crystal clear explanation of the page table usage in
> interrupt context. I have one more doubt, so in 2.6.35 as you said it
> doesn't support
> nested interrupt, does it mean that all other interrupts are
> completely disabled, (I mean no other can interrupt the processor)
> while executing an interrupt handler.
> 
> 
> 
> 2012/2/23 ??? <buyit@live.cn>:
> > Hi :
> >
> > for ARM architecture, from the point of my view, interrupt can be
> > handled in IRQ, SVC, or SYSTEM modes.
> > 1.if kernel handles interrupt in IRQ mode, it can use separate specific
> > stack of IRQ mode to handle interrupt,but it cannot support nest interupt,
> > suppose you are running interrupt handler in IRQ mode, a new coming
> > interrupt will corrupt the lr_irq which is used for current function.
> > 2. if kernel handles interrupt in SYSTEM mode, the sequences will be :
> > hardware interrupt occurs-->IRQ mode-->SYSTEM mode -->call
> > interrupt handler.
> > kernel can support nest interrupt well by this way, the problem is
> > SYSTEM mode use the same register with USER mode, which means kernel will
> > use the interrupted thread's user mode stack, this will leake information
> > of kernel to user space, so it is not a good idea, although i did this for
> > many years for OMAP chipset(the OS is not linux, it is mixed by REX and my
> > own design.).
> > 3. Linux kernel choose the last one, handle interrupt in SVC mode, which
> > can support nest interrupt if it wants(2.6.35 does not support this). and it
> > is very simple to use the interrupted thread's kernel mode stack as the
> > interrupt context. if kernel use a specific stack which is for interrupt
> > only, the sequences will be : hardware interrupt occurs-->IRQ mode-->SVC
> > mode-->backup sp register of interrupted thread to it's TCB--->set sp
> > register to be the specific kernel stack address-->call interrupt
> > handler--->restore sp of interrupted thread--->return from interrupt.
> > this is a little complicated compared with the current design. so i
> > agree with the current design.
> >
> >
> > Best Regards
> >
> >> Date: Thu, 23 Feb 2012 08:41:28 -0600
> >
> >> Subject: Re: pagetables used in interrupt context
> >> From: c.a.subramaniam at gmail.com
> >> To: buyit at live.cn
> >> CC: dhylands at gmail.com; subingangadharan at gmail.com;
> >> kernelnewbies at kernelnewbies.org
> >
> >>
> >> On Thu, Feb 23, 2012 at 6:52 AM, ??? <buyit@live.cn> wrote:
> >> > Hi Subin:
> >> >
> >> > for kernel version 2.6.35, ARM architecture, when interrupt occurs,
> >> > kernel will change from USER/SVC mode to IRQ mode,backup some registers
> >> > and
> >> > change to SVC mode immediately, handle the real interrupt handler in SVC
> >> > mode, which people say in interrupt context.
> >> > kernel will use the stack(interrupt context) of interrupted thread to
> >> > handle the interrupt, and there is no MMU operation which do page table
> >> > switch.
> >> > so the thread which is interrupted by interrupt, it's kernel mode stack
> >> > will be choosed as the interrupt context of current interrupt.
> >> >
> >> Thanks ! thats a terse explanation! Can you please mention why we do
> >> not have a IRQ stack (in terms of size of the stack) to do the
> >> processing?
> >> >
> >> >> Date: Tue, 21 Feb 2012 19:18:32 -0700
> >> >> Subject: Re: pagetables used in interrupt context
> >> >> From: subingangadharan at gmail.com
> >> >> To: dhylands at gmail.com
> >> >> CC: kernelnewbies at kernelnewbies.org
> >> >
> >> >>
> >> >> 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.
> >> >> >
> >> >> > --
> >> >> > Dave Hylands
> >> >> > Shuswap, BC, Canada
> >> >> > http://www.davehylands.com
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> With Regards
> >> >> Subin Gangadharan
> >> >>
> >> >> I am not afraid and I am also not afraid of being afraid.
> >> >>
> >> >> _______________________________________________
> >> >> Kernelnewbies mailing list
> >> >> Kernelnewbies at kernelnewbies.org
> >> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >> >
> >> > _______________________________________________
> >> > Kernelnewbies mailing list
> >> > Kernelnewbies at kernelnewbies.org
> >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >> >
> >>
> >> _______________________________________________
> >> Kernelnewbies mailing list
> >> Kernelnewbies at kernelnewbies.org
> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> 
> 
> -- 
> With Regards
> Subin Gangadharan
> 
> I am not afraid and I am also not afraid of being afraid.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120224/bbdcdb77/attachment-0001.html 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* is there any Android APK that generate the SIGBUG error because of ARM NEON instructions?
  2012-02-23 17:12           ` subin gangadharan
  2012-02-24  5:59             ` 卜弋天
@ 2012-02-24  8:01             ` 卜弋天
  1 sibling, 0 replies; 14+ messages in thread
From: 卜弋天 @ 2012-02-24  8:01 UTC (permalink / raw)
  To: kernelnewbies



Hi All:
 
    anybody who met such error of Android application? the logcat will be something like below:
 
signal 7 (SIGBUS), code 128 (?), fault addr 00000000

#00  pc 00015cec  /data/data/com.pccw.mobile.sip/lib/libavcodec.so    <--------------    this lib use ARM NEON instructions
 
 
 
   i found that Linux Kernel(even in latest 3.2 version) does not support un-alignment NEON instruction in data abort handler, if anybody who are interested in this topic, please contact me, i can provide the patch to workaroud it.

 
 
Best Regards 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120224/3221623a/attachment.html 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-24  5:59             ` 卜弋天
@ 2012-02-24  9:41               ` Kosta Zertsekel
  2012-02-24 17:39                 ` subin gangadharan
  0 siblings, 1 reply; 14+ messages in thread
From: Kosta Zertsekel @ 2012-02-24  9:41 UTC (permalink / raw)
  To: kernelnewbies

> I am not familiar with other architecture, but for ARM, Linux Kernel
> 2.6.35, i checked the function handle_level_irq()and handle_edge_irq() in
> chip.c, both of them will call handle_IRQ_event() which is in handle.c. and
> the function handle_IRQ_event() will call the interrupt handler written by
> user. Kernel does not open interrupt(ARM CPSR I bit)when calling interrupt
> handler in handle_IRQ_event() function. this is only for top-half interrupt
> handling.? for bottom-half, it is no doubt that the interrupt will be
> opened.

The same applies to 3.3.0 as I see from the code of handle_irq_event_percpu()
and its friends...
--- KostaZ

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-24  9:41               ` Kosta Zertsekel
@ 2012-02-24 17:39                 ` subin gangadharan
  2012-02-27  1:42                   ` 弋天 卜
  0 siblings, 1 reply; 14+ messages in thread
From: subin gangadharan @ 2012-02-24 17:39 UTC (permalink / raw)
  To: kernelnewbies

Hi ???,

> 2.6.35, i checked the function handle_level_irq()and handle_edge_irq() in
> chip.c, both of them will call handle_IRQ_event() which is in handle.c. and
> the function handle_IRQ_event() will call the interrupt handler written by
> user. Kernel does not open interrupt(ARM CPSR I bit)when calling interrupt
> handler in handle_IRQ_event() function.

Thank you for the valuable pointers. I have looked at the
handle_IRQ_event function, it seems at the end of the do while loop
its unconditionally disable the local interrupt (ARM CPSR I bit). If
the handler is running with interrupts disabled, why do we need to
disable the interrupts again.

Could you please explain about this logic.

Thanks in advance for your help and sorry to take up your time on this.



-- 
With Regards
Subin Gangadharan

I am not afraid and I am also not afraid of being afraid.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-24 17:39                 ` subin gangadharan
@ 2012-02-27  1:42                   ` 弋天 卜
  2012-02-27  4:29                     ` subin gangadharan
  0 siblings, 1 reply; 14+ messages in thread
From: 弋天 卜 @ 2012-02-27  1:42 UTC (permalink / raw)
  To: kernelnewbies

Hi:

   I think it is for safe,people can open interrupt inside their own interrupt handler, so kernel must disable it before touch kernel data that must be protected.


? 2012-2-25?1:39?"subin gangadharan" <subingangadharan@gmail.com> ???

> Hi ???,
> 
>> 2.6.35, i checked the function handle_level_irq()and handle_edge_irq() in
>> chip.c, both of them will call handle_IRQ_event() which is in handle.c. and
>> the function handle_IRQ_event() will call the interrupt handler written by
>> user. Kernel does not open interrupt(ARM CPSR I bit)when calling interrupt
>> handler in handle_IRQ_event() function.
> 
> Thank you for the valuable pointers. I have looked at the
> handle_IRQ_event function, it seems at the end of the do while loop
> its unconditionally disable the local interrupt (ARM CPSR I bit). If
> the handler is running with interrupts disabled, why do we need to
> disable the interrupts again.
> 
> Could you please explain about this logic.
> 
> Thanks in advance for your help and sorry to take up your time on this.
> 
> 
> 
> -- 
> With Regards
> Subin Gangadharan
> 
> I am not afraid and I am also not afraid of being afraid.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* pagetables used in interrupt context
  2012-02-27  1:42                   ` 弋天 卜
@ 2012-02-27  4:29                     ` subin gangadharan
  0 siblings, 0 replies; 14+ messages in thread
From: subin gangadharan @ 2012-02-27  4:29 UTC (permalink / raw)
  To: kernelnewbies

Thanks a ton for all your help.

2012/2/26 ?? ? <buyit@live.cn>:
> Hi:
>
>   I think it is for safe,people can open interrupt inside their own interrupt handler, so kernel must disable it before touch kernel data that must be protected.
>
>
> ? 2012-2-25?1:39?"subin gangadharan" <subingangadharan@gmail.com> ???
>
>> Hi ???,
>>
>>> 2.6.35, i checked the function handle_level_irq()and handle_edge_irq() in
>>> chip.c, both of them will call handle_IRQ_event() which is in handle.c. and
>>> the function handle_IRQ_event() will call the interrupt handler written by
>>> user. Kernel does not open interrupt(ARM CPSR I bit)when calling interrupt
>>> handler in handle_IRQ_event() function.
>>
>> Thank you for the valuable pointers. I have looked at the
>> handle_IRQ_event function, it seems at the end of the do while loop
>> its unconditionally disable the local interrupt (ARM CPSR I bit). If
>> the handler is running with interrupts disabled, why do we need to
>> disable the interrupts again.
>>
>> Could you please explain about this logic.
>>
>> Thanks in advance for your help and sorry to take up your time on this.
>>
>>
>>
>> --
>> With Regards
>> Subin Gangadharan
>>
>> I am not afraid and I am also not afraid of being afraid.



-- 
With Regards
Subin Gangadharan

I am not afraid and I am also not afraid of being afraid.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-02-27  4:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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? 卜弋天

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).