Revert "Add BFQ/SIO/FIOPS/ZEN/VR IO Schedulers"

This reverts commit a86acd52cf0a1f27479c2c509514b3bafe7f1362.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "cpufreq: Add OndemandPLUS Gov"

This reverts commit 8e57a4860f999dd76e87ea9f5aa935f371a83a0f.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq_ondemandplus.c
Revert "Added CPUfreq governor 'wheatley'"

This reverts commit 3d974da277321dfaff8d654bedc972bca094533e.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq_wheatley.c
boeffla_defconfig: Activate CIFS and NFS

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>

Conflicts:
	arch/arm/configs/sh_defconfig
cpufreq: Add Intellidemand governor

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
block: Add SIO scheduler

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
block: Add FIOPS scheduler

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
block: cgroups, kconfig, build bits for BFQ-v7r5-3.4

Update Kconfig.iosched and do the related Makefile changes to include
kernel configuration options for BFQ. Also add the bfqio controller
to the cgroups subsystem.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
block: introduce the BFQ-v7r5 I/O sched for 3.4

Add the BFQ-v7r5 I/O scheduler to 3.4.
The general structure is borrowed from CFQ, as much of the code for
handling I/O contexts. Over time, several useful features have been
ported from CFQ as well (details in the changelog in README.BFQ). A
(bfq_)queue is associated to each task doing I/O on a device, and each
time a scheduling decision has to be made a queue is selected and served
until it expires.

    - Slices are given in the service domain: tasks are assigned
      budgets, measured in number of sectors. Once got the disk, a task
      must however consume its assigned budget within a configurable
      maximum time (by default, the maximum possible value of the
      budgets is automatically computed to comply with this timeout).
      This allows the desired latency vs "throughput boosting" tradeoff
      to be set.

    - Budgets are scheduled according to a variant of WF2Q+, implemented
      using an augmented rb-tree to take eligibility into account while
      preserving an O(log N) overall complexity.

    - A low-latency tunable is provided; if enabled, both interactive
      and soft real-time applications are guaranteed a very low latency.

    - Latency guarantees are preserved also in the presence of NCQ.

    - Also with flash-based devices, a high throughput is achieved
      while still preserving latency guarantees.

    - BFQ features Early Queue Merge (EQM), a sort of fusion of the
      cooperating-queue-merging and the preemption mechanisms present
      in CFQ. EQM is in fact a unified mechanism that tries to get a
      sequential read pattern, and hence a high throughput, with any
      set of processes performing interleaved I/O over a contiguous
      sequence of sectors.

    - BFQ supports full hierarchical scheduling, exporting a cgroups
      interface.  Since each node has a full scheduler, each group can
      be assigned its own weight.

    - If the cgroups interface is not used, only I/O priorities can be
      assigned to processes, with ioprio values mapped to weights
      with the relation weight = IOPRIO_BE_NR - ioprio.

    - ioprio classes are served in strict priority order, i.e., lower
      priority queues are not served as long as there are higher
      priority queues.  Among queues in the same class the bandwidth is
      distributed in proportion to the weight of each queue. A very
      thin extra bandwidth is however guaranteed to the Idle class, to
      prevent it from starving.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
block, bfq: add Early Queue Merge (EQM) to BFQ-v7r5 for 3.4.0

A set of processes may happen  to  perform interleaved reads, i.e., requests
whose union would give rise to a  sequential read  pattern.  There are two
typical  cases: in the first  case,   processes  read  fixed-size chunks of
data at a fixed distance from each other, while in the second case processes
may read variable-size chunks at  variable distances. The latter case occurs
for  example with QEMU, which  splits the  I/O generated  by the  guest into
multiple chunks,  and lets these chunks  be served by a  pool of cooperating
processes,  iteratively  assigning  the  next  chunk of  I/O  to  the first
available  process. CFQ  uses actual  queue merging  for the  first type of
rocesses, whereas it  uses preemption to get a sequential  read pattern out
of the read requests  performed by the second type of  processes. In the end
it uses  two different  mechanisms to  achieve the  same goal: boosting the
throughput with interleaved I/O.

This patch introduces  Early Queue Merge (EQM), a unified mechanism to get a
sequential  read pattern  with both  types of  processes. The  main idea is
checking newly arrived requests against the next request of the active queue
both in case of actual request insert and in case of request merge. By doing
so, both the types of processes can be handled by just merging their queues.
EQM is  then simpler and  more compact than the  pair of mechanisms used in
CFQ.

Finally, EQM  also preserves the  typical low-latency properties of BFQ, by
properly restoring the weight-raising state of  a queue when it gets back to
a non-merged state.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
namespace: Restrict slave mountspace so Dalvik apps can mount system-wide volumes (Variant 2)

--> version without remounting on /mnt/shell/emulated !!!

Android 4.2 implements multi-user storage using per-process mount
namespaces.  Everything under "/" (the entire filesystem hierarchy) is
marked as a recursive-slave mountspace for all zygote instances.  This is
done so that user-storage sandbox mounts under /storage/emulated are hidden
from other apps and users.

Unfortunately this means that any Dalvik app (actually, any program whose
clone/fork ancestry includes a Dalvik zygote, which is everything except
services spawned directly from init) cannot mount system-wide volumes.
Thus, apps like CifsManager are effectively broken in Android 4.2, since
its cifs mounts are only visible to the CifsManager app itself.  All other
apps see empty mountpoints instead of the mounted volume.  Furthermore,
Linux provides no provision for a process to "escape" a recursive-slave
mountspace in versions prior to Linux 3.8 (setns syscall).

Here, we restrict rootfs-slave calls to /storage (and, due to a possible
kernel bug, /mnt/shell/emulated) so that Dalvik apps can mount system-wide
volumes elsewhere (with appropriate permission, as in earlier versions of
Android), while retaining full multi-user storage compatibility.  It is
made available as a kernel-based workaround for instances where libdvm can
not be modified.

This change requires that a tmpfs volume is mounted as /storage in init.rc.
If this volume is unavailable, then we falls back to the previous behavior
of marking the entire filesystem hierarchy as slave.

*** Do not commit to CyanogenMod Project kernels, as a similar workaround
    for this problem is patched in Zygote/Dalvik/libdvm instead.  ***

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>

Conflicts:
	fs/namespace.c
cpufreq: intelliactive: initial coding and introduction!

intelliactive is based on Latest Google Interactive cpufreq governor from
Google.  The original Interactive provides smooth UI operations but suffers
slight battery drain due to its aggressive policies.  Intelliactive is an
improvement built on top of it.

It has the following enhancements added:
1. self-boost capability from input drivers (no need for PowerHAL assist)
2. two phase scheduling (idle/busy phases to prevent from jumping directly to
   max freq
3. Checks for offline cpus and short circuits some unnecessary checks to
   improve code execution paths
4. removed trace calls

All credits to Faux123

intelliactive: fix race condition when unregistering input handlers
Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
block: Add Zen scheduler

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "Sound Control: separate locking mechanism for recording and playback"

This reverts commit bd0aaedb20e58f692df1eec78a01109394c10851.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "Sound Control: let register lock be dependent on different hw revisions"

This reverts commit a7ce7d4a42c563bf8f35b9106dbc9d8d7607ba50.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "Sound Control: Misc clean up for newer WCD9xxx SOCs"

This reverts commit 41bc3cd8c6c7fe8a4437d6b2a42cab4018cab94d.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "Sound Control: expose direct register manipulations to userspace"

This reverts commit f91b094276745e7ec6b2afe0b3bda8326c868ad6.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "sound control: add register cache"

This reverts commit a1cf8ecbed7ffc50001cbdf6cf6d0d4a8e736ba0.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "Sound Control: (OPTIONAL) add power amp registers access control as well"

This reverts commit 50733489a7de0af344915ca924809f6e444c6260.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>
Revert "Sound Control: (Optional) work around for Nexus 4/5 audio issues"

This reverts commit 499926f021b2455420b741096beb874ad68d9bc4.

Signed-off-by: João Paulo <joaolrpaulo@gmail.com>