lce13: cpuidle: consolidation status and discussion about next steps resource: lce13

18
June 2013 LCE-13 Engineering Review PMWG WG

Upload: linaro

Post on 13-Jun-2015

381 views

Category:

Technology


3 download

DESCRIPTION

Name: CPUIdle: consolidation status and discussion about next steps Date: 11-07-2013 Speaker: Daniel Lezcano Video: http://youtu.be/6sSGRT2r3QA

TRANSCRIPT

Page 1: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

June 2013

LCE-13 Engineering Review

PMWG WG

Page 2: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

CPUIdle: consolidation status and

discussion about next steps

Daniel Lezcano <[email protected]>

Page 3: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

CPUIdle: status

Dynamic timer irq affinity

Timer broadcast consolidation

A simplified function to register the driver and device

Code fixes and cleanup

Page 4: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Timer broadcast unoptimized behavior

CPU0

Broadcast timer local timer

Tick framework

CPU1

local timer

Enter broadcast mode

Setup timer

Interrupt

Handle broadcast interrupt

Send IPI timer

Z Z Z Z Z

CPU0 is woken up to wake up CPU1

Z Z Z Z Z

Dynamic timer irq affinity

Page 5: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Dynamic timer irq affinity

Timer broadcast optimized behaviour

CPU0

Broadcast timer local timer

Tick framework

CPU1

local timer

Enter broadcast mode

Setup timer

Interrupt

Z Z Z Z Z

CPU1 is directly wake up by the timer device

Z Z Z Z Z

Set irq to CPU1

Page 6: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Dynamic timer irq affinity

without dynamic timer irq affinity

with dynamic timer irq affinity

A specific test case 'usleep 10000' on CPU1

Page 7: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Dynamic timer irq affinity

Results:

reduced by 40% the number of wake up on the system

reduced by 49% the number of wake up for CPU0

increased by factor two idle time for CPU0

increase by 16% package idle hits + 16% average package idle time

Page 8: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Dynamic timer irq affinity

Pre-requisite :

timer device must support CPU affinity

Irq field in the clockdevice driver must be initialized

Dynamic irq affinity + timer / work queues migration = cpu

quiescent for a long period

In conjunction with the small task packing, we have a cluster

down for long periods

Add the CLOCK_EVT_FEAT_DYNIRQ flag to the clock

device driver if this feature is worth to add to the SoC

Page 9: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Timer broadcast consolidation

CPUIdle framework CPUIdle backend driver IDLE(cpu1) Enter idle state

Tick framework

Clockevents notify enter Low level sleep code

CPU0 CPU1

Setup broadcast timer

SMP cross call

Z Z Z Z Z

Old behaviour : the timer broadcast is handled in the

backend driver

Clockevents notify exit

Interrupt

Page 10: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Timer broadcast consolidation

New behaviour : the timer broadcast is handled by the

cpuidle framework with the idle state flag :

CPUIDLE_FLAG_TIMER_STOP

CPUIdle framework CPUIdle backend driver IDLE(cpu1) Enter idle state

Tick framework

Clockevents notify enter

Low level sleep code

CPU0 CPU1

Setup broadcast timer

SMP cross call

Z Z Z Z Z

Clockevents notify exit

Interrupt

Page 11: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Timer broadcast consolidation

Duplicated code across back end drivers removed

A flag to tell to use the timer broadcast for a specific state

CPUIdle backend drivers only cares about PM work

Idle state callbacks more and more simple and focused on SoC

specific function

Page 12: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Simplified register function

Usually the initialization routines are always the same

1. Register the driver : cpuidle_register_driver

2. Register all the cpu devices : cpuidle_register_device

With the cpuidle_device statically declared per cpu in each

driver

Page 13: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Simplified register function

Introduced a new generic register function

Page 14: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Simplified register function

Results in a nice code consolidation

Page 15: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Code fixes and cleanup

Multiple driver support simplified

Cpumask in the cpuidle_driver structure

cpuidle_register_driver / cpuidle_register could be used

Removed API cpuidle_register_driver_cpu

➔ Results in internal framework code simplified

Made governors optional at compile time

menu/tickless – ladder/periodic tick

Removed en_core_tk_irqen flag : all drivers have the same

behavior

Time keeping done and local irq enabled by the framework

Misc code cleanups, fixes and unification of the init functions

Page 16: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Conclusion

Where are we ?

Very similar init / exit functions

Some PM functions can be now factored out

davinci – kirkwood - at91 DDR self refresh

Platform driver and device tree more and more used

Kirkwood, davinci

PM arch dependant code and driver more and more

separated

ux500 and at91 drivers will be moved to drivers/cpuidle soon

Page 17: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

Europe 2013 (LCE13)

www.linaro.org

Next steps

b.L cpuidle driver for TC2 is incoming (planned for 3.12)

A single ARM driver

With the code consolidation, we are close now but still depends on the

points below

Handle cpu hotplug in the cpuidle framework

Continue to split arch specific PM code from the driver

And move the drivers to the drivers/cpuidle directory

More use of the device tree

Latencies

Arch specific check (eg. davinci ddr power down flag)

Page 18: LCE13: CPUIdle: consolidation status and discussion about next steps Resource: LCE13

More about Linaro Connect: www.linaro.org/connect/ More about Linaro: www.linaro.org/about/

More about Linaro engineering: www.linaro.org/engineering/

Europe 2013 (LCE13)