Commit Graph

120 Commits

Author SHA1 Message Date
Tao Zeng 042faaa89a zram: change zstd and mix implementation [1/1]
PD#SWPL-145324

Problem:
1, using contiguous conter for type identify is not uniform distribution
when compress for some tasks;
2, zram driver will alloc per-cpu contex for zstd, which will cause
about 3MB memory;

Solution:
1, using a fixed type array for uniform distribution of mix type
selection;
2, create 2 context: one dedicated for kswapd task; another one
dedicated for direct reclaim;

Verify:
t5m

Change-Id: I06683383e06d9601c9e6522bcd0fbcfa68a55987
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
2023-11-27 19:02:19 +08:00
Jianxiong Pan ed7c9dccef mm: cma optimite for alloc too long. [1/1]
PD#SWPL-145324

Problem:
cma alloc too slow.

Solution:
let the idle cpu allocate more.
reduce drain lru in cma task.

Verify:
local.

Change-Id: I5f46112dcc4d5eb8fe7b21526d09a4078edc2752
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-11-27 19:01:35 +08:00
Tao Zeng 705a515c08 zram: fix crash when cpu off line [1/1]
PD#SWPL-145324

Problem:
kernel NULL pointer panic when cpu off line

Solution:
The root cause is that context for zram is configured as 2 part:
one for direct reclaim and one for kswapd. They are not for per-cpu
but when a core is off, zram will free per-cpu context so caused panic
on other cpus. So we should remove free code for crypto hooks.

Verify:
T5M

Change-Id: I2e4c9362bda0ddf74c91c3dec55d39dd532f46c2
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
2023-11-27 19:01:05 +08:00
Tao Zeng 12ef9a846e zram: add a mixed zram compressor [1/1]
PD#SWPL-145324

Problem:
zstd is high compress ratio but low speed, lz4 is fast but low
compress ratio. Need balance them.

Solution:
Add a mixed crypto layer and can set ratio of lz4/zstd

Verify:
t5m

Change-Id: I4fbe930d05ef66336acacaae640fa47855d4b47b
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
2023-11-27 18:59:13 +08:00
Hanjie Lin b3b291de52 cma: delayed enable cma after kswap low [1/1]
PD#SWPL-139378

Problem:
playback not smooth when startup

Solution:
CMA used up when startup and cause cma alloc slow
delay enable CMA until swap free ratio less than 70%

Verify:
sc2

Change-Id: I42ddcaa281cae1c13128d028dbcf1128bede43b6
Signed-off-by: Hanjie Lin <hanjie.lin@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
2023-11-15 19:43:31 +08:00
Jianxiong Pan e3db5369be mm: reduce the print log in momeory module. [1/1]
PD#SWPL-141371

Problem:
optimize memory log.

Solution:
reduce the print log.

Verify:
local.

Change-Id: Id5b9a9240bc94d49f6d311a1f4084ffdf0a5a13a
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-11-06 17:32:53 +08:00
Hanjie Lin cd2489b429 mm: compaction_alloc don't alloc CMA pages [1/1]
PD#SWPL-141879

Problem:
compaction_alloc don't alloc CMA pages

Solution:
free_pfn skip CMA pages

Verify:
sc2

Change-Id: I3d32d72c342a1c6438822475bf560f9ab329ec57
Signed-off-by: Hanjie Lin <hanjie.lin@amlogic.com>
2023-11-06 14:46:13 +08:00
Jianxiong Pan 1231a9c7f9 mm: set cma_debug failure. [1/1]
PD#SWPL-121825

Problem:
echo 5 > /proc/cma_debug often failure.

Solution:
rebuild code.

Verify:
ohm.

Change-Id: Ie6a2fcd3c7b498d9877ef009d907c7d75c62d874
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-10-17 18:53:33 +08:00
Jianxiong Pan 9be95d2c09 mm: dmc not get pagetrace correct. [1/1]
PD#SWPL-140760

Problem:
dmc get wrong pagetrace information.

Solution:
Retrieve the value of module base.

Verify:
ohm.

Change-Id: Ia58bdc613d7974d1d7ade05fa7d4cefbd1287d59
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-10-09 20:06:39 +08:00
Jianxiong Pan cbb106f02b mm: remove kprobe for cma_alloc in pagetrace. [1/1]
PD#SWPL-137693

Problem:
not need the page trace kprobe.

Solution:
remove kprobe for cma_alloc in pagetrace.

Verify:
local.

Change-Id: I4e787c0b0778d7b76930a209a1f597002d9127e0
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-10-07 17:38:10 +08:00
qiankun.wang 44cc0c3c71 user fault: fix show_user_fault atomic sleep. [1/1]
PD#SWPL-140252

Problem:
The system will sleep in atomic,because 'show_user_data'
calls '__get_user' which calls 'might_sleep'.

Solution:
We use '__copy_from_user_inatomic' rather than
'__get_user'.

Verify:
T3x

Change-Id: I33368dcf371e528ea75b5f3e625c93109bf12907
Signed-off-by: qiankun.wang <qiankun.wang@amlogic.com>
2023-09-25 21:36:57 +08:00
song.han e2ab106c2c iotrace: record module base on last start [1/1]
PD#SWPL-136207

Problem:
use kprobe to forbid free module init text

Solution:
record module base and use offset to parse
this module symbol

Verify:
SC2_AH212

Change-Id: I43bd306e94e9a6a5afe6411a9cd9e93db0342b7a
Signed-off-by: song.han <song.han@amlogic.com>
2023-09-19 20:09:48 +08:00
Jianxiong Pan b03950657b mm: compaction page is not allowed to enter cma. [1/1]
PD#SWPL-138083

Problem:
cma alloc too long.

Solution:
compaction page in cma can not be migrated.

Verify:
adt4.

Change-Id: Ib26711f4530426cb0cec5699d3deeaf7626354b6
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-09-14 21:17:29 +08:00
Jianxiong Pan b6b293bc88 mm: add page owner for isolate page failure. [1/1]
PD#SWPL-138083

Problem:
add debug info for isolate page failure.

Solution:
add page owner in cma debug.

Verify:
ohm.

Change-Id: Ie6bcdf0afcfb884a12c228205b81017e77b6aa1f
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-09-14 13:30:03 +08:00
Dezhen Wang 1bfff1f439 coverity: fix [1/1]
PD#SWPL-136722

Problem:
coverity errors

Solution:
fix the coverity errors

Verify:
local

Change-Id: I5b210b5c44ee6a0e34c1c8b9685fe2d38cd52b1b
Signed-off-by: Dezhen Wang <dezhen.wang@amlogic.com>
2023-09-13 20:37:08 +08:00
Jianxiong Pan 988b1630cd vmap: fix __get_free_pages argument error [1/1]
PD#SWPL-101523

Problem:
The input parameter of the function "__get_free_pages"
in the function "aml_stack_alloc" is incorrect, the function
is in drivers\amlogic\memory_ext\vmap_stack.c

Solution:
fix input parameters

Verify:
TM2

Change-Id: I698ca5dc0beae707bbd50bcfad647cd9c8442d6d
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-09-13 16:23:22 +08:00
Tao Zeng c432ed2742 mm: fix compound page header problem [2/2]
PD#SWPL-131211

Problem:
kernel crash in check_page_to_cma

Solution:
The problem is that page_mapping function returns a invalid mapping
pointer, when a compound page is building while a compaction is doing
at same time, there will have a risk of compound page status checking.
page->mapping is set to TAIL_MAPPING first then set compound header.
But check_page_to_cma don't check real status of page, which caused
panic

Verify:
local

Change-Id: Id44ac3d43d1385148e0527b0ba4d3421c68d825e
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
2023-09-13 16:22:33 +08:00
Jianxiong Pan 0653747af8 mm: reset getblk_gfp flags. [1/1]
PD#SWPL-131448

Problem:
__getblk_gfp func get memory from cma can not migrate.

Solution:
not allow the __getblk_gfp get memory from cma pool.

Verify:
ohm.

Change-Id: If30d1eb2bef647368495965cf316debce5b05c54
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-09-13 16:21:32 +08:00
Jianxiong Pan 82268a4b2d mm: not alloc page in atomic context. [1/1]
PD#SWPL-112188

Problem:
BUG: scheduling while atomic.

Solution:
avoid alloc page in atomic context.

Verify:
local.

Change-Id: Ia6876af7c4f0dab7f1c9661f649c8fa94944773d
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-09-13 15:10:52 +08:00
Jianxiong Pan cd32f229c2 mm: not get page trace in dmc. [1/1]
PD#SWPL-137426

Problem:
print 0x0 in dmc monitor.

Solution:
update the pagetrace in cma alloc.

Verify:
local.

Change-Id: I417cb523bb7f7b82a08db43cb51503782cd34896
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-09-13 15:06:04 +08:00
qinglin.li 9d3b531cb4 break_gki: adjust break gki config [2/2]
PD#SWPL-137861

Problem:
adjust break gki config

Solution:
CONFIG_AMLOGIC_BREAK_GKI_20 only break gki2.0
CONFIG_AMLOGIC_BREAK_GKI break gki 1.0 and 2.0

Verify:
local

Change-Id: Ic86c771027980aa24c638d5f89c014240d65ec91
Signed-off-by: qinglin.li <qinglin.li@amlogic.com>
2023-09-05 20:43:25 +08:00
weitao.qiao dbb8a401de Revert "mm: cma alloc for common14-5.15. [1/1]"
PD#SWPL-137318

Problem:
system crash.

This reverts commit 6077ae3862.

Change-Id: I521e8ddd6c3294f07fe380cba848cae4893c5e16
Signed-off-by: weitao.qiao <weitao.qiao@amlogic.com>
2023-08-21 20:10:29 -07:00
Jianxiong Pan 6077ae3862 mm: cma alloc for common14-5.15. [1/1]
PD#SWPL-131448

Problem:
cma alloc time too long.
cma_alloc() is different between T and U.

Solution:
use the common14-5.15 cma api.
add more debug information.

Verify:
ohm.

Change-Id: Iead77f878fcb77854667ba117c57025afc5de0a4
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-08-18 01:53:38 -07:00
qiankun.wang e1d5f7dc52 secmon: filter out secure monitor region [1/1]
PD#SWPL-135009

Problem:
The function 'within_secmon_region' can
not filter out secure monitor region.

Solution:
'within_secmon_region' will get the
'secmon_start_virt' from the dts,and filter
out secure monitor region.

Verify:
SC2

Change-Id: Ie434e66d2b7ca6f269c7f8c0e06e1f53807b8a24
Signed-off-by: qiankun.wang <qiankun.wang@amlogic.com>
2023-08-10 06:19:31 -07:00
qiankun.wang f5412875b9 secmon: modify the wrong config [2/2]
PD#SWPL-135009

Problem:
The config 'CONFIG_AMLOGIC_SEC' has been
converted to CONFIG_AMLOGIC_SECMON.

Solution:
delete the config 'CONFIG_AMLOGIC_SEC',and
add the config 'CONFIG_AMLOGIC_SECMON'.

Verify:
SC2

Change-Id: I664ce36b86af24ff3e92adcf31f6149ecf381dcb
Signed-off-by: qiankun.wang <qiankun.wang@amlogic.com>
2023-08-09 04:29:35 -07:00
Jianxiong Pan e49f1f08c5 mm: set aml smmu driver to ko. [1/1]
PD#SWPL-112188

Problem:
aml smmu need to meet requirement of gki2.0.

Solution:
try to set aml smmu driver to ko.

Verify:
build failed.

Change-Id: I8a6a1fc2312aaa82f68f7e97cc05be731d03ac49
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-08-08 08:09:01 -07:00
Jianxiong Pan 62861cb101 mm: print pagetrace info in aml cma ko. [1/1]
PD#SWPL-112188

Problem:
need to trace buffer info in cma ko.

Solution:
print pagetrace info in aml cma ko.

Verify:
local

Change-Id: I288c78ffb0bb7b10cf149f149324ef0b8b236528
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-08-07 06:18:38 -07:00
Jianxiong Pan ec8fd57021 mm: asynchronous initialization of user fault. [1/1]
PD#SWPL-112188

Problem:
it takes a long time to find symbols.

Solution:
asynchronous initialization of user fault.

Verify:
t5w.

Change-Id: If0327b8285ec722bd84a5dbc7e97419b5752120f
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-08-07 04:18:42 -07:00
Jianxiong Pan a7057062fb mm: asynchronous initialization the aml cma ko. [1/1]
PD#SWPL-112188

Problem:
insmod the aml_cma.ko causes too long startup time.

Solution:
asynchronous initialization of aml_cma.

Verify:
ohm.

Change-Id: Ibd0d72cd85755783a9b25867baa7d86c9f272f35
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-08-03 06:08:39 -07:00
Jianxiong Pan 0a8eb767de mm: asynchronous initialization of pagetrace. [1/1]
PD#SWPL-124891

Problem:
pagetrace causes long startup time.

Solution:
asynchronous initialization of pagetrace.

Verify:
local.

Change-Id: I94380214c9b8c499a2594e728ed260dd1273ef8d
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-08-03 06:08:34 -07:00
Jianxiong Pan 4383f8b9c1 mm: fix build error when enable CONFIG_FUNCTION_GRAPH_TRACER. [1/1]
PD#SWPL-112188

Problem:
build error enable CONFIG_FUNCTION_GRAPH_TRACER.

Solution:
resolve the conflict.

Verify:
local.

Change-Id: Ic9aa616eada1d41bc9ad915ec5926828f2586e62
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-08-01 04:28:44 -07:00
Jianxiong Pan 80695386da user fault: fix arm64_show_signal kprobe fail. [1/1]
PD#SWPL-112188

Problem:
compiler optimization, resulting in unable to kprobe

Solution:
not kprobe the arm64_show_signal func.

Verify:
t215.

Change-Id: I2aac9ff78db34739050d5acba53bb5b7287d5ff0
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-07-26 02:09:41 -07:00
Jianxiong Pan dbd033d9d2 user fault: reduce invalid printing. [1/1]
PD#SWPL-112188

Problem:
too much invalid printing.

Solution:
reduce invalid printing.

Verify:
local.

Change-Id: I9ece325044275b6ba8ae62110db02e8ceb09ded3
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-07-22 20:57:05 -07:00
Jianxiong Pan f2bee04a0a mm: mem debug modularity. [1/1]
PD#SWPL-112188

Problem:
gki2.0 support.

Solution:
mem debug modularity.

Verify:
adt4.

Change-Id: I91b9352a60c8afcd78bb4ff4ec95e8629ed27212
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-07-17 22:56:16 -07:00
Jianxiong Pan e5da787cbd mm: user fault modularity for arm64. [1/1]
PD#SWPL-112188

Problem:
gki2.0 support.

Solution:
user fault modularity.

Verify:
adt4.

Change-Id: Ied1bddbf25f0341659ba2231c07e8df20906749c
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-07-17 07:13:05 -07:00
Jianxiong Pan a841efa789 mm: reduce the cma print information. [1/1]
PD#SWPL-128464

Problem:
cma alloc prints too many information.

Solution:
reduce cma print information.

Verify:
local.

Change-Id: I9e888aea9a80ede462333dc9d5029c4930e8d72c
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-07-12 23:10:17 -07:00
song.han 74709af2be kasan: enable kasan on arm32 [2/2]
PD#SWPL-128513

Problem:
enable kasan on arm32 will crash

Solution:
disable AMLOGIC_VMAP when kasan enabled
increase modules region form 16M to 32M

Verify:
TXHD2

Change-Id: Icdf82669750bec436756fbd6cd670eabedaf0096
Signed-off-by: song.han <song.han@amlogic.com>
2023-06-25 03:33:13 -07:00
Jianxiong Pan c0bb9c0310 mm: clear tvp secure memory use kprobe. [1/1]
PD#SWPL-128566

Problem:
tvp vendor hook not meet gki2.0

Solution:
use kprobe to get symbol.

Verify:
local.

Change-Id: I26160ebfa86ab98969bfd29d6cc0afa264b0270f
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-06-21 01:09:27 -07:00
Jianxiong Pan eb89e630a5 mm: custom cma allocation and release function. [1/1]
PD#SWPL-118431

Problem:
to meet gki requirements.

Solution:
allocating memory in multiple threads.

Verify:
t7c.

Change-Id: I2d92bf1caf202a2da170f317eddcb74058d97ed1
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-06-19 05:13:48 -07:00
Lei Zhang 4eac904433 debug: optimize log print [1/1]
PD#SWPL-125874

Problem:
log print deranged when use pr_cont

Solution:
optimize log print

Verify:
on SC2

Change-Id: If71749e1cb88dd19836869b84d86327b86ef0b17
Signed-off-by: Lei Zhang <lei.zhang@amlogic.com>
2023-06-14 18:21:04 -07:00
Jianxiong Pan 02b056568a mm: dump pagetrace when oom. [1/1]
PD#SWPL-124872

Problem:
show pagetrace when oom.

Solution:
show pagetrace when oom.

Verify:
local.

Change-Id: If068d2cbffa5969d2e62aadbb57e32bc1b28d415
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-06-13 01:59:26 -07:00
Jianxiong Pan 0ae39db470 mm: enable page trace for gki2.0. [1/1]
PD#SWPL-118782

Problem:
pagetrace not enable for gki2.0

Solution:
remove dependencies.

Verify:
adt4.

Change-Id: I7ea233bc7d29ece259805e43d550bffefd562464
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-04-27 21:24:27 -07:00
xinli.gao 70482b1592 gpu: remove fixed-area [1/1]
PD#SWPL-120307

Problem:
GPU no longer uses fixed-area

Solution:
Remove fixed-ared

Verify:
t5m

Change-Id: If7634558ebf89078dc2d1eb9256f382227a2f7f5
Signed-off-by: xinli.gao <xinli.gao@amlogic.com>
2023-04-19 22:11:36 -07:00
Jianxiong Pan 08a4e70bcf mm: add support pagetrace modularization. [1/1]
PD#SWPL-112188

Problem:
pagetrace not meet gki requirement.

Solution:
add support pagetrace modularization.

Verify:
t5m_ay301.

Change-Id: If13e80713bed25b192c3a6138ed6c6d26d6939a9
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-04-13 00:50:34 -07:00
Jianxiong Pan 3bd8a59542 zapper: defconfig optimization. [2/2]
PD#SWPL-116862

Problem:
optimizate kernel image.

Solution:
disable some defconfigs.

Verify:
t215.

Change-Id: I074710febef0a9e97ea01c1426b8328cc2e83582
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-04-12 15:05:21 -07:00
qiankun.wang 9f67545e23 panic: don't dump the problematic register data [1/1]
PD#SWPL-117678

Problem:
when dump call stack information,some problematic
registers data can cause synchronization error.

Solution:
add a judgment to filter out register information.

Verify:
SC2

Change-Id: I805b3d25b5e753cd8d9f25a724e06be942882c9f
Signed-off-by: qiankun.wang <qiankun.wang@amlogic.com>
2023-04-10 23:04:19 -07:00
Jianxiong Pan 84069bf36e mm: fix the filecache not work when dis MEMCG. [1/1]
PD#SWPL-112186

Problem:
cat /proc/filecache not work.

Solution:
change the vendor hook to pass data.

Verify:
s4_ap222.

Change-Id: I6233927a0649f1ad16710ab9370bb7507832ef80
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-03-23 05:12:29 -07:00
Jianxiong Pan 02b9290a75 dmc: change vendor hook to get pagetrace buffer. [1/1]
PD#SWPL-112306

Problem:
android u remove the rmqueue vendor hook.

Solution:
use cma_drain_all_pages_bypass instead.

Verify:
t5m_ay301.

Change-Id: I8f1c1634e9c72d15e9a1f7aac937b5fcc66f00be
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-03-16 21:03:42 -07:00
Jianxiong Pan 9c2b1ee161 mm: enable pagetrace for version U. [1/1]
PD#SWPL-112188

Problem:
not find the unwind_frame() in arm64.

Solution:
replace the unwind_frame() with unwind_next() .

Verify:
t7c.

Change-Id: I1c62c29d68174333198965ff385ba3022170fa28
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-03-16 04:14:43 -07:00
qiankun.wang 23002feac1 mem_debug: The printk is missing some content [1/1]
PD#SWPL-113705

Problem:
In the boot log, characters are missing when printing
due to long strings

Solution:
Print the string in some parts.

Verify:
SC2

Change-Id: I2989ac089598d3f2b97eaa98fcf923ff4c7963c8
Signed-off-by: qiankun.wang <qiankun.wang@amlogic.com>
2023-03-16 02:22:13 -07:00