This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cpuidle - SW & HW

Guru 20755 points


Hello,

I'm trying to find the relation between the cpuidle in Linux to the HW behaviour.

For example, let's assume there is a single process which only does as following:
while(1)

{

 //do something
 printf("C");

  sleep(1); // edited 16.10. was written here by mistake mdelay(1000);

}

1) If I am using retention as the lowest idle state, should I expect the system to get into retention (C5 state for MPU+CORE in retention) for 1 seconds and then wake-up to Active state (C1 state)  for a short time (printf) and return back to idle for 1 seconds, etc ?
2) mdelay command is a software delay, so what is the wakeup source ?

3) Another thing, when will the cpuidle shall succeed in changing to low idle mode  , i.e. What is the meaning of "does not require a clock" below ?
"
When a group of modules belonging to a clock domain in a power domain does not require a clock

(interface or functional), the PRCM module can be programmed to automatically cut the clock to these
modules, thereby reducing their power consumption. The PRCM module can then switch the power
domain to low-power retention or off mode to ensure minimum power consumption. When all clocks in a
domain are cut, the domain is idle." (OMAP35X TRM)

4) For example the core power domain contains dss (display) , and a picture is now being displayed. Does it mean the cpuidle won't succeed in getting to low power mode (MPU retention +CORE retention) ?

Thanks,

Ran

  • Hi Ran,

    Please try to understand the CPUIdle framework of linux.

    Documentation/cpuidle/

    http://processors.wiki.ti.com/index.php/AM335x_Linux_Power_Management_User_Guide#cpuidle

    http://processors.wiki.ti.com/index.php/Sitara_Linux_Training:_Power_Management#CPU_Idle


    4) For example the core power domain contains dss (display) , and a picture is now being displayed. Does it mean the cpuidle won't succeed in getting to low power mode (MPU retention +CORE retention) ?

    Yes, it won't.

    1) If I am using retention as the lowest idle state, should I expect the system to get into retention (C5 state for MPU+CORE in retention) for 1 seconds and then wake-up to Active state (C1 state)  for a short time (printf) and return back to idle for 1 seconds, etc ?


    No. It won't behave like that instead it would initiate low power mode when no thread to run on CPU (ie CPU in IDLE)

    If you want to behave like that then you may have to write your own PM framework for that.

  • Hi Titusrathinaraj,

    Thank you very much for the answer, it helps a lot.

    But still I don't understand why it won't get into idle in my example. What does it mean by "no thread to run" ? Is there any sw example which you can give for such state ? I am trying to understand when my program will get into such condition, and if a sleep state is not equal to idle, then I'm not sure now when such condition will happen.

    the link above state ""Essentially, the MPU is notified that there is no work to do, and it enters a low-power state. "

    Thanks for feedback,

    Ran

  • Hi Ran,

    For example, let's assume there is a single process which only does as following:
    while(1)

    {

     //do something
     printf("C");

      mdelay(1000);

    }

    1) If I am using retention as the lowest idle state, should I expect the system to get into retention (C5 state for MPU+CORE in retention) for 1 seconds and then wake-up to Active state (C1 state)  for a short time (printf) and return back to idle for 1 seconds, etc ?
    2) mdelay command is a software delay, so what is the wakeup source ?

    "mdelay" is not a IDLE instruction but CPU executes NOP instruction for doing thing.

    CPU won't go to IDLE when NOP instn executes.

    Are you expecting to the CPU should be in IDLE when "mdelay" fn called ?

  • Hi Titusrathinaraj ,

     

    I was definitely mistaked, at the examples I wrote !!
    I actually meant a real sleep command, for example:

    while(1)

    {

     //do something
     printf("C");

     sleep(1);

    }

    Another thing, about the display preventing to enter idle mode, isn't it that the cpu can enter some low power mode

    Thanks very much for you comments, They are very much helpful !

    Ran

     

     

  • Hi Titusrathinaraj,

    after the fix to sleep(1), Is the assumption that the cpu will get into idle for 1 seconds and then print "C" and so on, a correct assumption ?
    What is the wakeup source in this case ?

    Thanks,

    Ran

  • Hi Ran,

    after the fix to sleep(1), Is the assumption that the cpu will get into idle for 1 seconds and then print "C" and so on, a correct assumption ?
    What is the wakeup source in this case ?


    No.

    This "sleep" function also required some functions to execute.

    http://e2e.ti.com/support/embedded/linux/f/354/p/376034/1323125.aspx#1323125

    I don't mean that "sleep" function would initiate real "sleep" for the SoC.

    You can go and check the actual definition of sleep() fn in linux driver.