Showp1984 Mpdecision (squashed)

73 commits squashed

Mpdecision: fixup

Signed-off-by: ayysir <dresadd09691@gmail.com>
msm_mpdecision: boost: if we are not boosted, revib_wq does not need to run at all

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: fix changing boost freq sets min = boost freq

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: several changes [read more]
reworked cpu_up/down handling which removed redundant code
reworked max/min_cpus settings
reworked suspend/resume handling to obide by these new changes
also reworked locking for per cpu settings

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: min_cpus & max_cpus should on/offline affected cpus

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: change frequencies for input boost
This should provide us with a more battery friendly setup in light
usage situations while it still provides the obvious advantages
the input boost gives us (faster reaction).

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: increasing the check delay to 130ms
This change brings us down from 10 to 8 checks each second. The input boost reacts without
delay which is why we don't need to check for hotplugs so often anymore.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: boost: don't schedule more check than needed

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: boost: detect changed min frequency and update accordingly

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: tune hotplug values

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: input event boost: fix not resetting boost if cpu was unplugged before

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: add sysfs interface for input event boost

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: add input event boost [read more]

This adds an input event boost to mpdecision.
It will basically boost the min freq of all cpus to predefined values if an
input event is detected.
Devices that qualify as boosters must fullfill one of these conditions:
- contain touch in their name
- contain keyboard in their name
This also boosts cpus independently from each other. Meaning:
If a cpu is hotplugged after the boost of another cpu was initiated the next
boost pulse will boost that cpu too.

Sysfs interface underway.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: stats: if cpu is online, add current ontime to stats

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: fix spacing across the whole file
In the past year this evolved to a battlefield of tabs, spaces and different sizes of them. Fix that.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: fix sleep, don't use pause

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: add stats & expose to sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: tweak hotplug values

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: on resume pull up cpu1

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: turn on cpu1 early

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: we can't turn off cpu0

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: when returning from sleep, start immediately

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: disable debug

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: various fixes and tweaks

- fix get_slowest_cpu_rate(): don't cut off rate to int
- fix get_slowest_cpu_rate(): don't use values from an offline cpu
- fix get_slowest_cpu(): don't return cpu0.
- tweak hotplug thresholds

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: fix merge errors

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: add get_rate()

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: decrease delay between checks to 70ms

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: use CONFIG_NR_CPUS for max_cpu sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: add max/min cpu limits to sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: use unique lock names

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: cancel/resume main work thread on ES/LR

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: use own workqueues

This will alter mpdecision to alloc it's own wq rather than using
the predefined queue which is a shared resource.

The WQ is not bound to the issuer CPU (=high-priority), has a
rescue worker task and is freezable.
Also destroy the workqueue on exit, and rename msm_mpdec to
msm_mpdec_init.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: remove useless locking

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: fix disabling mpdecision over sysfs for multicore

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: export the new, larger nwns/twts arrays to sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: update header to include full feature list

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: make earlysuspend/lateresume core independent

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: don't let msm_mpdec_work_thread() run if we are still booting

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: update core data on first call

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: decrease decision delay

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: decrease startup delay

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: make debug output more compact & informative

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: fix get_slowest_cpu()

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: make msm_mpdec_work_thread() core independent

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: make mpdecision() core independent

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: add debug output

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
msm_mpdecision: fix check for khz/mhz value (idle_freq sysfs)

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: don't turn on cpu1 if cpu0 freq is below idle_freq
If the clock of cpu0 is below the set idle_freq don't enable cpu1 and
disregard the runqueue value.

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: fixup: move idle block to mpdecision()

This belongs in mp_decision() because this influences the decision
mpdecision is about to make.

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: don't turn off cpu1 if freq > idle

This fixes cpu1 being turned off though it is still working
with a high frequency. The idle_freq can be modified through sysfs.

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: sysfs: check if cpu is offline before hotplugging it

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: increase up threshold for Sense

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: increase start delay for Sense

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: allow mpdecision to be disabled (sysfs)

This allows disabling/enabling of mpdecision over sysfs.

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: fix foreign cpu control detection

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: adjust thresholds for sense

Sense is just too hungry...

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: increase startdelay for sense

Surprise! Sense needs a lot longer to boot up than aosp...

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: remove debug output

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: add sysfs interface

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: rename msm_mpdec_suspend to msm_mpdec_cpudata

Since this is being used for more than suspend stuff the old name
just isn't accurate anymore.

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: show how long the cpu was online

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: fix foreign hotplug/unplug detection

Signed-off-by: showp1984 <showp1984@gmail.com>

Conflicts:

	arch/arm/mach-msm/msm_mpdecision.c
mach-msm: mpdecision: add email to (c)

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: remove up/down delay, our default delay is large enough

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: always set the suspend var

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: show cpumask after up/down

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: don't start immediately

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: change early_suspend_level to blank_screen

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: pause if CPU is unplugged outside of mpdecision

This fixes cpu wars if something else tries to control the cpus.
default delay: 10000ms

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: restructure locks, add delay

The new delay allows the CPU to come up before any other action is taken.
This prevents fast plugging and also ensures the CPU hotplug process
is really done, before trying to unplug it again (or plug it).

The new locks are more efficient, and only used if necessary.

Signed-off-by: showp1984 <showp1984@gmail.com>
mach-msm: mpdecision: add load based decision making

This now works like the mpdecision binary from QCOM.
CPU hotplugging/unplugging based on system load.

A sysfs interface will be built in with a later commit.

Signed-off-by: showp1984 <showp1984@gmail.com>

Conflicts:
	arch/arm/mach-msm/msm_rq_stats.c
mach-msm: mpdecision: small cleanup

Signed-off-by: showp1984 <showp1984@gmail.com>
AIO: Don't plug the I/O queue in do_io_submit()
Asynchronous I/O latency to a solid-state disk greatly increased
between the 2.6.32 and 3.0 kernels. By removing the plug from
do_io_submit(), we observed a 34% improvement in the I/O latency.

Unfortunately, at this level, we don't know if the request is to
a rotating disk or not.

Change-Id: I7101df956473ed9fd5dcff18e473dd93b688a5c1
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: linux-aio@kvack.org
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Revert "cpufreq: ondemand: Fix hotplug deadlock with store_powersave_bias"

This reverts commit 434d8246b42f43e001aa2232cc33782195e4d0b7.
Revert "cpufreq: Adding traces to the cpufreq"

This reverts commit 3cdae8e1f5835135a480181f9de85fe0ce854585.
Revert "cpufreq: ondemand: Fix update_sampling_rate race with hotplug"

This reverts commit 2b481193c5da88c79627dd9a8dbf775978e33bab.
Revert "cpufreq: ondemand: add input_boost interface"

This reverts commit 2e4ff8b52f7810b4ba4e11a807f8c780596150f5.
Revert "cpufreq: ondemand: Boost CPU frequency only for touch input"

This reverts commit 22b9a0df48f9b5ffecd06473a1db8dff27e40dcb.
Revert "cpufreq: ondemand: Disable freq sync feature in store_powersave_bias"

This reverts commit 8a6dd38cf1ada77143fa22b99816b3d11aadd982.
Revert "cpufreq: ondemand: Use the input handler when SEC_DVFS_BOOSTER isn't enabled"

This reverts commit 9509f5f6ead3160cce83cbfa72fc03925a380f42.
Revert "cpufreq: Avoid using smp_processor_id() in preemptible context"

This reverts commit a662c7f585054be3527ff76466188c48b776bc2a.
Revert "cpufreq: ondemand: change freq sync code to use per-CPU kthreads"

This reverts commit 013a8615867137256b3c79048dcf0b60a0d60a5e.
Revert "cpufreq: ondemand: Fix locking in store_powersave_bias"

This reverts commit 1b00f62820c9e422fb514935fbcb035b0bd066a4.
Revert "cpufreq: ondemand: Fix store_powersave_bias() race with hotplug"

This reverts commit c6d902735245066e1aa9a28bfab96f53f3a7e13a.
Revert "cpufreq: Use dedicated high-priority workqueues"

This reverts commit e4081b0736ab5a2e4590da7caa339fedcfb969cc.
Revert "msm: Synchronize CPU frequency on thread migration"

This reverts commit e9dae23edc1005cafac736299152c17496bc2964.
Revert "cpufreq: Fix optimal_freq logic on ramp down"

This reverts commit 32497d353302f7bcce59ccd8ab10f42383ccb506.
cpufreq_ondemand.c: sync with my mako kernel
cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold

In order to avoid the calculation of up_threshold - down_differential
every time that the frequency must be decreased, we replace the
down_differential tuner with the adj_up_threshold which keeps the
difference across multiple checks.

Update the adj_up_threshold only when the up_theshold is also updated.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: ondemand: Fix typos in comments

Fix some typos in comments.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: governors: Calculate iowait time only when necessary

Currently we always calculate the CPU iowait time and add it to idle
time.
If we are in ondemand and we use io_is_busy, we re-calculate iowait time
and we subtract it from idle time.

With this patch iowait time is calculated only when necessary avoiding
the double call to get_cpu_iowait_time_us. We use a parameter in
function get_cpu_idle_time to distinguish when the iowait time will be
added to idle time or not, without the need of keeping the prev_io_wait.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.,org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>