<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:΢ÈíÑźÚ
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi Subin:<BR>
<BR>
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.<BR>
<BR>
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.<BR>
<BR>
<BR> <BR>
<DIV>
<DIV id=SkyDrivePlaceholder></DIV>> Date: Thu, 23 Feb 2012 11:12:06 -0600<BR>> Subject: Re: pagetables used in interrupt context<BR>> From: subingangadharan@gmail.com<BR>> To: buyit@live.cn<BR>> CC: c.a.subramaniam@gmail.com; dhylands@gmail.com; kernelnewbies@kernelnewbies.org<BR>> <BR>> Hi ,<BR>> <BR>> > can support nest interrupt if it wants(2.6.35 does not support this). and it<BR>> > is very simple to use the interrupted thread's kernel mode stack as the<BR>> > interrupt context. if kernel use a specific stack which is for interrupt<BR>> <BR>> Thanks for the crystal clear explanation of the page table usage in<BR>> interrupt context. I have one more doubt, so in 2.6.35 as you said it<BR>> doesn't support<BR>> nested interrupt, does it mean that all other interrupts are<BR>> completely disabled, (I mean no other can interrupt the processor)<BR>> while executing an interrupt handler.<BR>> <BR>> <BR>> <BR>> 2012/2/23 ²·ß®Ìì <buyit@live.cn>:<BR>> > Hi :<BR>> ><BR>> > for ARM architecture, from the point of my view, interrupt can be<BR>> > handled in IRQ, SVC, or SYSTEM modes.<BR>> > 1.if kernel handles interrupt in IRQ mode, it can use separate specific<BR>> > stack of IRQ mode to handle interrupt,but it cannot support nest interupt,<BR>> > suppose you are running interrupt handler in IRQ mode, a new coming<BR>> > interrupt will corrupt the lr_irq which is used for current function.<BR>> > 2. if kernel handles interrupt in SYSTEM mode, the sequences will be :<BR>> > hardware interrupt occurs-->IRQ mode-->SYSTEM mode -->call<BR>> > interrupt handler.<BR>> > kernel can support nest interrupt well by this way, the problem is<BR>> > SYSTEM mode use the same register with USER mode, which means kernel will<BR>> > use the interrupted thread's user mode stack, this will leake information<BR>> > of kernel to user space, so it is not a good idea, although i did this for<BR>> > many years for OMAP chipset(the OS is not linux, it is mixed by REX and my<BR>> > own design.).<BR>> > 3. Linux kernel choose the last one, handle interrupt in SVC mode, which<BR>> > can support nest interrupt if it wants(2.6.35 does not support this). and it<BR>> > is very simple to use the interrupted thread's kernel mode stack as the<BR>> > interrupt context. if kernel use a specific stack which is for interrupt<BR>> > only, the sequences will be : hardware interrupt occurs-->IRQ mode-->SVC<BR>> > mode-->backup sp register of interrupted thread to it's TCB--->set sp<BR>> > register to be the specific kernel stack address-->call interrupt<BR>> > handler--->restore sp of interrupted thread--->return from interrupt.<BR>> > this is a little complicated compared with the current design. so i<BR>> > agree with the current design.<BR>> ><BR>> ><BR>> > Best Regards<BR>> ><BR>> >> Date: Thu, 23 Feb 2012 08:41:28 -0600<BR>> ><BR>> >> Subject: Re: pagetables used in interrupt context<BR>> >> From: c.a.subramaniam@gmail.com<BR>> >> To: buyit@live.cn<BR>> >> CC: dhylands@gmail.com; subingangadharan@gmail.com;<BR>> >> kernelnewbies@kernelnewbies.org<BR>> ><BR>> >><BR>> >> On Thu, Feb 23, 2012 at 6:52 AM, ²·ß®Ìì <buyit@live.cn> wrote:<BR>> >> > Hi Subin:<BR>> >> ><BR>> >> > for kernel version 2.6.35, ARM architecture, when interrupt occurs,<BR>> >> > kernel will change from USER/SVC mode to IRQ mode,backup some registers<BR>> >> > and<BR>> >> > change to SVC mode immediately, handle the real interrupt handler in SVC<BR>> >> > mode, which people say in interrupt context.<BR>> >> > kernel will use the stack(interrupt context) of interrupted thread to<BR>> >> > handle the interrupt, and there is no MMU operation which do page table<BR>> >> > switch.<BR>> >> > so the thread which is interrupted by interrupt, it's kernel mode stack<BR>> >> > will be choosed as the interrupt context of current interrupt.<BR>> >> ><BR>> >> Thanks ! thats a terse explanation! Can you please mention why we do<BR>> >> not have a IRQ stack (in terms of size of the stack) to do the<BR>> >> processing?<BR>> >> ><BR>> >> >> Date: Tue, 21 Feb 2012 19:18:32 -0700<BR>> >> >> Subject: Re: pagetables used in interrupt context<BR>> >> >> From: subingangadharan@gmail.com<BR>> >> >> To: dhylands@gmail.com<BR>> >> >> CC: kernelnewbies@kernelnewbies.org<BR>> >> ><BR>> >> >><BR>> >> >> Thank you for clearing my doubt.<BR>> >> >><BR>> >> >> On Mon, Feb 20, 2012 at 8:39 PM, Dave Hylands <dhylands@gmail.com><BR>> >> >> wrote:<BR>> >> >> > Hi Subin,<BR>> >> >> ><BR>> >> >> > On Mon, Feb 20, 2012 at 6:47 PM, subin gangadharan<BR>> >> >> > <subingangadharan@gmail.com> wrote:<BR>> >> >> >> Hi All,<BR>> >> >> >><BR>> >> >> >> Please correct me if I am wrong. In linux each process will have its<BR>> >> >> >> own page tables, so when a interrupt happens processor will switch<BR>> >> >> >> to<BR>> >> >> >> interrupt context<BR>> >> >> >> and execute the proper handler. So my doubt, if this is the case,<BR>> >> >> >> interrupt hanlder will be using the pagetables of the interrupted<BR>> >> >> >> process or is there a separate page table for this.<BR>> >> >> ><BR>> >> >> > Yep - that's right. Conceptually you can imagine that the kernel page<BR>> >> >> > tables are replicated in each process, so when the interrupt occurs,<BR>> >> >> > the kernel mappings will always be in effect regardless of which task<BR>> >> >> > is running. How this is actually achieved may vary from architecture<BR>> >> >> > to architecture.<BR>> >> >> ><BR>> >> >> > --<BR>> >> >> > Dave Hylands<BR>> >> >> > Shuswap, BC, Canada<BR>> >> >> > http://www.davehylands.com<BR>> >> >><BR>> >> >><BR>> >> >><BR>> >> >> --<BR>> >> >> With Regards<BR>> >> >> Subin Gangadharan<BR>> >> >><BR>> >> >> I am not afraid and I am also not afraid of being afraid.<BR>> >> >><BR>> >> >> _______________________________________________<BR>> >> >> Kernelnewbies mailing list<BR>> >> >> Kernelnewbies@kernelnewbies.org<BR>> >> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies<BR>> >> ><BR>> >> > _______________________________________________<BR>> >> > Kernelnewbies mailing list<BR>> >> > Kernelnewbies@kernelnewbies.org<BR>> >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies<BR>> >> ><BR>> >><BR>> >> _______________________________________________<BR>> >> Kernelnewbies mailing list<BR>> >> Kernelnewbies@kernelnewbies.org<BR>> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies<BR>> <BR>> <BR>> <BR>> -- <BR>> With Regards<BR>> Subin Gangadharan<BR>> <BR>> I am not afraid and I am also not afraid of being afraid.<BR></DIV>                                            </div></body>
</html>