Saturday, February 9, 2013

ARM: modes used in Linux


There are 7 modes in ARM.

User                 usr
Fast interrupt       fiq
Interrupt            irq
Supervisor           svc
Abort                abt
System               sys
Undefined            und

*************The following information in unreliable and still under construction***********

In Linux,

Userspace: usr mode

Kernel: svc mode

Interrupts and exceptions: irq, fiq, abt and und modes

TODO:
For what sys mode is used in Linux?


References:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0210c/Cihhcjia.html

Saturday, February 2, 2013

Linux Power Management

The following frameworks are part of Linux Power Management:
  • cpuidle
  • cpufreq
  • clock
  • regulator
  • devfreq

suspend ans resume
sysfs



Android Power Management

wakelocks
early suspend and late resume

Linux boot sequence

                                           *** UNDER DEVELOPMENT ***

Bottom-halves in Linux - Part 1: Softirqs

 

Kernel APIs



                                         **** UNDER DEVELOPMENT ****

Bottom-halves in Linux - Part 2: Tasklets

 

 

Kernel APIs



                                         **** UNDER DEVELOPMENT ****

Tuesday, January 29, 2013

Bottom-halves in Linux - Part 3: Workqueues



Kernel APIs



"kworker" is a placeholder process for kernel worker threads, which perform most of the actual processing for the kernel, especially in cases where there are interrupts, timers, I/O, etc.

Explain about:
create_singlethread_workqueue()
create_workqueue()

Refer the following for more information on work queues:


kernel/Documentation/workqueue.txt

http://www.linuxjournal.com/article/6916




Tuesday, January 15, 2013

ARM: Interrupts in Linux

This is based on Linux kernel 3.8-rc1.

When an interrupt has occurred: (Code flow from top to bottom)

[GIC: Global Interrupt Controller]

For the SoCs which are using ARM GIC:

arch/arm/kernel/setup.c:
 
handle_arch_irq = mdesc->handle_irq

arch/arm/mach-ux500/board-mop500.c:
.handle_irq     = gic_handle_irq,

arch/arm/common/gic.c:
gic_handle_irq:handle_IRQ

arch/arm/kernel/irq.c:
handle_IRQ:generic_handle_irq

For the SoCs which are using their own GIC:
arch/arm/kernel/entry-armv.S:

__irq_svc:irq_handler:arch_irq_handler_default

arch/arm/include/asm/entry-macro-multi.S

arch_irq_handler_default:
get_irqnr_preamble
get_irqnr_and_base - An arch specific function which gets the IRQ no.
asm_do_IRQ

arch/arm/kernel/irq.c

asm_do_IRQ:handle_IRQ:generic_handle_irq

Common code:
kernel/irq/irqdesc.c:
generic_handle_irq:generic_handle_irq_desc

include/linux/irqdesc.h:
generic_handle_irq_desc:desc->handle_irq

[TODO: FILL THE MISSING CODE FLOW]

"kernel/irq/handle.c":
handle_irq_event_percpu
action->handler: execute the interrupt handler
irq_wake_thread: wakeup threaded function
------------------------------------------------------------------
"kernel/irq/chip.c":
__irq_set_handler:desc->handle_irq = handle;

[TODO: FILL THE MISSING CODE FLOW]

kernel/irq/manage.c:
request_threaded_irq:__setup_irq
include/linux/interrupt.h
request_irq:request_threaded_irq

When an ISR is registered using request_irq(): (Code flow from bottom to top)


=========================================================================