[Techteam] Weekend 10/31

Deepak Saxena dsaxena at laptop.org
Mon Nov 3 13:50:28 EST 2008

On Nov 03 2008, at 12:45, Richard A. Smith was caught saying:
> drivers/acpi/processor_core.c:
>   result = cpuidle_register_driver(&acpi_idle_driver);
> looking at this file I see that its called from
> static int __init acpi_processor_init(void)
> This is the same routine that creates a /proc/acpi directory which does  
> not exist on the XO so that plus the fact that I know we have ACPI  
> disabled I'm assuming that this routine is not called.
> Further greping for 'cpuidle_' I find that the only places cpuidle_  
> functions are called is in drivers/acpi/processor_core.c and  
> driver/acpi/processor_idle.c .
> If its used in another archs besides x86 can you point me to the code?  
> Perhaps I'm not grepping for the right thing?

drivers/acpi/processor_idle.c:acpi_processor_power_init() calls 
driver/cpuidle/cpuidle.c:cpuidle_register_device(). This in turn
calls cpuidle_install_idle_handler() which sets the pm_idle
pointer to cpuidle_idle_call(). pm_idle() is called by 

cpu_idle_call() calls the governor's select() function which 
pokes at various the bits int the cpuidle_device structure and 
the current system state to determine the next state and returns an 
index into the cpuidle_device's state table. We then index into the 
state table, and call the state's enter() function to perform the 
actual CPU swtich.

It looks like to make it work with a non-x86 arch, one would have
to hook the pm_idle() call into the the cpu_idle() routine, for example 
arch/arm/kernel/process.c:cpu_idle() on ARM. In our case, we would want 
to register an olpc_idle_driver and an olpc_idle_device that exports 
the known states. Once those are in place, the generic x86 cpu_idle() 
call will call into them via the framework.

> [1] cpuidle is very hard to google for usage info. There is  lots of  
> unrelated hits that use the term cupidle.  Is there a good reference for  
> the stuff thats exposed to userspace other than whats in the kernel docs?

I haven't found anything super useful except for reading the code. 
linux-pm list is probably the  best place to go for more details.


 Deepak Saxena - Kernel Developer, One Laptop Per Child
   _____   __o                                   (o>
------    -\<,  Give One Laptop, Get One Laptop  //\
 ----- ( )/ ( )  http://www.amazon.com/xo        V_/_

More information about the Devel mailing list