If sync wakee task's demand is small it's worth to place the wakee task
on waker's cluster for better performance in the sense that waker and
wakee are corelated so the wakee should take advantage of waker cluster's
frequency which is voted by the waker along with cache locality benefit.
While biasing towards the waker's cluster we want to avoid the waker CPU
as much as possible as placing the wakee on the waker's CPU can make the
waker got preempted and migrated by load balancer.
Introduce a new tunable 'sched_small_wakee_task_load' that differentiates
eligible small wakee task and place the small wakee tasks on the waker's
cluster.
CRs-fixed: 971295
Change-Id: I96897d9a72a6f63dca4986d9219c2058cd5a7916
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
[joonwoop@codeaurora.org: fixed a minor conflict in
include/linux/sched/sysctl.h.]
p->grp is being accessed outside of lock which can cause null-pointer
dereference. Fix this and also add rcu critical section around access
of this data structure.
CRs-fixed: 985379
Change-Id: Ic82de6ae2821845d704f0ec18046cc6a24f98e39
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[joonwoop@codeaurora.org: fixed conflict in init_new_task_load().]
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
At present sched_select_prev_cpu_us tunable is restricted to values
below 100us. Fix this unintended restriction.
CRs-Fixed: 972237
Change-Id: I5eaf9f40468805c396328ca1022baef32acf8de0
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
The idle task's mark_start can get updated even without the CPU being
online. Hence the mark_start is restored when the CPU is coming online.
The idle task's mark_start is reset in init_idle()->__sched_fork()->
init_new_task_load(). The original mark_start is saved and restored
later. This can be avoided by moving init_new_task_load() to
wake_up_new_task(), which never gets called for an idle task.
We only care about idle task's ravg.mark_start and not initializing
the other fields of ravg struct will not have any side effects.
This clean up allows the subsequent patches to drop the rq->lock
while calling __sched_fork() in init_idle().
CRs-Fixed: 965873
Change-Id: I41de6d69944d7d44b9c4d11b2d97ad01bd8fe96d
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
[joonwoop@codeaurora.org: fixed a minor conflict in core.c. omitted
changes for CONFIG_SCHED_QHMP.]
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
When sched_restrict_cluster_spill knob is enabled, RT tasks are restricted
to lower power cluster. This knob also restricts inter cluster no-hz kicks.
Ignore this knob setting when sched_boost is enabled so that tasks are
placed on CPUs with highest spare capacity.
CRs-Fixed: 968852
Change-Id: I01b3fc10b39dc834a733d64c2ee29c308d7ff730
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Current window based load tracking only saves history for five
windows. A historically heavy task's heavy load will be completely
forgotten after five windows of light load. Even before the five
window expires, a heavy task wakes up on same CPU it used to run won't
trigger any frequency change until end of the window. It would starve
for the entire window. It also adds one "small" load window to
history because it's accumulating load at a low frequency, further
reducing the tracked load for this heavy task.
Ideally, scheduler should be able to identify such tasks and notify
governor to increase frequency immediately after it wakes up.
Add a histogram for each task to track a much longer load history. A
prediction will be made based on runtime of previous or current
window, histogram data and load tracked in recent windows. Prediction
of all tasks that is currently running or runnable on a CPU is
aggregated and reported to CPUFreq governor in sched_get_cpus_busy().
sched_get_cpus_busy() now returns predicted busy time in addition
to previous window busy time and new task busy time, scaled to
the CPU maximum possible frequency.
Tunables:
- /proc/sys/kernel/sched_gov_alert_freq (KHz)
This tunable can be used to further filter the notifications.
Frequency alert notification is sent only when the predicted
load exceeds previous window load by sched_gov_alert_freq converted to
load.
Change-Id: If29098cd2c5499163ceaff18668639db76ee8504
Suggested-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
[joonwoop@codeaurora.org: fixed merge conflicts around __migrate_task()
and removed changes for CONFIG_SCHED_QHMP.]
Each time a task wakes up, scheduler evaluates its load and notifies
governor if the resulting frequency of destination CPU is larger than
a threshold. However, some governor wakes up a separate task that
handles frequency change, which again calls wake_up_process().
This is dangerous because if the task being woken up meets the
threshold and ends up being moved around, there is a potential for
endless recursive notifications.
Introduce a new API for waking up a task without triggering
frequency notification.
Change-Id: I24261af81b7dc410c7fb01eaa90920b8d66fbd2a
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
If the tasks are run on the higher capacity cluster solely due to the
reason that they can not be be fit in the lower capacity cluster, the
downmigrate threshold prevents the frequent tasks migrations between
the clusters.
Change-Id: I234a23ffd907c2476c94d5f6227dab1bb6c9bebb
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
The current CPU selection algorithm for RT tasks looks for the
least loaded CPU in all clusters. Stop the search at the lowest
possible power cluster based on "sched_restrict_cluster_spill"
sysctl tunable.
Change-Id: I34fdaefea56e0d1b7e7178d800f1bb86aa0ec01c
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
The select_best_cpu() algorithm iterates over all the clusters and
selects the most power efficient CPU that satisfies the task needs.
During the search, skip the next cluster if its minimum power cost
is higher than the power cost of an eligible CPU found in the previous
cluster.
In a b.L system, if the BIG cluster minimum power cost is higher than
the maximum power cost of the little cluster, this optimization avoids
searching the BIG cluster if an eligible CPU is found in the little
cluster.
Change-Id: I5e3755f107edb6c72180edbec2a658be931c276d
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
The frequency based inter cluster load balance restrictions are not
reliable as frequency does not provide a good estimate of the CPU's
current load. Replace them with the spill_load and spill_nr_run
based checks.
The higher capacity cluster is restricted from pulling the tasks from
the lower capacity cluster unless all of the lower capacity CPUs are
above spill. This behavior can be controlled by a sysctl tunable and
it is disabled by default (i.e. no load balance restrictions).
Change-Id: I45c09c8adcb61a8a7d4e08beadf2f97f1805fb42
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
[joonwoop@codeaurora.org: fixed merge conflicts due to omitted changes
for CONFIG_SCHED_QHMP.]
Provide userspace interface for tasks to be grouped together as
"related" threads. For example, all threads involved in updating
display buffer could be tagged as related.
Scheduler will attempt to provide special treatment for group of
related threads such as:
1) Colocation of related threads in same "preferred" cluster
2) Aggregation of demand towards determination of cluster frequency
This patch extends scheduler to provide best-effort colocation support
for a group of related threads.
Change-Id: Ic2cd769faf5da4d03a8f3cb0ada6224d0101a5f5
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
[joonwoop@codeaurora.org: fixed minor merge conflicts. removed ifdefry
for CONFIG_SCHED_QHMP.]
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Make use of clusters in the fair and rt scheduling classes. This is
needed as the freq domain mask can no longer be used to do correct
task placement. The freq domain mask was being used to demarcate
clusters.
Change-Id: I57f74147c7006f22d6760256926c10fd0bf50cbd
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
[joonwoop@codeaurora.org: fixed merge conflicts due to omitted changes
for CONFIG_SCHED_QHMP.]
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
A cluster is set of CPUs sharing some power controls and an L2 cache.
This patch buids a list of clusters at bootup which are sorted by
their max_power_cost. Many cluster-shared attributes like cur_freq,
max_freq etc are needlessly maintained in per-cpu 'struct rq' currently.
Consolidate them in a cluster structure.
Change-Id: I0567672ad5fb67d211d9336181ceb53b9f6023af
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
[joonwoop@codeaurora.org: fixed minor conflict in
arch/arm64/kernel/topology.c. fixed conflict due to ommited changes for
CONFIG_SCHED_QHMP.]
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
This snapshot is taken as of msm-3.18 commit
d5809484b (Merge "msm: ipa: fix race condition
when teardown pipe" )
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Both QUSB PHY and QMP PHY are required set of registers to configure
as part of initialization sequence. This change provides those registers'
offset and value to program with it.
Also remove android_usb device node as it usage is deprecated now.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Currently QMP PHY driver expects to have both se_clk and diff_clk
based PHY initialization sequence from devicetree. This change
removes need of both phy_clk_scheme based init sequence as on newer
platform QMP PHY only uses one of phy_clk_scheme.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This change adds phy_clk_scheme property related configuration with
QUSB PHY device node for 8996 and cobalt.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This change adds qcom,phy-clk-scheme mandatory property with QUSB
PHY driver. qcom,phy-clk-scheme property must have "cml" (i.e. DIFF
clock scheme) or "cmos" (i.e. SE clock scheme). Based on this input
qusb phy driver uses required reset and initialization sequence.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
On newer platform TCSR register based clk_scheme usage is not
available. Hence remove its usage from QUSB and QMP PHY drivers.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This change fixes below compilation warning on Kernel 4.4.
watchdog.c:122:22: warning: 'hardlockup_allcpu_dumped' \
defined but not used [-Wunused-variable]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This change fixes below compilation warnings on Kernel 4.4.
thermal_core.c:303:2: warning: format '%d' expects argument of \
type 'int', but argument 4 has type 'long int' [-Wformat=]
thermal_core.c:303:2: warning: format '%d' expects argument of \
type 'int', but argument 5 has type 'long int' [-Wformat=]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Now that we don't use SNDRV_PCM_RATE_xxx bit fields for sample rate, we need to
change the description to an array for describing the sample rates supported by
the sink/source
Change-Id: I2dc6b4e48cccbc7a3da7207be42cf11502373572
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Git-commit: b8bab04829
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: vivek mehta <mvivek@codeaurora.org>
[fred@codeaurora.org: resolved context conflict in struct snd_codec_desc]
[fred@codeaurora.org: added msm-compress-q6-v2.c to resolve compilation error]
Signed-off-by: Fred Oh <fred@codeaurora.org>
On the 4.4 kernel non platform devices now have to call
arch_setup_dma_ops to setup their dma ops otherwise the
dummy dma opts will be used.
This because of change the following change:
1dccb59 arm64: simplify dma_get_ops
Introduce a panic if a the dummy dma alloc is used to
help clients more easily identify why their dma allocations
are failing.
This patch can later be reverted once all non platform devices
have fixed their code.
Change-Id: I2dd7eb0694c8c403da21133601eb7e831ead2dfd
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Enable MHI driver for MSM8996.
Change-Id: I2161f6cedc4152bb7c48fec9868cfc7070a5d494
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable MHI runtime PM by default to enable additional
power savings.
Change-Id: I115af9e823ed685d7bf6e2ebaf18ad526256dc98
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Fix race condition in mhi_poll_inbound which could leave the
bounce buffer list and TRE list out of sync.
Change-Id: I76c7de75256b59f8a0dff2a85af733c441761385
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Read the EXEC_ENV register from device to determine the MHI
base state.
Change-Id: Id70a360cfa3775a7186e5059306385a37960df2d
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable dynamic allocation of event rings from the coherent pool
to ensure appropriate page alignment with device.
Change-Id: Id57ccd889cf96aad73f4ada01405e2d734351c8c
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Set the correct DMA mask on the platform device to
avoid bounce buffering from the default 32 bit mask.
Change-Id: I7e201e83fd21b0f0a6f57754a3b6f3eded9be58f
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Replace the MHI defined enum for return codes with
kernel standard return codes. This greatly improves readability
and parsing of errors by userspace clients.
Change-Id: Ica47f8c3a149f23243b5fb6a4aabcdc0a36b1535
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Failed M2 wakeups may represent a serious hardware problem.
The device is refusing to wake up from low power states and all
modem functionality is now stalled.
Track these wakeup attempts.
Change-Id: I3115a4416f85290c5faead0e2d9f280d8cc3b662
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable runtime PM on PCIe device to ensure sync with
PCIe framework.
Change-Id: Ied432440df0dc788642fe1a1a8d9195b6cc1cf7c
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Remove unused macros for TRE sizes. This information is
now present in device tree.
Change-Id: Id3ca59c62d66ce8913e83fcba60e1a912cf146ea
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Add mdmcalifornium to the list of supported PCIe devices
by MHI.
Change-Id: I34e846caceb8fd2808594470cccbb7e318011cda
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
In case of BHI failure, read the device BHI error registers
in the hopes of root causing the failure.
Change-Id: I0c695f7afc873d6fd5c0c9d88e9885799b228d46
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable the local bounce buffer list before the device
channel initialization sequence.
Change-Id: Ia87698dc83807727f6897356bf9b23f123c53851
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable correct allignment of MHI channels to the
ring size rounded up to the next power of two as
per device requirement.
Change-Id: Ic77c43fdbcde2ec3b6f08e3062eaf778eb13ec5b
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Resolve issue whereby UL DL properties were
being incorrectly set for non HW event rings.
CRs-Fixed: 827294
Change-Id: Ie279061e84c0f2498393c5d7bfaef404307c84da
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable logging based on MHI defconfig option. This
avoids excessive logging in secondary boot image.
Change-Id: Ie22d56d781feadb2d484e6117c9c25ee29aa5299
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable parsing of device window size from device tree
and calculating the appropriate addressing limitations.
Change-Id: I252a593a74f0cc00e6295a45d4d13db6c79cdfca
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Signed-off-by: Tony Truong <truong@codeaurora.org>
Enable clients to queue virtual buffers, thus leaving
all the DMA operations to MHI.
Change-Id: I824d2f387b1a21d322ca0628963995824227bd76
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Enable the queueing of virtual buffers to MHI instead
of buffers obtained from streaming DMA.
Change-Id: I8ba25c1f28cbd1cb302aec184864ed2e25672d4a
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Enable the queueing of virtual buffers to MHI instead
of buffers obtained from streaming DMA.
Change-Id: I3f77c7d5d9924659ce13e454646d5a65402353cc
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>