[Moto E General] xperiafan13:
I open this topic for a discussion of the performance and acceptance, famous hotplug ...

What is CPU Hot-plug?

Hot-plug by definition is adding or removing things without switching off the system. Say Add a hard disk to the system and increase it's storage capacity without switching off the system. CPU hot-plug means adding or removing CPU's from the system without switching off the system.

Why CPU Hot-plug?

This feature came in for servers which have so many CPU's and one or more CPU's may become faulty. And switching off the server and physically removing it may be costly for any business. CPU hot-plug helps here by hot-plugging out the CPU from the software so that nothing gets scheduled on the CPU once that is done the power rails of the CPU can be turned off from the software and later if need be, the CPU can be safely removed from the system.

Similarly, Adding CPUs.

Hot-plugging for Saving Power.

But, this feature is increasingly being used for saving power. We have so many mobile phone or tablets with 4-Core, 8-Core CPU's etc... But when the mobile is just idling in your pocket waiting for any call or when the tablet is in standby or playing a song, one really does not need the power of so many cores. So, Mobile/Processor makers nicely use the hot-plug mechanisms to turn off the CPU. When very lightly loaded or in standby the not-need cores are hot-plugged off. And added whenever needed. This way there is a lot of power saving achieved.

A bit of Internals.

Once it is decided that a CPU is going to be hot-plugged basic thing needs to be done. In a multi-processor system there are several processes running, or sleeping in every CPU. Which essentially means there could/will be some processes that are running or sleeping in the CPU that we would like to hot-plug. So, first thing to be done is to "migrate". The migration scheduler thread has to run and transfer all the running or sleeping processes into the other available cores. The isr's. We need to mention the interrupt controller that this core is no longer available for servicing interrupts if the core is capable of handling interrupts. This step is very architecture specific.

After this is done the architecture specific hot-plug code is invoked in arch/xxx/mach-xxx/cpuxxx.c. This will do what is needed in the specific chip to switch off the cpu rails and turn off or reduce to voltages according to the need.

When adding the core the same step is reversed. Once the hardware specific things are done the new CPU is added to schedulers domain and scheduler starts freely migrating threads into the new cpu.

Pitfalls of CPU Hot-plug:

When CPU Hot-plug is used for power saving, the major pitfall is the cpu not being available on time during sudden load conditions. It always take a while to predict the load, and latency in brining a CPU online and latency in moving a process to a new CPU. So, there can be instances in which we have a load and the CPU's are not yet added to the system to digest it. This might lead to some uneasy user experience. Even after paying money for a 4/8 CPU product the user may not have them when needed. But, this is not as bad as I have worded it. It is just a balance.

If there is a running task on a CPU which is going to be hot-plugged it has to be moved to another CPU. There is always a cache penalty associate with every migration as there will be no cache for this process in the per-cpu cache of the new processor where it has moved. Cache penalty is separate subject and it is very very architecture specific.

How and when to Hot-plug?

There is no simple answer or this. It is purely dependent on the SoC. Every SoC vendor have their own implementation of the logic. There are some open source implementations also available. Also, there are some multi-core SoC's which don't use CPU hot-plug for power savings.

I modify my kernel, each with a different version of hotplug, each will have to try it, and based on the experience rate, the hotplug with the most votes, will be the default hotplug my kernel.

FIRST VERSION

FenomenalMOD with MSM_ZEN DECISION

msm: add msm_zen_decision

This adds a simple driver intended to allow the MPDecision service to be disabled.

The driver is easily extendable, but currently it:

- Can be enabled/disabled in /sys/kernel/zen_decision/enabled

- On screen power OFF it removes all cpu cores after suspend_wait_time

- On screen power ON it enables all cpu cores.

- /sys/kernel/zen_decision/suspend_wait_time (ms) refers to how long we wait after screen is off to remove the cores (default 5s). This just to avoid removing cores in excess.

DOWNLOAD: ZEN-Hotplug

SECOND VERSION

FenokenalMOD with msm_hotplug

It will switch on more cores very quickly. In Dorimanx kernel, this hotplug can be heavily tweaked to be battery friendly to pure performance. With the right tweaks it is a very good choice for balanced performance.

DOWNLOAD: MSM Hotplug

THIRD VERSION

FenomenalMOD with Mako Hotplug

Basic Hotplug by francisco franco

DOWNLOAD: Mako Hotplug

FIVE VERSION

FenomenalMOD with AUTOSMP Hotplug (very good!!)

AutoSMP is a simple but effective hot plug governor by mrg666

You can modify this in sys/kernel/autosmp/conf

DOWNLOAD: AUTOSMP

SIX VERSION

FenomenalMOD with Bricked Hotplug(very good!!!)

Conservative hotplug driver by [MENTION=358990]show[/MENTION]p1984

DOWNLOAD: BRICKED HOTPLUG

Please, try each before voting, Czech performance, battery, etc .... ALL DOWNLOAD IS FOR AOSP ROMS (CM, AOSP, PARANOIS, ETC=