How Kernel stack is used in case of different processor mode in ARM architecture?

Rahul Garg rahul.lnmiit at gmail.com
Tue Mar 25 06:40:21 EDT 2014


Hi Arun,

Lines from Robert Love :

Early in the 2.6 kernel process, an option was added to reduce the
stack size from two
pages down to one, providing only a 4KB stack on 32-bit systems.This
reduced memory
pressure because every process on the system previously needed two
pages of contiguous,
nonswappable kernel memory.To cope with the reduced stack size,
interrupt handlers
were given their own stack, one stack per processor, one page in
size.This stack is referred
to as the interrupt stack.Although the total size of the interrupt
stack is half that of the
original shared stack, the average stack space available is greater
because interrupt handlers
get the full page of memory to themselves.


So with these lines, it is clear that interrupt stack is used by
interrupt handlers. So can you please re-confirm your answer ?

And one more thing, as you mentioned only interrupt, undefined and
abort have stack, So how nested interrupt is handled because for that
we need System mode stack ?

Regards
Rahul

On Tue, Mar 25, 2014 at 3:06 PM, Arun KS <getarunks at gmail.com> wrote:
> On Tue, Mar 25, 2014 at 2:58 PM, Arun KS <getarunks at gmail.com> wrote:
>> Hello Rahul,
>>
>> On Tue, Mar 25, 2014 at 6:29 AM, Rahul Garg <rahul.lnmiit at gmail.com> wrote:
>>> As I understand every process have a user stack and kernel stack.
>> True.
>>
>>> Apart from that there is a stack for every mode in ARM achitecture. So
>> This is wrong.
>> Only irq, abort and undefined modes have stacks in linux. That too is
>> very limited, 3 bytes per mode per cpu.
>> Have a look at arch/arm/kernel/irq.c
> Sorry. Wrong file, its at arch/arm/kernel/setup.c
>
> Thanks,
> Arun
>> struct stack {
>>         u32 irq[3];
>>         u32 abt[3];
>>         u32 und[3];
>> } ____cacheline_aligned;
>>
>> kernel runs in SVC mode and the stack used belong to the kernel stack
>> of the current task.
>> Even irq, abort and undefined exception handlers use kernel stack of
>> current task. All the exception
>> handlers switch to SVC mode at a very early stage and use kernel
>> stack. Those 3 bytes are used
>> as stack just during the transition phase(for example transition from
>> irq to svc mode during and interrupt).
>>
>> Thanks,
>> Arun
>>> I want to know How different stack and stack pointer works in ARM
>>> modes? Also when this kernel stack associated with the process will be
>>> used ?
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



More information about the Kernelnewbies mailing list