When CPU do spin lock irq save, it will disable irq/preemption.
If the same CPU do spin lock (without disabling irq),
then irq context can preempt and acuire the lock hold by user,
which will possibly hang CPU.
Avoid the issue to use spin lock irq save consistantly.
Change-Id: I52e17d189668166ae126dc5948fe51bd79ae9859
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
Signed-off-by: Jing Zhou <jzhou70@codeaurora.org>
Due to the tasklet scheduling, SOF and Epoch irq handling can be out of
order. This causes some false isp error message being reported. This change
removes the false error message due to the out of order irq handling.
This change will remove this unnecessary check.
Change-Id: I7dd7d36692f63a53e54e7afcee4d9ed32cb22bc6
Signed-off-by: Jing Zhou <jzhou70@codeaurora.org>
Do not memset the buffer queue since its already reset during free.
This also removes the requirement to reinitialize the buffer queue
lock
Change-Id: Ifccbd3fbffb822f47898cff5bfcae0e53ef7f275
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Jing Zhou <jzhou70@codeaurora.org>
Update bit mask per VFE for put_buf instead of only count. In flush buf
update put buf mask first and put buffer if put_mask is same as get_mask
Change-Id: I8b128094e4ae62e5676a46e6a4624e4933234266
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
Signed-off-by: Jing Zhou <jzhou70@codeaurora.org>
Add changes to track buffer being added to list. Add error
messages if buffer is found to be added twice. Add state checking
in the isp driver.
Change-Id: I1504e8984db3578009b8944719bbd559ad57d63d
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
Signed-off-by: Jing Zhou <jzhou70@codeaurora.org>
Add snapshot for Video driver source for MSM targets. The code is
migrated from msm-3.18 kernel at the below commit level -
d5809484bb1bf5864dad2f081b0145224762963a.
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
This module provides support to userspace entity for hotplugging
and setting cpufreq policy min/max limits. It can also detect
cpu/io workload and notify userspace via sysfs nodes.
A userspace entity can specify a CPU mask and the number of CPUs
it wants online within that mask and this module will try to make
a best effort to keep those many CPUs online. Userspace can also
specify the min and max limits on CPUs instead of writing to the
scaling_min/max nodes from sysfs so that if any CPU is offline
this module maintains a vote for it which is applied
once the CPU comes back online.
A userspace entity can also set threshold value in sysfs nodes of
this module for cpu/io workload detection and this module can notify
userspace entity when that crietia is met via sysfs nodes.
Change-Id: Ib8185b684e92e28b766f20954df0f63cdbeec1e4
Signed-off-by: Tapas Kumar Kundu <tkundu@codeaurora.org>
Detect Perf cluster peak loads near FMAX based on the trigger
thresholds set. On meeting the peak load criteria, the userspace
is notified to take action by applying parameters to enhance performance.
CRs-Fixed: 969499
Change-Id: Ie9687bf1aa832434dc61d20056f91a096d7be4f0
Signed-off-by: Vijay Ganti <viganti@codeaurora.org>
Replace obsolute cpu_up/cpu_down api with device_online/
device_offline api for cpu hotplugging
Change-Id: I808c733b0109ee6cf6183be229592d67f760d5cc
Signed-off-by: Tapas Kumar Kundu <tkundu@codeaurora.org>
If any error happens during allocating memory or initializing cluster
structure then it returns error but it does not free already
allocated memory. This may cause memory leak in certain scenerios.
This change prevents memory leak by freeing memory when error
happens during initialization.
Change-Id: I820acd676dc5baff270c2093ca24a1014c25dabb
Signed-off-by: Tapas Kumar Kundu <tkundu@codeaurora.org>
cpufreq governor tunables could be updated
only when cpu is online. Userspace might need
to apply and restore these tunables depending
on the power/perf need.
Provide sysfs node for userspace to poll over
and which gets notified on CPU_ONLINE and CPU_DEAD
events for any cpu. This mechanism could be
utilized to know when cpus come online
and then restoring or applying cpufreq governor
tunables. CPU_DEAD notification is also provided
for completeness.
Change-Id: I221a97c49a72da217e5e4b46a16a26042ef5c83f
Signed-off-by: Omprakash Dhyade <odhyade@codeaurora.org>
Add support for enter/exit cycle sysfs nodes for io detection
There are some usecases which may benefit from different enter/exit
cycle load criteria for IO load. This change adds support for
that.
Change-Id: Iff135ed11b92becc374ace4578e0efc212d2b731
Signed-off-by: Tapas Kumar Kundu <tkundu@codeaurora.org>
Add support for multi_enter_cycles/multi_exit_cycles per cluster
There are some usecases which may benefit from different enter/exit
cycle load criteria for multimode cpu load. This change adds support for
that.
Change-Id: I3408405307ca03b9bba3f03e216ef59b98f29832
Signed-off-by: Tapas Kumar Kundu <tkundu@codeaurora.org>
Certain governors may stop sending out notifications once CPUs enter
idle at min frequency.If governor's notifications stop then single mode
will not exit for long time. It can happen only if the exit conditions are
set in such a way that the time taken to exit single mode exceeds the time
for the governor to ramp down, idle out and hence stop sending
notifications leaving the system in single mode indefinitely.
This change adds separate enter/exit cycle sysfs nodes along with a per
cluster non-deferrable timer for single mode exit. The timer is armed only
when the load starts falling below the exit load threshold and is
cancelled when either the load starts going up or SINGLE mode is exited
due to exceeding exit cycle count. On expiry the timer resets SINGLE mode
and the enter/exit cycle counts.
Change-Id: I13552b2f4085c435b917833a2993f8c64ff4ed2f
Signed-off-by: Tapas Kumar Kundu <tkundu@codeaurora.org>
If msm_performance module and some other module with the
core hotplug capability (like core_ctl) co-exist and
both of them try to hotplug the cores system inconsistencies
can occur. To avoid such behavior sysfs nodes needed for hotplug
support in msm_performance module are compiled out.
Change-Id: I25e8404ce0581e718d6b55cd0e1f5c7da8e92db5
Signed-off-by: Prachee Ramsinghani <pracheer@codeaurora.org>
Detect single and multi threaded heavy workloads based on loads
received from interactive governor.
- If the max load across all the CPUs is greater than a
user-specified threshold for certain number of governor windows
then the load is detected as a single-threaded workload.
- If the total load across all the CPUs is greater than a
user-specified threshold for certain number of governor windows
then the load is detected as a multi-threaded workload.
If one of these is detected then a notification is sent to the
userspace so that an entity can read the nodes exposed to get an
idea of the nature of workload running.
Change-Id: Iba75d26fb3981886b3a8460d5f8999a632bbb73a
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Some workloads spend a lot of time in IO activity and need higher
performance from system resources (for eg. CPU/DDR frequencies)to
complete with decent performance. Unfortunately cpufreq governors and
other system resources crucial for IO are tuned for general usecases
and hence might be slower to react to such demanding IO workloads.
This patch adds functionality to detect IO workloads and then send
hints to userspace of the detected activity so that userspace can
take necessary tuning action to prepare the system for such activity.
IO activity is tracked every interactive governor timer boundary and
if the percentage of iowait time in each cycle exceeds certain
threshold continuously for certain number of cycles then heavy IO
activity is detected.
Change-Id: I73859517cb436e50340ef14739183e61fc62f90f
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
The structure cpu_hp responsible for keeping stats related to CPU
hotplug operations is basically doing so for each cluster. Renaming
it as 'cluster' in this patch so that it can be used to store any
cluster-specific stats in future modifications to the code.
Change-Id: I8ae34c883b932631341379baaa6c39e144c5c86f
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
msm_performance relies on userspace to initialize cluster related
variables such as num_clusters, managed_cpus etc. Once num_clusters
is set the cluster related data structures are initialized and
userspace is allowed to set them.
However there could be a race where between num_clusters being set
and the cluster data structures being allocated, there is a hotplug
activity which would invoke the hotplug callback which in turn tries
to access managed_cpus. managed_cpus might not have been allocated by
that time resulting in a NULL pointer access in the callback causing
kernel panic.
Change-Id: Ia40af624322a89e0c0f9598bf7eea059e6969ebe
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
While getting input for min and max freq from userspace,
checking against just the number of present CPUs can
cause an access to an invalid CPU id if the userspace
input is not properly constructed for a particular
target.
This change prevents that from happening by
checking against num_present_cpus() - 1 so that
invalid CPU ids are not considered while accepting
input from userspace.
Change-Id: I9e52a175ff8ea9448a0676695a63ffddfa12419e
Signed-off-by: Pracheer <pracheer@codeaurora.org>
Fix the upper limit on the number of cores to be offlined
in try_hotplug function.
Change-Id: I8bcfddac16727b907f40bd319cf4128d49937293
Signed-off-by: Pracheer <pracheer@codeaurora.org>
Some CPUs might have higher operating power costs than others.
While honoring hotplug requests, offline cores with higher power
costs than others within a cluster.
Fallback to the conventional way of offlining CPUs if the power
costs for CPUs are unavaialable.
Change-Id: Ia970bbe751ef5ffbc716ab5d8a7069ee373d8846
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
As per the current code, if any other entity decides to offline a
CPU and the module disallows it from coming up to meet the current
request, when cluster control is released the CPU in question might
be left offline since the module only plugs back in cores which it
itself offlined. Hence it is crucial to maintain a correct status of
offlined cores to be brought back up online on control release request.
This change identifies the CPU that module prevents from being onlined
so that it is restored back when cluster control is released.
Change-Id: I87831eca879d1cf7d33f88a881e0427641e39bd6
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Adding support to manage multiple clusters at a time in
msm_performance driver. The number of clusters and the respective
masks are initialized once from userspace and then the max_cpus
tunable can be used to manage the CPUs to be put online in the
cluster thereafter.
Change-Id: I35a80af37e1ecedbc53670edd65698170fe349e1
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Userspace might need to set scaling_min/scaling_max for different
usecases based on perf/power requirement.
Currently available userspace nodes exposed by cpufreq framework
might not be appropriate in situations where userspace wants to
revert back its vote and the CPU in question is offline. Add support
to msm_performance module to set min/max limits on cpufreq for
different CPUs such that the module maintains the userspace vote
across hotplugs and applies it whenever CPU policy gets updated
(after it comes online).
Change-Id: I1fab2a8b63d4ba13465ecd36adecddcb7c63b43a
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Sometimes for power saving reasons we might want to keep fewer CPUs
online without adversely affecting performance for certain real world
usecases. This module helps to provide that hotplug support to the
userspace such that it tries to make a best effort in keeping a certain
number of CPUs online as specified by the userspace.
It allows any userspace entity to specify the CPUs that it wants to
manage with this module and of those, the number of CPUs that should be
kept online.
Change-Id: I82c6d6e998d3740ad6f8c67b47344ce87f328b8b
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
The change to refactor kernel/setup.c to use the common
of_flat_dt_get_machine_name() API has apparently removed
the line which prints the device tree model string during
boot. Having the model string in the kernel log is helpful,
so add it back in. This change was already merged in past
but possibly got overridden during upmerge. Add it back.
While at it, add back print for the processor name and
its rev id as well.
Change-Id: I7dccc3ab00f5b67753cdd256846a522596c5058f
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
[satyap: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Add support for apq8096 Liquid devices, using msm8996pro Liquid data
as a starting point.
Change-Id: I0597d9dbdd7fc1d2e6f4492e90e6fcfd2e80c3fd
Signed-off-by: Sanrio Alvares <salvares@codeaurora.org>
Add config support to disable the network skb fragment cache.
Enabling this option ensures that when allocating skbs the network
skb fragment cache will not be used.
Disabling use of the fragment cache can be useful on some low end
targets because it reduces memory pressure.
Change-Id: If3be82741a51d9275e41ca2eca99db3d1a4b2fcb
Signed-off-by: Liam Mark <lmark@codeaurora.org>
[satyap: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
If we detect that there is nothing to do just set the flag and do not
check if it was already set before. Races really do not matter. If the
flag is set by any code then the shepherd will start dealing with the
situation and reenable the vmstat workers when necessary again.
Since commit 0eb77e988032 ("vmstat: make vmstat_updater deferrable again
and shut down on idle") quiet_vmstat might update cpu_stat_off and mark
a particular cpu to be handled by vmstat_shepherd. This might trigger a
VM_BUG_ON in vmstat_update because the work item might have been
sleeping during the idle period and see the cpu_stat_off updated after
the wake up. The VM_BUG_ON is therefore misleading and no more
appropriate. Moreover it doesn't really suite any protection from real
bugs because vmstat_shepherd will simply reschedule the vmstat_work
anytime it sees a particular cpu set or vmstat_update would do the same
from the worker context directly. Even when the two would race the
result wouldn't be incorrect as the counters update is fully idempotent.
Change-Id: I4b46e471024ff4cac2b32234dffb3dfcf91713b6
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: 587198ba5206cdf0d30855f7361af950a4172cd6
[shashim@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
Currently the vmstat updater is not deferrable as a result of commit
ba4877b9ca ("vmstat: do not use deferrable delayed work for
vmstat_update"). This in turn can cause multiple interruptions of the
applications because the vmstat updater may run at
Make vmstate_update deferrable again and provide a function that folds
the differentials when the processor is going to idle mode thus
addressing the issue of the above commit in a clean way.
Note that the shepherd thread will continue scanning the differentials
from another processor and will reenable the vmstat workers if it
detects any changes.
Change-Id: Idf256cfacb40b4dc8dbb6795cf06b34e8fec7a06
Fixes: ba4877b9ca ("vmstat: do not use deferrable delayed work for vmstat_update")
Signed-off-by: Christoph Lameter <cl@linux.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: 0eb77e9880321915322d42913c3b53241739c8aa
[shashim@codeaurora.org: resolve minor merge conflicts]
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
[satyap: resolve trivial merge conflicts]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Add support for parsing the explicit topology bindings to discover the
topology of the system.
Change-Id: I7f8a62d243fe1452408ab696ea2714aaa5b929eb
Signed-off-by: Venkatesh Yadav Abbarapu <vabbar@codeaurora.org>
[satyap: resolve trivial merge conflicts]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
testDevMemSane & testDevkmemSane test cases are introduced
in latest Android-6.0 version of CTS. These testcases expect
mem and kmem nodes should not be present in /dev.
So disable DEVMEM and DEVKMEM flags in msm*_defconfig files.
Change-Id: I607e59f6fcb4a6d0d76ffb7e9a42adf8f79e76f1
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
[satyap: trivial merge conflict resolution & updated commit text
to reflect the changes]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
The cpu_up/down calls do not update userspace cpu
online information accurately. Use the device_on/offline
API to correct this.
Change-Id: I97ab55f4f917bd9cbb31dd89785eecdbe4d2f9ca
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
[satyap: merge conflict resolution and move changes in
arch/arm64/kernel/perf_event.c to drivers/perf/arm_pmu.c
to align with kernel 4.4]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
The sleep time for suspend is accounted as a part of suspend_prepare and
suspend wake call backs. Moreover the timekeeping framework is suspended
before suspend_enter calls, which causes a warning when called from within
the suspend_enter function.
Remove ktime_get() calls from within the lpm_suspend_enter() callbacks.
Change-Id: Ifff59b5caa387c603719d42a22559da6e97fdd9e
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
In cases where client driver would call the API lpm_get_latency before the
lpm_root_node is initialized, would result in a NULL pointer exception. Fix
the same by moving the node check before.
CRs-Fixed: 973895
Change-Id: Ib2c7257bb7289f68d2bcb621ad311ceefe88a5f3
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Add API to get latency for a low power mode with particular
affinity level and reset level. Reset level is level at which
only control logic power collpase happen or both control and
memory logic power collapse happen or Retention state.
The API returns the minum latency out of all clusters in the
particular affinity level and reset level if cluster name is
not passed or the latency of the specific cluster for which
the cluster name is passed.
Change-Id: I2facd9a1fa2dba7e7103d65544537799bd8ba518
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
Conflicts:
arch/arm/boot/dts/qcom/mdm9607-pm.dtsi
arch/arm/boot/dts/qcom/mdm9640-pm.dtsi
arch/arm/boot/dts/qcom/mdmcalifornium-pm.dtsi
arch/arm/boot/dts/qcom/msm8909-pm8909-pm.dtsi
arch/arm/boot/dts/qcom/msm8909-pm8916-pm.dtsi
arch/arm/boot/dts/qcom/msm8937-pm.dtsi
arch/arm/boot/dts/qcom/msm8952-pm.dtsi
arch/arm/boot/dts/qcom/msmgold-pm.dtsi
arch/arm/boot/dts/qcom/msmtitanium-pm.dtsi
Stats for cpu and cluster exit path query the ktime for every level and
this increases the overall idle exit latency. Get the timestamp only
once and use the same information to populate into different level.
Change-Id: Iece36015910fcb16bd04a25dae1bf0396ab463e2
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Conflicts:
drivers/cpuidle/lpm-levels.c
drivers/power/qcom/lpm-stats.c
Currently framework uses menu as governor and the mode selection happens
again in lpm driver. Register QCOM cpuidle governor, use the mode
selected for cpu to enter and further select the mode for the cluster to
enter.
Change-Id: Ifa98c4c90859f70fb5406715b53c89276ac1a4f4
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Conflicts:
drivers/cpuidle/lpm-levels.c
In 4.4 kernel, regulator_set_optimum_mode() is replaced by
regulator_set_load(). Hence update it accordingly for CNSS
driver in 4.4 kernel to avoid compilation issue.
Signed-off-by: Yue Ma <yuem@codeaurora.org>
Calling usb_remove_hcd() on both of the xHCI HCDs may race with
hub_event() which executes on its own workqueue. When xhci_halt()
is called and stops the command ring, the hub thread may have
already issued a command such as xhci_configure_endpoint() and
is currently waiting for the command to complete while holding
the device lock. Meanwhile since the controller is already halted,
no events are expected to complete and the command timer will
continually timeout every 5 seconds and re-arm itself. Since the
completion for the command is never issued, the threads are
essentially deadlocked.
Avoid this situation when halting the controller by forcing the
command queue to be cleaned up.
Change-Id: I88150e3435b5f06e37e9881dddaeff4807c24cc9
Signed-off-by: Jack Pham <jackp@codeaurora.org>
ADB function is mainly used for debugging, hence it is
not expected to allow USB LPM followed by system suspend
in device bus suspend. Driver also doesn't handle
usb_ep_dequeue failure in LPM when adbd is interrupted
by signal as buffer is left queued to the hardware after
usb_ep_dequeue failure and can cause memory corruption.
Change-Id: Ib89c80318dcdd0dbb35d122a2ab77fb61f83518e
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Whenever data is transmitted from device to Host PC, MTP daemon sitting
in userspace writes to mtp driver through ioctl, which eventually
calls send_file_work to send data. Currently header length is not updated
properly to reflect correct length in case data file size is greater
than 4GB. Due to this, Host PC throws error when file of size > 4GB is
copied from device to Host PC. Hence fix the issue by updating header
length to (2 ^ 32 - 1) if length is greater than 4GB.
CRs-Fixed: 953737
Change-Id: I3840afb63f365c28bf3638b13b728800bc2419f4
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>