Commit Graph

141 Commits

Author SHA1 Message Date
Jianxiong Pan 4d958d7508 mm: aml_smmu: add resume function. [1/1]
PD#SWPL-165424

Problem:
aml smmu not work after suspend and resume.

Solution:
reinit the memory after resume.

Verify:
s7.

Change-Id: I1dc2da25da6a8837a701ec3a2b2b7e3b2f8ebe70
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2024-04-28 03:58:19 -07:00
Jianxiong Pan 2836e79ed3 mm: fix kasan slab-out-of-bounds in _parse_integer_limit. [1/1]
PD#SWPL-166814

Problem:
kasan report slab-out-of-bounds in _parse_integer_limit.

Solution:
alloc more memory.

Verify:
local.

Change-Id: Iccf89bab6b219c7a0020ec84b96cf411e7648088
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2024-04-24 20:31:58 -07:00
Jianxiong Pan 2053631cca mm: aml_smmu: get max_pfn from node instead of find symbol. [1/1]
PD#SWPL-166736

Problem:
aml smmu init failed.

Solution:
get max_pfn from node instead of find symbol.

Verify:
s5.

Change-Id: I1af0dbe7006ee590a82750491d9ab6a82835bf14
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2024-04-23 05:54:08 -07:00
Jianxiong Pan 3923075c2e mm: delay enable cma after kswap low. [1/1]
PD#SWPL-162740

Problem:
cma alloc too long in cts.

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

Verify:
t5d

Change-Id: Idac4be36533ed1ae9995ba84435ea7f44833dd61
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2024-04-02 07:44:55 -07:00
Dezhen Wang e76a11e78d kernel6.6: optimise clang smarthome building for 5.15 [1/1]
PD#SWPL-156726

Problem:
support clang build for 5.15

Solution:
fix build error

Verify:
local

Change-Id: I8e5fe60e7cee109a3606b0f1aa55fbb3404999fc
Signed-off-by: Dezhen Wang <dezhen.wang@amlogic.com>
2024-03-14 02:49:39 -08:00
zhenyu.gao 4c748a719c RDK: CB1 Fix compile issue when opening production mode [1/1]
PD#SWPL-160189

Problem:
Compile fail when opening production mode

Solution:
Add macro definition control
to solve compatibility issues after enabling production mode

Verify:
droid14-sh

Signed-off-by: zhenyu.gao <zhenyu.gao@amlogic.com>
Change-Id: I7d0229010fefed4e44246b160f05aa3d886b5aad
2024-03-11 00:57:48 -08:00
Jianxiong Pan d99a3ed68c mm: fix kasan build failed. [1/1]
PD#SWPL-159825

Problem:
not found function in pagetrace

Solution:
add kasan/kasan.h to pagetrace file.

Verify:
local

Change-Id: I47d208acd46c494a32ac19ef2331ef3935004035
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2024-03-07 19:00:11 -08:00
Jianxiong Pan 4f8f6c783a mm: fix dead loop if signal pending for cma alloc task [1/1]
PD#GH-17

Problem:
If a task be killed during CMA allocation, then it will abort
cma allocation in function compact_unlock_should_abort. But in
function aml_cma_alloc_range, it will return -EBUSY. Which cause
cma allocation loop won't exit and run again and again.

Solution:
return -EINT for this case to exit cma allocation loop.

Verify:
newman platform

Change-Id: I648b1e4e119c5af7637cbd288c7d8684a5c9d60f
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2024-03-05 01:53:11 -08:00
Dezhen Wang 6256ce3548 kernel6.6: support clang build for a4 and a5 [1/1]
PD#SWPL-156726

Problem:
support clang build for a4 and a5

Solution:
fix build error

Verify:
a4 a5

Change-Id: I9aa3e06010344c9a313365d3dcdf1b10b4f75904
Signed-off-by: Dezhen Wang <dezhen.wang@amlogic.com>
2024-02-21 04:05:46 -07:00
qinglin.li f0bef1b9b5 dmc_monitor: use dmc irq thread when irq ratio is too high [1/1]
PD#SWPL-147355

Problem:
due to lockup when dmc irq ratio is too high

Solution:
use dmc irq thread when irq ratio is too high

Verify:
local

Change-Id: Ie13d584f81563e3c2e111fb5d6033f0e2aa0d337
Signed-off-by: qinglin.li <qinglin.li@amlogic.com>
2024-01-31 04:53:17 -07:00
Hanjie Lin 94a7d0f46c vmap: protect and alloc harder vmap pages [1/1]
PD#SWPL-153716

Problem:
vmap alloc fail cause crash

Solution:
add vmap cache size
add retry when vmap alloc failed

Verify:
t5m

Change-Id: I975022ff1b46938207d4911fb3199bab7dd7c135
Signed-off-by: Hanjie Lin <hanjie.lin@amlogic.com>
2024-01-11 16:04:43 +08:00
Hanjie Lin 2138214c02 cma: use workqueue when delayed enable cma [1/1]
PD#SWPL-149209

Problem:
si_swapinfo() can't used in timer and may caused softlockup

Solution:
use workqueue instead of timer

Verify:
sc2

Change-Id: Ied213f981cded785b394d19331c48c1833ff33cf
Signed-off-by: Hanjie Lin <hanjie.lin@amlogic.com>
2024-01-05 03:09:11 -07:00
Jianxiong Pan 1715c8010f mm: reduce printing in cma free. [1/1]
PD#SWPL-150374

Problem:
print too much.

Solution:
reduce printing in cma free

Verify:
local.

Change-Id: I5b197051bb07e526a0f43f104e5b1a1481df4abe
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-12-21 04:24:27 -07:00
Jianxiong Pan ebfb6f158c mm: direct init cma task list. [1/1]
PD#SWPL-150374

Problem:
cma task list corruption.

Solution:
direct init cma task list.

Verify:
t5m.

Change-Id: I1e5eec4e5841d9e1179b7f3542ce36d9b74450ae
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-12-19 00:19:36 -07:00
Jianxiong Pan 6482205b3a mm: compaction not alloc cma pages via vendor hook. [1/1]
PD#SWPL-149407

Problem:
compaction not alloc cma pages.

Solution:
use vendor hook to filter cma pages.

Verify:
local.

Change-Id: I4e581ceccf4ed0a874980fe907a5bb344a804114
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-12-15 02:45:42 -07:00
Jianxiong Pan 453a5c3c11 mm: initialize kprob symbols at definition time. [1/1]
PD#SWPL-149407

Problem:
const variables cannot be assigned a value after definition.

Solution:
initialize kprob symbols at definition time.

Verify:
t7c.

Change-Id: I9741da633db166750e51f0580f2bc6c02bb821e7
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-12-14 22:31:20 -07:00
Lei Zhang 8594f23db1 debug: optimize registers and pfn dump [1/1]
PD#SWPL-144211

Problem:
n/a

Solution:
1 not dump registers and pfn when warning
2 enable user fault dump
3 enable pfn pagetrace dump

Verify:
on SC2

Change-Id: Id0329bde1dd2d91fc818c12cd502796c3cdf123d
Signed-off-by: Lei Zhang <lei.zhang@amlogic.com>
2023-12-14 22:31:07 -07:00
Jianxiong Pan 52549b9184 mm: set pagetrace y defalut no gki20. [1/1]
PD#SWPL-146738

Problem:
pagetrace too late in suspend phase.

Solution:
set pagetrace y default no gki20.

Verify:
local.

Change-Id: I258abab43c336e3de2a4190dce365705d2860f34
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-12-04 04:37:18 -07:00
Jianxiong Pan 455d10eff1 zapper: disable hdmitx20 and mbox. [1/1]
PD#SWPL-126879

Problem:
s1a memory optimization.

Solution:
disable hdmitx20 and mbox.

Verify:
s1a.

Test:
s1a.

Change-Id: I317718936fdc14ec3b30faae7672fea66ac4541c
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-12-03 04:25:04 -07:00
Jianxiong Pan bf1142d38d mm: optimizate cma release debug info. [1/1]
PD#SWPL-147434

Problem:
print information is incomplete.

Solution:
optimizate cma release debug info.

Verify:
local.

Change-Id: I251f6ee13ca32b38a800a0241903fa3c5c6c02ef
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-11-28 02:15:34 -07:00
Tao Zeng 9de64d8c21 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 22:18:07 -07:00
Tao Zeng fb7770317f 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-15 22:25:30 -07:00
Hanjie Lin a0caa34843 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>
2023-11-15 02:02:45 -07:00
Tao Zeng 06164b0106 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-14 06:25:41 -07:00
Jianxiong Pan b206b13d9d 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-14 02:43:11 -07:00
Jianxiong Pan ce218b6b98 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-05 22:23:43 -07:00
Hanjie Lin a780b7fe8d 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-05 06:37:04 -07:00
Jianxiong Pan 21ac069019 mm: use msleep_interrupt in vmap_task. [1/1]
PD#SWPL-121825

Problem:
livelock detected too long uninterrupt in vma_thread.

Solution:
use msleep_interrupt() install of msleep().

Verify:
local.

Change-Id: I63fd52a73c2cb1a72bde78a50c17051d36db6320
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2023-10-30 02:27:52 -07:00
Jianxiong Pan 3d4053396b 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 00:08:58 -07:00
Jianxiong Pan 8560951fe6 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 00:08:53 -07:00
qiankun.wang bd5059f258 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-22 04:39:01 -07:00
song.han 6ddd2f7641 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-18 20:08:36 -07:00
Jianxiong Pan 5e62300b00 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-13 00:44:16 -07:00
Jianxiong Pan a0d71a6b7e 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-09-12 08:04:15 -07:00
Jianxiong Pan b8d0e63544 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-10 20:53:36 -07:00
Dezhen Wang dadc15697a 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-03 21:53:42 -07:00
Jianxiong Pan cb8dc5466c 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-01 02:18:45 -07:00
Tao Zeng 706f8590d8 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-08-31 20:23:44 -07:00
Jianxiong Pan ae088bb11d 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-08-31 18:34:46 -07:00
qinglin.li 9f54c42bbd 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-08-30 20:13:49 -07:00
Jianxiong Pan b9052a5a8f 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-08-27 23:03:46 -07:00
Jianxiong Pan 5f372f4ec7 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-08-24 03:54:26 -07: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