Channel migration logic assumes that the remote & local channel contexts
are always different and exist in different transports. If the remote
& local channel contexts exist in the same transport, then it leads to
a use-after-free scenario.
Fix the channel migration logic by not freeing the channel context if
the local & remote side opens in the same initial transport.
Change-Id: I319a93c49022b08e5c33b561d982a751d5223a58
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
Errata#845719 is also applicable for Kryo2xx Silver. Enable
the appropriate entry for it with rAp4 revision.
Please note that default midr_range logic depends on the
less or greather than logic with "min" and "max" range,
assuming that rX where X will be zero only. This is not
true for all the processors and since it is 4-bit field
it can be greater than the the "max" or pY bits.
We are specifying the direct match values like
0xA00004 instead here to keep the logic consistent.
CRs-Fixed: 969563
Change-Id: I16b0c2106ae649b8a23b7ebb534c967aebd72774
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Set DOMAIN_ATTR_S1_BYPASS SMMU attribute to put
stage 1 context bank in bypass, as an initial
configuration.
Stage-1 will be enabled in a later stage.
CRs-Fixed: 1001858
Change-Id: I5a320a605622fab85373d02fdbc6c206ddc514aa
Signed-off-by: Maya Erez <merez@codeaurora.org>
bonding and TC drivers (sch_multiq) are required in
8996 for fast session transfer feature.
CRs-Fixed: 1001827
Change-Id: I93facd07e46e2e2ce9e302c5a6d48ae2fb2ca9c3
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
This change disables USB QMP PHY on msmcobalt until SSUSB
functionality is validated. With this only USB high speed
functionality is supported now.
CRs-Fixed: 1001222
Change-Id: I74a00cc76ab86ee96905d270b1f6e09fb3fb9db7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Export MHI device header for user space clients.
Change-Id: I0f68975dfcad9483182e5af5477153f39a98ac1f
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
The Modem Host Interface (MHI) device driver supports
clients to send control and data packets such as
IP data packets, control messages and Diagnostic
data between the Host and the device. It follows the
MHI specification to transfer data.
The driver interfaces with the IPA driver for Hardware
accelerated channels and PCIe End point driver
to communicate between the Host and the device.
The driver exposes to both userspace and kernel space
generic IO read/write/open/close system calls and
kernel APIs to communicate and transfer data between
Host and the device.
Change-Id: I64990a972cbf7c2022d638c35f7517071de67f19
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
bitmap_scnprintf has been deprecated, so replace it with
scnprintf.
Change-Id: I8563fafc56515fde764046f882814c1c6e4c4299
Signed-off-by: Shashank Mittal <mittals@codeaurora.org>
The __GFP_CMA mask is now placed after all available GFP masks.
With this we need to increase the total number of GFP flags.
Do so accordingly.
CRs-Fixed: 648978
Change-Id: I53f5f064ac16a50ee10c84ff2bb50fdb7e085bd0
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[lmark@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Add a cma pcp list in order to increase cma memory utilization.
Increased cma memory utilization will improve overall memory
utilization because free cma pages are ignored when memory reclaim
is done with gfp mask GFP_KERNEL.
Since most memory reclaim is done by kswapd, which uses a gfp mask
of GFP_KERNEL, by increasing cma memory utilization we are therefore
ensuring that less aggressive memory reclaim takes place.
Increased cma memory utilization will improve performance,
for example it will increase app concurrency.
Change-Id: I809589a25c6abca51f1c963f118adfc78e955cf9
Signed-off-by: Liam Mark <lmark@codeaurora.org>
CMA pages are designed to be used as fallback for movable allocations
and cannot be used for non-movable allocations. If CMA pages are
utilized poorly, non-movable allocations may end up getting starved if
all regular movable pages are allocated and the only pages left are
CMA. Always using CMA pages first creates unacceptable performance
problems. As a midway alternative, use CMA pages for certain
userspace allocations. The userspace pages can be migrated or dropped
quickly which giving decent utilization.
Change-Id: I6165dda01b705309eebabc6dfa67146b7a95c174
CRs-Fixed: 452508
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Heesub Shin <heesub.shin@samsung.com
[lauraa@codeaurora.org: Missing CONFIG_CMA guards, add commit text]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[lmark@codeaurora.org: resolve conflicts relating to
MIGRATE_HIGHATOMIC and some other trivial merge conflicts]
Signed-off-by: Liam Mark <lmark@codeaurora.org>
In vmpressure notifier of LMK, shift_adj would have been set
by a previous invocation of notifier, which is not followed by
a lowmem_shrink yet. If this is follwed by a lower vmpressure,
and then by a lowmem_shrink, ALMK still triggers because of the
previous higher vmpressure notification. This is wrong.
Since vmpressure has improved, reset shift_adj to avoid false
adaptive LMK trigger.
CRs-fixed: 893699
Change-Id: I2d77103d7c8f4d8a66e4652cba78e619a7bcef9a
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Couple of cases were reported few months ago, where the cpu was blocked
on the following call stack for /seconds/ after which the watchdog fires.
test_task_flag(p = 0xE14ABF00, ?)
lowmem_shrink(?, sc = 0xD7A03C04)
shrink_slab(shrink = 0xD7A03C04, nr_pages_scanned = 0, lru_pages = 120)
try_to_free_pages(zonelist = 0xC1116440, ?, ?, ?)
__alloc_pages_nodemask(?, order = 0, ?, nodemask = 0x0)
__do_page_cache_readahead(mapping = 0xEB819364, filp = 0xCC16DC00, offset =
ra_submit(?, ?, ?)
filemap_fault(vma = 0xC105D240, vmf = 0xD7A03DC8)
There weren't any dumps to analyse the case, but this can be a possible
reason. while_each_thread is known to be buggy and can result in the
function looping forever if the task exits, even when protected with
rcu_read_lock. Use for_each_thread instead.
More details on the problems with while_each_thread can be found
at https://lkml.org/lkml/2013/12/2/320
Change-Id: I5eb6e4b463f81142a2a7824db389201357432ec7
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
The lowmem_shrink function discounts all the swap cache pages from
the file cache count. The zone aware code also discounts all file
cache pages from a certain zone. This results in some swap cache
pages being discounted twice, which can result in the low memory
killer being unnecessarily aggressive.
Fix the low memory killer to only discount the swap cache pages
once.
Change-Id: I650bbfbf0fbbabd01d82bdb3502b57ff59c3e14f
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
There were issues reported, where page cache thrashing was
observed because of LMK not killing tasks when required,
resulting in sluggishness and higher app launch latency.
LMK does not kill a task for the following reasons.
1. The free and file pages are above the LMK thresholds
2. LMK tries to pick task with an adj level corresponding
to current thresholds, but fails to do so because of the
absence of tasks in that level.
But sometimes it is better to kill a lower adj task, than thrashing.
And there are cases where the number of file pages are huge, though
we dont thrash, the reclaim process becomes time consuming, since
LMK triggers will be delayed because of higher number of file
pages. Even in such cases, when reclaim path finds it difficult
to reclaim pages, it is better to trigger lmk to free up some memory
faster.
The basic idea here is to make LMK more aggressive dynamically
when such a thrashing scenario is detected.
To detect thrashing, this patch uses vmpressure events.
The values of vmpressure upon which an action has to be taken,
was derived empirically.
This patch also adds tracepoints to validate this feature,
almk_shrink and almk_vmpressure.
Two knobs are available for the user to tune adaptive lmk
behaviour.
/sys/module/lowmemorykiller/parameters/adaptive_lmk - Write
1 to enable the feature, 0 to disable. By default disabled.
/sys/module/lowmemorykiller/parameters/vmpressure_file_min -
This parameter controls the behaviour of LMK when vmpressure
is in the range of 90-94. Adaptive lmk triggers based on number file
pages wrt vmpressure_file_min, when vmpressure is in the range of
90-94. Usually this is a pseudo minfree value, higher than the
highest configured value in minfree array.
Change-Id: I1a08160c35d3e33bdfd1d2c789c288fc07d0f0d3
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Pointer other_free is getting dereferenced without
performing proper NULL checks which may cause issue.
Do proper NULL checks at all points before dereferencing
it.
Change-Id: I88515703d64730e42598ab16136dcce4c18b099c
Signed-off-by: Susheel Khiani <skhiani@codeaurora.org>
Add extra debug information to make it easier to both determine
why the lowmemorykiller killed a process and to help find the source
of memory leaks.
Also increase the debug level for "select" statements to help prevent
flooding the log.
Change-Id: I3b6876c5ecdf192ecc271aed3f37579f66d47a08
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Currenlty most memory reclaim is done through kswapd.
Since kswapd uses a gfp mask of GFP_KERNEL, and because
the lowmemorykiller is zone aware, the lowmemorykiller will
ignore highmem most of the time.
This results in the lowmemorykiller being overly aggressive.
The fix to this issue is to allow the lowmemorykiller to
count highmem when being called by the kswapd if the lowmem
watermarks are satisfied.
Change-Id: I938644584f374763d10d429d835e74daa4854a38
Signed-off-by: Liam Mark <lmark@codeaurora.org>
The lowmemorykiller relies on NR_FILE_PAGES when measuring
the amount of reclaimable memory in the system.
However when swap is enabled swap cache pages are counted
in NR_FILE_PAGES, and swap cache pages aren't as reclaimable
in low memory as file cache pages. Therefore a large swap
cache can result in the lowmemorykiller not running and
an OOM occurring.
In order to ensure the lowmemorykiller properly evaluates the
amount of reclaimable memory don't count the swap cache pages.
Change-Id: I38239283e572f814b277c718eaf6be7f92abacbb
Signed-off-by: Liam Mark <lmark@codeaurora.org>
In certain memory configurations there can be a large number of
CMA pages which are not suitable to satisfy certain memory
requests.
This large number of unsuitable pages can cause the
lowmemorykiller to not kill any tasks because the
lowmemorykiller counts all free pages.
In order to ensure the lowmemorykiller properly evaluates the
free memory only count the free CMA pages if they are suitable
for satisfying the memory request.
Change-Id: I7f06d53e2d8cfe7439e5561fe6e5209ce73b1c90
CRs-fixed: 437016
Signed-off-by: Liam Mark <lmark@codeaurora.org>
There are cases that LMK doesn't run, even when it must run.
It is due to LMK shrinker not considering memory status per zone.
So add LMK parameters(other_free, other_file) tunnig code to
consider target zone of LMK shrinker.
Change-Id: I6f1f8660d5da920a0e3af45a160499965032081d
Git-commit: 22d990a58fc17b3f0155e15eb2dc3efa037bea1c
Git-repo: https://android.googlesource.com/kernel/common/
[ohaugan@codeaurora.org: Fix compilation issues]
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Liam Mark <lmark@codeaurora.org>
A killed task can stay in the task list long after its
memory has been returned to the system, therefore
ignore any tasks whose mm struct has been freed.
Change-Id: I76394b203b4ab2312437c839976f0ecb7b6dde4e
CRs-fixed: 450383
Signed-off-by: Liam Mark <lmark@codeaurora.org>
This change enables CONFIG_USB_CONFIGFS_F_GSI required for
USB GSI (RMNET, RNDIS and DPL) related functionality.
CRs-Fixed: 1001469
Change-Id: I91b2531a2ce739613181f2e13c692263d9e2454a
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This change adds required .h files to resolve below seen
compilation errors.
In function ‘gsi_update_function_bind_params’:
error: implicit declaration of function ‘msm_ep_config’
warning: ‘enum ipa_usb_notify_event’ declared inside parameter list
CRs-Fixed: 1001469
Change-Id: Ic62b4dae798726055beb778509e6b65e69f4db34
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
f_gsi compilation is failing with below error:
fatal error: linux/usb/usb_ctrl_qti.h: No such file or directory
Hence add missing usb_ctrl_qti.h to resolve above error while
compiling f_gsi.c file.
This file's snapshot is taken from msm-3.18 kernel as
'commit 24b986908cc1 ("power: qpnp-fg: stop IMA transactions
during FG shutdown")'.
CRs-Fixed: 1001469
Change-Id: Ib7dce6b2ae1670554a29847e4381e71ba7b75edf
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
-Pmcobalt GPIO 9 belongs to GPIO_LV subtype, so update the voltage
selection value to 0 which is the allowed selection.
-Pull up/down is not needed for pmcobalt GPIOs, so update the pull
value to PULL_NO.
Change-Id: I7b9faf485dda6f450f6df4410e3ae25efa40aad1
Signed-off-by: Sureshnaidu Laveti <lsuresh@codeaurora.org>
FastRPC migration to use GLINK from existing SMD driver for inter-
process communication. Updated FastRPC context bank details for
msmcobalt. Added "qcom,enable-glink" option in dtsi file for
using glink, uses smd if this flag is not defined.
Change-Id: I4a933c9b3355b0aa1b653719ec1ec7ded1f368dd
Acked-by: Viswanatham Paduchuri <vpaduchu@qti.qualcomm.com>
Signed-off-by: Sathish Ambley <sathishambley@codeaurora.org>
Implement the tag, swevent, and swentity message formats.
Additionally, abstract the actual scm call and error checking
into a separate shared function.
CRs-Fixed: 997749
Change-Id: Ie80846978a84a114b38d69b0bca86639bfab7e91
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Replace the previous format of a unique scm call id per function to
a buffer-based protocol.
CRs-Fixed: 997749
Change-Id: I7738b6369e095868fa6087aac94116f4767dc168
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
In case of deaggregation error in IPA, IPA HW will send
the deaggregation error frame as exception.
This change fixes a bug in this logic for large frames.
CRs-Fixed: 999351
Change-Id: I49ae94cea34dda039d03dbeeab2add2bdd1760bd
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Add smp2p entries to device tree to enable IPA driver
handshake with modem. This handshake is used to synchronize IPA clocks
vote with modem during apps or modem crash.
CRs-Fixed: 988881
Change-Id: Idc8ac5fc273d91035254c675c7cedefa9a92a5a5
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
MHI channel burst mode is used to reduce link activity by reducing the
frequency of host initiated doorbells and device initiated link accesses.
This change adds support for mhi burst mode in IPA MHI driver, according to
MHI v0.45 spec.
CRs-Fixed: 990856
Change-Id: Iae170042b70c6eaf5bc05ea2b4a1ccdb7dd6f946
Acked-by: Nadine Toledano <nadinet@codeaurora.org>
Signed-off-by: Ghanim Fodi <gfodi@codeaurora.org>
Unify IPA RM from ipa_v2 and ipa_v3 to common driver
under ipa folder
CRs-Fixed: 995821
Change-Id: I4a7d8c328af7cd5506b3fbbdc76b1bc5bb0de698
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Add a common internal header for ipa_v2 and ipa_v3.
Common definitions should go to this header.
CRs-Fixed: 995821
Change-Id: I39539cf661d9e0e0bb59236c92b169d3054485a9
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Add a library for a kernel client to register and be notified of
any state changes regarding a local or remote service which runs
on a remote processor on the SoC.
CRs-Fixed: 999530
Change-Id: Idd56140e11f4fdc48fd999a1e808f3263024f34d
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
Signed-off-by: Puja Gupta <pujag@codeaurora.org>
To support Android need to set SELINUX as default security.
CRs-Fixed: 998858
Change-Id: Id6d18a67329abe5a89b4284fc5a3d1cf6a042dc4
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Allowing RPM to handshake allows RPM to switch to sleep set vote for
resources allowing the SOC to enter a lower power state.
Change-Id: I9d835cddc85c007bcc6b918b9dc4335b82b97306
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Drivers use event timer framework to programs timers with zero wakeup
latency
Change-Id: I991dfdc22936dba667110de338d0109c58e68bd5
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Some of the common irq data is moved into a irq_common_data structure
within irq_desc structure.
Change irq_data references to irq_common_data structure to fix
compilation issues.
Change-Id: I59c99348a44d364d74af6b67ccabdd2d8c5008b0
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
MPM driver is required to configure the hardware to wakeup from SoC
sleep. It is currently not enabled for cortex targets.
Enable MPM_OF config for cortex targets.
Change-Id: I09313d7809ec939a9d0440d0ab30a5992f512b96
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
MSM_PM enables sleep modes for CPU subsystem. It is not currently
enabled for msmcortex target.
Enable MSM_PM for cortex target.
Change-Id: I67244ff55690c164634e9233e2d0cec3388c5be8
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Rename vdda18-supply as core-supply with USB QMP PHY on msm8996
and msmcobalt. Also provides required voltage value with this
core ldo for msm8996.
CRs-Fixed: 1001463
Change-Id: Ia826e361d8259126a8168c07539ba4b4f6053f65
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
On newer platform USB QMP PHY needs different voltage supply as core
voltage. This change adds required support for the same.
CRs-Fixed: 1001463
Change-Id: If100d36bade241dedf28e3cea9e07be192bdfdc2
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
USB QMP PHY requires CML based refclock, otherwise USB QMP PHY
PLL may not lock. Hence select CML based refclock by programming
SYSCLK_EN_SEL register.
CRs-Fixed: 1001463
Change-Id: I4cc68a447d0cf3571a50b18d7eec5415430f9423
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Update USB3_PHY_SW_RESET register's offset on msmcobalt otherwise
USB QMP PHY is not released out of reset.
CRs-Fixed: 1001463
Change-Id: Idc71b0abb24cf8c103dfde893ba8c40d342a7fb8
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
As long as GPMU is enabled, DCVS has to handshake with firmware.
It is a new requirement of A540 power management.
CRs-Fixed: 973565
Change-Id: Ie6480fc3ba0e1b95aab40e31b09ff2bd798ff30f
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
A3XX doesn't have support for command batch profiling. Return
EOPNOTSUPP for a command batch profiling request on A3XX, so that
userspace code knows that this feature is not supported.
CRs-Fixed: 986169
Change-Id: I6dfcab462a933ef31e3bba6bef07f17016ae50b9
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Current code incorrectly specifies buffer size as 0 for mapping
gpuobj user memory. This causes the map to fail because buffer
size is expected to be a non zero value. Fix this by passing the
correct size of the buffer to be mapped.
CRs-Fixed: 995378
Change-Id: I1a9aeb3f1dd67f014847322e5b14cba8775a82a4
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
In adreno_remove() there is possibility of dereference of gpudev
without NULL check. Fix this by getting gpudev after adreno_dev
NULL check.
CRs-Fixed: 993267
Change-Id: I17d8b4ba2c74a787a065dbdb0ac88d065605fcb1
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>