Compare commits

..

194 Commits

Author SHA1 Message Date
openharmony_ci
0b141e052b !1079 Fix : 将测试用例移植过程中的修改同步回A核
Merge pull request !1079 from yinjiaming/test
2023-01-10 07:02:38 +00:00
openharmony_ci
46cc84331a !1089 Fix : 内核告警清理
Merge pull request !1089 from yinjiaming/fix
2023-01-06 03:51:23 +00:00
yinjiaming
e816896dc4 Fix: 将测试用例移植过程中的修改同步回A核
Change-Id: I021e11f3e36bd71358a7cc674ec83dd5d98bc97e
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
2023-01-05 17:21:02 +08:00
yinjiaming
ebc3f30524 fix:修复codecheck扫描出的告警
给宏定义中的参数加上了括号,删除了多余的函数声明

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I8853f6a9717ede96578cd674b83b716c8e63f0d8
2023-01-04 15:17:45 +08:00
openharmony_ci
3119d83a6a !1087 feat: README添加内核编码规范指导
Merge pull request !1087 from zhushengle/README
2022-12-05 12:57:14 +00:00
zhushengle
8482c9d7be feat: README新增内核编码规范
Close #I644XN
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I733a65111f7557e155b0bb7be87944aaa377e928
2022-12-01 16:08:38 +08:00
openharmony_ci
248e9f7089 !1082 fix: 修复README失效链接
Merge pull request !1082 from zhushengle/README
2022-11-29 11:43:57 +00:00
zhushengle
f2a35262bd fix: 修复README失效链接
Close #I63RAH

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iebff2bacd5d85ad126cf6039d4f9be1dab64815f
2022-11-29 17:42:07 +08:00
openharmony_ci
794cdae65f !1080 feat: 更新PR模板, 添加对外变确认项
Merge pull request !1080 from zhushengle/pr
2022-11-29 01:53:25 +00:00
zhushengle
7975f5c8ef feat: 更新PR模板, 添加对外变确认项
1.更新PR模板, 添加对外变确认项
2.添加历史版本的CHANGELOG

Close #I63L3D

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I22f64cd0bc5ad083806edd4ff00d955cb81bef0e
2022-11-28 22:24:16 +08:00
openharmony_ci
fc4c694235 !1078 fix: codecheck问题清零
Merge pull request !1078 from zhushengle/codecheck
2022-11-28 13:36:55 +00:00
openharmony_ci
ead4da80ba !1071 fix:增强对LOS_ArchCopyToUser接口的安全防护
Merge pull request !1071 from zhangdengyu/fix_kernelStack_1115
2022-11-28 09:07:57 +00:00
zhushengle
8d980ded54 fix: codecheck问题清零
1.shell初始化异常流程double free
2.los_disk_init中冗余初始化
3.OsKProcessPmUsage 中OsUProcessPmUsage异常退出时,存在使用未初始化的变量
4.HiLogHeadInit异常推出后,存在使用未初始化的变量
5.api_shell.c 中存在冗余初始化

fix #I63H5G

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If17d8ed1e6f2276e20fbce24b32de169bfd22e54
2022-11-28 16:09:10 +08:00
zhangdengyu
07e3feb456 fix: 增强对LOS_ArchCopyToUser接口的安全防护
Close: #I61CLY

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I0faf8e5849c24b108f290e483124f3edaf70ef50
2022-11-25 11:47:56 +08:00
openharmony_ci
b5ce4d34df !1058 更新liteos_a 内核架构图
Merge pull request !1058 from zhushengle/Arch
2022-11-25 01:52:49 +00:00
zhushengle
99c81c4ffa feat: 更新liteos_a内核架构图
fix #I61OYY

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I038f1cae44f0138ef924bf4905f3a5b0dc24841e
2022-11-24 12:34:08 +08:00
openharmony_ci
4d1fd22b1c !1060 LTS 补丁升级适配
Merge pull request !1060 from gaochao/master
2022-11-14 09:16:06 +00:00
openharmony_ci
efa336ab26 !1061 time相关系统调用内核栈信息泄露排查
Merge pull request !1061 from zhushengle/time
2022-11-11 06:44:21 +00:00
zhushengle
0b05a46691 task: time相关系统调用内核栈信息泄露排查
解决方案:
    在涉及从内核拷贝数据到用户态的场景时,先将内核的数据进行清零操作,再填充内核数据
Close #I60M1P

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ia61d4e39b9e190accea477ff5b361e41d0eed2af
2022-11-11 14:24:07 +08:00
gaochao
177f32283f LTS 补丁升级适配
Signed-off-by: gaochao <gaochao49@huawei.com>
2022-11-10 16:32:48 +08:00
openharmony_ci
6888193e3f !1052 LTS 5.10 补丁升级适配
Merge pull request !1052 from gaochao/master
2022-11-04 07:23:25 +00:00
gc1202
6c352a7b10 LTS 补丁升级适配
Signed-off-by: gc1202 <gaochao49@huawei.com>
2022-11-02 14:23:47 +08:00
openharmony_ci
73a9587f02 !1046 Fix : 内核告警清理
Merge pull request !1046 from yinjiaming/fix
2022-10-27 12:50:29 +00:00
openharmony_ci
cbd03bd7e0 !913 删除PLATFORM_QEMU_ARM_VIRT_CA7侵入内核的所有代码
Merge pull request !913 from laokz/jffs2fat
2022-10-26 03:52:16 +00:00
yinjiaming
8d55bb1d8c fix: 内核告警清理
【背景】
内核告警清理

【修改方案】
删去了多余的空格,更改了魔数字

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iba21be6cb23027dfb369576847d7d21e85f936b4
2022-10-26 10:57:08 +08:00
openharmony_ci
e7daa28200 !1025 清除一些静态检查工具发现的问题
Merge pull request !1025 from Far/master
2022-10-17 01:39:02 +00:00
Far
987a722d2d fix: 修复一些静态检查工具发现的问题
Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I2b93259d55a9eb1a9dfd5887fd7821c15274bb7f
2022-10-15 17:36:45 +08:00
openharmony_ci
ccdfa72431 !1016 修复执行测试用例执行时间过长等问题
Merge pull request !1016 from 夏不白/fix_unittest
2022-10-12 06:29:16 +00:00
openharmony_ci
557a71c1c3 !1020 jffs2.patch 文件适配LTS补丁升级
Merge pull request !1020 from 闻飞/master
2022-10-08 11:28:25 +00:00
wenfei
569aecb6ea jffs2.patch update
Signed-off-by: wenfei <wenfei9@huawei.com>
2022-09-30 11:23:29 +08:00
xiacong
8c0b7d0f38 <fix>
修复测试用例不过的问题

<body>
1.修复执行liteos_a_basic_unittest.bin时间过长的问题
2.修复测试shm系列系统调用函数用例失败的问题

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: Iabc541cb1c0e97dac0fe13aaeb98e85404e5bf6f
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-28 17:24:14 +08:00
openharmony_ci
c488817b32 !1008 修复内核告警信息
Merge pull request !1008 from zhangdengyu/fix_preferused
2022-09-26 12:52:00 +00:00
openharmony_ci
43d47a27e3 !1011 fix: 修复shell_lk.c告警清零带来的逻辑修改
Merge pull request !1011 from 夏不白/module_fix
2022-09-26 11:22:57 +00:00
xiacong
a83f916298 <fix>
恢复告警清零带来的逻辑改变

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: I8d34d2b9c43ea54e5474cbddcde0048658cbb891
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-26 17:29:08 +08:00
zhangdengyu
8dbfd3846e fix: 修复告警
Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
2022-09-26 17:08:56 +08:00
openharmony_ci
f34762c105 !1001 修复函数返回错误等问题
Merge pull request !1001 from zhangdengyu/fix_tsacn
2022-09-25 06:42:18 +00:00
zhangdengyu
043e84dfcb fix:修复函数返回错误等问题
Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
2022-09-25 10:09:29 +08:00
openharmony_ci
453c376198 !997 Fix : 内核告警清理
Merge pull request !997 from yinjiaming/fix
2022-09-22 11:33:00 +00:00
yinjiaming
204d7a4abb fix: 内核告警清理
【背景】
内核中经扫描有可以修改的告警之处

【修改方案】
优化了代码的格式

【影响】
对现有的产品编译不会有影响。

re #I5SHM2

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I89be86a8317637f9eb54257131712b5b79f1e454
2022-09-22 16:53:11 +08:00
openharmony_ci
f2861a84bf !987 Fix : 内核告警清理
Merge pull request !987 from yinjiaming/fix
2022-09-21 04:42:42 +00:00
yinjiaming
96b2d557ac fix: 内核告警修复
【背景】
经代码扫描工具检测,内核代码中存在
可以修复的告警

【修改方案】
1.将单语句的if, while等加上括号
2.将C语言风格的类型转换变为C++风格

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I7d4a04a8904abb3c33e843049bf15f4386d3efd8
2022-09-21 11:38:51 +08:00
openharmony_ci
ffa11535ca !991 【OpenHarmony开源贡献者计划2022】fix warning: expression result unused
Merge pull request !991 from xiwen1225/void
2022-09-19 03:19:16 +00:00
openharmony_ci
b581207045 !992 【OpenHarmony开源贡献者计划2022】fix warning for signal_test_016.cpp
Merge pull request !992 from queuechen/warn
2022-09-19 02:44:00 +00:00
ookami78
5105249ecf fix warning for signal_test_016.cpp
Signed-off-by: ookami78 <ookami78@mymailcr.com>
2022-09-18 14:21:46 +08:00
cunwen
a61e2cf16e fix warning: expression result unused
Signed-off-by: cunwen <cunwen181168@liuxiuhai.cn>
2022-09-18 11:29:44 +08:00
openharmony_ci
39e25c5220 !989 Fix : 修复测试用例返回值问题
Merge pull request !989 from yinjiaming/dev
2022-09-13 12:38:03 +00:00
yinjiaming
5541965365 fix: 修复测试用例中函数返回值的问题
【背景】
测试用例中有函数的返回值不正确

【修改方案】
将返回值为VOID *的函数的返回值改为
retrun NULL

【影响】
对现有的产品编译不会有影响。

re #I5O3LH

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I6d3ce9efbe9afe14b1e9dd12538b80e69928fd71
2022-09-09 15:28:22 +08:00
openharmony_ci
edd2223083 !983 【OpenHarmony开源贡献者计划2022】删除未使用的变量 count
Merge pull request !983 from leijiawei/master
2022-09-06 06:20:52 +00:00
openharmony_ci
22392965b5 !947 Fix : 版权头时间更新
Merge pull request !947 from yinjiaming/dev
2022-09-06 02:55:30 +00:00
yinjiaming
d906bb91ea fix: 版权头时间更新问题
【背景】
一些代码文件经过修改后需要更新版权头

【修改方案】
更新了需要更新的版权头时间

【影响】
对现有的产品编译不会有影响。

re #I5LG22

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I7963bf6ce5746707bad688dd4c634ae9d72b3c04
2022-09-05 16:03:30 +08:00
leijiawei
51f6a20723 fix warning:unused variable 'count' & add return value
Signed-off-by: leijiawei <18691361562@163.com>
2022-08-31 15:28:27 +08:00
leibanli
325ea29df3 fix warning:unused variable 'count'
Signed-off-by: leijiawei <18691361562@163.com>
2022-08-31 15:01:32 +08:00
leibanli
c2f9f6705f 【openHarmony开源贡献者计划2022】18691361562@163.com
Signed-off-by: leibanli <18691361562@163.com>
2022-08-30 21:53:58 +08:00
openharmony_ci
71e51d8813 !971 非安全函数告警清理
Merge pull request !971 from xuxinyu/function_s
2022-08-26 04:45:29 +00:00
xuxinyu
e0b4fcb23d test: replace unsecure function with secure function
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Ie120ffa529798f0f087ddfcd34f5d9c5802b6766
2022-08-25 23:08:58 +08:00
openharmony_ci
7d62d3d62b !979 style: shell脚本中不同函数使用不同变量
Merge pull request !979 from Hongjin Li/dev
2022-08-25 03:32:45 +00:00
Hongjin Li
69f3bf3a2a style: using different variable in different functions
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I814dcccefcd6248ea32cae94bfde567f3077c7cd
2022-08-25 10:16:45 +08:00
openharmony_ci
2590e34346 !969 编译构建规范优化
Merge pull request !969 from Hongjin Li/dev
2022-08-23 12:55:42 +00:00
Hongjin Li
660b314f90 style: string format in python
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: Ie84a97ca5e0250991aa774b737eb7787e27d80af
2022-08-23 20:22:13 +08:00
openharmony_ci
44ec199465 !951 【OpenHarmony开源贡献者计划2022】fix moudule to module
Merge pull request !951 from bingge88/module
2022-08-12 02:16:38 +00:00
openharmony_ci
7437408f65 !950 OpenHarmony开源贡献者计划2022】fix: change szie to size
Merge pull request !950 from Dream_Liu/master
2022-08-12 02:15:42 +00:00
binge889
1134332a58 fix moudule to module
Signed-off-by: binge889 <binge889@liuxiuhai.cn>
2022-08-11 23:31:52 +08:00
Dream_Liu
8099f6578d fix:change szie to size
Signed-off-by: Dream_Liu <lxm201x@163.com>
2022-08-11 23:14:20 +08:00
openharmony_ci
ba23a26f95 !928 Fix : 内核告警清理
Merge pull request !928 from yinjiaming/fix
2022-08-09 08:37:34 +00:00
yinjiaming
2dc24da826 fix: 内核告警清理
【背景】
内核代码经代码扫描工具发现存在一些关于代码格式的告警,
现经修改解除掉告警.

【修改方案】
修改了代码中格式不规范的地方,修改的点有:
1.代码中一行过长
2.没有合理的添加空格和空行
3.没有按照规范进行缩进
4.括号的格式没有按照规范
5.注释的格式不对以及存在魔数字
6.函数的声明与定义的格式不一致
并更新了修改文件的版权头时间

【影响】
对现有的产品编译不会有影响。

re #I5H6F5

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ie46b5b3238fd88c25f99542b8ccd138b956c6458
2022-08-08 13:09:54 +00:00
openharmony_ci
6302c5f767 !938 修复用例告警
Merge pull request !938 from xuxinyu/master
2022-07-29 03:46:59 +00:00
xuxinyu
f0d5959576 fix: 修复用例告警问题
re #I5I21P

Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Iedab5b6fddafc2042c7fd23fbcd82061629f87d8
2022-07-26 11:07:02 +08:00
openharmony_ci
65790b67d5 !937 拼写错误修正
Merge pull request !937 from yinjiaming/dev
2022-07-25 11:06:35 +00:00
openharmony_ci
9eff5cff1d !934 refactor: sysroot部件化
Merge pull request !934 from Zhaotianyu/20220716sysroot_lite
2022-07-22 08:57:25 +00:00
yinjiaming
99ea8d4ed2 fix: 拼写错误修正
【背景】
代码中存在拼写错误

【修改方案】
修改存在拼写错误的地方

【影响】
对现有的产品编译不会有影响。

re #I5IA7P

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Idd5d7fc9705e5ec661596aa6533402e8d4a8a117
2022-07-21 11:05:11 +00:00
arvinzzz
1568c317bb refactor: sysroot部件化
close: #I5HF8S

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I727b10c3b419fc71e228f5ad92abc107e756bbac
2022-07-19 12:32:32 +08:00
openharmony_ci
5e70129199 !917 【OpenHarmony开源贡献者计划2022】fix warning: unused variable
Merge pull request !917 from rtos_ming/unused
2022-07-04 01:24:28 +00:00
zhumingxian
089376994a fix warning: unused variable
Signed-off-by: zhumingxian <zhumingxian@ohos.com.cn>
2022-06-30 20:49:50 +08:00
openharmony_ci
12adfd5832 !915 【OpenHarmony开源贡献者计划2022】Fixed typos.
Merge pull request !915 from Mr_YX/master
2022-06-30 06:11:01 +00:00
openharmony_ci
c46c5a640d !905 「OpenHarmony贡献者计划2022」update signal_test_020.cpp
Merge pull request !905 from Mr_YX/master
2022-06-30 06:09:18 +00:00
mr-yx
c812b0c27b fixed typos
Signed-off-by: mr-yx <496043997@qq.com>
2022-06-28 23:48:24 +08:00
openharmony_ci
51528ec39c !906 【OpenHarmony开源贡献者计划2022】Optimized conversion instructions.
Merge pull request !906 from Mr_YX/master
2022-06-27 09:31:08 +00:00
laokz
059c1c22b1 fix(PLATFORM_QEMU_ARM_VIRT_CA7): remove all invasive code
arm-virt emulation rootfs change to vfat from jffs2,
root device change to eMMC from CFI flash

Signed-off-by: laokz <laokz@foxmail.com>
Change-Id: If284809b989918cf10f5d32803df42c8c57830b2
2022-06-25 18:25:39 +08:00
openharmony_ci
beb03bfc81 !903 【OpenHarmony开源贡献者计划2022】fix typos for net
Merge pull request !903 from c01dface/master
2022-06-23 14:54:42 +00:00
openharmony_ci
bbbd96784e !904 修复liteos_a仓库中存在的一些拼写错误
Merge pull request !904 from Hongjin Li/dev
2022-06-23 04:15:03 +00:00
lihongjin
1c0de289ec style: Misspelling
Signed-off-by: lihongjin <lihongjin1@huawei.com>
Change-Id: I13163f2e4d1e4b6e6c6bedaf9d4e705544df926b
2022-06-23 09:45:46 +08:00
openharmony_ci
a3d757c8e1 !898 【轻量级 PR】:「OpenHarmony开源贡献者计划2022」update testsuites/unittest/libc/util/smoke/util_test_005.cpp.
Merge pull request !898 from Mr_YX/N/A
2022-06-23 01:02:42 +00:00
openharmony_ci
6fede4eb92 !892 【OpenHarmony开源贡献者计划2022】更新readme中的目录结构
Merge pull request !892 from wanggang/master
2022-06-23 00:43:57 +00:00
Mr_YX
7be302633f Signed-off-by: mr-yx <496043997@qq.com> 2022-06-20 18:08:19 +00:00
Mr_YX
0164461b33 Signed-off-by: mr-yx <496043997@qq.com> 2022-06-20 15:16:02 +00:00
Neil Chen
9bb4be5e13 fix typos for net
Signed-off-by: Neil Chen <jingsi.chen@petalmail.com>
2022-06-19 14:10:19 +08:00
openharmony_ci
4acf1e9f8d !896 feat: normalize drivers framework component and repos
Merge pull request !896 from yuanbo/master
2022-06-17 06:39:48 +00:00
openharmony_ci
870221452d !900 【轻量级 PR】:remove tzdriver Kconfig
Merge pull request !900 from WoolenSky/N/A
2022-06-17 03:16:48 +00:00
WoolenSky
30c3fb086e remove tzdriver Kconfig
Signed-off-by: YuanHao<yuanhao34@huawei.com>
2022-06-16 11:59:28 +00:00
Mr_YX
9b1e0a186b update testsuites/unittest/libc/util/smoke/util_test_005.cpp.
Signed-off-by: mr-yx <496043997@qq.com>
2022-06-15 14:05:19 +00:00
yuanbo
00dbf1e5d5 feat: normalize drivers framework component and repos
Signed-off-by: yuanbo <yuanbo@huawei.com>
2022-06-15 20:02:05 +08:00
openharmony_ci
16fdbdf650 !885 【OpenHarmony开源贡献者计划2022】代码打印中sucess修改为success
Merge pull request !885 from lingxin_2019/master
2022-06-14 01:57:54 +00:00
openharmony_ci
bee3d97163 !890 fix:修复llvm编译告警
Merge pull request !890 from Zhaotianyu/0601llvm_apt
2022-06-13 02:20:53 +00:00
wanggang
9fb176b827 update readme
Signed-off-by: wanggang <wanggang@kaihongdigi.com>
2022-06-10 10:11:17 +08:00
openharmony_ci
398f4a6ada !891 fix : 修复测试用例中部分测试内容硬编码的问题
Merge pull request !891 from yinjiaming/master
2022-06-09 12:42:07 +00:00
yinjiaming
19553f73e1 fix: 修复测试用例中部分测试内容硬编码的问题
【背景】
A核测试用例中有一些敏感字符串需要修改

【修改方案】
将敏感的字符串改为随机生成

【影响】
对现有的产品编译不会有影响。

re #I5ALBS

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ib9b023ace6be1d58248c993f7b9919a96afbea96
2022-06-09 02:28:05 +00:00
arvinzzz
de24efadfa fix: llvm10.0->12.0
close: I5AM0I

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I02ae045208411c6dac1234372b706ce0dbec5cef
2022-06-07 15:35:33 +08:00
openharmony_ci
0057fb0dd5 !886 修复文档链接失效问题
Merge pull request !886 from xuxinyu/master
2022-05-30 08:50:35 +00:00
x_xiny
bcf7e8ee02 修复文档链接失效问题
re #I59PF7

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Idc498604fbaadd8a00db4a5690de094883b280c4
2022-05-30 15:43:46 +08:00
lingxin_2019
0b9cac2cd3 Signed-off-by: 贺婷婷 <596256905@qq.com> 2022-05-26 08:09:56 +00:00
lingxin_2019
9958f647f5 Signed-off-by: 贺婷婷 <596256905@qq.com> 2022-05-26 12:24:46 +08:00
openharmony_ci
fa6b2d352c !880 【OpenHarmony开源贡献者计划2022】readme表达规范性和OAT英文表达规范性
Merge pull request !880 from king_he/master
2022-05-17 07:09:56 +00:00
openharmony_ci
7f57e11ef9 !881 修改jffs2引用路径
Merge pull request !881 from xuxinyu/master
2022-05-11 07:02:30 +00:00
x_xiny
1097d41a40 修改jffs2引用路径
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Id4ab149ff33747f1957b3a6843a1d8e43447e00e
2022-05-11 11:27:11 +08:00
openharmony_ci
90d6ff9a6f !871 fix: newlib for liteos_a and clip for liteos_a_mini
Merge pull request !871 from Harylee/qemu
2022-05-05 08:41:34 +00:00
king_he
eebe85fe31 update README_zh.md.
Signed-off-by: king_he <6384784@qq.com>
2022-04-30 03:41:16 +00:00
king_he
b126f1cb5f update README_zh.md.
Signed-off-by: king_he <6384784@qq.com>
2022-04-30 03:35:27 +00:00
king_he
639160f517 update OAT.xml.
Signed-off-by: king_he <6384784@qq.com>
2022-04-30 03:26:01 +00:00
Haryslee
7fef6ac8d9 fix: newlib for liteos_a and clip for liteos_a_mini
close #I53VW6

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I591b4ffaeb220311b63bd95f19400e0b9fde3c45
2022-04-29 14:12:29 +08:00
openharmony_ci
2f44d18618 !877 LiteOS-A内核jffs2文件系统停止使用third_party下的Linux_Kernel
Merge pull request !877 from Far/master
2022-04-29 03:32:22 +00:00
Far
fbc81cd821 fix: LiteOS-A内核jffs2文件系统停止使用third_party下的Linux_Kernel
Close #I5564N
Signed-off-by: Far <yesiyuan2@huawei.com>
2022-04-29 10:46:39 +08:00
openharmony_ci
a6e17fea9b !875 LiteIpc驱动增强:增加版本控制命令、增加handle特殊处理机制。
Merge pull request !875 from 万晓庆/master
2022-04-27 01:45:22 +00:00
openharmony_ci
18f7ab1380 !874 fix:进程退出后还能获取其调度参数的问题
Merge pull request !874 from Zhaotianyu/0426sched_fix
2022-04-26 13:27:49 +00:00
arvinzzz
d205cfa65a fix: 进程退出后获取其调度参数有问题
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I0e98fef07e4919a5fbb051899ecb45a224225f91
2022-04-26 18:35:19 +08:00
万晓庆
11b35fe795 LiteIpc驱动增强:增加版本控制命令、增加handle特殊处理机制。
Signed-off-by: 万晓庆 <wanxiaoqing@huawei.com>
2022-04-26 17:40:17 +08:00
openharmony_ci
b086195e97 !869 chore:精简冗余语句
Merge pull request !869 from Zhaotianyu/0326libc_opt
2022-04-11 02:53:22 +00:00
openharmony_ci
b90531e366 !869 chore:精简冗余语句
Merge pull request !869 from Zhaotianyu/0326libc_opt
2022-04-11 02:53:21 +00:00
arvinzzz
a1a6286500 feature: 高频函数优化
精简冗余语句

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: If7716d6ce6b751b3525c41fe3c95ff608ef64136
2022-04-08 17:14:23 +08:00
openharmony_ci
e1027b5902 !866 fix: 修复前后台进程支持
Merge pull request !866 from zhushengle/shell_
2022-04-07 11:19:32 +00:00
openharmony_ci
b9a445ca44 !866 fix: 修复前后台进程支持
Merge pull request !866 from zhushengle/shell_
2022-04-07 11:19:32 +00:00
zhushengle
338044cd9c fix: 修复前后台进程支持
1.优化shell机制,删除无用的线程
2.修复前后台进程支持

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I8bb13e53f290989455260dd5fb3f604ddebc9c8b
2022-04-06 16:47:49 +08:00
openharmony_ci
18a2fc8e8d !769 fix: 修复hm_liteipc.c的double unlock错误
Merge pull request !769 from niejianglei/master
2022-04-06 03:14:21 +00:00
openharmony_ci
fa0e803ac9 !865 add stm32mp157 development board
Merge pull request !865 from Laowang-BearPi/master
2022-04-01 06:38:31 +00:00
Laowang-BearPi
4f641cc145 删除GN中特殊构建命令
Signed-off-by: Laowang-BearPi <wangcheng@holdiot.com>
2022-03-31 23:08:50 +08:00
Laowang-BearPi
9063a45d5a 修改部分板级配置
Signed-off-by: Laowang-BearPi <wangcheng@holdiot.com>
2022-03-31 22:12:44 +08:00
Laowang-BearPi
4b4e1264f5 add stm32mp157 development board
Signed-off-by: Laowang-BearPi <wangcheng@holdiot.com>
2022-03-30 18:46:02 +08:00
openharmony_ci
3f5307e7bb !855 feat: 支持调度框架
Merge pull request !855 from zhushengle/sched_frame
2022-03-30 09:27:43 +00:00
zhushengle
eddcb840d3 feat: 支持调度框架
Close #I4Z3BL

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I5f32d1001ffabc0f725ce65b51ed9b3791e97f2b
2022-03-30 15:54:47 +08:00
openharmony_ci
a0e205eb0a !864 update readme
Merge pull request !864 from LeonChan/master
2022-03-30 03:44:30 +00:00
LeonChan
707028dfe1 update README
Signed-off-by: leonchan5 <chenwei26@huawei.com>
2022-03-29 07:15:46 +00:00
openharmony_ci
49d72afc8e !810 fix:优化修改epoll系统调用接口
Merge pull request !810 from Kiita/220224_epoll
2022-03-28 08:41:06 +00:00
zhangyan
c11ff67869 fix:优化修改epoll_create系统调用接口和epoll_create实现方式
re #I4STTF
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: I4d5dcfbe6937659489a3f688d188706398e25ec0
2022-03-28 04:13:54 +00:00
zhangyan
b6a49e7c89 fix:优化修改epoll_create系统调用接口和epoll_create实现方式
re #I4STTF
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: I06a8bb79376ca3799fa45732bc612c977e0a7ac9
2022-03-28 04:10:11 +00:00
lnlan
e847c8b468 fix:优化修改epoll_create系统调用接口和epoll_create实现方式
re #I4STTF
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: Ifec720eb5dd7aef8283875048d23b6a3d66b5436
2022-03-28 04:07:59 +00:00
openharmony_ci
faeeaf294c !862 fix: 修复魔法键无法显示进程信息的问题
Merge pull request !862 from zhushengle/magickey
2022-03-26 06:52:05 +00:00
zhushengle
b2caf46b4e fix: 修复魔法键无法显示进程信息的问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I9787fb3420da73cf289c434995fd2371e3fe5117
2022-03-26 11:54:39 +08:00
openharmony_ci
ccbc55df60 !861 feat: 优化调度debug功能
Merge pull request !861 from zhushengle/sched_stat
2022-03-26 02:19:22 +00:00
zhushengle
7f4294af00 feat: 优化调度debug功能
1.删除废弃功能
2.优化调度debug功能
3.删除sched_sq目录

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If2e60fb334f4c3a3f6008d724d7619cdcb3baf51
2022-03-26 09:58:54 +08:00
openharmony_ci
4a63bacc47 !860 fix:修复readme链接指向问题
Merge pull request !860 from xuxinyu/master
2022-03-24 13:10:28 +00:00
x_xiny
ee6f3f0d79 fix:修复readme链接指向问题
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Ieb18e3e525c9222aea8605875bb6c141420ae13f
2022-03-24 21:01:55 +08:00
openharmony_ci
e05300cdf0 !858 fix:修复readme链接指向问题
Merge pull request !858 from xuxinyu/master
2022-03-24 12:37:53 +00:00
openharmony_ci
b8951e2cd9 !858 fix:修复readme链接指向问题
Merge pull request !858 from xuxinyu/master
2022-03-24 12:37:53 +00:00
x_xiny
e3ce27536c fix:修复readme链接指向问题
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Iac679135e78e895f0bb6fb2fd12df017db3534c9
2022-03-24 20:23:34 +08:00
openharmony_ci
a6c5309a5f !856 fix: 修复类型不匹配问题
Merge pull request !856 from zhushengle/type
2022-03-24 03:59:05 +00:00
zhushengle
65d5526c70 fix: 修复类型不匹配问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I31e16c9716de1223db7e4de916af3e010ca5f4e4
2022-03-24 11:24:34 +08:00
openharmony_ci
33c4e194b8 !851 增加队列支持变长读操作
Merge pull request !851 from chenliming_kh/master
2022-03-24 01:51:29 +00:00
openharmony_ci
1b11caa45c !853 检视问题修复
Merge pull request !853 from wangchen/0322_up
2022-03-22 13:46:47 +00:00
wangchen
6ba17fc862 fix: kora工具检视问题修复
【背景】kora工具检视问题修复

【修改方案】
1,对部分代码问题进行整改

【影响】
对现有的产品编译不会有影响。

Signed-off-by: wangchen <wangchen64@huawei.com>
Change-Id: Iafc58b7c71e5d139e11a0ae9d98ca5a57fc6549f
2022-03-22 13:24:07 +00:00
openharmony_ci
f61ecd7669 !849 fix: 删除无效用例
Merge pull request !849 from zhushengle/de
2022-03-22 11:14:27 +00:00
chenliming
ec3c8be6ee chenliming@kaihongdigi.com: 队列支持变长读操作
Signed-off-by: chenliming <chenliming@kaihongdigi.com>
2022-03-22 18:36:24 +08:00
zhushengle
3cd28f32ca fix: 删除无效用例
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I8d932d850705f2ef9d54a53403fef2a44e77a2fc
2022-03-22 18:24:45 +08:00
openharmony_ci
4b6a6e806f !846 fix: 编码规范修复
Merge pull request !846 from zhushengle/xxx
2022-03-21 13:40:48 +00:00
zhushengle
216c124854 fix: 编码规范修复
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Idddb6f081546d880560d075395079d95e4112599
2022-03-21 20:47:46 +08:00
openharmony_ci
e26d969ca8 !751 OsFutexWait接口当absTime为0时,返回值不正确,导致用户态c库处理不当,触发当前线程卡死
Merge pull request !751 from zhangfanfan2/other
2022-03-21 04:03:26 +00:00
openharmony_ci
45f66359cd !841 fix:3.1代码检视问题修改
Merge pull request !841 from xuxinyu/master
2022-03-19 12:50:31 +00:00
x_xiny
5b87a530f5 fix:3.1代码检视
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I0e0b59cdc22b292ccf0a790010c037d43793a934
2022-03-19 20:22:59 +08:00
openharmony_ci
5280a45434 !840 fix: 修复內源检视问题
Merge pull request !840 from zhushengle/xxx
2022-03-19 10:37:45 +00:00
zhushengle
f7a8630584 fix: 修复內源检视问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I3e4e26d55dedc1eb079911eaee59a8bddf4e8eee
2022-03-19 17:50:04 +08:00
openharmony_ci
cb67dd5498 !834 feat: swtmr机制与调度分离,调度只针对通用线程,不针对特殊功能
Merge pull request !834 from zhushengle/swtmr
2022-03-19 07:59:45 +00:00
zhushengle
6d8cef40c8 feat: swtmr机制与调度分离,调度只针对通用线程,不针对特殊功能
背景:
原调度机制与软件定时器实现混合,调度时间链表存在两个链表,
任务切换时需要遍历两个链表才可以获取到最终的tick响应时间。
软件定时作为一个独立的功能,不应该和调度强耦合,而且软件定时
器作为一个任务,某个软件定时器的响应时间应该是软件定时器任务的
响应时间,不应该直接做为tick中断的响应时间。

方案描述:
1.将软件定时器从调度分离,作为一个独立的机制,从调度角度看其就是一个任务
2.软件定时器从调度分离之后,其timelist遍历从tick中断移动至软件定时器任务中
3.优化软件定时器的均衡调度

优势:
1.将软件定时器与调度完全分离,使得调度功能单一化,便于后续其它调度算法的引入
2.优化tick中断,减小tick中断耗时
3.优化通过写队列唤醒软件定时器任务去执行软件定时器钩子为插队列,减少软件定时
器机制本身的耗时,提升软件定时器的实时性
4.优化软件定时器均衡调度,使得软件定时器均匀分布于多核,提升软件定时器的实时性

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I07c01f134e69c1d9b7061ddf5a231df1ee99b68e
2022-03-19 11:23:36 +08:00
openharmony_ci
41b80ad20a !838 fix: 内源检视问题修复
Merge pull request !838 from Zhaotianyu/0318codex_fix_1
2022-03-18 08:42:36 +00:00
arvinzzz
47fac7158e fix: 内源检视问题修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I7c0b8f4026d8fbd4b0d985d4ce82187e56f1d6ec
2022-03-18 16:06:23 +08:00
openharmony_ci
6c0e1b1f04 !836 内核内源代码检视问题修改
Merge pull request !836 from wangchen/0317_lfx_a
2022-03-18 07:21:54 +00:00
wangchen
b06520ac7c fix: 内核内源代码检视问题修改
【背景】内源代码检视问题

【修改方案】
1,按检视意见,进行拼写等问题的修改

【影响】
对现有的产品编译不会有影响。

Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-17 12:33:01 +00:00
openharmony_ci
e4cad073a9 !835 fix: 修复任务部分接口防护
Merge pull request !835 from zhushengle/task
2022-03-16 12:22:41 +00:00
zhushengle
b151fa6b65 fix: 修复任务部分接口防护
1.LosTaskDelete接口未对锁调度做检查
2.LOS_SetTaskScheduler未校验任务有效性
3.LOS_TaskJoin未对系统任务做校验

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I2c0a83ed5825706f3fa2609574e9e440a0d8eb1f
2022-03-16 19:51:18 +08:00
openharmony_ci
40329e182c !832 fix: 修复部分内核态测试用例
Merge pull request !832 from zhushengle/test
2022-03-16 09:45:59 +00:00
zhushengle
0f38ecb863 fix: 修复部分内核态测试用例
1.修复删除任务后调度不及时的问题
2.修复部分内核态测试用例

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4cb29f6a7dce96bfdad68e0d89a004b5f5e33036
2022-03-16 17:16:55 +08:00
openharmony_ci
3f43438017 !831 fix:修复拼写错误
Merge pull request !831 from xuxinyu/master
2022-03-14 14:43:36 +00:00
x_xiny
bc70db58a7 fix:修复拼写错误
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I1cc4897e5d37dd98696221f0cc70220cef45e7d4
2022-03-14 22:22:56 +08:00
openharmony_ci
ac9399d2b7 !830 C库gn修改
Merge pull request !830 from Zhaotianyu/0314libc_opt
2022-03-14 14:13:07 +00:00
arvinzzz
89850d0715 feature: libc opt
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I6efb8c61179b29c0415ec6df060d8a4c7ede88ab
2022-03-14 19:57:39 +08:00
openharmony_ci
86be540829 !829 fix:修改拼写错误
Merge pull request !829 from xuxinyu/FixSpellingMisstakes
2022-03-14 10:45:10 +00:00
x_xiny
0f75bf01a6 fix:内源代码检视拼写错误修改
【背景】3.1代码review问题修改

    【修改方案】
     根据检视意见对拼写错误进行修改

     Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: I9fb982a8ba2052fa4d56e91eec33c96ab4035a90
2022-03-14 17:34:46 +08:00
openharmony_ci
395c0be775 !828 fix: 内源代码检视问题修改
Merge pull request !828 from zhushengle/sample
2022-03-14 08:26:48 +00:00
zhushengle
a40f8383ee fix: 内源代码检视问题修改
1.删除测试用例中的需求单号和问题单号
2.部分格式问题
3.使用非安全函数问题

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I348bd9730f584fd3ebeb6d4245fe4a84c0c90c7d
2022-03-14 15:14:44 +08:00
openharmony_ci
87a7df48b8 !821 fix: 源代码检视问题修复
Merge pull request !821 from xuxinyu/master
2022-03-10 12:13:18 +00:00
openharmony_ci
2df39a7e51 !825 A核内源代码检视问题修改2
Merge pull request !825 from wangchen/0310_a
2022-03-10 12:12:21 +00:00
openharmony_ci
9f8127cc54 !824 fix: 源码检视修复
Merge pull request !824 from yinjiaming/master
2022-03-10 08:19:06 +00:00
wangchen
2f1ed39bc1 fix: 内源代码检视问题
【背景】内源代码检视问题

【修改方案】
1,按检视意见,进行资源泄露等问题的修改

【影响】
对现有的产品编译不会有影响。

re #I4WV56
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-10 07:47:56 +00:00
x_xiny
0770e5f972 fix:内源代码检视修改(安全函数)
【背景】3.1代码review问题修改

【修改方案】
 根据检视意见对安全函数,版权等信息进行修改

 re #I4WV56

 Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: Ia2a6ba828700006f6bfe810714e2cd88fc2ccddc
2022-03-10 14:40:58 +08:00
openharmony_ci
0fb16312dc !823 添加一些启动注释
Merge pull request !823 from Zhaotianyu/0309reset
2022-03-10 04:06:28 +00:00
yinjiaming
9a030d6930 fix: 修复3.1源码检视的问题
【背景】
3.1 代码检视过程中有一些问题需要修复

【修改方案】
修改了失效的文档链接,更改了一些非可执行文件的权限

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: If87ac9a3e17ba679f4712552f5a89cc13349287e
2022-03-09 09:34:31 +00:00
arvinzzz
29dde5d752 refactor: 启动加注释
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I124e24f42b52c7ac1d848cbdeeb2e111d5813d33
2022-03-09 17:28:16 +08:00
openharmony_ci
b797f50596 !813 主干告警清零
Merge pull request !813 from yinjiaming/master
2022-03-09 03:51:33 +00:00
openharmony_ci
913d22bf83 !822 A核内源代码检视问题修改
Merge pull request !822 from wangchen/0308_a
2022-03-09 03:29:42 +00:00
wangchen
3824d1e9e4 【背景】内源代码检视问题
【修改方案】
1,按检视意见,进行资源泄露等问题的修改

【影响】
对现有的产品编译不会有影响。

re #I4WV56
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-08 09:45:17 +00:00
openharmony_ci
7941b93d1c !816 fix: codex及合规修复
Merge pull request !816 from Zhaotianyu/0307codex_fix
2022-03-08 08:06:29 +00:00
openharmony_ci
d376efbe46 !815 feat: 优化shell 命令
Merge pull request !815 from zhushengle/shell
2022-03-08 02:14:59 +00:00
arvinzzz
64ddb1ff07 fix:codex及合规问题修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I5a738c243a07325b7cc314956a1658a69e768559
2022-03-07 19:34:50 +08:00
zhushengle
f02d40d25d feat: 优化shell 命令
1.优化task 命令关中断时间较长的问题
  2.优化hwi 命令,可以查看不同核的中断分布情况
  3.丰富hiw 命令,统计每个中断在一定时间内的平均执行时间和最大执行时间
  4.丰富swtmr 命令,在debug模式下支持查看各软件定时器的运行情况, 默认关闭

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I01cfe50c918da51f9de5b460e9eb91a863e1de36
2022-03-07 15:25:38 +08:00
yinjiaming
672bc729a6 fix: 主干告警清理
【背景】
主干告警清理

【修改方案】
在需要的地方添加了强制类型转换

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id6693137310d8c2e63f4e5489564d7c01c016a18
2022-03-03 12:04:22 +00:00
Jianglei Nie
a0ad1a4333 fix: 修复hm_liteipc.c的double unlock错误
对g_cmsTask的访问应该加锁,但代码中LOS_MuxLock被误用为LOS_MuxUnLock,导致double unlock错误。
可以将865行的LOS_MuxUnlock改为LOS_MuxLock来解决这个问题。

Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
2022-01-07 11:28:55 +08:00
zff
f504cc9145 fix: OsFutexWait接口当absTime为0时,返回值不正确,导致用户态c库不当处理,触发当前线程卡死
close: #I4KGO4

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I77d73836ec550828fd74ca84a13f83b1050316ac
2021-12-25 10:37:20 +08:00
693 changed files with 8277 additions and 6551 deletions

View File

@@ -10,6 +10,12 @@
### 测试用例(新增、改动、可能影响的功能)
### 是否涉及对外变更典型的如对外API规格变更、新增对外接口等等
必须选择一项在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
- [ ] 是,涉及对外变更: 需要在commit message中按【[模板要求](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)】描述变更点
- [ ] 否,不涉及对外变更
### 是否需要同步至release3.0LTS ... )分支?
必须选择一项在MarkDown模式下用[x]替换[ ]即可勾选对应选项):

View File

@@ -35,6 +35,7 @@ declare_args() {
tee_enable = false
liteos_name = "OHOS_Image"
liteos_skip_make = false
liteos_is_mini = false
}
tee = ""
@@ -128,7 +129,9 @@ config("stdinc_config") {
"-isystem",
std_include,
]
cflags += [ "-nostdinc" ]
if (!defined(LOSCFG_LIBC_NEWLIB)) {
cflags += [ "-nostdinc" ]
}
asmflags = cflags
}
@@ -289,6 +292,7 @@ group("modules") {
"security",
"shell",
"syscall",
"testsuites/kernel:kernel_test",
]
deps += [
@@ -314,13 +318,17 @@ group("kernel") {
}
group("liteos_a") {
deps = [
":apps",
":kernel",
":make",
":tests",
"//prebuilts/lite/sysroot/build:strip",
]
deps = [ ":kernel" ]
if (!liteos_is_mini) {
deps += [
":apps",
":tests",
"//third_party/musl/scripts/build_lite:strip",
]
if (liteos_skip_make == false) {
deps += [ ":make" ]
}
}
}
executable("liteos") {
@@ -336,6 +344,17 @@ executable("liteos") {
"-Wl,--no-eh-frame-hdr",
]
if (defined(LOSCFG_LIBC_NEWLIB)) {
ldflags += [
"-Wl,--wrap=_free_r",
"-Wl,--wrap,_malloc_usable_size_r",
"-Wl,--wrap,_malloc_r",
"-Wl,--wrap,_memalign_r",
"-Wl,--wrap,_realloc_r",
"-Wl,--wrap,_fseeko_r",
]
ldflags -= [ "-nostdlib" ]
}
libgcc = exec_script("//build/lite/run_shell_cmd.py",
[ "$cc -print-libgcc-file-name" ],
"trim string")
@@ -347,7 +366,7 @@ executable("liteos") {
} else {
ldflags +=
[ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ]
ldflags += [ "-Wl,-nostartfiles" ]
ldflags += [ "-nostartfiles" ]
inputs = [ "tools/build/liteos.ld" ]
}

338
CHANGELOG.md Normal file
View File

@@ -0,0 +1,338 @@
# (2022-03-30)
### Bug Fixes
* **arm-virt:** HW_RANDOM_ENABLE配置支持arm virt平台 ([68f9f49](https://gitee.com/openharmony/kernel_liteos_a/commits/68f9f49c2a62d3271db14ccb896c9f9fc78a60e4))
* A核代码静态告警定期清理 ([9ba725c](https://gitee.com/openharmony/kernel_liteos_a/commits/9ba725c3d486dd28fe9b2489b0f95a65354d7d86)), closes [#I4I0O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4I0O8)
* change default permission of procfs to 0550 ([a776c04](https://gitee.com/openharmony/kernel_liteos_a/commits/a776c04a3da414f73ef7136a543c029cc6dd75be)), closes [#I4NY49](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NY49)
* change the execFile field in TCB to execVnode ([e4a0662](https://gitee.com/openharmony/kernel_liteos_a/commits/e4a06623ceb49b5bead60d45c0534db88b9c666f)), closes [#I4CLL9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CLL9)
* close file when process interpretor failed ([a375bf5](https://gitee.com/openharmony/kernel_liteos_a/commits/a375bf5668a5e86e082d0e124b538e423023a259)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* codex 清理 ([9ab3e35](https://gitee.com/openharmony/kernel_liteos_a/commits/9ab3e351d38cdae2ec083048a50a253bc2a3b604)), closes [#I4BL3](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BL3)
* dyload open close failed ([5e87d8c](https://gitee.com/openharmony/kernel_liteos_a/commits/5e87d8c183471166294e2caa041ab4da8570c6a1)), closes [#I452Z7](https://gitee.com/openharmony/kernel_liteos_a/issues/I452Z7)
* fix ppoll ([a55f68f](https://gitee.com/openharmony/kernel_liteos_a/commits/a55f68f957e9f8ad74bd9e0c1b3d27775e0f8c75))
* fix some function declarations ([63fd8bc](https://gitee.com/openharmony/kernel_liteos_a/commits/63fd8bc39b21fffb6990f74e879eefecafad6c88))
* implicit declaration of function 'syscall' in apps/shell ([bd0c083](https://gitee.com/openharmony/kernel_liteos_a/commits/bd0c0835fc58ed5f941dbbc9adfac74253eeb874))
* LOS_Panic和魔法键功能中的使用PRINTK打印依赖任务调度特殊情况下存在打印不出来的问题 ([53addea](https://gitee.com/openharmony/kernel_liteos_a/commits/53addea304de09e0df457b690403ac652bbcea72)), closes [#I4NOC7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NOC7)
* los_stat_pri.h中缺少依赖的头文件 ([2cd03c5](https://gitee.com/openharmony/kernel_liteos_a/commits/2cd03c55b7a614c648adc965ebfe494d491fe20f)), closes [#I4KEZ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KEZ1)
* los_trace.h接口注释错误修正 ([6d24961](https://gitee.com/openharmony/kernel_liteos_a/commits/6d249618aecc216388f9b1a2b48fe0ac6dd19ff2)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* MMU竞态问题修复 ([748e0d8](https://gitee.com/openharmony/kernel_liteos_a/commits/748e0d8ffb6ee9c8757ed056f575e3abc6c10702)), closes [#I2](https://gitee.com/openharmony/kernel_liteos_a/issues/I2)
* **mtd:** 去除mtd对hisilicon驱动的依赖 ([f7d010d](https://gitee.com/openharmony/kernel_liteos_a/commits/f7d010dfa4cb825096267528e131a9e2735d7505)), closes [#I49](https://gitee.com/openharmony/kernel_liteos_a/issues/I49)
* OsFutexWaitParamCheck函数中absTime为0时直接返回不需要打印 ([3f71be7](https://gitee.com/openharmony/kernel_liteos_a/commits/3f71be75355f11037d9de80cc4d7da0f01905003)), closes [#I4D67](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D67)
* OsLockDepCheckIn异常处理中存在g_lockdepAvailable锁嵌套调用, ([bf030b6](https://gitee.com/openharmony/kernel_liteos_a/commits/bf030b6bb5843151a5b8b8736246a1376a5fb9d0)), closes [#I457](https://gitee.com/openharmony/kernel_liteos_a/issues/I457)
* pr模板补充说明 ([e3cd485](https://gitee.com/openharmony/kernel_liteos_a/commits/e3cd485db528490a16a8932d734faab263b44bc9))
* same file mode for procfs files ([c79bcd0](https://gitee.com/openharmony/kernel_liteos_a/commits/c79bcd028e1be34b45cba000077230fa2ef95e68)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* shell支持exit退出完善帮助信息特殊处理不可见字符 ([cc6e112](https://gitee.com/openharmony/kernel_liteos_a/commits/cc6e11281e63b6bdc9be8e5d3c39f1258eb2ceaa))
* smp初始化中副核冗余的启动框架调用 ([5ce70a5](https://gitee.com/openharmony/kernel_liteos_a/commits/5ce70a50c3733b6ec8cc4b444837e366ec837f69)), closes [#I4F8A5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F8A5)
* solve SIGCHLD ignored in sigsuspend() ([5a80d4e](https://gitee.com/openharmony/kernel_liteos_a/commits/5a80d4e1a34c94204a0bb01443bf25a4fdb12750)), closes [#I47](https://gitee.com/openharmony/kernel_liteos_a/issues/I47)
* syscall review bugfix ([214f44e](https://gitee.com/openharmony/kernel_liteos_a/commits/214f44e935277c29d347c50b553a31ea7df36448)), closes [#149](https://gitee.com/openharmony/kernel_liteos_a/issues/149)
* **test:** misc09用例因依赖hosts文件而失败 ([f2f5c5f](https://gitee.com/openharmony/kernel_liteos_a/commits/f2f5c5fdc3202610de173e7046adab4df5e59142)), closes [re#I48IZ0](https://gitee.com/re/issues/I48IZ0)
* **test:** 修复sys部分用例因依赖passwd、group文件而失败 ([614cdcc](https://gitee.com/openharmony/kernel_liteos_a/commits/614cdccf91bd2d220c4c76418b53400ce714c6cb)), closes [re#I48](https://gitee.com/re/issues/I48)
* 中断中调用PRINTK概率卡死导致系统不能正常响应中断 ([9726ba1](https://gitee.com/openharmony/kernel_liteos_a/commits/9726ba11a79f3d2d1e616e12ef0bb44e4fc5cd20)), closes [#I4C9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4C9)
* 临终遗言重定向内容缺失task相关信息对应的shell命令中申请的内存需要cacheline对齐 ([48ca854](https://gitee.com/openharmony/kernel_liteos_a/commits/48ca854bf07f8dcda9657f950601043a485a1b33)), closes [#I482S5](https://gitee.com/openharmony/kernel_liteos_a/issues/I482S5)
* 优化liteipc任务状态删除功能重复字段 ([5004ef4](https://gitee.com/openharmony/kernel_liteos_a/commits/5004ef4d87b54fb6d7f748ca8212ae155bcefac5)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 优化trace buffer初始化删除swtmr 桩中的无效参数 ([b551270](https://gitee.com/openharmony/kernel_liteos_a/commits/b551270ef50cb206360e2eee3dd20ace5cecccb7)), closes [#I4DQ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DQ1)
* 修复 virpart.c 不适配的格式化打印问题 ([de29140](https://gitee.com/openharmony/kernel_liteos_a/commits/de29140edf2567f4847876cb1ed5e0b6857420f3)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 修复A核文档失效的问题 ([456d255](https://gitee.com/openharmony/kernel_liteos_a/commits/456d255a81c2031be8ebecc2bf897af80c3d3c7a)), closes [#I4U7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4U7)
* 修复A核测试用例失败的问题 ([59329ce](https://gitee.com/openharmony/kernel_liteos_a/commits/59329ce7c6b6a00084df427748e6283287a773c0)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 修复A核测试用例失败的问题 ([be68dc8](https://gitee.com/openharmony/kernel_liteos_a/commits/be68dc8bcaf8d965039ae1d792775f00a08adfac)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 修复dispatch单词拼写错误。 ([9b07aec](https://gitee.com/openharmony/kernel_liteos_a/commits/9b07aece2dfa3494cf35e8b388410341508d6224)), closes [#I4BLE8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BLE8)
* 修复futime提示错误22的BUG ([f2861dd](https://gitee.com/openharmony/kernel_liteos_a/commits/f2861ddfb424af7b99c278273601ce0fab1f37e6))
* 修复jffs2适配层错误释放锁的BUG ([011a55f](https://gitee.com/openharmony/kernel_liteos_a/commits/011a55ff21d95f969abac60bcff96f4c4d7a326d)), closes [#I4FH9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FH9)
* 修复los_vm_scan.c中内部函数OsInactiveListIsLow冗余代码 ([bc32a1e](https://gitee.com/openharmony/kernel_liteos_a/commits/bc32a1ec0fa5d19c6d2672bcf4a01de5e1be3afb)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 修复LOSCFG_FS_FAT_CACHE宏关闭后编译失败的BUG ([63e71fe](https://gitee.com/openharmony/kernel_liteos_a/commits/63e71feca05a8d46a49822c713258738740f0712)), closes [#I3T3N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T3N0)
* 修复OsVmPhysFreeListAdd和OsVmPhysFreeListAddUnsafe函数内容重复 ([6827bd2](https://gitee.com/openharmony/kernel_liteos_a/commits/6827bd2a22b78aa05e20d6460412fc7b2d738929)), closes [#I4FL95](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FL95)
* 修复PR520缺陷 ([4033891](https://gitee.com/openharmony/kernel_liteos_a/commits/40338918d9132399ee0494d331930a05b7a13c67)), closes [re#I4DEG5](https://gitee.com/re/issues/I4DEG5)
* 修复shcmd.h需要用宏包起来的问题 ([6c4e4b1](https://gitee.com/openharmony/kernel_liteos_a/commits/6c4e4b16abe9c68fea43d40b2d39b4f0ed4bfc9c)), closes [#I4N50](https://gitee.com/openharmony/kernel_liteos_a/issues/I4N50)
* 修复xts权限用例压测异常问题 ([b0d31cb](https://gitee.com/openharmony/kernel_liteos_a/commits/b0d31cb43f5a8d1c3da574b2b957e3b0e98b3067)), closes [#I3ZJ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZJ1)
* 修复硬随机不可用时,地址随机化不可用问题 ([665c152](https://gitee.com/openharmony/kernel_liteos_a/commits/665c152c27bb86395ddd0395279255f6cdaf7255)), closes [#I4D4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D4)
* 修复进程用例导致门禁概率失败 ([1ed28b4](https://gitee.com/openharmony/kernel_liteos_a/commits/1ed28b4c80cfd222be08b0c2e71e6287e52bb276)), closes [#I4FO0](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FO0)
* 修复进程线程不稳定用例 ([f6ac03d](https://gitee.com/openharmony/kernel_liteos_a/commits/f6ac03d3e3c56236adc5734d4c059f1fbcc9e0c1)), closes [#I4F1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F1)
* 修复重复执行内存用例导致系统卡死问题 ([6c2b163](https://gitee.com/openharmony/kernel_liteos_a/commits/6c2b163c7d7c696ef89b17a0275f3cddb3d7cefb)), closes [#I4F7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F7)
* 修改MMU模块的注释错误 ([1a8e22d](https://gitee.com/openharmony/kernel_liteos_a/commits/1a8e22dcf15944153e013d004fd7bbf24557a8c7)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 共享内存问题修复 ([9fdb80f](https://gitee.com/openharmony/kernel_liteos_a/commits/9fdb80f85f92d0167a0456455a94fc6f679797ce)), closes [#I47X2](https://gitee.com/openharmony/kernel_liteos_a/issues/I47X2)
* 内核ERR打印无进程和线程信息不方便问题定位。 ([cb423f8](https://gitee.com/openharmony/kernel_liteos_a/commits/cb423f845462b8cc474c3cba261dadf3943a08ef)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 内核ERR级别及以上的打印输出当前进程和线程名 ([540b201](https://gitee.com/openharmony/kernel_liteos_a/commits/540b2017c5460e300365d2039a08abd5945cec6b))
* 内源检视测试用例问题修复 ([a6ac759](https://gitee.com/openharmony/kernel_liteos_a/commits/a6ac7597f85043ba6de3a1b395ca676d85c65ea7))
* 删除冗余的头文件 ([8e614bb](https://gitee.com/openharmony/kernel_liteos_a/commits/8e614bb1616b75bc89eee7ad7da49b7a9c285b47)), closes [#I4KN63](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KN63)
* 增加pselect SYSCALL函数及测试用例 ([f601c16](https://gitee.com/openharmony/kernel_liteos_a/commits/f601c16b9e67d531dda51fc18389a53db4360b7b)), closes [#I45](https://gitee.com/openharmony/kernel_liteos_a/issues/I45)
* 增加内核epoll系统调用 ([2251b8a](https://gitee.com/openharmony/kernel_liteos_a/commits/2251b8a2d1f649422dd67f8551b085a7e0c63ec7)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 实现了musl库net模块中的一些函数接口和相应的测试用例 ([3d00a7d](https://gitee.com/openharmony/kernel_liteos_a/commits/3d00a7d23a96f29c138cfc1672825b90b9e0c05e)), closes [#I4JQI1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4JQI1)
* 添加进程线程冒烟用例 ([2be5968](https://gitee.com/openharmony/kernel_liteos_a/commits/2be59680f2fb0801b43522cd38cc387c8ff38766)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 用户态进程主线程退出时,其他子线程刚好进入异常处理流程会导致系统卡死 ([d955790](https://gitee.com/openharmony/kernel_liteos_a/commits/d955790a44a679421798ec1ac2900b4d75dd75a4)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 编码规范修改 ([d161a0b](https://gitee.com/openharmony/kernel_liteos_a/commits/d161a0b03de046c05fff45a2b625631b4e45a347))
* 编码规范问题修复 ([f60bc94](https://gitee.com/openharmony/kernel_liteos_a/commits/f60bc94cf231bc615ff6603ca0393b8fe33a8c47))
* 编译框架在做编译入口的统一 ([bdb9864](https://gitee.com/openharmony/kernel_liteos_a/commits/bdb9864436a6f128a4c3891bbd63e3c60352689f)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 解决dmesg -s参数double lock问题 ([e151256](https://gitee.com/openharmony/kernel_liteos_a/commits/e1512566e322eb1fbc8f5d5997f9bfcd022feac7)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 进程退出前自己回收vmspace中的所有region ([298ccea](https://gitee.com/openharmony/kernel_liteos_a/commits/298ccea3fedaccc651b38973f0455fa1ce12e516)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 通过g_uart_fputc_en关闭打印后shell进程不能正常启动 ([d21b05c](https://gitee.com/openharmony/kernel_liteos_a/commits/d21b05c0f69877130366ad37b852a0f30c11809d)), closes [#I4CTY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CTY2)
* 针对pr是否同步至release分支增加原因说明规则 ([b37a7b7](https://gitee.com/openharmony/kernel_liteos_a/commits/b37a7b79292d93dae6c4914952b5f3bb509e8721))
* 非当前进程销毁时销毁liteipc时错误的销毁了当前进程的liteipc资源 ([0f0e85b](https://gitee.com/openharmony/kernel_liteos_a/commits/0f0e85b7a6bf76d540925fbf661c483c8dba1cba)), closes [#I4FSA7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FSA7)
### Code Refactoring
* los_cir_buf.c中接口整合 ([0d325c5](https://gitee.com/openharmony/kernel_liteos_a/commits/0d325c56a1053043db05d53a6c8083f4d35f116b)), closes [#I4MC13](https://gitee.com/openharmony/kernel_liteos_a/issues/I4MC13)
### Features
* add option SIOCGIFBRDADDR for ioctl ([4ecc473](https://gitee.com/openharmony/kernel_liteos_a/commits/4ecc473843207d259613d26b8ee176d75e7f00fd)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* add sync() to vfs ([f67c4da](https://gitee.com/openharmony/kernel_liteos_a/commits/f67c4dae5141914df2e069dce0196b14780649d8)), closes [#I480](https://gitee.com/openharmony/kernel_liteos_a/issues/I480)
* **build:** support gcc toolchain ([6e886d4](https://gitee.com/openharmony/kernel_liteos_a/commits/6e886d4233dec3b82a27642f174b920e5f98f6aa))
* L0-L1 支持Perf ([6e0a3f1](https://gitee.com/openharmony/kernel_liteos_a/commits/6e0a3f10bbbfe29d110c050da927684b6d77b961)), closes [#I47I9](https://gitee.com/openharmony/kernel_liteos_a/issues/I47I9)
* L0~L1 支持Lms ([e748fdb](https://gitee.com/openharmony/kernel_liteos_a/commits/e748fdbe578a1ddd8eb10b2e207042676231ba26)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* liteipc 静态内存优化 ([5237924](https://gitee.com/openharmony/kernel_liteos_a/commits/52379242c109e0cf442784dbe811ff9d42d5f33a)), closes [#I4G4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4G4)
* page cache backed by vnode instead of filep ([38a6b80](https://gitee.com/openharmony/kernel_liteos_a/commits/38a6b804e9291d2fdbd189825ebd7d56165ec51c)), closes [#I44](https://gitee.com/openharmony/kernel_liteos_a/issues/I44)
* 提供低功耗默认处理框架 ([212d1bd](https://gitee.com/openharmony/kernel_liteos_a/commits/212d1bd1e806530fe7e7a16ea986cb2c6fb084ed)), closes [#I4KBG9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KBG9)
* 支持AT_RANDOM以增强用户态栈保护能力 ([06ea037](https://gitee.com/openharmony/kernel_liteos_a/commits/06ea03715f0cfb8728fadd0d9c19a403dc8f6028)), closes [#I4CB8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CB8)
* 支持L1 低功耗框架 ([64e49ab](https://gitee.com/openharmony/kernel_liteos_a/commits/64e49aba7c9c7d2280c5b3f29f04b17b63209855)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 支持LOS_TaskJoin 和 LOS_TaskDetach ([37bc11f](https://gitee.com/openharmony/kernel_liteos_a/commits/37bc11fa8837a3019a0a56702f401ec1845f6547)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 新增解析异常和backtrace信息脚本 ([7019fdf](https://gitee.com/openharmony/kernel_liteos_a/commits/7019fdfcbb33c660e8aa9fd399d5fccbd7e23b49)), closes [#I47](https://gitee.com/openharmony/kernel_liteos_a/issues/I47)
* 调度tick响应时间计算优化 ([f47da44](https://gitee.com/openharmony/kernel_liteos_a/commits/f47da44b39be7fa3e9b5031d7b79b9bef1fd4fbc))
* 调度去进程化,优化进程线程依赖关系 ([dc479fb](https://gitee.com/openharmony/kernel_liteos_a/commits/dc479fb7bd9cb8441e4e47d44b42110ea07d76a2))
* 调度相关模块间依赖优化 ([0e3936c](https://gitee.com/openharmony/kernel_liteos_a/commits/0e3936c4f8b8bcfc48d283a6d53413e0fc0619b3)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 进程cpup占用率结构优化为动态分配 ([f06e090](https://gitee.com/openharmony/kernel_liteos_a/commits/f06e090a1085a654fd726fbc3c3a1c2bc703d663)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
* 进程rlimit修改为动态分配,减少静态内存占用 ([cf8446c](https://gitee.com/openharmony/kernel_liteos_a/commits/cf8446c94112ed6993a2e6e71e793d83a72689d5)), closes [#I4EZY5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EZY5)
### BREAKING CHANGES
* 1. 删除 LOS_CirBufLock()LOS_CirBufUnlock()内核对外接口
2. LOS_CirBufWrite()LOS_CirBufRead()由原先内部不进行上/解锁操作,变为默认已包含上/解锁操作。
* 新增支持API:
LOS_LmsCheckPoolAdd使能检测指定内存池
LOS_LmsCheckPoolDel不检测指定内存池
LOS_LmsAddrProtect为指定内存段上锁不允许访问
LOS_LmsAddrDisableProtect去能指定内存段的访问保护
* 1.新增一系列perf的对外API位于los_perf.h中.
LOS_PerfInit配置采样数据缓冲区
LOS_PerfStart开启Perf采样
LOS_PerfStop停止Perf采样
LOS_PerfConfig配置Perf采样事件
LOS_PerfDataRead读取采样数据
LOS_PerfNotifyHookReg 注册采样数据缓冲区的钩子函数
LOS_PerfFlushHookReg 注册缓冲区刷cache的钩子
2. 用户态新增perf命令
【Usage】:
./perf [start] /[start id] Start perf.
./perf [stop] Stop perf.
./perf [read nBytes] Read nBytes raw data from perf buffer and print out.
./perf [list] List events to be used in -e.
./perf [stat] or [record] <option> <command>
-e, event selector. use './perf list' to list available events.
-p, event period.
-o, perf data output filename.
-t, taskId filter(whiltelist), if not set perf will sample all tasks.
-s, type of data to sample defined in PerfSampleType los_perf.h.
-P, processId filter(whiltelist), if not set perf will sample all processes.
-d, whether to prescaler (once every 64 counts), which only take effect on cpu cycle hardware event.
# (2021-09-30)
### Bug Fixes
* A核代码告警清零 ([698756d](https://gitee.com/openharmony/kernel_liteos_a/commits/698756d1e6dfb11b9f874c02ce6a1496646f2c27)), closes [#I4378](https://gitee.com/openharmony/kernel_liteos_a/issues/I4378)
* A核告警消除 ([d16bfd0](https://gitee.com/openharmony/kernel_liteos_a/commits/d16bfd005a6dae78df2df3ad55cf21e0716dfae9)), closes [#I46KF6](https://gitee.com/openharmony/kernel_liteos_a/issues/I46KF6)
* 3518平台, 异常测试进程无法正常退出 ([23937a2](https://gitee.com/openharmony/kernel_liteos_a/commits/23937a239f50d1487e89f3184e4f4b933d6842c6)), closes [#I3V8R5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8R5)
* add (void) to GetFileMappingList method ([56b8eca](https://gitee.com/openharmony/kernel_liteos_a/commits/56b8ecaf171671c0fe97f1dd1f191bebb7812a51)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* add capability and amend smoke testcase ([c9d69e2](https://gitee.com/openharmony/kernel_liteos_a/commits/c9d69e2d1bde57c67068cc36f6a79327d5db5daf))
* add fchdir api ([e828cbd](https://gitee.com/openharmony/kernel_liteos_a/commits/e828cbdeac7d60bfd6ed98c75a9958ee8ec7b672))
* add fchmod api ([2f214bf](https://gitee.com/openharmony/kernel_liteos_a/commits/2f214bf4de6c31875c77e84b1763e96bc5ceb669))
* add fststfs api and unitest ([4c57aa2](https://gitee.com/openharmony/kernel_liteos_a/commits/4c57aa26ad3644ce2429effc8e8fe7fd3c52ebc2))
* add product_path parameter for driver build ([88fe4eb](https://gitee.com/openharmony/kernel_liteos_a/commits/88fe4eb3e1eafa6d1e32c7b96579a07f5a8c6e35)), closes [#I3PQ10](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PQ10)
* add syscall for ppoll & add 2 testcases ([defedb6](https://gitee.com/openharmony/kernel_liteos_a/commits/defedb6fdf0806da4a39e22408544cdfb405f2ff))
* avoid compile warning ignored ([eca711b](https://gitee.com/openharmony/kernel_liteos_a/commits/eca711bb64a7c806ae34c8483cac73fe22b0104f)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* A核codex修改 ([ec977a1](https://gitee.com/openharmony/kernel_liteos_a/commits/ec977a1c7e9ba4ea6621ceb1d0d10e586148208d)), closes [#I40B1](https://gitee.com/openharmony/kernel_liteos_a/issues/I40B1)
* BBOX使用预留物理内存缓存故障日志 ([2ad176e](https://gitee.com/openharmony/kernel_liteos_a/commits/2ad176e587d5ed7106831a25d386a88e26192e2b)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
* bootargs解析与rootfs挂载解耦并支持自定义bootargs参数 ([80473f0](https://gitee.com/openharmony/kernel_liteos_a/commits/80473f0975fe6fd4c4eae3a8a473674ad2dd1293)), closes [#I41CL8](https://gitee.com/openharmony/kernel_liteos_a/issues/I41CL8)
* **build:** clang10.0.1支持lto去掉冗余判断 ([73223ae](https://gitee.com/openharmony/kernel_liteos_a/commits/73223ae7e652b7cd9f1e1848c32b2b2573d07b2a))
* **build:** fix rootfsdir.sh target directory not exist ([21bf2b8](https://gitee.com/openharmony/kernel_liteos_a/commits/21bf2b889931787fb18ca7ea238291fd57e76d51)), closes [#I3NHQ0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NHQ0)
* **build:** 去除冗余单板相关的宏配置 ([471de36](https://gitee.com/openharmony/kernel_liteos_a/commits/471de3663ea8b63f7448162edc0293b8723dcefc))
* clang10 lld could not recognized Oz ([87a0006](https://gitee.com/openharmony/kernel_liteos_a/commits/87a0006d5e1976fdf5efe4be383921610eb04ec6))
* clang相关编译选项隔离 ([77dcef4](https://gitee.com/openharmony/kernel_liteos_a/commits/77dcef4bc0c92d0141f7a3be0addd4d5cb533b0b)), closes [#I444](https://gitee.com/openharmony/kernel_liteos_a/issues/I444)
* codex ([101a55d](https://gitee.com/openharmony/kernel_liteos_a/commits/101a55d1199530d621f809976f0024aa8295cce8))
* codex clean ([b5370af](https://gitee.com/openharmony/kernel_liteos_a/commits/b5370af822c8e81ed2248ac8aa3bb479a0db9dae)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* compile error when fatfs disabled ([fd3f407](https://gitee.com/openharmony/kernel_liteos_a/commits/fd3f4072b5c3dff710013ccdaddf114b0e13f435))
* console compile bug fix ([f8441a0](https://gitee.com/openharmony/kernel_liteos_a/commits/f8441a0cdea301449416b0c0477dc48a05b6ab4e))
* correct spelling ([c66fe03](https://gitee.com/openharmony/kernel_liteos_a/commits/c66fe0313f76ba41992b4864c93cf82934378ad3))
* Correctly handle the return value of LOS_EventRead in QuickstartListen. ([0e0ab81](https://gitee.com/openharmony/kernel_liteos_a/commits/0e0ab81ff9474cffd5e60a8ee741840eac5d737b)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* Ctrl-C move out of LOS_MAGIC_KEY_ENABLE ([40f239a](https://gitee.com/openharmony/kernel_liteos_a/commits/40f239a7d4673dc740c853b1011b5072e48385b7))
* Delete useless 'exc interaction' macros and function declarations. ([d2f2679](https://gitee.com/openharmony/kernel_liteos_a/commits/d2f26790716c9f76589c4a7d6fa5518f9ccd743c)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* dereference NULL point bug fix ([deaa564](https://gitee.com/openharmony/kernel_liteos_a/commits/deaa564a66b83c9fe19a37b8a061ec9064ece354))
* do not build toybox temporarily ([044f2c7](https://gitee.com/openharmony/kernel_liteos_a/commits/044f2c7c17c68e10aeccc3af0c222cfc722d194c))
* do not override existing libs ([8118408](https://gitee.com/openharmony/kernel_liteos_a/commits/8118408123e75f7f5a4ab9101e388be6bba0dcda))
* **doc:** 修复README_zh-HK.md的链接错误 ([f1b4c87](https://gitee.com/openharmony/kernel_liteos_a/commits/f1b4c87bc44650348504bc00b3f6f94491c341a0))
* fatfs memory leak ([fbfd71d](https://gitee.com/openharmony/kernel_liteos_a/commits/fbfd71dfe3b5555ef09e542d96a630dfba636daa))
* fix function name OsSchedSetIdleTaskSchedParam ([8f8c038](https://gitee.com/openharmony/kernel_liteos_a/commits/8f8c038b217d5ba2518413bfc1ba857587d47442))
* Fix kernel page fault exception handling causing system exception. ([a89fb57](https://gitee.com/openharmony/kernel_liteos_a/commits/a89fb57f5795236b93fd19ee2d7a059cae1b2b1b)), closes [#I3RAN4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RAN4)
* fix length typo ([12d98b1](https://gitee.com/openharmony/kernel_liteos_a/commits/12d98b144b70e726d3fd31ddc9d17ed855d0ec1b))
* fix mq function by enable mq_notify api ([4427142](https://gitee.com/openharmony/kernel_liteos_a/commits/4427142d734df8f95f4599093392904abacc5c93))
* Fix quickstart codingstyle ([2e011b6](https://gitee.com/openharmony/kernel_liteos_a/commits/2e011b672f6b96ea7e0db066a07e3f9fb6ba5df3)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* fix stored typo ([d25560f](https://gitee.com/openharmony/kernel_liteos_a/commits/d25560f8ac3216670d198cbbb25891c394e0b3c2))
* fix syscall faccessat,fstatfs,fstatat & add 6 testcases ([aa1cd24](https://gitee.com/openharmony/kernel_liteos_a/commits/aa1cd245a5711e5b53c328b688da5ddc2e783d5f))
* fix the inappropriate errno in FatFs ([af61187](https://gitee.com/openharmony/kernel_liteos_a/commits/af61187587411dca38ff62e720451f08f19c1c82)), closes [#I3O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3O8)
* fix typo in quickstart ([3b2ff4b](https://gitee.com/openharmony/kernel_liteos_a/commits/3b2ff4b71fc5ae1dc74180c33fd66f69da0059d1)), closes [#I3M1S8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M1S8)
* Fix wrong judgment in los_trace.c to avoid null pointer access. ([4d863e9](https://gitee.com/openharmony/kernel_liteos_a/commits/4d863e985b6372f7895db57b602b662dba5cadd0)), closes [#I3RT9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RT9)
* Identical condition 'ret<0', second condition is always false. :bug: ([1348809](https://gitee.com/openharmony/kernel_liteos_a/commits/1348809807548dd481286a55a6677a9169fcd705))
* init进程收到子进程退出信号后调用fork重新拉起进程会导致系统卡死 ([35a2f3a](https://gitee.com/openharmony/kernel_liteos_a/commits/35a2f3af33a5dba1e0ba36587efced8fead97223)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
* kernel crashed after rmdir the umounted folder ([ac0d083](https://gitee.com/openharmony/kernel_liteos_a/commits/ac0d083b1c89c4ad3fdaab0347d11f174d0185cb))
* kernel crashed when delete a umounted folder ([f305d1f](https://gitee.com/openharmony/kernel_liteos_a/commits/f305d1f702a770010125a0f4f0152ffefeeec5c4))
* kernel crashed when delete a umounted folder ([c6e9212](https://gitee.com/openharmony/kernel_liteos_a/commits/c6e921241b1cf26bcbfeea44e20f6b596512e259))
* **kernel_test:** 内核mem/shm冒烟用例重复运行失败 ([0676578](https://gitee.com/openharmony/kernel_liteos_a/commits/0676578aae09c101d79e7a276823e849df293e29)), closes [#I3TH4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TH4)
* L1 toybox 命令功能实现 ([2ff44c4](https://gitee.com/openharmony/kernel_liteos_a/commits/2ff44c4938d2e66ce60e9497c505eb6e97efc8c2)), closes [#I41N2](https://gitee.com/openharmony/kernel_liteos_a/issues/I41N2)
* liteipc max data size too small ([4dc421e](https://gitee.com/openharmony/kernel_liteos_a/commits/4dc421e3decdaae60219d533c4a93dbc9334e35f))
* LiteOS_A BBOX Codex整改 ([6a5a032](https://gitee.com/openharmony/kernel_liteos_a/commits/6a5a0326d2b18ffacce5d38fb351530973c2f245)), closes [#I43](https://gitee.com/openharmony/kernel_liteos_a/issues/I43)
* Liteos-a创建的文件夹在Ubuntu中不可见 ([a9fc1e0](https://gitee.com/openharmony/kernel_liteos_a/commits/a9fc1e0e5d3e5eb8a34c568a8d147320a9afebe1)), closes [#I3XMY6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XMY6)
* lookup new vnode may cause parent vnode freeing ([902a11d](https://gitee.com/openharmony/kernel_liteos_a/commits/902a11de9a4b08e799820fb87942cb2171b9e095)), closes [#I3MYP4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3MYP4)
* **mini:** fix compile error in mini liteos_a ([e13cb3b](https://gitee.com/openharmony/kernel_liteos_a/commits/e13cb3bcc4e74d4c49c31d290d686f99a4e81e3f))
* minimal compile ([ac8c2c6](https://gitee.com/openharmony/kernel_liteos_a/commits/ac8c2c6d5b9ede0e46b48212f0b3447605a613c4))
* misspell ([08980ea](https://gitee.com/openharmony/kernel_liteos_a/commits/08980eac3c249ec6a6717d8a04fb0be7716053a1))
* mkdir -p is more robust ([e38f9a9](https://gitee.com/openharmony/kernel_liteos_a/commits/e38f9a98c9d373db8381af707c5996d1fefef64e))
* mksh compile bug fix ([d8263b1](https://gitee.com/openharmony/kernel_liteos_a/commits/d8263b1e91d76706d52df321ef642c1c8297e8e4)), closes [#I3ZMR7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZMR7)
* modify event API description ([937734b](https://gitee.com/openharmony/kernel_liteos_a/commits/937734b1e9f5fc52e0ac727549bd2e4b4c864e3c))
* move nuttx head file back ([4c8a86e](https://gitee.com/openharmony/kernel_liteos_a/commits/4c8a86ece7cafa8f74441bacc74c7788c0a1b780)), closes [#I4443](https://gitee.com/openharmony/kernel_liteos_a/issues/I4443)
* nanosleep 接口的rmtp参数被错误清零 ([9458de9](https://gitee.com/openharmony/kernel_liteos_a/commits/9458de9ac664cd75540c8b638b9a6caf82812fc8)), closes [#I41U0](https://gitee.com/openharmony/kernel_liteos_a/issues/I41U0)
* no exception information output, when the system is abnormal ([5bf4d1c](https://gitee.com/openharmony/kernel_liteos_a/commits/5bf4d1c7128e6718611bbec23cb4373bcb3bfe55))
* no exception information output, when the system is abnormal ([28aa777](https://gitee.com/openharmony/kernel_liteos_a/commits/28aa777191e7b41e4f1f346ab79f8688edc59c6d))
* no exception information output, when the system is abnormal after holding ([0ed8adf](https://gitee.com/openharmony/kernel_liteos_a/commits/0ed8adfe3ae59672e284331d40ef3b9e0bc8e094))
* Optimiz macro of quickstart cmd ([cb140a4](https://gitee.com/openharmony/kernel_liteos_a/commits/cb140a4442c02dd0b1925cc58deecbf4da36dcea)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* Optimize /dev/quickstart permissions. ([4e24b57](https://gitee.com/openharmony/kernel_liteos_a/commits/4e24b572897c33e1b2723122c0e13d3931096bae)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* Optimize quickstart node implementation ([4abd2e0](https://gitee.com/openharmony/kernel_liteos_a/commits/4abd2e0247b14718bb21756fb446142140d30a88)), closes [#I3R8O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R8O8)
* OsGerCurrSchedTimeCycle 函数存在拼写错误 ([53ced1a](https://gitee.com/openharmony/kernel_liteos_a/commits/53ced1a85edc3d06230225ced3916772f432243f)), closes [#I446](https://gitee.com/openharmony/kernel_liteos_a/issues/I446)
* OsGetArgsAddr声明所在头文件不正确 ([14bd753](https://gitee.com/openharmony/kernel_liteos_a/commits/14bd753aa8beb49af887c8d0aedaefa446409760)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
* parent point of vnode found by VfsHashGet should be updated ([f32caa5](https://gitee.com/openharmony/kernel_liteos_a/commits/f32caa52c67eca20d58676be4e0439acbb4c5ac3)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* PathCacheFree try to free name field in struct PathCache ([9f47faf](https://gitee.com/openharmony/kernel_liteos_a/commits/9f47faff732609cf2249f104b94ed55f3ef133bb)), closes [#I3NTH9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NTH9)
* PathCacheMemoryDump miscalculate the RAM usage of PathCache ([87da7c7](https://gitee.com/openharmony/kernel_liteos_a/commits/87da7c794c9bc8e311ae5242820fbf8aefd8d558)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* Provide a separate configuration macro for boot environment in RAM. ([e28e06b](https://gitee.com/openharmony/kernel_liteos_a/commits/e28e06b08f5b28091153e584cb9d93014a9f2b10))
* Provide a separate configuration macro for boot environment in RAM. ([bc67393](https://gitee.com/openharmony/kernel_liteos_a/commits/bc67393a67f714e0a8165b6103e53699c676341c))
* Provide a separate configuration macro for boot environment in RAM. ([f13b90e](https://gitee.com/openharmony/kernel_liteos_a/commits/f13b90e4308ba3d60683799b9ce62fb3705ac277)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* race condition in liteipc ([7e2aef2](https://gitee.com/openharmony/kernel_liteos_a/commits/7e2aef2480b15f71ee0e089cef4443f578e03dbb)), closes [#I3PW5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PW5)
* rebuild mksh depends on rebuild.sh script ([bef4ab9](https://gitee.com/openharmony/kernel_liteos_a/commits/bef4ab9835dec865898c74337dfb7154718b94aa))
* remove redundant headfile ([73a7777](https://gitee.com/openharmony/kernel_liteos_a/commits/73a777777e1b834192f6bb2c0e8bd03c69765c11)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* Remove redundant invalid codes ([fe05df4](https://gitee.com/openharmony/kernel_liteos_a/commits/fe05df40ae710632adb1bd54fb04ad4a8e0c1429)), closes [#I3R70](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R70)
* Show conflicting files for git apply or patch -p command ([35f7957](https://gitee.com/openharmony/kernel_liteos_a/commits/35f79579758644cbcac6005f894be21f34f42b99)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* SIOCGIFCONF ioctl malloc size error in kernel ([bfd27e7](https://gitee.com/openharmony/kernel_liteos_a/commits/bfd27e78b259eedbd4c30548e80c9b4d789d26e1)), closes [#I3XEZ3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XEZ3)
* smp启动代码解耦及内存映射关系解耦 ([3bb3173](https://gitee.com/openharmony/kernel_liteos_a/commits/3bb3173604dc4dea09301f61da402974185dc112)), closes [#I41P8](https://gitee.com/openharmony/kernel_liteos_a/issues/I41P8)
* some branch in format does not release the vnode mutex properly ([9b2b700](https://gitee.com/openharmony/kernel_liteos_a/commits/9b2b700fa0e3a8edadb38f09c917a3e3f013347f)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* Sortlink, the response time to insert the node should be inserted into the back of the existing node. ([1323874](https://gitee.com/openharmony/kernel_liteos_a/commits/1323874389030c55fb053fead12ca1c6654d8851)), closes [#I3PSJ8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PSJ8)
* statfs can't get f_bfree and f_bavail of a FAT12/FAT16 partition ([9503c4a](https://gitee.com/openharmony/kernel_liteos_a/commits/9503c4a9fc30aaa8ea2031d4fb794436f3c98055)), closes [#I3Q0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0)
* SysOpenat返回值应该为进程fd而非系统全局fd。 ([3457c0b](https://gitee.com/openharmony/kernel_liteos_a/commits/3457c0b11debb2cf5d4abe325c2510a750654512)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* the total used vnode number not increased after unlink a file under ([4f514a1](https://gitee.com/openharmony/kernel_liteos_a/commits/4f514a16af5a3f3b9c4ea182de774297afb17f66)), closes [#I3TS1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TS1)
* tick 动态化计算优化,消除中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。 ([8df3e8c](https://gitee.com/openharmony/kernel_liteos_a/commits/8df3e8c96515a1907455a9bbc61426f43c803c62)), closes [#I43](https://gitee.com/openharmony/kernel_liteos_a/issues/I43)
* toybox update ([c3245b3](https://gitee.com/openharmony/kernel_liteos_a/commits/c3245b3ce317eb58c8dad58fdfc7f094b9b9794b))
* toybox命令升级 ([76f45b3](https://gitee.com/openharmony/kernel_liteos_a/commits/76f45b3fb2783d1cab45a6ba08787c29dfa2c948)), closes [#I41N2](https://gitee.com/openharmony/kernel_liteos_a/issues/I41N2)
* update LOS_DL_LIST_IS_END comment ([900269b](https://gitee.com/openharmony/kernel_liteos_a/commits/900269bd4645252d898f6d3b73de01d8548c960c))
* userfs分区的起始地址与大小改为通过bootargs配置 ([2e2b142](https://gitee.com/openharmony/kernel_liteos_a/commits/2e2b14205f4b81c7483ab42d62f144487097e9a4)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* VnodeInUseIter and VnodeFreeAll used to be recursive ([5f6656c](https://gitee.com/openharmony/kernel_liteos_a/commits/5f6656cb36a2ffb0b290aeb53981aba7501e80b2)), closes [#I3NN3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN3)
* 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效 ([67ac8c4](https://gitee.com/openharmony/kernel_liteos_a/commits/67ac8c4c586adc371ece56700fd42371ca7fc885)), closes [#I45HP5](https://gitee.com/openharmony/kernel_liteos_a/issues/I45HP5)
* 修复FATFS中不同内部接口不支持FAT12/FAT16 FAT表结束标志 ([33f5c70](https://gitee.com/openharmony/kernel_liteos_a/commits/33f5c70e6c8781758d2bfde0f60ca3d6ec7d543f)), closes [#I409R6](https://gitee.com/openharmony/kernel_liteos_a/issues/I409R6)
* 修复kill进程时因liteipc阻塞的进程概率无法退出问题 ([7de43bb](https://gitee.com/openharmony/kernel_liteos_a/commits/7de43bb004a12f926550f0b36ca3c2fa610feb27)), closes [#I3XX7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XX7)
* 修复MagicKey数组越界访问 ([071cd62](https://gitee.com/openharmony/kernel_liteos_a/commits/071cd6268aeaaef702387dacaf4ef1ffbb7618fc)), closes [#I3U4N9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U4N9)
* 修复mprotect修改地址区间的权限后相应的区间名丢失问题 ([e425187](https://gitee.com/openharmony/kernel_liteos_a/commits/e425187d176a5e09bc5253faefc9cfc8454da0a3)), closes [#I43R40](https://gitee.com/openharmony/kernel_liteos_a/issues/I43R40)
* 修复mq_close关闭后仍然占用文件描述符的问题 ([590c7b4](https://gitee.com/openharmony/kernel_liteos_a/commits/590c7b4e22662781d05ad035a785e985d573ec33)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* 修复mqueue问题 ([26ee8b8](https://gitee.com/openharmony/kernel_liteos_a/commits/26ee8b836e346e641de4ecd72284f5d377bca6f8)), closes [#I43P4](https://gitee.com/openharmony/kernel_liteos_a/issues/I43P4)
* 修复sigwait等待到的信号值与获取的siginfo中的值不一致 ([ed7defb](https://gitee.com/openharmony/kernel_liteos_a/commits/ed7defbd439c345a07159d40eb04433afd530004)), closes [#I3M12](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M12)
* 修复了LOSCFG_FS_FAT_VIRTUAL_PARTITION宏开关错误作用域引起的功能错误 ([acda419](https://gitee.com/openharmony/kernel_liteos_a/commits/acda419a2d773ea890052a16ee66b4872f941fbb)), closes [#I3W1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W1)
* 修复了内核的VFAT测试用例 ([a8384b5](https://gitee.com/openharmony/kernel_liteos_a/commits/a8384b5db2274d50a350910d7cfd3fc36b4f4103)), closes [#I3XF3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XF3)
* 修复内核access chmod chown接口 ([56a95b9](https://gitee.com/openharmony/kernel_liteos_a/commits/56a95b9ec903f815f9199ac65ca318e00a83b2ed)), closes [#I3Z5L6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z5L6)
* 修复内核c库的makefile中被优化函数替换的高频函数依然参与了编译的问题 ([6f6dc4f](https://gitee.com/openharmony/kernel_liteos_a/commits/6f6dc4f24c8ab05a6d42da46a9fa41d74a477bd7)), closes [#I3XGM8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XGM8)
* 修复内核堆完整性检查逻辑中访问非法指针导致系统异常问题。 ([30f5ab8](https://gitee.com/openharmony/kernel_liteos_a/commits/30f5ab89b72d45f596b15af82a8e8e01add7977d)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* 修复启动框架debug模式下-Werror=maybe-uninitialized告警以及符号链接不进镜像的隐患 ([4c02415](https://gitee.com/openharmony/kernel_liteos_a/commits/4c024159a9600745863e49ee955308470a5b657b)), closes [#I3T5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T5)
* 修复开机概率挂死 ([2e82c36](https://gitee.com/openharmony/kernel_liteos_a/commits/2e82c361f73b2119613c3571c48faae8ec41d4eb)), closes [#I3SWY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SWY2)
* 修复文档链接失效问题 ([42a3a6c](https://gitee.com/openharmony/kernel_liteos_a/commits/42a3a6c51bfca4ade8ce94084ea2f8eb1c86a137)), closes [#I45297](https://gitee.com/openharmony/kernel_liteos_a/issues/I45297)
* 修改/proc/mounts显示格式 ([6860246](https://gitee.com/openharmony/kernel_liteos_a/commits/6860246cfaac6f540665e79bbc4c3d54c419b092)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* 修改clock_gettime接口适配posix标准测试用例011输入clk_id错误时返回值ESRCH为EINVAL. ([f8cf6e6](https://gitee.com/openharmony/kernel_liteos_a/commits/f8cf6e6439ee017fe8e0d4ecfc9949c28fa6775f)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* 修改DoNanoSleep 以纳秒为单位 ([6917e08](https://gitee.com/openharmony/kernel_liteos_a/commits/6917e08431689ccbd5a30e9a39b67016ffb64d0a)), closes [#I3Z9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z9)
* 修改某些平台保存bbox日志失败的问题 ([8f6a1dd](https://gitee.com/openharmony/kernel_liteos_a/commits/8f6a1dd33c59164070e8d2fb5abbd3e76ef8ac8e)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
* 修改默认窗口宽度到400 ([09c491c](https://gitee.com/openharmony/kernel_liteos_a/commits/09c491ca1fd6d3110eafb0d07e45b25bdc3bd5d0)), closes [#I40](https://gitee.com/openharmony/kernel_liteos_a/issues/I40)
* 关闭jffs和fat后rootfs配置也被相应关闭导致nand介质的rootfs不可用。 ([0ea476b](https://gitee.com/openharmony/kernel_liteos_a/commits/0ea476b9741fabd3c255c2770688f587920cf509)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* 内核态在console初始化完成后使用printf无法正常打印 ([44ce696](https://gitee.com/openharmony/kernel_liteos_a/commits/44ce6969048c2e252f3f9d66fa485c77bdab8ae7)), closes [#I3UG00](https://gitee.com/openharmony/kernel_liteos_a/issues/I3UG00)
* 去掉冗余的strip操作 ([7819d15](https://gitee.com/openharmony/kernel_liteos_a/commits/7819d15b3619681ae37a1349a6bec2440c829ae9)), closes [#I43767](https://gitee.com/openharmony/kernel_liteos_a/issues/I43767)
* 合并进程栈两个地址连续的region ([42f374d](https://gitee.com/openharmony/kernel_liteos_a/commits/42f374dd7a353f1c8227e92fa92827c1c7b32424)), closes [#I43](https://gitee.com/openharmony/kernel_liteos_a/issues/I43)
* 在内核提示No idle TCB时增加打印当前系统任务信息以方便问题定位。 ([11a9b00](https://gitee.com/openharmony/kernel_liteos_a/commits/11a9b00d43a6dbe9fba9f6eb07d78a9d226c28f8)), closes [#I434](https://gitee.com/openharmony/kernel_liteos_a/issues/I434)
* 增加表头,内容以制表符分栏。 ([e9ad6b7](https://gitee.com/openharmony/kernel_liteos_a/commits/e9ad6b71c3b1136414672cd21b339ded7a02dfb9)), closes [#I3W2M9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W2M9)
* 将用户态内存调测解析脚本移至tools目录下 ([85b4cb7](https://gitee.com/openharmony/kernel_liteos_a/commits/85b4cb7a67b717984d3ebf68115c7139cc61d690)), closes [#I42T9](https://gitee.com/openharmony/kernel_liteos_a/issues/I42T9)
* 恢复了FATFS设置卷标的功能 ([9515d53](https://gitee.com/openharmony/kernel_liteos_a/commits/9515d53dccc9a6458bfbaf8e15143928f05cb660)), closes [#I3Y5G8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Y5G8)
* 解决kill进程时无法保证进程的已持有的内核资源合理释放. ([cf89f01](https://gitee.com/openharmony/kernel_liteos_a/commits/cf89f016e93f28f8d72e6f5de08640d08a155908)), closes [#I3S0N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0N0)
* 解决不同环境下计算的rootfs的size偏小导致mcopy造成的disk full错误 ([c54879b](https://gitee.com/openharmony/kernel_liteos_a/commits/c54879b54875abece53b1f64072cfacbd2e1970e)), closes [#I3IA06](https://gitee.com/openharmony/kernel_liteos_a/issues/I3IA06)
* 设置qemu默认userfs大小/修改qemu驱动目录 ([1d952a2](https://gitee.com/openharmony/kernel_liteos_a/commits/1d952a254a6e7ec2f70f7112eb27355cfd01ba4d)), closes [#I3XW96](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XW96) [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
### Features
* active mksh & toybox ([cacb4f0](https://gitee.com/openharmony/kernel_liteos_a/commits/cacb4f0103ecb2d1b7af54d84957f88d3e9443d2)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* Add /dev/quickstart to support synchronous communication between processes in user mode startup. ([46b63f7](https://gitee.com/openharmony/kernel_liteos_a/commits/46b63f71537789743ed2f3f337c1809ee4900d71)), closes [#I3OHO5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OHO5)
* add /proc/fd file to dump the pid/fd/path information ([600dded](https://gitee.com/openharmony/kernel_liteos_a/commits/600dded31e80df275ed08c326c0ce3d1857d8dd8)), closes [#I3WB5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WB5)
* add /proc/fs_cache to display cache info ([231cb6b](https://gitee.com/openharmony/kernel_liteos_a/commits/231cb6be27380948bc48136ae2e02c28450f47a8)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* add /proc/fs_cache to display cache info ([53c6d96](https://gitee.com/openharmony/kernel_liteos_a/commits/53c6d96c6f97cb006216769f8b73f50fba3bc325)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* add and fix some syscall ([ce849f2](https://gitee.com/openharmony/kernel_liteos_a/commits/ce849f2145e1569517c5244c9ffcaebed53f3a66))
* add blackbox for liteos_a ([a195aac](https://gitee.com/openharmony/kernel_liteos_a/commits/a195aac9fb60b0163f9eebb29084287d226bd14c)), closes [#I406](https://gitee.com/openharmony/kernel_liteos_a/issues/I406)
* add blackbox for liteos_a ([425975e](https://gitee.com/openharmony/kernel_liteos_a/commits/425975e4811023e31a520979c20ea2562224d9d0)), closes [#I3NN7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN7)
* add clear cache cmd to /proc/fs_cache ([3d1cf68](https://gitee.com/openharmony/kernel_liteos_a/commits/3d1cf683f37a6f75e9db2ce1f11ec93159b77663)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* add liteos patch ability ([98ca844](https://gitee.com/openharmony/kernel_liteos_a/commits/98ca8441fe75ee1c3318a6a09376fd72f5a51350))
* add support for gn build system ([a8805a6](https://gitee.com/openharmony/kernel_liteos_a/commits/a8805a65aab9109b915364fccf36c8328f636e48))
* add uid/gid for ProcFs ([6780659](https://gitee.com/openharmony/kernel_liteos_a/commits/67806596a3c0df9a54893d8c74ebe9da98d7fb06)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* A核proc文件系统在echo模式下新增write的功能 ([f10dd7c](https://gitee.com/openharmony/kernel_liteos_a/commits/f10dd7c135d37a5fb0d78610d5ece5807d01eb1f)), closes [#I3T6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T6)
* build OHOS_Image from kernel ([abf4d8f](https://gitee.com/openharmony/kernel_liteos_a/commits/abf4d8fb252631aca9d46211762880a23be2a0b1))
* **build:** make liteos_config_file available as gn argument ([f9a9077](https://gitee.com/openharmony/kernel_liteos_a/commits/f9a907772f506ca7e2d84e96d4d17cffc7dae50f))
* **build:** 使用xts -notest选项时内核用例不参与编译构建和用例编译配置方式调整 ([9bdf716](https://gitee.com/openharmony/kernel_liteos_a/commits/9bdf716407c125c9877b6f49c2133112c18cdabc))
* don't apply module_swith on configs of config ([f3beb4b](https://gitee.com/openharmony/kernel_liteos_a/commits/f3beb4b273c9a76fbfaffe57302f27d2a74cd2ba))
* enable gn build for toybox and mksh ([c54bfa1](https://gitee.com/openharmony/kernel_liteos_a/commits/c54bfa16e3907482c252e9738192df869c63326e))
* fatfs支持符号链接功能 ([e50cf0b](https://gitee.com/openharmony/kernel_liteos_a/commits/e50cf0be6f6d118022b6d79c5177aece574ba150)), closes [#I3V8D1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8D1)
* **file system:** add memory-based romfs ([c4595d2](https://gitee.com/openharmony/kernel_liteos_a/commits/c4595d25042b188570d991a815009764c37f3cb3)), closes [#I3S0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0)
* introduce mksh toybox to rootfs ([41c7689](https://gitee.com/openharmony/kernel_liteos_a/commits/41c7689dfa49c52fb15705ce15ef22a278fbf2ef))
* L0-L1 支持Trace ([dc9ec68](https://gitee.com/openharmony/kernel_liteos_a/commits/dc9ec6856fe14aa604f037f55f17a3ba2bafb098)), closes [#I46WA0](https://gitee.com/openharmony/kernel_liteos_a/issues/I46WA0)
* L1支持低功耗投票框架 ([21d8ac8](https://gitee.com/openharmony/kernel_liteos_a/commits/21d8ac8752469f6e0dc2d50d28b75421f665385a)), closes [#I3VS5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VS5)
* **libc:** upgrade optimized-routines to v21.02 ([1ec8d5a](https://gitee.com/openharmony/kernel_liteos_a/commits/1ec8d5a454658e95c4acb821d0878f357f4e82ad))
* **make:** optimize makefiles and remove some unused files ([0e26094](https://gitee.com/openharmony/kernel_liteos_a/commits/0e260949c962158a263d4b0ad45fe9f6843d6e30))
* Open macro for ADC moudule ([c71ec9d](https://gitee.com/openharmony/kernel_liteos_a/commits/c71ec9d7e8574078a9dc2a8463f3141cca3d625a))
* **QEMU_ARM_VIRT_CA7:** 使能FAT文件系统编译选项 ([49856dc](https://gitee.com/openharmony/kernel_liteos_a/commits/49856dc1e0de1c5e92346c83eda641dfb1bb16be))
* support .mkshrc ([51a50c9](https://gitee.com/openharmony/kernel_liteos_a/commits/51a50c95b4cd47b6931523926b728d1c0ff8988b)), closes [#I3Y5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Y5)
* support link/symlink/readlink ([6eddc86](https://gitee.com/openharmony/kernel_liteos_a/commits/6eddc869d349be59860bfd84ff10b7579a9b00a9)), closes [#I3Q0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0)
* support toybox in qemu ([5618319](https://gitee.com/openharmony/kernel_liteos_a/commits/561831928bb1ad1871b2d60d2bba2d67488cea5f)), closes [#I3V17](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V17)
* timer_create支持以SIGEV_THREAD方式创建定时器 ([e5f6bf0](https://gitee.com/openharmony/kernel_liteos_a/commits/e5f6bf05567c2d193f3746caca502199e7b81e92)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
* using kconfiglib instead of kconfig ([8784694](https://gitee.com/openharmony/kernel_liteos_a/commits/878469468647a19f704e7ee2af696b0ba8ab775a))
* vfs support sdcard hotplug ([2db80ec](https://gitee.com/openharmony/kernel_liteos_a/commits/2db80ecb389176b53c77807567895470bb180a06)), closes [#I44WH1](https://gitee.com/openharmony/kernel_liteos_a/issues/I44WH1)
* **vfs:** vfs支持FD_CLOEXEC标记 ([27dca4d](https://gitee.com/openharmony/kernel_liteos_a/commits/27dca4d857ef8de6b4bb9302e0dd435be7e3284f)), closes [#I3U81](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U81)
* 删除zpfs冗余代码 ([3393479](https://gitee.com/openharmony/kernel_liteos_a/commits/3393479c52f4a9dfe2394bb32beb4b98fca8e171))
* 基于汇编实现内核对用户态内存清零的功能 ([9db3407](https://gitee.com/openharmony/kernel_liteos_a/commits/9db3407589bb0b2d4a5772faac3130032bc0b8a9)), closes [#I3XXT0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XXT0)
* 增加mount的MS_RDONLY标志的支持 ([8729f6e](https://gitee.com/openharmony/kernel_liteos_a/commits/8729f6ee57ea57bc664d076ff112c8726fedded9)), closes [#I3Z1W6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z1W6)
* 支持killpg和waitid ([dc3cc09](https://gitee.com/openharmony/kernel_liteos_a/commits/dc3cc094a75c6da65d87522930afea06106d3933))
* 新增toybox reboot命令 ([e567a10](https://gitee.com/openharmony/kernel_liteos_a/commits/e567a10d021c3e0fe02d6911dbe8687255c67ffa)), closes [#I3YQ7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3YQ7)
* 给开发者提供系统信息导出Hidumper工具。 ([cb17fa5](https://gitee.com/openharmony/kernel_liteos_a/commits/cb17fa50ed28e6e8f59b7d68ede13c759b983311)), closes [#I3NN7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN7)
* 自研shell命令回补 ([7bc68f4](https://gitee.com/openharmony/kernel_liteos_a/commits/7bc68f454ff5fbf415712c9b8479b8c832f68417)), closes [#I44U0](https://gitee.com/openharmony/kernel_liteos_a/issues/I44U0)
### Performance Improvements
* assign '-1' to uninitialized variable: ret ([e0a27ba](https://gitee.com/openharmony/kernel_liteos_a/commits/e0a27badde20868cf3a5b4a44305b90af00e4f3f))
### Reverts
* Revert "fix: 修改默认窗口宽度到400" ([1878849](https://gitee.com/openharmony/kernel_liteos_a/commits/187884937cd087e39a28c033c41033163d6b4766)), closes [#I42X9](https://gitee.com/openharmony/kernel_liteos_a/issues/I42X9)
### BREAKING CHANGES
* 1.新增一系列trace的对外API位于los_trace.h中.
LOS_TRACE_EASY简易插桩
LOS_TRACE标准插桩
LOS_TraceInit配置Trace缓冲区的地址和大小
LOS_TraceStart开启事件记录
LOS_TraceStop停止事件记录
LOS_TraceRecordDump输出Trace缓冲区数据
LOS_TraceRecordGet获取Trace缓冲区的首地址
LOS_TraceReset清除Trace缓冲区中的事件
LOS_TraceEventMaskSet设置事件掩码仅记录某些模块的事件
LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数
* **vfs:** 执行exec类函数后进程拥有的文件描述符情况发生变化修改前默认关闭所有的进程文件描述符012重新打开修改后除非文件描述符拥有FD_CLOEXEC标记否则该描述符不会被关闭。

View File

@@ -265,7 +265,7 @@ config MEM_LEAKCHECK
default n
depends on DEBUG_VERSION && MEM_DEBUG
help
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the informations of mem node.
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node.
config BASE_MEM_NODE_INTEGRITY_CHECK
bool "Enable integrity check or not"
default n

View File

@@ -82,9 +82,6 @@ endif
ifeq ($(LOSCFG_STORAGE_SPINAND), y)
FSTYPE = yaffs2
endif
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
FSTYPE = jffs2
endif
ROOTFS_DIR = $(OUT)/rootfs
ROOTFS_ZIP = $(OUT)/rootfs.zip
@@ -121,7 +118,7 @@ sysroot:
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
ifeq ($(origin SYSROOT_PATH),file)
$(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \
ln -snf $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/build/Makefile && \
ln -snf $(LITEOSTOPDIR)/../../third_party/musl/scripts/build_lite/Makefile && \
$(MAKE) TARGETS=liteos_a_user \
ARCH=$(ARCH) \
TARGET=$(LOSCFG_LLVM_TARGET) \

View File

@@ -15,7 +15,7 @@
-->
<!--
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
This is the configuration file template for OpenHarmony OSS Audit Tool. Please copy it to your project root dir and modify it by referring to OpenHarmony/tools_oat/README.
-->
<configuration>
@@ -24,6 +24,7 @@
<policylist>
<policy name="projectPolicy" desc="">
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
<policyitem type="copyright" name="Huawei Device Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
</policy>
</policylist>
@@ -38,7 +39,7 @@
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="defaultPolicyFilter" desc="Filters for compatibilitylicense header policies">
<filefilter name="defaultPolicyFilter" desc="Filters for license header policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->

View File

@@ -4,10 +4,10 @@
- [Directory Structure](#section161941989596)
- [Constraints](#section119744591305)
- [Usage](#section741617511812)
- [Preparations](#section1579912573329)
- [Source Code Acquisition](#section11443189655)
- [Compilation and Building](#section2081013992812)
- [Preparations](#section1579912573329)
- [Source Code Acquisition](#section11443189655)
- [Compilation and Building](#section2081013992812)
- [Contribution](#section1371123476304)
- [Repositories Involved](#section1371113476307)
## Introduction<a name="section11660541593"></a>
@@ -67,24 +67,33 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
## Usage<a name="section741617511812"></a>
OpenHarmony LiteOS Cortex-A supports the [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md). You can develop and run your applications based on this development board.
OpenHarmony LiteOS Cortex-A supports the [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-appendix-hi3516.md). You can develop and run your applications based on this development board.
### Preparations<a name="section1579912573329"></a>
You need to set up the compilation environment on Linux.
You need to set up the compilation environment on Ubuntu.
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-env-setup.md)
- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md).
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/Readme-EN.md)
### Source Code Acquisition<a name="section11443189655"></a>
Download and decompress a set of source code on a Linux server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
Download and decompress a set of source code on a Ubuntu server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
### Compilation and Building<a name="section2081013992812"></a>
For details about how to develop the first application, see:
For details about how to develop the first application, see: [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)
- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)
For compilation, please refer to the [compilation instructions](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-build.md).
## Contribution<a name="section1371123476304"></a>
[How to involve](https://gitee.com/openharmony/docs/blob/HEAD/en/contribute/contribution.md)
[Commit message spec](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
[C&C++ Secure Coding Guide](https://gitee.com/openharmony/docs/blob/master/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
[LiteOS-A Kernel Coding Style Guide](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
## Repositories Involved<a name="section1371113476307"></a>

View File

@@ -4,10 +4,10 @@
- [目錄](#section161941989596)
- [約束](#section119744591305)
- [使用說明](#section741617511812)
- [準備](#section1579912573329)
- [獲取源碼](#section11443189655)
- [編譯構建](#section2081013992812)
- [準備](#section1579912573329)
- [獲取源碼](#section11443189655)
- [編譯構建](#section2081013992812)
- [貢獻](#section1371123476304)
- [相關倉](#section1371113476307)
## 簡介<a name="section11660541593"></a>
@@ -67,24 +67,33 @@ OpenHarmony LiteOS-A內核是基於Huawei LiteOS內核演進發展的新一代
## 使用說明<a name="section741617511812"></a>
OpenHarmony LiteOS-A內核支持Hi3516DV300[介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)單板,開發者可基於此單板開發運行自己的應用程序。
OpenHarmony LiteOS-A內核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-hi3516.md)單板,開發者可基於此單板開發運行自己的應用程序。
### 準備<a name="section1579912573329"></a>
開發者需要在Linux上搭建編譯環境:
開發者需要在Ubuntu上搭建編譯環境:
- [編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md);
- Hi3516DV300單板參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
- [編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md);
### 獲取源碼<a name="section11443189655"></a>
Linux服務器上下載並解壓一套源代碼,源碼獲取方式參考[源碼獲取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
Ubuntu服務器上下載並解壓一套源代碼,源碼獲取方式參考[源碼獲取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
### 編譯構建<a name="section2081013992812"></a>
開發者開發第一個應用程序可參考:
開發者開發第一個應用程序可參考:[helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)。
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)
編譯可以參考:[編譯指導](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-build.md)
## 貢獻<a name="section1371123476304"></a>
[如何貢獻](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
[Commit message規範](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
[OpenHarmony C&C++ 安全編程指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
[LiteOS-A 內核編碼規範指南](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
## 相關倉<a name="section1371113476307"></a>

View File

@@ -4,10 +4,10 @@
- [目录](#section161941989596)
- [约束](#section119744591305)
- [使用说明](#section741617511812)
- [准备](#section1579912573329)
- [获取源码](#section11443189655)
- [编译构建](#section2081013992812)
- [准备](#section1579912573329)
- [获取源码](#section11443189655)
- [编译构建](#section2081013992812)
- [贡献](#section1371123476304)
- [相关仓](#section1371113476307)
## 简介<a name="section11660541593"></a>
@@ -33,6 +33,7 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
│ ├── quickstart # 系统快速启动接口目录
│ ├── random # 随机数设备驱动
│ └── video # framebuffer驱动框架
├── figures # 内核架构图
├── fs # 文件系统模块主要来源于NuttX开源项目
│ ├── fat # fat文件系统
│ ├── jffs2 # jffs2文件系统
@@ -54,7 +55,9 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
│ ├── include # 对外暴露头文件存放目录
│ └── uart # 串口相关逻辑代码
├── security # 安全特性相关的代码包括进程权限管理和虚拟id映射管理
├── shell # 接收用户输入的命令,内核去执行
├── syscall # 系统调用
├── testsuilts # 测试套件
└── tools # 构建工具及相关配置和代码
```
@@ -66,24 +69,33 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
## 使用说明<a name="section741617511812"></a>
OpenHarmony LiteOS-A内核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)单板。开发者可基于此单板开发运行自己的应用程序。
OpenHarmony LiteOS-A内核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-hi3516.md)单板。开发者可基于此单板开发运行自己的应用程序。
### 准备<a name="section1579912573329"></a>
开发者需要在Linux上搭建编译环境:
开发者需要在Ubuntu上搭建编译环境:
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md);
- Hi3516DV300单板参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md);
### 获取源码<a name="section11443189655"></a>
Linux服务器上下载并解压一套源代码源码获取方式参考[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
Ubuntu服务器源码获取方式参考: [源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
### 编译构建<a name="section2081013992812"></a>
开发者开发第一个应用程序可参考:
如果这是您的首次应用程序开发,可参考:[helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)。
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)
编译可以参考:[编译指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-build.md)
## 贡献<a name="section1371123476304"></a>
[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
[Commit message规范](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
[OpenHarmony C&C++ 安全编程指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
[LiteOS-A 内核编码规范指南](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
## 相关仓<a name="section1371113476307"></a>

View File

@@ -180,7 +180,8 @@ static void LmsStrcpyTest(void)
return;
}
char *testStr = "bbbbbbbbbbbbbbbbb";
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n", strlen(testStr) + 1);
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n",
(int)strlen(testStr) + 1);
strcpy(buf, testStr);
free(buf);
printf("\n-------- LmsStrcpyTest End --------\n");

View File

@@ -42,7 +42,7 @@ copy("copy_mksh_src") {
build_ext_component("build_mksh") {
deps = [ ":copy_mksh_src" ]
deps += [ "//prebuilts/lite/sysroot" ]
deps += [ "//third_party/musl:sysroot_lite" ]
exec_path = rebase_path("$target_out_dir/mksh_build")
cflags = [

View File

@@ -62,7 +62,7 @@ int main(int argc, char **argv)
PerfStop(fd);
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
if (size <= 0) {
if (size == 0) {
goto EXIT:
}

View File

@@ -32,13 +32,15 @@
#ifndef _SHELL_PRI_H
#define _SHELL_PRI_H
#include "shell.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern void *ShellEntry(void *argv);
extern void ShellEntry(ShellCB *shellCB);
extern void *ShellTask(void *argv);
#ifdef __cplusplus

View File

@@ -32,6 +32,7 @@
#ifndef _SHMSG_H
#define _SHMSG_H
#include "shell_list.h"
#include "shell.h"
#ifdef __cplusplus
@@ -61,8 +62,7 @@ extern "C" {
typedef void (* OutputFunc)(const char *fmt, ...);
extern int ShellTaskInit(ShellCB *shellCB);
extern int ShellEntryInit(ShellCB *shellCB);
extern void ChildExec(const char *cmdName, char *const paramArray[]);
extern void ChildExec(const char *cmdName, char *const paramArray[], bool foreground);
extern void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB);
extern int ShellNotify(ShellCB *shellCB);

View File

@@ -31,13 +31,16 @@
#define _GNU_SOURCE
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/syscall.h>
#include "show.h"
#include "shmsg.h"
#include "shcmd.h"
#include "shell_pri.h"
#include "semaphore.h"
#include "securec.h"
#include "unistd.h"
#include <sys/syscall.h>
ShellCB *g_shellCB = NULL;
@@ -46,7 +49,7 @@ ShellCB *OsGetShellCb()
return g_shellCB;
}
void ShellDeinit(ShellCB *shellCB)
static void ShellDeinit(ShellCB *shellCB)
{
(void)pthread_mutex_destroy(&shellCB->historyMutex);
(void)pthread_mutex_destroy(&shellCB->keyMutex);
@@ -62,32 +65,23 @@ static int OsShellCreateTask(ShellCB *shellCB)
ret = sched_getparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
ret = sched_setparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
ret = ShellTaskInit(shellCB);
if (ret != SH_OK) {
goto OUT;
return ret;
}
ret = ShellEntryInit(shellCB);
if (ret != SH_OK) {
goto OUT;
}
(void)pthread_join(shellCB->shellTaskHandle, NULL);
(void)pthread_join(shellCB->shellEntryHandle, NULL);
OUT:
ShellDeinit(shellCB);
return ret;
shellCB->shellEntryHandle = pthread_self();
return 0;
}
static int DoShellExec(char **argv)
@@ -98,7 +92,7 @@ static int DoShellExec(char **argv)
char *cmdLine = NULL;
if (strncmp(argv[0], SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
ChildExec(argv[1], argv + 1);
ChildExec(argv[1], argv + 1, FALSE);
}
for (i = 0; argv[i]; i++) {
len += strlen(argv[i]);
@@ -125,11 +119,22 @@ static int DoShellExec(char **argv)
return ret;
}
static void ShellSigChildHook(int sig)
{
(void)sig;
while (waitpid(-1, NULL, WNOHANG) > 0) {
continue;
}
}
int main(int argc, char **argv)
{
int ret = SH_NOK;
ShellCB *shellCB = NULL;
(void)signal(SIGCHLD, ShellSigChildHook);
if (argc > 1) {
ret = DoShellExec(argv + 1);
return ret;
@@ -139,7 +144,7 @@ int main(int argc, char **argv)
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
if (shellCB == NULL) {
goto ERR_OUT1;
return SH_NOK;
}
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
if (ret != SH_OK) {
@@ -165,7 +170,14 @@ int main(int argc, char **argv)
sem_init(&shellCB->shellSem, 0, 0);
g_shellCB = shellCB;
return OsShellCreateTask(shellCB);
ret = OsShellCreateTask(shellCB);
if (ret != SH_OK) {
ShellDeinit(shellCB);
g_shellCB = NULL;
return ret;
}
ShellEntry(shellCB);
ERR_OUT3:
(void)pthread_mutex_destroy(&shellCB->historyMutex);

View File

@@ -351,7 +351,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
return cmdName;
}
void ChildExec(const char *cmdName, char *const paramArray[])
void ChildExec(const char *cmdName, char *const paramArray[], bool foreground)
{
int ret;
pid_t gid;
@@ -367,10 +367,12 @@ void ChildExec(const char *cmdName, char *const paramArray[])
exit(1);
}
ret = tcsetpgrp(STDIN_FILENO, gid);
if (ret != 0) {
printf("tcsetpgrp failed, errno %d\n", errno);
exit(1);
if (!foreground) {
ret = tcsetpgrp(STDIN_FILENO, gid);
if (ret != 0) {
printf("tcsetpgrp failed, errno %d\n", errno);
exit(1);
}
}
ret = execve(cmdName, paramArray, NULL);
@@ -404,20 +406,30 @@ int CheckExit(const char *cmdName, const CmdParsed *cmdParsed)
exit(ret);
}
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, const CmdParsed *cmdParsed)
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, CmdParsed *cmdParsed)
{
bool foreground = FALSE;
int ret;
pid_t forkPid;
if (strncmp(cmdline, CMD_EXEC_COMMAND, CMD_EXEC_COMMAND_BYTES) == 0) {
if ((cmdParsed->paramCnt > 1) && (strcmp(cmdParsed->paramArray[cmdParsed->paramCnt - 1], "&") == 0)) {
free(cmdParsed->paramArray[cmdParsed->paramCnt - 1]);
cmdParsed->paramArray[cmdParsed->paramCnt - 1] = NULL;
cmdParsed->paramCnt--;
foreground = TRUE;
}
forkPid = fork();
if (forkPid < 0) {
printf("Faild to fork from shell\n");
printf("Failed to fork from shell\n");
return;
} else if (forkPid == 0) {
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray);
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray, foreground);
} else {
waitpid(forkPid, 0, 0);
if (!foreground) {
(void)waitpid(forkPid, 0, 0);
}
ret = tcsetpgrp(STDIN_FILENO, getpid());
if (ret != 0) {
printf("tcsetpgrp failed, errno %d\n", errno);
@@ -567,20 +579,10 @@ static void ExecCmdline(const char *cmdline)
free(output);
}
void RecycleZombieChild(void)
{
while (waitpid(-1, NULL, WNOHANG) > 0) {
continue;
}
}
static void ShellCmdProcess(ShellCB *shellCB)
{
char *buf = NULL;
while (1) {
/* recycle zombine child process */
RecycleZombieChild();
buf = GetCmdline(shellCB);
char *buf = GetCmdline(shellCB);
if (buf == NULL) {
break;
}
@@ -654,25 +656,19 @@ static int ShellKernelReg(unsigned int shellHandle)
return ioctl(STDIN_FILENO, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
}
void *ShellEntry(void *argv)
void ShellEntry(ShellCB *shellCB)
{
char ch;
int ret;
int n;
pid_t tid = syscall(__NR_gettid);
ShellCB *shellCB = (ShellCB *)argv;
if (shellCB == NULL) {
return NULL;
return;
}
(void)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
ret = prctl(PR_SET_NAME, "ShellEntry");
if (ret != SH_OK) {
return NULL;
}
ret = ShellKernelReg((int)tid);
if (ret != 0) {
printf("another shell is already running!\n");
@@ -685,32 +681,5 @@ void *ShellEntry(void *argv)
ShellCmdLineParse(ch, (OutputFunc)printf, shellCB);
}
}
return NULL;
return;
}
int ShellEntryInit(ShellCB *shellCB)
{
int ret;
size_t stackSize = SHELL_ENTRY_STACKSIZE;
void *arg = NULL;
pthread_attr_t attr;
if (shellCB == NULL) {
return SH_NOK;
}
ret = pthread_attr_init(&attr);
if (ret != SH_OK) {
return SH_NOK;
}
pthread_attr_setstacksize(&attr, stackSize);
arg = (void *)shellCB;
ret = pthread_create(&shellCB->shellEntryHandle, &attr, &ShellEntry, arg);
if (ret != SH_OK) {
return SH_NOK;
}
return ret;
}

View File

@@ -500,7 +500,7 @@ static void lwip_tftp_send_error(s32_t iSockNum, u32_t ulError, const char *szEr
}
}
/* INTEFACE to get a file using filename
/* INTERFACE to get a file using filename
ulHostAddr - IP address of Host
szSrcFileName - Source file
szDestDirPath - Destination file path
@@ -1419,7 +1419,7 @@ err_handler:
}
#ifdef TFTP_TO_RAWMEM
/* INTEFACE to get a file using filename
/* INTERFACE to get a file using filename
ulHostAddr - IP address of Host
szSrcFileName - Source file
szDestMemAddr - The target memory address in the client
@@ -1437,10 +1437,8 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
{
s32_t iSockNum = TFTP_NULL_INT32;
u32_t ulSrcStrLen;
u32_t lDestStrLen;
u32_t ulSize;
u32_t ulRecvSize = TFTP_NULL_UINT32;
s32_t iErrCode;
u32_t ulErrCode;
u16_t usReadReq;
u16_t usTempServPort;

View File

@@ -51,7 +51,7 @@ build_ext_component("build_toybox") {
":copy_toybox_config",
":copy_toybox_src",
]
deps += [ "//prebuilts/lite/sysroot" ]
deps += [ "//third_party/musl:sysroot_lite" ]
exec_path = rebase_path("$target_out_dir/toybox_build")
cflags = [

View File

@@ -70,7 +70,7 @@ static void TraceRead(int fd, size_t size)
{
ssize_t i;
ssize_t len;
if (size <= 0) {
if (size == 0) {
return;
}

View File

@@ -55,8 +55,8 @@ extern "C" {
#define HWI_IS_REGISTED(num) ((&g_hwiForm[num])->pstNext != NULL)
#endif
extern VOID OsHwiInit(VOID);
extern VOID OsIncHwiFormCnt(UINT32 index);
extern UINT32 OsGetHwiFormCnt(UINT32 index);
extern VOID OsIncHwiFormCnt(UINT16 cpuid, UINT32 index);
extern UINT32 OsGetHwiFormCnt(UINT16 cpuid, UINT32 index);
extern CHAR *OsGetHwiFormName(UINT32 index);
extern VOID OsInterrupt(UINT32 intNum);
extern VOID OsSyscallHandleInit(VOID);

View File

@@ -74,7 +74,7 @@
STATIC UINTPTR g_minAddr;
STATIC UINTPTR g_maxAddr;
STATIC UINT32 g_currHandleExcCpuID = INVALID_CPUID;
STATIC UINT32 g_currHandleExcCpuid = INVALID_CPUID;
VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr);
UINT32 g_curNestCount[LOSCFG_KERNEL_CORE_NUM] = { 0 };
BOOL g_excFromUserMode[LOSCFG_KERNEL_CORE_NUM];
@@ -88,6 +88,7 @@ STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
#define OS_MAX_BACKTRACE 15U
#define DUMPSIZE 128U
#define DUMPREGS 12U
#define COM_REGS 4U
#define INSTR_SET_MASK 0x01000020U
#define THUMB_INSTR_LEN 2U
#define ARM_INSTR_LEN 4U
@@ -112,11 +113,11 @@ STATIC const StackInfo g_excStack[] = {
UINT32 OsGetSystemStatus(VOID)
{
UINT32 flag;
UINT32 cpuID = g_currHandleExcCpuID;
UINT32 cpuid = g_currHandleExcCpuid;
if (cpuID == INVALID_CPUID) {
if (cpuid == INVALID_CPUID) {
flag = OS_SYSTEM_NORMAL;
} else if (cpuID == ArchCurrCpuid()) {
} else if (cpuid == ArchCurrCpuid()) {
flag = OS_SYSTEM_EXC_CURR_CPU;
} else {
flag = OS_SYSTEM_EXC_OTHER_CPU;
@@ -516,13 +517,22 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
return;
}
for (excReg = &(excBufAddr->R0); count <= DUMPREGS; excReg++, count++) {
for (excReg = &(excBufAddr->R0); count < COM_REGS; excReg++, count++) {
if (IS_VALID_ADDR(*excReg)) {
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
}
}
for (excReg = &(excBufAddr->R4); count < DUMPREGS; excReg++, count++) {
if (IS_VALID_ADDR(*excReg)) {
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
}
}
if (IS_VALID_ADDR(excBufAddr->R12)) {
PrintExcInfo("\ndump mem around R12:%p", excBufAddr->R12);
OsDumpMemByte(DUMPSIZE, (excBufAddr->R12 - (DUMPSIZE >> 1)));
}
if (IS_VALID_ADDR(excBufAddr->SP)) {
PrintExcInfo("\ndump mem around SP:%p", excBufAddr->SP);
OsDumpMemByte(DUMPSIZE, (excBufAddr->SP - (DUMPSIZE >> 1)));
@@ -531,11 +541,11 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
STATIC VOID OsExcRestore(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
UINT32 currCpuid = ArchCurrCpuid();
g_excFromUserMode[currCpuID] = FALSE;
g_intCount[currCpuID] = 0;
g_curNestCount[currCpuID] = 0;
g_excFromUserMode[currCpuid] = FALSE;
g_intCount[currCpuid] = 0;
g_curNestCount[currCpuid] = 0;
#ifdef LOSCFG_KERNEL_SMP
OsCpuStatusSet(CPU_RUNNING);
#endif
@@ -556,15 +566,15 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
#ifdef LOSCFG_KERNEL_SMP
LOS_SpinLock(&g_excSerializerSpin);
if (g_nextExcWaitCpu != INVALID_CPUID) {
g_currHandleExcCpuID = g_nextExcWaitCpu;
g_currHandleExcCpuid = g_nextExcWaitCpu;
g_nextExcWaitCpu = INVALID_CPUID;
} else {
g_currHandleExcCpuID = INVALID_CPUID;
g_currHandleExcCpuid = INVALID_CPUID;
}
g_currHandleExcPID = OS_INVALID_VALUE;
LOS_SpinUnlock(&g_excSerializerSpin);
#else
g_currHandleExcCpuID = INVALID_CPUID;
g_currHandleExcCpuid = INVALID_CPUID;
#endif
#ifdef LOSCFG_KERNEL_SMP
@@ -645,6 +655,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
const StackInfo *stack = NULL;
vaddr_t kvaddr;
#ifdef LOSCFG_KERNEL_VM
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
taskCB = OsCurrTaskGet();
stackStart = taskCB->userMapBase;
@@ -655,6 +666,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
}
return found;
}
#endif
/* Search in the task stacks */
for (index = 0; index < g_taskMaxNum; index++) {
@@ -979,14 +991,14 @@ VOID OsDataAbortExcHandleEntry(ExcContext *excBufAddr)
#define EXC_WAIT_INTER 50U
#define EXC_WAIT_TIME 2000U
STATIC VOID WaitAllCpuStop(UINT32 cpuID)
STATIC VOID WaitAllCpuStop(UINT32 cpuid)
{
UINT32 i;
UINT32 time = 0;
while (time < EXC_WAIT_TIME) {
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
if ((i != cpuID) && !OsCpuStatusIsHalt(i)) {
if ((i != cpuid) && !OsCpuStatusIsHalt(i)) {
LOS_Mdelay(EXC_WAIT_INTER);
time += EXC_WAIT_INTER;
break;
@@ -1000,19 +1012,19 @@ STATIC VOID WaitAllCpuStop(UINT32 cpuID)
return;
}
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuid)
{
while (1) {
LOS_SpinLock(&g_excSerializerSpin);
if ((g_currHandleExcCpuID == INVALID_CPUID) || (g_currHandleExcCpuID == currCpuID)) {
g_currHandleExcCpuID = currCpuID;
if ((g_currHandleExcCpuid == INVALID_CPUID) || (g_currHandleExcCpuid == currCpuid)) {
g_currHandleExcCpuid = currCpuid;
g_currHandleExcPID = OsCurrProcessGet()->processID;
LOS_SpinUnlock(&g_excSerializerSpin);
break;
}
if (g_nextExcWaitCpu == INVALID_CPUID) {
g_nextExcWaitCpu = currCpuID;
g_nextExcWaitCpu = currCpuid;
}
LOS_SpinUnlock(&g_excSerializerSpin);
LOS_Mdelay(EXC_WAIT_INTER);
@@ -1021,7 +1033,7 @@ STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
STATIC VOID OsCheckAllCpuStatus(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
UINT32 currCpuid = ArchCurrCpuid();
UINT32 ret, target;
OsCpuStatusSet(CPU_EXC);
@@ -1029,17 +1041,17 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
LOS_SpinLock(&g_excSerializerSpin);
/* Only the current CPU anomaly */
if (g_currHandleExcCpuID == INVALID_CPUID) {
g_currHandleExcCpuID = currCpuID;
if (g_currHandleExcCpuid == INVALID_CPUID) {
g_currHandleExcCpuid = currCpuid;
g_currHandleExcPID = OsCurrProcessGet()->processID;
LOS_SpinUnlock(&g_excSerializerSpin);
#ifndef LOSCFG_SAVE_EXCINFO
if (g_excFromUserMode[currCpuID] == FALSE) {
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
if (g_excFromUserMode[currCpuid] == FALSE) {
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
}
#endif
} else if (g_excFromUserMode[currCpuID] == TRUE) {
} else if (g_excFromUserMode[currCpuid] == TRUE) {
/* Both cores raise exceptions, and the current core is a user-mode exception.
* Both cores are abnormal and come from the same process
*/
@@ -1051,12 +1063,12 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
}
LOS_SpinUnlock(&g_excSerializerSpin);
OsWaitOtherCoresHandleExcEnd(currCpuID);
OsWaitOtherCoresHandleExcEnd(currCpuid);
} else {
if ((g_currHandleExcCpuID < LOSCFG_KERNEL_CORE_NUM) && (g_excFromUserMode[g_currHandleExcCpuID] == TRUE)) {
g_currHandleExcCpuID = currCpuID;
if ((g_currHandleExcCpuid < LOSCFG_KERNEL_CORE_NUM) && (g_excFromUserMode[g_currHandleExcCpuid] == TRUE)) {
g_currHandleExcCpuid = currCpuid;
LOS_SpinUnlock(&g_excSerializerSpin);
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
} else {
LOS_SpinUnlock(&g_excSerializerSpin);
@@ -1066,7 +1078,7 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
#ifndef LOSCFG_SAVE_EXCINFO
/* use halt ipi to stop other active cores */
if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) {
WaitAllCpuStop(currCpuID);
WaitAllCpuStop(currCpuid);
}
#endif
}
@@ -1077,7 +1089,7 @@ STATIC VOID OsCheckCpuStatus(VOID)
#ifdef LOSCFG_KERNEL_SMP
OsCheckAllCpuStatus();
#else
g_currHandleExcCpuID = ArchCurrCpuid();
g_currHandleExcCpuid = ArchCurrCpuid();
#endif
}

View File

@@ -46,16 +46,11 @@ LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_hwiSpin);
size_t g_intCount[LOSCFG_KERNEL_CORE_NUM] = {0};
HwiHandleForm g_hwiForm[OS_HWI_MAX_NUM];
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC UINT32 g_hwiFormCnt[LOSCFG_KERNEL_CORE_NUM][OS_HWI_MAX_NUM] = {0};
VOID OsIncHwiFormCnt(UINT32 index)
UINT32 OsGetHwiFormCnt(UINT16 cpuid, UINT32 index)
{
g_hwiFormCnt[index]++;
}
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
return g_hwiFormCnt[cpuid][index];
}
CHAR *OsGetHwiFormName(UINT32 index)
@@ -74,16 +69,17 @@ VOID OsInterrupt(UINT32 intNum)
{
HwiHandleForm *hwiForm = NULL;
UINT32 *intCnt = NULL;
UINT16 cpuid = ArchCurrCpuid();
/* Must keep the operation at the beginning of the interface */
intCnt = &g_intCount[ArchCurrCpuid()];
intCnt = &g_intCount[cpuid];
*intCnt = *intCnt + 1;
OsSchedIrqStartTime();
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
OsCpupIrqStart();
OsCpupIrqStart(cpuid);
#endif
OsSchedIrqStartTime();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, intNum);
hwiForm = (&g_hwiForm[intNum]);
#ifndef LOSCFG_NO_SHARED_IRQ
@@ -105,14 +101,14 @@ VOID OsInterrupt(UINT32 intNum)
#ifndef LOSCFG_NO_SHARED_IRQ
}
#endif
++g_hwiFormCnt[intNum];
++g_hwiFormCnt[cpuid][intNum];
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, intNum);
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
OsCpupIrqEnd(intNum);
#endif
OsSchedIrqUpdateUsedTime();
OsSchedIrqUsedTimeUpdate();
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
OsCpupIrqEnd(cpuid, intNum);
#endif
/* Must keep the operation at the end of the interface */
*intCnt = *intCnt - 1;
}

View File

@@ -121,8 +121,9 @@ reset_vector:
mcr p15, 0, r0, c13, c0, 4
/* do some early cpu setup: i/d cache disable, mmu disabled */
mrc p15, 0, r0, c1, c0, 0
bic r0, #(1<<12)
bic r0, #(1<<2 | 1<<0)
bic r0, #(1 << 12) /* i cache */
bic r0, #(1 << 2) /* d cache */
bic r0, #(1 << 0) /* mmu */
mcr p15, 0, r0, c1, c0, 0
/* enable fpu+neon */
@@ -275,18 +276,18 @@ mmu_setup:
mov r12, #0x7 /* 0b0111 */
mcr p15, 0, r12, c3, c0, 0 /* Set DACR with 0b0111, client and manager domian */
isb
mrc p15, 0, r12, c1, c0, 1 /* ACTLR, Auxlliary Control Register */
mrc p15, 0, r12, c1, c0, 1 /* ACTLR, Auxiliary Control Register */
orr r12, r12, #(1 << 6) /* SMP, Enables coherent requests to the processor. */
orr r12, r12, #(1 << 2) /* Enable D-side prefetch */
orr r12, r12, #(1 << 11) /* Global BP Enable bit */
mcr p15, 0, r12, c1, c0, 1 /* ACTLR, Auxlliary Control Register */
mcr p15, 0, r12, c1, c0, 1 /* ACTLR, Auxiliary Control Register */
dsb
mrc p15, 0, r12, c1, c0, 0
bic r12, #(1 << 29 | 1 << 28)
orr r12, #(1 << 0)
bic r12, #(1 << 29 | 1 << 28) /* Disable TRE/AFE */
orr r12, #(1 << 0) /* mmu enable */
bic r12, #(1 << 1)
orr r12, #(1 << 2)
orr r12, #(1 << 12)
orr r12, #(1 << 2) /* D cache enable */
orr r12, #(1 << 12) /* I cache enable */
mcr p15, 0, r12, c1, c0, 0 /* Set SCTLR with r12: Turn on the MMU, I/D cache Disable TRE/AFE */
isb
ldr pc, =1f /* Convert to VA */

View File

@@ -101,8 +101,9 @@ __exception_handlers:
reset_vector:
/* do some early cpu setup: i/d cache disable, mmu disabled */
mrc p15, 0, r0, c1, c0, 0
bic r0, #(1<<12)
bic r0, #(1<<2 | 1<<0)
bic r0, #(1 << 12) /* i cache */
bic r0, #(1 << 2) /* d cache */
bic r0, #(1 << 0) /* mmu */
mcr p15, 0, r0, c1, c0, 0
/* enable fpu+neon */
@@ -269,11 +270,11 @@ mmu_setup:
isb
mrc p15, 0, r12, c1, c0, 0
bic r12, #(1 << 29 | 1 << 28)
orr r12, #(1 << 0)
bic r12, #(1 << 29 | 1 << 28) /* Disable TRE/AFE */
orr r12, #(1 << 0) /* mmu enable */
bic r12, #(1 << 1)
orr r12, #(1 << 2)
orr r12, #(1 << 12)
orr r12, #(1 << 2) /* D cache enable */
orr r12, #(1 << 12) /* I cache enable */
mcr p15, 0, r12, c1, c0, 0 /* Set SCTLR with r12: Turn on the MMU, I/D cache Disable TRE/AFE */
isb

View File

@@ -46,7 +46,7 @@ INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
}
maxCount = (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)src, (size_t)count)) ? \
count : (USER_ASPACE_TOP_MAX - (UINTPTR)src);
count : (INT32)(USER_ASPACE_TOP_MAX - (UINTPTR)src);
for (i = 0; i < maxCount; ++i) {
if (LOS_GetUser(&character, src + offset) != LOS_OK) {

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include $(LITEOSTOPDIR)/config.mk
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk
include $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos/lite.mk
MODULE_NAME := usb_base
@@ -122,13 +122,13 @@ LOCAL_SRCS += $(STORAGE_SRC)/umass.c
endif
ifeq ($(LOSCFG_DRIVERS_USB_HID_CLASS)_$(LOSCFG_DRIVERS_HDF_INPUT), y_y)
LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/framework/model/input/driver \
-I$(LITEOSTOPDIR)/../../drivers/framework/include/core \
-I$(LITEOSTOPDIR)/../../drivers/framework/core/common/include/host \
-I$(LITEOSTOPDIR)/../../drivers/framework/utils \
-I$(LITEOSTOPDIR)/../../drivers/framework/osal \
-I$(LITEOSTOPDIR)/../../drivers/framework/ability/sbuf/include \
-I$(LITEOSTOPDIR)/../../drivers/framework/include/osal \
LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/model/input/driver \
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/core \
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/core/common/include/host \
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/utils \
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/osal \
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/ability/sbuf/include \
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/osal \
-I$(LITEOSTOPDIR)/../../third_party/FreeBSD/sys/dev/evdev
LOCAL_SRCS += $(INPUT_SRC)/uhid.c \

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -158,7 +158,7 @@ STATIC VOID SetPthreadAttr(const _pthread_data *self, const pthread_attr_t *attr
}
if (outAttr->inheritsched == PTHREAD_INHERIT_SCHED) {
if (self->task == NULL) {
outAttr->schedparam.sched_priority = ((LosTaskCB *)(OsCurrTaskGet()))->priority;
outAttr->schedparam.sched_priority = LOS_TaskPriGet(OsCurrTaskGet()->taskID);
} else {
outAttr->schedpolicy = self->attr.schedpolicy;
outAttr->schedparam = self->attr.schedparam;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -71,7 +71,7 @@
#ifdef LOSCFG_AARCH64
/*
* This two structures originally did't exit,
* This two structures originally didn't exit,
* they added by liteos to support 64bit interfaces on 32bit platform,
* in 64bit platform, timeval64 define to timeval which is platform adaptive.
*/
@@ -387,9 +387,16 @@ int gettimeofday64(struct timeval64 *tv, struct timezone *tz)
}
#endif
#ifdef LOSCFG_LIBC_NEWLIB
int gettimeofday(struct timeval *tv, void *_tz)
#else
int gettimeofday(struct timeval *tv, struct timezone *tz)
#endif
{
struct timeval64 stTimeVal64 = {0};
#ifdef LOSCFG_LIBC_NEWLIB
struct timezone *tz = (struct timezone *)_tz;
#endif
if (tv == NULL) {
TIME_RETURN(EINVAL);
@@ -471,7 +478,6 @@ static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
uint64_t runtime;
UINT32 intSave;
UINT32 tid = GetTidFromClockID(clockID);
if (OS_TID_CHECK_INVALID(tid)) {
return -EINVAL;
}
@@ -718,6 +724,7 @@ typedef struct {
static VOID SwtmrProc(UINTPTR tmrArg)
{
#ifdef LOSCFG_KERNEL_VM
INT32 sig, ret;
UINT32 intSave;
pid_t pid;
@@ -761,9 +768,47 @@ static VOID SwtmrProc(UINTPTR tmrArg)
return;
EXIT:
PRINT_ERR("Dispatch signals failed!, ret: %d\r\n", ret);
#endif
return;
}
int timer_create(clockid_t clockID, struct sigevent *restrict evp, timer_t *restrict timerID)
{
UINT32 ret;
UINT16 swtmrID;
#ifdef LOSCFG_SECURITY_VID
UINT16 vid;
#endif
if (!timerID || (clockID != CLOCK_REALTIME) || !evp) {
errno = EINVAL;
return -1;
}
if ((evp->sigev_notify != SIGEV_THREAD) || evp->sigev_notify_attributes) {
errno = ENOTSUP;
return -1;
}
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)evp->sigev_notify_function,
&swtmrID, (UINTPTR)evp->sigev_value.sival_ptr);
if (ret != LOS_OK) {
errno = (ret == LOS_ERRNO_SWTMR_MAXSIZE) ? EAGAIN : EINVAL;
return -1;
}
#ifdef LOSCFG_SECURITY_VID
vid = AddNodeByRid(swtmrID);
if (vid == MAX_INVALID_TIMER_VID) {
(VOID)LOS_SwtmrDelete(swtmrID);
return -1;
}
swtmrID = vid;
#endif
*timerID = (timer_t)(UINTPTR)swtmrID;
return 0;
}
int OsTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
{
UINT32 ret;
@@ -823,6 +868,7 @@ int timer_delete(timer_t timerID)
{
UINT16 swtmrID = (UINT16)(UINTPTR)timerID;
VOID *arg = NULL;
UINTPTR swtmrProc;
#ifdef LOSCFG_SECURITY_VID
swtmrID = GetRidByVid(swtmrID);
@@ -832,10 +878,11 @@ int timer_delete(timer_t timerID)
}
arg = (VOID *)OS_SWT_FROM_SID(swtmrID)->uwArg;
swtmrProc = (UINTPTR)OS_SWT_FROM_SID(swtmrID)->pfnHandler;
if (LOS_SwtmrDelete(swtmrID)) {
goto ERROUT;
}
if (arg != NULL) {
if ((swtmrProc == (UINTPTR)SwtmrProc) && (arg != NULL)) {
free(arg);
}
@@ -979,7 +1026,11 @@ STATIC INT32 DoNanoSleep(UINT64 nanoseconds)
return -1;
}
#ifdef LOSCFG_LIBC_NEWLIB
int usleep(unsigned long useconds)
#else
int usleep(unsigned useconds)
#endif
{
return DoNanoSleep((UINT64)useconds * OS_SYS_NS_PER_US);
}

View File

@@ -5,7 +5,7 @@ config DRIVERS
Answer Y to enable LiteOS support driver.
source "bsd/dev/usb/Kconfig"
source "../../drivers/adapter/khdf/liteos/Kconfig"
source "../../drivers/hdf_core/adapter/khdf/liteos/Kconfig"
# Device driver Kconfig import
source "$(DEVICE_PATH)/drivers/Kconfig"
@@ -17,5 +17,4 @@ source "drivers/char/video/Kconfig"
source "drivers/char/trace/Kconfig"
source "drivers/char/perf/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "../../drivers/liteos/hievent/Kconfig"

View File

@@ -163,7 +163,7 @@ extern "C" {
#define DISK_ATA_GET_MODEL 21 /* Get model name */
#define DISK_ATA_GET_SN 22 /* Get serial number */
#ifdef LOSCFG_FS_FAT_CACHE
#ifndef LOSCFG_FS_FAT_CACHE
#define DISK_DIRECT_BUFFER_SIZE 4 /* los_disk direct io buffer when bcache is off */
#endif

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -42,7 +42,7 @@
#ifdef __cplusplus
#if __cplusplus
extern "C"{
extern "C" {
#endif
#endif /* __cplusplus */

View File

@@ -1465,7 +1465,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
ret = VnodeLookup(diskName, &blkDriver, 0);
if (ret < 0) {
VnodeDrop();
ret = ENOENT;
PRINT_ERR("disk_init : %s, failed to find the vnode, ERRNO=%d\n", diskName, ret);
goto DISK_FIND_ERROR;
}
struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops;

View File

@@ -39,10 +39,6 @@ kernel_module(module_name) {
include_dirs = [ "$LITEOSTOPDIR/fs/jffs2/include" ]
if (defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)) {
include_dirs += [ "//device/qemu/drivers/cfiflash" ]
}
public_configs = [ ":public" ]
}

View File

@@ -36,10 +36,6 @@ LOCAL_SRCS := $(wildcard src/*.c)
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/fs/jffs2/include
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/../../device/qemu/drivers/cfiflash
endif
LOCAL_FLAGS := $(LOCAL_INCLUDE)
include $(MODULE)

View File

@@ -39,11 +39,6 @@
#include "fs/driver.h"
#include "mtd/mtd_legacy_lite.h"
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
#include "cfiflash.h"
#endif
#define DRIVER_NAME_ADD_SIZE 3
pthread_mutex_t g_mtdPartitionLock = PTHREAD_MUTEX_INITIALIZER;
@@ -134,17 +129,10 @@ static VOID MtdNorParamAssign(partition_param *spinorParam, const struct MtdDev
* you can change the SPIBLK_NAME or SPICHR_NAME to NULL.
*/
spinorParam->flash_mtd = (struct MtdDev *)spinorMtd;
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
spinorParam->flash_ops = GetDevSpinorOps();
spinorParam->char_ops = GetMtdCharFops();
spinorParam->blockname = SPIBLK_NAME;
spinorParam->charname = SPICHR_NAME;
#else
spinorParam->flash_ops = GetCfiBlkOps();
spinorParam->char_ops = NULL;
spinorParam->blockname = CFI_DRIVER;
spinorParam->charname = NULL;
#endif
spinorParam->partition_head = g_spinorPartitionHead;
spinorParam->block_size = spinorMtd->eraseSize;
}
@@ -158,11 +146,7 @@ static VOID MtdDeinitSpinorParam(VOID)
static partition_param *MtdInitSpinorParam(partition_param *spinorParam)
{
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
struct MtdDev *spinorMtd = GetMtd("spinor");
#else
struct MtdDev *spinorMtd = GetCfiMtdDev();
#endif
if (spinorMtd == NULL) {
return NULL;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 139 KiB

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -343,7 +343,8 @@ static FRESULT init_cluster(DIR_FILE *pdfp, DIR *dp_new, FATFS *fs, int type, co
return FR_OK;
}
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp, BYTE type, const char *target)
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp,
BYTE type, const char *target)
{
struct Vnode *vp = NULL;
FATFS *fs = (FATFS *)parent->originMount->data;
@@ -1408,7 +1409,7 @@ DWORD fattime_format(time_t time)
ftime |= ((DWORD)((st.tm_year > YEAR_OFFSET) ? (st.tm_year - YEAR_OFFSET) : 0)) << FTIME_YEAR_OFFSET;
ftime <<= FTIME_DATE_OFFSET;
ftime = (DWORD)st.tm_sec / SEC_MULTIPLIER;
ftime |= (DWORD)st.tm_sec / SEC_MULTIPLIER;
ftime |= ((DWORD)st.tm_min) << FTIME_MIN_OFFSET;
ftime |= ((DWORD)st.tm_hour) << FTIME_HR_OFFSET;
@@ -2166,7 +2167,7 @@ int fatfs_symlink(struct Vnode *parentVnode, struct Vnode **newVnode, const char
ssize_t fatfs_readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
{
int ret;
FRESULT res = FR_OK;
FRESULT res;
DWORD clust;
QWORD sect;
DIR_FILE *dfp = (DIR_FILE *)(vnode->data);

View File

@@ -64,7 +64,7 @@ extern "C" {
#define MBR_PRIMARY_PART_NUM 4
#define JUMP_CODE "\xEB\xFE\x90"
/* Partiton type */
/* Partition type */
#define FAT12 0x01 /* FAT12 as primary partition in first physical 32MB */
#define FAT16 0x04 /* FAT16 with less than 65536 sectors(32MB) */
#define EXTENDED_PARTITION_CHS 0x05

View File

@@ -179,7 +179,7 @@ static INT FatfsDisablePart(void *handle)
* Scan the FAT inside the boundary of CHILD FATFS limit, and update the free cluster and last cluster
* for all CHILD FATFS.
* Acceptable Return Value:
* - FR_OK : Successfully scaned the FAT and update field.
* - FR_OK : Successfully scanned the FAT and update field.
* Others Return Value:
* - FR_INVAILD_FATFS : The FATFS object has error or the info in it has been occuried
* - FR_DENIED : The virtual partition feature has been shut down by switcher

View File

@@ -373,7 +373,7 @@ static FRESULT FatfsCheckScanFatParam(FATFS *fs)
* Scan the FAT inside the boundary of CHILD FATFS limit, and update the free cluster and last cluster
*
* Acceptable Return Value:
* - FR_OK : Successfully scaned the FAT and update field.
* - FR_OK : Successfully scanned the FAT and update field.
*
* Others Return Value:
* - FR_INVAILD_FATFS : The FATFS object has error or the info in it has been occuried

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -244,8 +244,9 @@ extern int chattr(const char *pathname, struct IATTR *attr);
*
* @retval #0 On success.
* @retval #-1 On failure with errno set.
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through Nuttx vfs operation.</li>
*
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through
* Nuttx vfs operation.</li>
*
* @par Dependency:
* <ul><li>fs.h</li></ul>
* @see None

View File

@@ -49,7 +49,7 @@ struct Mount {
LIST_HEAD vnodeList; /* list of vnodes */
int vnodeSize; /* size of vnode list */
LIST_HEAD activeVnodeList; /* list of active vnodes */
int activeVnodeSize; /* szie of active vnodes list */
int activeVnodeSize; /* size of active vnodes list */
void *data; /* private data */
uint32_t hashseed; /* Random seed for vfshash */
unsigned long mountFlags; /* Flags for mount */

View File

@@ -2311,7 +2311,7 @@ diff -Nupr old/fs/jffs2/erase.c new/fs/jffs2/erase.c
diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
--- old/fs/jffs2/file.c 2022-05-09 17:22:53.000000000 +0800
+++ new/fs/jffs2/file.c 2022-05-10 09:43:14.250000000 +0800
@@ -9,325 +9,34 @@
@@ -9,335 +9,30 @@
* For licensing information, see the file 'LICENCE' in this directory.
*
*/
@@ -2336,32 +2336,35 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- loff_t pos, unsigned len, unsigned flags,
- struct page **pagep, void **fsdata);
-static int jffs2_readpage (struct file *filp, struct page *pg);
-
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
-{
- struct inode *inode = filp->f_mapping->host;
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- int ret;
-
- ret = file_write_and_wait_range(filp, start, end);
- if (ret)
- return ret;
- inode_lock(inode);
- /* Trigger GC to flush any pending writes for this inode */
- jffs2_flush_wbuf_gc(c, inode->i_ino);
- inode_unlock(inode);
+static unsigned char gc_buffer[PAGE_SIZE]; //avoids malloc when user may be under memory pressure
- return 0;
-}
-const struct file_operations jffs2_file_operations =
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
+unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
+ struct jffs2_inode_info *f,
+ unsigned long offset,
+ unsigned long *priv)
{
- struct inode *inode = filp->f_mapping->host;
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+ /* FIXME: This works only with one file system mounted at a time */
int ret;
-
- ret = file_write_and_wait_range(filp, start, end);
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
if (ret)
- return ret;
-
- inode_lock(inode);
- /* Trigger GC to flush any pending writes for this inode */
- jffs2_flush_wbuf_gc(c, inode->i_ino);
- inode_unlock(inode);
-
- return 0;
-}
-
-const struct file_operations jffs2_file_operations =
-{
- .llseek = generic_file_llseek,
- .open = generic_file_open,
- .read_iter = generic_file_read_iter,
@@ -2395,9 +2398,8 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- unsigned char *pg_buf;
+ /* FIXME: This works only with one file system mounted at a time */
int ret;
- int ret;
-
- jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
- __func__, inode->i_ino, pg->index << PAGE_SHIFT);
-
@@ -2436,18 +2438,15 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
-{
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
- int ret;
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
+ if (ret)
+ return ERR_PTR(ret);
-
- mutex_lock(&f->sem);
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
- mutex_unlock(&f->sem);
- return ret;
+ return ERR_PTR(ret);
+ return gc_buffer;
}
-
-static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
- loff_t pos, unsigned len, unsigned flags,
- struct page **pagep, void **fsdata)
@@ -2458,20 +2457,15 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- struct page *pg;
- struct inode *inode = mapping->host;
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- pgoff_t index = pos >> PAGE_SHIFT;
- uint32_t pageofs = index << PAGE_SHIFT;
- int ret = 0;
-
- pg = grab_cache_page_write_begin(mapping, index, flags);
- if (!pg)
- return -ENOMEM;
- *pagep = pg;
-
- jffs2_dbg(1, "%s()\n", __func__);
-
- if (pageofs > inode->i_size) {
- /* Make new hole frag from old EOF to new page */
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- struct jffs2_raw_inode ri;
- struct jffs2_full_dnode *fn;
- uint32_t alloc_len;
@@ -2482,7 +2476,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
- ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
- if (ret)
- goto out_page;
- goto out_err;
-
- mutex_lock(&f->sem);
- memset(&ri, 0, sizeof(ri));
@@ -2512,7 +2506,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- ret = PTR_ERR(fn);
- jffs2_complete_reservation(c);
- mutex_unlock(&f->sem);
- goto out_page;
- goto out_err;
- }
- ret = jffs2_add_full_dnode_to_inode(c, f, fn);
- if (f->metadata) {
@@ -2527,7 +2521,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- jffs2_free_full_dnode(fn);
- jffs2_complete_reservation(c);
- mutex_unlock(&f->sem);
- goto out_page;
- goto out_err;
- }
- jffs2_complete_reservation(c);
- inode->i_size = pageofs;
@@ -2535,6 +2529,19 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- }
-
- /*
- * While getting a page and reading data in, lock c->alloc_sem until
- * the page is Uptodate. Otherwise GC task may attempt to read the same
- * page in read_cache_page(), which causes a deadlock.
- */
- mutex_lock(&c->alloc_sem);
- pg = grab_cache_page_write_begin(mapping, index, flags);
- if (!pg) {
- ret = -ENOMEM;
- goto release_sem;
- }
- *pagep = pg;
-
- /*
- * Read in the page if it wasn't already present. Cannot optimize away
- * the whole page write case until jffs2_write_end can handle the
- * case of a short-copy.
@@ -2543,19 +2550,20 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- mutex_lock(&f->sem);
- ret = jffs2_do_readpage_nolock(inode, pg);
- mutex_unlock(&f->sem);
- if (ret)
- goto out_page;
- if (ret) {
- unlock_page(pg);
- put_page(pg);
- goto release_sem;
- }
- }
- jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
- return ret;
-
-out_page:
- unlock_page(pg);
- put_page(pg);
-release_sem:
- mutex_unlock(&c->alloc_sem);
-out_err:
- return ret;
+ /* Do nothing */
}
-}
-
-static int jffs2_write_end(struct file *filp, struct address_space *mapping,
- loff_t pos, unsigned len, unsigned copied,
- struct page *pg, void *fsdata)
@@ -2653,7 +2661,8 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- unlock_page(pg);
- put_page(pg);
- return writtenlen > 0 ? writtenlen : ret;
-}
+ /* Do nothing */
}
diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
--- old/fs/jffs2/fs.c 2022-05-09 17:22:53.000000000 +0800
+++ new/fs/jffs2/fs.c 2022-05-10 16:13:37.830000000 +0800
@@ -2769,7 +2778,11 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
ri->version = cpu_to_je32(++f->highest_version);
+ ri->uid = cpu_to_je16(inode->i_uid);
+ ri->gid = cpu_to_je16(inode->i_gid);
+
- ri->uid = cpu_to_je16((ivalid & ATTR_UID)?
- from_kuid(&init_user_ns, iattr->ia_uid):i_uid_read(inode));
- ri->gid = cpu_to_je16((ivalid & ATTR_GID)?
- from_kgid(&init_user_ns, iattr->ia_gid):i_gid_read(inode));
+ if (ivalid & CHG_UID) {
+ if (((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) && (!IsCapPermit(CAP_CHOWN))) {
+ jffs2_complete_reservation(c);
@@ -2791,16 +2804,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
+ ri->gid = cpu_to_je16(attr->attr_chg_gid);
+ }
+ }
- ri->uid = cpu_to_je16((ivalid & ATTR_UID)?
- from_kuid(&init_user_ns, iattr->ia_uid):i_uid_read(inode));
- ri->gid = cpu_to_je16((ivalid & ATTR_GID)?
- from_kgid(&init_user_ns, iattr->ia_gid):i_gid_read(inode));
-
- if (ivalid & ATTR_MODE)
- ri->mode = cpu_to_jemode(iattr->ia_mode);
- else
- ri->mode = cpu_to_jemode(inode->i_mode);
+
+ if (ivalid & CHG_MODE) {
+ if (!IsCapPermit(CAP_FOWNER) && (c_uid != inode->i_uid)) {
+ jffs2_complete_reservation(c);
@@ -2814,6 +2818,10 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
+ }
+ }
- if (ivalid & ATTR_MODE)
- ri->mode = cpu_to_jemode(iattr->ia_mode);
- else
- ri->mode = cpu_to_jemode(inode->i_mode);
+ if (ivalid & CHG_ATIME) {
+ if ((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) {
+ return -EPERM;
@@ -2823,7 +2831,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
+ } else {
+ ri->atime = cpu_to_je32(inode->i_atime);
+ }
+
+ if (ivalid & CHG_MTIME) {
+ if ((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) {
+ return -EPERM;
@@ -2875,7 +2883,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
if (IS_ERR(new_metadata)) {
jffs2_complete_reservation(c);
jffs2_free_raw_inode(ri);
@@ -147,23 +140,20 @@ int jffs2_do_setattr (struct inode *inod
@@ -147,23 +140,20 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
return PTR_ERR(new_metadata);
}
/* It worked. Update the inode */
@@ -2908,7 +2916,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
f->metadata = NULL;
} else {
f->metadata = new_metadata;
@@ -182,315 +172,201 @@ int jffs2_do_setattr (struct inode *inod
@@ -182,315 +172,201 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
We are protected from a simultaneous write() extending i_size
back past iattr->ia_size, because do_truncate() holds the
generic inode semaphore. */
@@ -2927,31 +2935,43 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
{
- struct inode *inode = d_inode(dentry);
- int rc;
-
- rc = setattr_prepare(dentry, iattr);
- if (rc)
- return rc;
-
- rc = jffs2_do_setattr(inode, iattr);
- if (!rc && (iattr->ia_valid & ATTR_MODE))
- rc = posix_acl_chmod(inode, inode->i_mode);
+ /* We can forget about this inode for now - drop all
+ * the nodelists associated with it, etc.
+ */
+ struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+ struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
+
+ jffs2_do_clear_inode(c, f);
+}
- rc = setattr_prepare(dentry, iattr);
- if (rc)
- return rc;
+static struct jffs2_inode *ilookup(struct super_block *sb, uint32_t ino)
+{
+ struct jffs2_inode *node = NULL;
- rc = jffs2_do_setattr(inode, iattr);
- if (!rc && (iattr->ia_valid & ATTR_MODE))
- rc = posix_acl_chmod(inode, inode->i_mode);
+ if (sb->s_root == NULL) {
+ return NULL;
+ }
- return rc;
+ jffs2_do_clear_inode(c, f);
+ // Check for this inode in the cache
+ Jffs2NodeLock();
+ (void)Jffs2HashGet(&sb->s_node_hash_lock, &sb->s_node_hash[0], sb, ino, &node);
+ Jffs2NodeUnlock();
+ return node;
}
-int jffs2_statfs(struct dentry *dentry, struct kstatfs *buf)
+static struct jffs2_inode *ilookup(struct super_block *sb, uint32_t ino)
+struct jffs2_inode *new_inode(struct super_block *sb)
{
- struct jffs2_sb_info *c = JFFS2_SB_INFO(dentry->d_sb);
- unsigned long avail;
+ struct jffs2_inode *node = NULL;
-
- buf->f_type = JFFS2_SUPER_MAGIC;
- buf->f_bsize = 1 << PAGE_SHIFT;
- buf->f_blocks = c->flash_size >> PAGE_SHIFT;
@@ -2970,47 +2990,35 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
- spin_unlock(&c->erase_completion_lock);
-
- buf->f_bavail = buf->f_bfree = avail >> PAGE_SHIFT;
+ if (sb->s_root == NULL) {
+ return NULL;
+ }
+ struct jffs2_inode *inode = NULL;
- return 0;
+ // Check for this inode in the cache
+ Jffs2NodeLock();
+ (void)Jffs2HashGet(&sb->s_node_hash_lock, &sb->s_node_hash[0], sb, ino, &node);
+ Jffs2NodeUnlock();
+ return node;
}
-}
+ inode = zalloc(sizeof (struct jffs2_inode));
+ if (inode == NULL)
+ return 0;
+ D2(PRINTK("malloc new_inode %x ####################################\n",
+ inode));
-
-void jffs2_evict_inode (struct inode *inode)
+struct jffs2_inode *new_inode(struct super_block *sb)
{
-{
- /* We can forget about this inode for now - drop all
- * the nodelists associated with it, etc.
- */
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
+ struct jffs2_inode *inode = NULL;
+ inode->i_sb = sb;
+ inode->i_ino = 1;
+ inode->i_nlink = 1; // Let JFFS2 manage the link count
+ inode->i_size = 0;
+ LOS_ListInit((&(inode->i_hashlist)));
- jffs2_dbg(1, "%s(): ino #%lu mode %o\n",
- __func__, inode->i_ino, inode->i_mode);
- truncate_inode_pages_final(&inode->i_data);
- clear_inode(inode);
- jffs2_do_clear_inode(c, f);
+ inode = zalloc(sizeof (struct jffs2_inode));
+ if (inode == NULL)
+ return 0;
+
+ D2(PRINTK("malloc new_inode %x ####################################\n",
+ inode));
+
+ inode->i_sb = sb;
+ inode->i_ino = 1;
+ inode->i_nlink = 1; // Let JFFS2 manage the link count
+ inode->i_size = 0;
+ LOS_ListInit((&(inode->i_hashlist)));
+
+ return inode;
}
@@ -3075,16 +3083,16 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
- inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime));
-
- set_nlink(inode, f->inocache->pino_nlink);
-
- inode->i_blocks = (inode->i_size + 511) >> 9;
+ inode->i_atime = je32_to_cpu(latest_node.atime);
+ inode->i_mtime = je32_to_cpu(latest_node.mtime);
+ inode->i_ctime = je32_to_cpu(latest_node.ctime);
+ inode->i_nlink = f->inocache->pino_nlink;
- inode->i_blocks = (inode->i_size + 511) >> 9;
- switch (inode->i_mode & S_IFMT) {
+ (void)mutex_unlock(&f->sem);
- switch (inode->i_mode & S_IFMT) {
-
- case S_IFLNK:
- inode->i_op = &jffs2_symlink_inode_operations;
- inode->i_link = f->target;
@@ -3154,20 +3162,21 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
jffs2_dbg(1, "jffs2_read_inode() returning\n");
- unlock_new_inode(inode);
- return inode;
-
+ Jffs2NodeUnlock();
-error_io:
- ret = -EIO;
-error:
- mutex_unlock(&f->sem);
- iget_failed(inode);
- return ERR_PTR(ret);
-}
+ Jffs2NodeUnlock();
+ return inode;
}
-void jffs2_dirty_inode(struct inode *inode, int flags)
-{
- struct iattr iattr;
-
- if (!(inode->i_state & I_DIRTY_DATASYNC)) {
- jffs2_dbg(2, "%s(): not calling setattr() for ino #%lu\n",
- __func__, inode->i_ino);
@@ -3186,16 +3195,19 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
- iattr.ia_ctime = inode->i_ctime;
-
- jffs2_do_setattr(inode, &iattr);
+ return inode;
}
-}
+// -------------------------------------------------------------------------
+// Decrement the reference count on an inode. If this makes the ref count
+// zero, then this inode can be freed.
-int jffs2_do_remount_fs(struct super_block *sb, struct fs_context *fc)
-{
+int jffs2_iput(struct jffs2_inode *i)
{
- struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
-
- if (c->flags & JFFS2_SB_FLAG_RO && !sb_rdonly(sb))
- return -EROFS;
-
- /* We stop if it was running, then restart if it needs to.
- This also catches the case where it was stopped and this
- is just a remount to restart it.
@@ -3206,12 +3218,9 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
- jffs2_flush_wbuf_pad(c);
- mutex_unlock(&c->alloc_sem);
- }
+// -------------------------------------------------------------------------
+// Decrement the reference count on an inode. If this makes the ref count
+// zero, then this inode can be freed.
+
+int jffs2_iput(struct jffs2_inode *i)
+{
-
- if (!(fc->sb_flags & SB_RDONLY))
- jffs2_start_garbage_collect_thread(c);
+ // Called in jffs2_find
+ // (and jffs2_open and jffs2_ops_mkdir?)
+ // super.c jffs2_fill_super,
@@ -3233,9 +3242,6 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
+ free(i);
+ Jffs2NodeUnlock();
- if (!(fc->sb_flags & SB_RDONLY))
- jffs2_start_garbage_collect_thread(c);
-
- fc->sb_flags |= SB_NOATIME;
return 0;
}
@@ -3342,7 +3348,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
{
/*
* Pick a inocache hash size based on the size of the medium.
@@ -510,117 +386,17 @@ static int calculate_inocache_hashsize(u
@@ -510,118 +386,17 @@ static int calculate_inocache_hashsize(uint32_t flash_size)
return hashsize;
}
@@ -3438,8 +3444,9 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
- jffs2_free_ino_caches(c);
- jffs2_free_raw_node_refs(c);
- kvfree(c->blocks);
- out_inohash:
- jffs2_clear_xattr_subsystem(c);
- jffs2_sum_exit(c);
- out_inohash:
- kfree(c->inocache_list);
- out_wbuf:
- jffs2_flash_cleanup(c);
@@ -3448,8 +3455,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
-}
-
void jffs2_gc_release_inode(struct jffs2_sb_info *c,
- struct jffs2_inode_info *f)
+ struct jffs2_inode_info *f)
struct jffs2_inode_info *f)
{
- iput(OFNI_EDONI_2SFFJ(f));
+ struct jffs2_inode *node = OFNI_EDONI_2SFFJ(f);
@@ -3464,7 +3470,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
struct jffs2_inode_cache *ic;
if (unlinked) {
@@ -668,72 +444,9 @@ struct jffs2_inode_info *jffs2_gc_fetch_
@@ -669,72 +444,9 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
Just iget() it, and if read_inode() is necessary that's OK.
*/
inode = jffs2_iget(OFNI_BS_2SFFJ(c), inum);
@@ -5499,7 +5505,7 @@ diff -Nupr old/fs/jffs2/readinode.c new/fs/jffs2/readinode.c
break;
default:
+ JFFS2_ERROR("Unknow f->inocache->state %d!\n", f->inocache->state);
+ JFFS2_ERROR("Unknown f->inocache->state %d!\n", f->inocache->state);
BUG();
}
}
@@ -5556,7 +5562,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
#define DEFAULT_EMPTY_SCAN_SIZE 256
@@ -74,7 +73,7 @@ static int file_dirty(struct jffs2_sb_in
@@ -74,7 +73,7 @@ static int file_dirty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
return ret;
if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size)))
return ret;
@@ -5565,15 +5571,13 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
think it's recoverable now. */
jeb->dirty_size += jeb->wasted_size;
c->dirty_size += jeb->wasted_size;
@@ -95,40 +94,26 @@ int jffs2_scan_medium(struct jffs2_sb_in
@@ -95,40 +94,26 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
unsigned char *flashbuf = NULL;
uint32_t buf_size = 0;
struct jffs2_summary *s = NULL; /* summary info collected by the scan process */
-#ifndef __ECOS
- size_t pointlen, try_size;
+ struct super_block *sb = NULL;
+ struct MtdNorDev *device = NULL;
-
- ret = mtd_point(c->mtd, 0, c->mtd->size, &pointlen,
- (void **)&flashbuf, NULL);
- if (!ret && pointlen < c->mtd->size) {
@@ -5586,6 +5590,9 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
- if (ret && ret != -EOPNOTSUPP)
- jffs2_dbg(1, "MTD point failed %d\n", ret);
-#endif
+ struct super_block *sb = NULL;
+ struct MtdNorDev *device = NULL;
+
if (!flashbuf) {
/* For NAND it's quicker to read a whole eraseblock at a time,
apparently */
@@ -5613,7 +5620,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
}
if (jffs2_sum_active()) {
@@ -140,7 +125,9 @@ int jffs2_scan_medium(struct jffs2_sb_in
@@ -140,7 +125,9 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
}
}
@@ -5624,7 +5631,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
struct jffs2_eraseblock *jeb = &c->blocks[i];
cond_resched();
@@ -269,19 +256,12 @@ int jffs2_scan_medium(struct jffs2_sb_in
@@ -269,14 +256,10 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
ret = -EIO;
goto out;
}
@@ -5634,20 +5641,13 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
}
ret = 0;
out:
- if (buf_size)
- kfree(flashbuf);
-#ifndef __ECOS
- else
- mtd_unpoint(c->mtd, 0, c->mtd->size);
-#endif
- jffs2_sum_reset_collected(s);
- kfree(s);
+
+ kfree(flashbuf);
+
return ret;
}
@@ -411,7 +391,7 @@ static int jffs2_scan_xref_node(struct j
out_buf:
if (buf_size)
kfree(flashbuf);
@@ -413,7 +396,7 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
if (!ref)
return -ENOMEM;
@@ -5656,7 +5656,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
* and AFTER xattr_ref is marked as a dead xref,
* ref->xid is used to store 32bit xid, xd is not used
* ref->ino is used to store 32bit inode-number, ic is not used
@@ -484,10 +464,10 @@ static int jffs2_scan_eraseblock (struct
@@ -486,10 +469,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
struct jffs2_sum_marker *sm;
void *sumptr = NULL;
uint32_t sumlen;
@@ -5669,7 +5669,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
sumptr = buf + je32_to_cpu(sm->offset);
sumlen = c->sector_size - je32_to_cpu(sm->offset);
@@ -500,13 +480,13 @@ static int jffs2_scan_eraseblock (struct
@@ -502,13 +485,13 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
buf_len = sizeof(*sm);
/* Read as much as we want into the _end_ of the preallocated buffer */
@@ -5686,7 +5686,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
sumlen = c->sector_size - je32_to_cpu(sm->offset);
sumptr = buf + buf_size - sumlen;
@@ -521,18 +501,15 @@ static int jffs2_scan_eraseblock (struct
@@ -523,18 +506,15 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
sumptr = kmalloc(sumlen, GFP_KERNEL);
if (!sumptr)
return -ENOMEM;
@@ -5709,7 +5709,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
}
}
@@ -543,7 +520,7 @@ static int jffs2_scan_eraseblock (struct
@@ -545,7 +525,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
if (buf_size && sumlen > buf_size)
kfree(sumptr);
@@ -5718,7 +5718,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
If it returns positive, that's a block classification
(i.e. BLK_STATE_xxx) so return that too.
If it returns zero, fall through to full scan. */
@@ -605,7 +582,7 @@ full_scan:
@@ -607,7 +587,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
/* Now ofs is a complete physical flash offset as it always was... */
ofs += jeb->offset;
@@ -5727,7 +5727,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
dbg_summary("no summary found in jeb 0x%08x. Apply original scan.\n",jeb->offset);
@@ -698,7 +675,7 @@ scan_more:
@@ -700,7 +680,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
scan_end = buf_len;
goto more_empty;
}
@@ -5736,7 +5736,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
/* See how much more there is to read in this eraseblock... */
buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
if (!buf_len) {
@@ -948,7 +925,7 @@ scan_more:
@@ -950,7 +930,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
jffs2_dbg(1, "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n",
jeb->offset, jeb->free_size, jeb->dirty_size,
jeb->unchecked_size, jeb->used_size, jeb->wasted_size);
@@ -5745,7 +5745,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
/* mark_node_obsolete can add to wasted !! */
if (jeb->wasted_size) {
jeb->dirty_size += jeb->wasted_size;
@@ -976,7 +953,6 @@ struct jffs2_inode_cache *jffs2_scan_mak
@@ -978,7 +958,6 @@ struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uin
pr_notice("%s(): allocation of inode cache failed\n", __func__);
return NULL;
}
@@ -5753,7 +5753,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
ic->ino = ino;
ic->nodes = (void *)ic;
@@ -1067,7 +1043,7 @@ static int jffs2_scan_dirent_node(struct
@@ -1069,7 +1048,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
pseudo_random += je32_to_cpu(rd->version);
/* Should never happen. Did. (OLPC trac #4184)*/
@@ -5762,7 +5762,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
if (checkedlen < rd->nsize) {
pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
ofs, checkedlen);
@@ -1079,7 +1055,7 @@ static int jffs2_scan_dirent_node(struct
@@ -1081,7 +1060,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
memcpy(&fd->name, rd->name, checkedlen);
fd->name[checkedlen] = 0;
@@ -5771,7 +5771,248 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
if (crc != je32_to_cpu(rd->name_crc)) {
pr_notice("%s(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
__func__, ofs, je32_to_cpu(rd->name_crc), crc);
@@ -1104,7 +1080,7 @@ static int jffs2_scan_dirent_node(struct
@@ -1106,7 +1085,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
fd->next = NULL;
fd->version = je32_to_cpu(rd->version);
fd->ino = je32_to_cpu(rd->ino);
- fd->nhash = full_name_hash(NULL, fd->name, checkedlen);
+ fd->nhash = full_name_hash(fd->name, checkedlen);
fd->type = rd->type;
jffs2_add_fd_to_list(c, fd, &ic->scan_dents);
diff
@@ -9,18 +9,17 @@
*
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/mtd/mtd.h>
#include <linux/pagemap.h>
-#include <linux/crc32.h>
#include <linux/compiler.h>
#include "nodelist.h"
#include "summary.h"
#include "debug.h"
+#include "mtd_dev.h"
+#include "los_typedef.h"
+#include "los_crc32.h"
#define DEFAULT_EMPTY_SCAN_SIZE 256
@@ -74,7 +73,7 @@ static int file_dirty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
return ret;
if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size)))
return ret;
- /* Turned wasted size into dirty, since we apparently
+ /* Turned wasted size into dirty, since we apparently
think it's recoverable now. */
jeb->dirty_size += jeb->wasted_size;
c->dirty_size += jeb->wasted_size;
@@ -95,40 +94,26 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
unsigned char *flashbuf = NULL;
uint32_t buf_size = 0;
struct jffs2_summary *s = NULL; /* summary info collected by the scan process */
-#ifndef __ECOS
- size_t pointlen, try_size;
-
- ret = mtd_point(c->mtd, 0, c->mtd->size, &pointlen,
- (void **)&flashbuf, NULL);
- if (!ret && pointlen < c->mtd->size) {
- /* Don't muck about if it won't let us point to the whole flash */
- jffs2_dbg(1, "MTD point returned len too short: 0x%zx\n",
- pointlen);
- mtd_unpoint(c->mtd, 0, pointlen);
- flashbuf = NULL;
- }
- if (ret && ret != -EOPNOTSUPP)
- jffs2_dbg(1, "MTD point failed %d\n", ret);
-#endif
+ struct super_block *sb = NULL;
+ struct MtdNorDev *device = NULL;
+
if (!flashbuf) {
/* For NAND it's quicker to read a whole eraseblock at a time,
apparently */
if (jffs2_cleanmarker_oob(c))
- try_size = c->sector_size;
+ buf_size = c->sector_size;
else
- try_size = PAGE_SIZE;
+ buf_size = PAGE_SIZE;
jffs2_dbg(1, "Trying to allocate readbuf of %zu "
- "bytes\n", try_size);
+ "bytes\n", buf_size);
- flashbuf = mtd_kmalloc_up_to(c->mtd, &try_size);
+ flashbuf = kmalloc(buf_size, GFP_KERNEL);
if (!flashbuf)
return -ENOMEM;
jffs2_dbg(1, "Allocated readbuf of %zu bytes\n",
- try_size);
-
- buf_size = (uint32_t)try_size;
+ buf_size);
}
if (jffs2_sum_active()) {
@@ -140,7 +125,9 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
}
}
- for (i=0; i<c->nr_blocks; i++) {
+ sb = OFNI_BS_2SFFJ(c);
+ device = (struct MtdNorDev*)(sb->s_dev);
+ for (i=device->blockStart; i<c->nr_blocks + device->blockStart; i++) {
struct jffs2_eraseblock *jeb = &c->blocks[i];
cond_resched();
@@ -269,14 +256,10 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
ret = -EIO;
goto out;
}
- spin_lock(&c->erase_completion_lock);
- jffs2_garbage_collect_trigger(c);
- spin_unlock(&c->erase_completion_lock);
}
ret = 0;
out:
- jffs2_sum_reset_collected(s);
- kfree(s);
+ kfree(flashbuf);
out_buf:
if (buf_size)
kfree(flashbuf);
@@ -413,7 +396,7 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
if (!ref)
return -ENOMEM;
- /* BEFORE jffs2_build_xattr_subsystem() called,
+ /* BEFORE jffs2_build_xattr_subsystem() called,
* and AFTER xattr_ref is marked as a dead xref,
* ref->xid is used to store 32bit xid, xd is not used
* ref->ino is used to store 32bit inode-number, ic is not used
@@ -486,10 +469,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
struct jffs2_sum_marker *sm;
void *sumptr = NULL;
uint32_t sumlen;
-
+
if (!buf_size) {
/* XIP case. Just look, point at the summary if it's there */
- sm = (void *)buf + c->sector_size - sizeof(*sm);
+ sm = (struct jffs2_sum_marker *)((uint8_t *)buf + c->sector_size - sizeof(*sm));
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
sumptr = buf + je32_to_cpu(sm->offset);
sumlen = c->sector_size - je32_to_cpu(sm->offset);
@@ -502,13 +485,13 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
buf_len = sizeof(*sm);
/* Read as much as we want into the _end_ of the preallocated buffer */
- err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len,
+ err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len,
jeb->offset + c->sector_size - buf_len,
- buf_len);
+ buf_len);
if (err)
return err;
- sm = (void *)buf + buf_size - sizeof(*sm);
+ sm = (struct jffs2_sum_marker *)((uint8_t *)buf + buf_size - sizeof(*sm));
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
sumlen = c->sector_size - je32_to_cpu(sm->offset);
sumptr = buf + buf_size - sumlen;
@@ -523,18 +506,15 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
sumptr = kmalloc(sumlen, GFP_KERNEL);
if (!sumptr)
return -ENOMEM;
- memcpy(sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len);
+ memcpy((uint8_t *)sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len);
}
if (buf_len < sumlen) {
/* Need to read more so that the entire summary node is present */
- err = jffs2_fill_scan_buf(c, sumptr,
+ err = jffs2_fill_scan_buf(c, sumptr,
jeb->offset + c->sector_size - sumlen,
- sumlen - buf_len);
- if (err) {
- if (sumlen > buf_size)
- kfree(sumptr);
+ sumlen - buf_len);
+ if (err)
return err;
- }
}
}
@@ -545,7 +525,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
if (buf_size && sumlen > buf_size)
kfree(sumptr);
- /* If it returns with a real error, bail.
+ /* If it returns with a real error, bail.
If it returns positive, that's a block classification
(i.e. BLK_STATE_xxx) so return that too.
If it returns zero, fall through to full scan. */
@@ -607,7 +587,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
/* Now ofs is a complete physical flash offset as it always was... */
ofs += jeb->offset;
- noise = 10;
+ noise = 1;
dbg_summary("no summary found in jeb 0x%08x. Apply original scan.\n",jeb->offset);
@@ -700,7 +680,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
scan_end = buf_len;
goto more_empty;
}
-
+
/* See how much more there is to read in this eraseblock... */
buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
if (!buf_len) {
@@ -950,7 +930,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
jffs2_dbg(1, "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n",
jeb->offset, jeb->free_size, jeb->dirty_size,
jeb->unchecked_size, jeb->used_size, jeb->wasted_size);
-
+
/* mark_node_obsolete can add to wasted !! */
if (jeb->wasted_size) {
jeb->dirty_size += jeb->wasted_size;
@@ -978,7 +958,6 @@ struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uin
pr_notice("%s(): allocation of inode cache failed\n", __func__);
return NULL;
}
- memset(ic, 0, sizeof(*ic));
ic->ino = ino;
ic->nodes = (void *)ic;
@@ -1069,7 +1048,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
pseudo_random += je32_to_cpu(rd->version);
/* Should never happen. Did. (OLPC trac #4184)*/
- checkedlen = strnlen(rd->name, rd->nsize);
+ checkedlen = strnlen((const char *)rd->name, rd->nsize);
if (checkedlen < rd->nsize) {
pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
ofs, checkedlen);
@@ -1081,7 +1060,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
memcpy(&fd->name, rd->name, checkedlen);
fd->name[checkedlen] = 0;
- crc = crc32(0, fd->name, checkedlen);
+ crc = crc32(0, fd->name, rd->nsize);
if (crc != je32_to_cpu(rd->name_crc)) {
pr_notice("%s(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
__func__, ofs, je32_to_cpu(rd->name_crc), crc);
@@ -1106,7 +1085,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
fd->next = NULL;
fd->version = je32_to_cpu(rd->version);
fd->ino = je32_to_cpu(rd->ino);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -682,7 +682,6 @@ int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, const ch
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
ret = jffs2_rmdir(parentInode, targetInode, (const unsigned char *)path);
if (ret == 0) {
(void)jffs2_iput(targetInode);
}
@@ -781,7 +780,6 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
cnt = (bufLen - 1) < targetLen ? (bufLen - 1) : targetLen;
if (LOS_CopyFromKernel(buffer, bufLen, (const char *)f->target, cnt) != 0) {
cnt = 0;
LOS_MuxUnlock(&g_jffs2FsLock);
return -EFAULT;
}
@@ -809,7 +807,6 @@ int VfsJffs2Unlink(struct Vnode *parentVnode, struct Vnode *targetVnode, const c
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
ret = jffs2_unlink(parentInode, targetInode, (const unsigned char *)path);
if (ret == 0) {
(void)jffs2_iput(targetInode);
}

View File

@@ -137,7 +137,7 @@ struct ProcData {
#define S_IALLUGO (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
/**
* Interface for modules using proc below internal proc moudule;
* Interface for modules using proc below internal proc module;
*/
/**
* @ingroup procfs

View File

@@ -135,7 +135,7 @@ void ProcFdInit(void)
{
struct ProcDirEntry *pde = CreateProcEntry("fd", 0, NULL);
if (pde == NULL) {
PRINT_ERR("creat /proc/fd error.\n");
PRINT_ERR("create /proc/fd error.\n");
return;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -154,7 +154,8 @@ static int FsCacheInfoFill(struct SeqBuf *buf, void *arg)
VnodeHold();
LosBufPrintf(buf, "\n=================================================================\n");
LosBufPrintf(buf, "VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
LosBufPrintf(buf,
"VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
vnodeVirtual = VnodeListProcess(buf, GetVnodeVirtualList());
vnodeFree = VnodeListProcess(buf, GetVnodeFreeList());
vnodeActive = VnodeListProcess(buf, GetVnodeActiveList());

View File

@@ -91,7 +91,7 @@ void ProcMountsInit(void)
{
struct ProcDirEntry *pde = CreateProcEntry("mounts", 0, NULL);
if (pde == NULL) {
PRINT_ERR("creat mounts error!\n");
PRINT_ERR("create mounts error!\n");
return;
}

View File

@@ -78,7 +78,7 @@ void ProcUptimeInit(void)
{
struct ProcDirEntry *pde = CreateProcEntry("uptime", 0, NULL);
if (pde == NULL) {
PRINT_ERR("creat /proc/uptime error!\n");
PRINT_ERR("create /proc/uptime error!\n");
return;
}

View File

@@ -62,8 +62,9 @@ static struct ProcDirEntry g_procRootDirEntry = {
int ProcMatch(unsigned int len, const char *name, struct ProcDirEntry *pn)
{
if (len != pn->nameLen)
if (len != pn->nameLen) {
return 0;
}
return !strncmp(name, pn->name, len);
}
@@ -387,8 +388,9 @@ static void FreeProcEntry(struct ProcDirEntry *entry)
void ProcFreeEntry(struct ProcDirEntry *pn)
{
if (atomic_dec_and_test(&pn->count))
if (atomic_dec_and_test(&pn->count)) {
FreeProcEntry(pn);
}
}
static void RemoveProcEntryTravalsal(struct ProcDirEntry *pn)

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -62,8 +62,8 @@ int OsShellCmdWriteProc(int argc, char **argv)
if (argc == WRITEPROC_ARGC) {
value = argv[0];
path = argv[2];
len = strlen(value) + 1; /* +1:add the \0 */
path = argv[2]; // 2: index of path
len = strlen(value) + 1; /* + 1:add the \0 */
if (strncmp(argv[1], ">>", strlen(">>")) == 0) {
if ((realpath(path, realPath) == NULL) || (strncmp(realPath, rootProcDir, strlen(rootProcDir)) != 0)) {
PRINT_ERR("No such file or directory\n");

View File

@@ -29,10 +29,9 @@ endchoice
config BOOTENV_ADDR
int "Address of boot command line (KB)"
depends on PLATFORM_ROOTFS && (STORAGE_SPINOR || STORAGE_SPINAND || STORAGE_EMMC)
range 0 1024
default 512
help
Boot command line addr, range from 0 to 1MB.
Boot command line addr.
config BOOTENV_RAM
bool "Read bootenv from RAM"

View File

@@ -33,10 +33,6 @@ MODULE_NAME := rootfs
LOCAL_SRCS := $(wildcard los_rootfs.c los_bootargs.c)
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/../../device/qemu/drivers/cfiflash
endif
LOCAL_FLAGS := $(LOCAL_INCLUDE)
include $(MODULE)

View File

@@ -32,14 +32,10 @@
#include "los_base.h"
#include "string.h"
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
#include "mtd_list.h"
#endif
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
#include "cfiflash.h"
#endif
#ifdef LOSCFG_STORAGE_EMMC
#include "disk.h"
#endif
@@ -98,19 +94,6 @@ INT32 LOS_GetCmdLine(VOID)
}
#endif
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
struct MtdDev *mtd = GetCfiMtdDev();
if (mtd == NULL) {
PRINT_ERR("Get CFI mtd failed!\n");
goto ERROUT;
}
g_alignSize = mtd->eraseSize;
ret = mtd->read(mtd, CFIFLASH_BOOTARGS_ADDR, COMMAND_LINE_SIZE, g_cmdLine);
if (ret == COMMAND_LINE_SIZE) {
return LOS_OK;
}
#endif
PRINT_ERR("Read cmdline error!\n");
ERROUT:
free(g_cmdLine);

View File

@@ -37,15 +37,11 @@
#include "sys/stat.h"
#include "sys/types.h"
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
#include "mtd_list.h"
#include "mtd_partition.h"
#endif
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
#include "cfiflash.h"
#endif
#ifdef LOSCFG_STORAGE_EMMC
#include "disk.h"
#include "ff.h"
@@ -128,14 +124,7 @@ STATIC INT32 AddEmmcParts(INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32
STATIC INT32 AddPartitions(CHAR *dev, UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize)
{
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
if ((strcmp(dev, "cfi-flash") == 0) && (rootAddr != CFIFLASH_ROOT_ADDR)) {
PRINT_ERR("Error rootAddr, must be %#0x!\n", CFIFLASH_ROOT_ADDR);
return LOS_NOK;
}
#endif
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
INT32 ret;
INT32 blk0 = 0;
INT32 blk2 = 2;

View File

@@ -59,12 +59,6 @@
#define ROOTFS_ADDR 0x600000
#define ROOTFS_SIZE 0x800000
#define USERFS_SIZE 0x80000
#elif defined (LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
#define ROOT_DEV_NAME "/dev/cfiflash0"
#define USER_DEV_NAME "/dev/cfiflash2"
#define ROOTFS_ADDR CFIFLASH_ROOT_ADDR
#define ROOTFS_SIZE 0x1B00000
#define USERFS_SIZE (CFIFLASH_CAPACITY - ROOTFS_ADDR - ROOTFS_SIZE)
#elif defined (LOSCFG_STORAGE_EMMC)
#define ROOT_DEV_NAME "/dev/mmcblk0p0"
#ifdef LOSCFG_PLATFORM_PATCHFS

View File

@@ -581,8 +581,8 @@ static OsBcacheBlock *AllocNewBlock(OsBcache *bc, BOOL read, UINT64 num)
DelBlock(bc, prefer);
}
if (prefer->used) {
MergeSyncBlocks(bc, prefer);
if (prefer->used) { /* do not combine with next check */
MergeSyncBlocks(bc, prefer); /* prefer->used may be changed here */
}
if (prefer->used) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -164,23 +164,23 @@ static VOID DoEpollClose(struct epoll_head *epHead)
}
/**
* epoll_create,
* epoll_create unsupported api
*
* epoll_create is implemented by calling epoll_create1, it's parameter 'size' is useless.
*
* epoll_create1,
* The simple version of epoll does not use red-black trees,
* so when fd is normal value (greater than 0),
* actually allocated epoll can manage num of EPOLL_DEFAULT_SIZE
*
* @param size: not actually used
* @param flags: not actually used
* @return epoll fd
*/
int epoll_create(int size)
int epoll_create1(int flags)
{
(void)flags;
int fd = -1;
if (size <= 0) {
set_errno(EINVAL);
return fd;
}
struct epoll_head *epHead = (struct epoll_head *)malloc(sizeof(struct epoll_head));
if (epHead == NULL) {
set_errno(ENOMEM);
@@ -304,7 +304,7 @@ int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout
int pollSize;
epHead = EpollGetDataBuff(epfd);
if (epHead== NULL) {
if (epHead == NULL) {
set_errno(EBADF);
return -1;
}

View File

@@ -138,7 +138,7 @@ typedef struct tagOsBcache {
* <li>The block number is automatically adjusted if position is greater than block size.</li>
* </ul>
*
* @retval #0 read succeded
* @retval #0 read succeeded
* @retval #INT32 read failed
*
* @par Dependency:
@@ -168,7 +168,7 @@ INT32 BlockCacheRead(OsBcache *bc,
* <li>The block number is automatically adjusted if position is greater than block size.</li>
* </ul>
*
* @retval #0 write succeded
* @retval #0 write succeeded
* @retval #INT32 write failed
*
* @par Dependency:
@@ -193,7 +193,7 @@ INT32 BlockCacheWrite(OsBcache *bc,
* <li>None.</li>
* </ul>
*
* @retval #0 sync succeded
* @retval #0 sync succeeded
* @retval #INT32 sync failed
*
* @par Dependency:
@@ -219,7 +219,7 @@ INT32 BlockCacheSync(OsBcache *bc);
* <li>None.</li>
* </ul>
*
* @retval #OsBcache * init succeded
* @retval #OsBcache * init succeeded
* @retval #NULL init failed
*
* @par Dependency:

View File

@@ -72,7 +72,7 @@ struct epoll_event {
epoll_data_t data;
};
int epoll_create(int size);
int epoll_create1(int flags);
int epoll_close(int epfd);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev);
int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout);

View File

@@ -160,7 +160,7 @@ typedef int VfsHashCmp(struct Vnode *vnode, void *arg);
int VnodesInit(void);
int VnodeDevInit(void);
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **vnode);
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode);
int VnodeFree(struct Vnode *vnode);
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
int VnodeLookupFullpath(const char *fullpath, struct Vnode **vnode, uint32_t flags);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -225,7 +225,6 @@ static char *vfs_normalize_fullpath(const char *directory, const char *filename,
/* it's a absolute path, use it directly */
fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) {
*pathname = NULL;
set_errno(ENOMEM);
@@ -258,11 +257,10 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
}
#ifdef VFS_USING_WORKDIR
if (directory == NULL)
{
if (directory == NULL) {
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
directory = curr->files->workdir;
}
}
#else
if ((directory == NULL) && (filename[0] != '/')) {
PRINT_ERR("NO_WORKING_DIR\n");
@@ -275,20 +273,18 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
#ifdef VFS_USING_WORKDIR
if (dir_flags == TRUE)
{
if (dir_flags == TRUE) {
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
}
}
#endif
return -ENAMETOOLONG;
}
fullpath = vfs_normalize_fullpath(directory, filename, pathname, namelen);
#ifdef VFS_USING_WORKDIR
if (dir_flags == TRUE)
{
if (dir_flags == TRUE) {
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
}
}
#endif
if (fullpath == NULL) {
return -get_errno();
@@ -308,7 +304,7 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
int vfs_normalize_pathat(int dirfd, const char *filename, char **pathname)
{
/* Get path by dirfd*/
/* Get path by dirfd */
char *relativeoldpath = NULL;
char *fullpath = NULL;
int ret = 0;

View File

@@ -133,7 +133,7 @@ int fallocate64(int fd, int mode, off64_t offset, off64_t len)
return VFS_ERROR;
}
if (filep->f_oflags & O_DIRECTORY) {
if ((unsigned int)filep->f_oflags & O_DIRECTORY) {
set_errno(EBADF);
return VFS_ERROR;
}

View File

@@ -353,7 +353,7 @@ static struct file_operations_vfs g_errorFileOps = {
.unlink = ErrorFopUnlink,
};
static struct Mount* GetDevMountPoint(struct Vnode *dev)
static struct Mount* GetDevMountPoint(const struct Vnode *dev)
{
struct Mount *mnt = NULL;
LIST_HEAD *mntList = GetMountList();
@@ -394,7 +394,7 @@ static void FilePreClose(struct file *filep, const struct file_operations_vfs *o
}
}
static void FileDisableAndClean(struct Mount *mnt)
static void FileDisableAndClean(const struct Mount *mnt)
{
struct filelist *flist = &tg_filelist;
struct file *filep = NULL;
@@ -435,7 +435,7 @@ static void VnodeTryFree(struct Vnode *vnode)
vnode->fop = &g_errorFileOps;
}
static void VnodeTryFreeAll(struct Mount *mount)
static void VnodeTryFreeAll(const struct Mount *mount)
{
struct Vnode *vnode = NULL;
struct Vnode *nextVnode = NULL;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -132,19 +132,19 @@ int VfsPermissionCheck(uint fuid, uint fgid, uint fileMode, int accMode)
#ifdef VFS_USING_WORKDIR
static int SetWorkDir(const char *dir, size_t len)
{
errno_t ret;
uint lock_flags;
LosProcessCB *curr = OsCurrProcessGet();
errno_t ret;
uint lock_flags;
LosProcessCB *curr = OsCurrProcessGet();
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
ret = strncpy_s(curr->files->workdir, PATH_MAX, dir, len);
curr->files->workdir[PATH_MAX - 1] = '\0';
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
if (ret != EOK) {
return -1;
}
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
ret = strncpy_s(curr->files->workdir, PATH_MAX, dir, len);
curr->files->workdir[PATH_MAX - 1] = '\0';
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
if (ret != EOK) {
return -1;
}
return 0;
return 0;
}
#endif
@@ -155,7 +155,6 @@ int chdir(const char *path)
char *fullpath_bak = NULL;
struct stat statBuff;
if (!path) {
set_errno(EFAULT);
return -1;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -57,7 +57,6 @@ int utime(const char *path, const struct utimbuf *ptimes)
/* Sanity checks */
if (path == NULL) {
ret = -EINVAL;
goto errout;

View File

@@ -66,7 +66,6 @@ static int iov_trans_to_buf(char *buf, ssize_t totallen, const struct iovec *iov
} else {
writepart = bytestowrite - ret;
curbuf += writepart;
totallen -= writepart;
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -239,7 +239,7 @@ BOOL VnodeInUseIter(const struct Mount *mount)
return FALSE;
}
int VnodeHold()
int VnodeHold(void)
{
int ret = LOS_MuxLock(&g_vnodeMux, LOS_WAIT_FOREVER);
if (ret != LOS_OK) {
@@ -248,7 +248,7 @@ int VnodeHold()
return ret;
}
int VnodeDrop()
int VnodeDrop(void)
{
int ret = LOS_MuxUnlock(&g_vnodeMux);
if (ret != LOS_OK) {
@@ -583,7 +583,7 @@ int VnodeCreate(struct Vnode *parent, const char *name, int mode, struct Vnode *
return 0;
}
int VnodeDevInit()
int VnodeDevInit(void)
{
struct Vnode *devNode = NULL;
struct Mount *devMount = NULL;
@@ -616,7 +616,7 @@ int VnodeGetattr(struct Vnode *vnode, struct stat *buf)
return LOS_OK;
}
struct Vnode *VnodeGetRoot()
struct Vnode *VnodeGetRoot(void)
{
return g_rootVnode;
}
@@ -697,7 +697,7 @@ LIST_HEAD* GetVnodeActiveList()
return &g_vnodeActiveList;
}
int VnodeClearCache()
int VnodeClearCache(void)
{
struct Vnode *item = NULL;
struct Vnode *nextItem = NULL;

View File

@@ -67,6 +67,12 @@ config PAGE_TABLE_FINE_LOCK
help
This option will enable fine lock for page table.
config ENABLE_KERNEL_TEST
bool "Enable kernel test"
default n
help
This option will enable kernel test.
######################### config options of extended #####################
source "kernel/extended/Kconfig"

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -65,10 +65,12 @@ kernel_module(module_name) {
"mp/los_mp.c",
"mp/los_percpu.c",
"mp/los_spinlock.c",
"mp/los_stat.c",
"om/los_err.c",
"sched/sched_sq/los_sched.c",
"sched/sched_sq/los_sortlink.c",
"sched/los_idle.c",
"sched/los_priority.c",
"sched/los_sched.c",
"sched/los_sortlink.c",
"sched/los_statistics.c",
"vm/los_vm_boot.c",
"vm/los_vm_dump.c",
"vm/los_vm_fault.c",
@@ -88,8 +90,13 @@ kernel_module(module_name) {
}
public_configs = [ ":public" ]
configs += [ ":private" ]
}
config("public") {
include_dirs = [ "include" ]
}
config("private") {
cflags = [ "-Wno-frame-address" ]
}

View File

@@ -28,7 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include $(LITEOSTOPDIR)/config.mk
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk
include $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos/lite.mk
MODULE_NAME := $(notdir $(shell pwd))
@@ -37,9 +37,9 @@ LOCAL_SRCS := $(wildcard ipc/*.c) $(wildcard core/*.c) $(wildcard mem/membox/*.
$(wildcard misc/*.c)\
$(wildcard mem/tlsf/*.c) \
$(wildcard mp/*.c) \
$(wildcard sched/sched_sq/*.c) \
$(wildcard sched/*.c) \
$(wildcard vm/*.c)
LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK)
LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK) -Wno-frame-address
include $(MODULE)

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -87,7 +87,7 @@ VOID OsDeleteTaskFromProcess(LosTaskCB *taskCB)
OsTaskInsertToRecycleList(taskCB);
}
UINT32 OsProcessAddNewTask(UINT32 pid, LosTaskCB *taskCB)
UINT32 OsProcessAddNewTask(UINT32 pid, LosTaskCB *taskCB, SchedParam *param)
{
UINT32 intSave;
UINT16 numCount;
@@ -100,12 +100,14 @@ UINT32 OsProcessAddNewTask(UINT32 pid, LosTaskCB *taskCB)
if (OsProcessIsUserMode(processCB)) {
taskCB->taskStatus |= OS_TASK_FLAG_USER_MODE;
if (processCB->threadNumber > 0) {
taskCB->basePrio = OS_TCB_FROM_TID(processCB->threadGroupID)->basePrio;
LosTaskCB *task = OS_TCB_FROM_TID(processCB->threadGroupID);
task->ops->schedParamGet(task, param);
} else {
taskCB->basePrio = OS_USER_PROCESS_PRIORITY_HIGHEST;
OsSchedProcessDefaultSchedParamGet(param->policy, param);
}
} else {
taskCB->basePrio = OsCurrTaskGet()->basePrio;
LosTaskCB *runTask = OsCurrTaskGet();
runTask->ops->schedParamGet(runTask, param);
}
#ifdef LOSCFG_KERNEL_VM
@@ -283,7 +285,7 @@ STATIC LosProcessCB *OsFindExitChildProcess(const LosProcessCB *processCB, INT32
VOID OsWaitWakeTask(LosTaskCB *taskCB, UINT32 wakePID)
{
taskCB->waitID = wakePID;
OsSchedTaskWake(taskCB);
taskCB->ops->wake(taskCB);
#ifdef LOSCFG_KERNEL_SMP
LOS_MpSchedule(OS_MP_CPU_ALL);
#endif
@@ -897,7 +899,7 @@ STATIC INLINE INT32 OsProcessSchedlerParamCheck(INT32 which, INT32 pid, UINT16 p
}
#ifdef LOSCFG_SECURITY_CAPABILITY
STATIC BOOL OsProcessCapPermitCheck(const LosProcessCB *processCB, UINT16 prio)
STATIC BOOL OsProcessCapPermitCheck(const LosProcessCB *processCB, const SchedParam *param, UINT16 prio)
{
LosProcessCB *runProcess = OsCurrProcessGet();
@@ -907,7 +909,7 @@ STATIC BOOL OsProcessCapPermitCheck(const LosProcessCB *processCB, UINT16 prio)
}
/* user mode process can reduce the priority of itself */
if ((runProcess->processID == processCB->processID) && (prio > OsCurrTaskGet()->basePrio)) {
if ((runProcess->processID == processCB->processID) && (prio > param->basePrio)) {
return TRUE;
}
@@ -921,31 +923,33 @@ STATIC BOOL OsProcessCapPermitCheck(const LosProcessCB *processCB, UINT16 prio)
LITE_OS_SEC_TEXT INT32 OsSetProcessScheduler(INT32 which, INT32 pid, UINT16 prio, UINT16 policy)
{
LosProcessCB *processCB = NULL;
BOOL needSched = FALSE;
SchedParam param = { 0 };
UINT32 intSave;
INT32 ret;
ret = OsProcessSchedlerParamCheck(which, pid, prio, policy);
INT32 ret = OsProcessSchedlerParamCheck(which, pid, prio, policy);
if (ret != LOS_OK) {
return -ret;
}
LosProcessCB *processCB = OS_PCB_FROM_PID(pid);
SCHEDULER_LOCK(intSave);
processCB = OS_PCB_FROM_PID(pid);
if (OsProcessIsInactive(processCB)) {
ret = LOS_ESRCH;
goto EXIT;
}
#ifdef LOSCFG_SECURITY_CAPABILITY
if (!OsProcessCapPermitCheck(processCB, prio)) {
if (!OsProcessCapPermitCheck(processCB, &param, prio)) {
ret = LOS_EPERM;
goto EXIT;
}
#endif
needSched = OsSchedModifyProcessSchedParam(pid, policy, prio);
LosTaskCB *taskCB = OS_TCB_FROM_TID(processCB->threadGroupID);
taskCB->ops->schedParamGet(taskCB, &param);
param.basePrio = prio;
BOOL needSched = taskCB->ops->schedParamModify(taskCB, &param);
SCHEDULER_UNLOCK(intSave);
LOS_MpSchedule(OS_MP_CPU_ALL);
@@ -991,8 +995,8 @@ LITE_OS_SEC_TEXT INT32 LOS_SetProcessPriority(INT32 pid, UINT16 prio)
LITE_OS_SEC_TEXT INT32 OsGetProcessPriority(INT32 which, INT32 pid)
{
INT32 prio;
UINT32 intSave;
SchedParam param = { 0 };
(VOID)which;
if (OS_PID_CHECK_INVALID(pid)) {
@@ -1006,15 +1010,15 @@ LITE_OS_SEC_TEXT INT32 OsGetProcessPriority(INT32 which, INT32 pid)
LosProcessCB *processCB = OS_PCB_FROM_PID(pid);
SCHEDULER_LOCK(intSave);
if (OsProcessIsUnused(processCB)) {
prio = -LOS_ESRCH;
goto OUT;
SCHEDULER_UNLOCK(intSave);
return -LOS_ESRCH;
}
prio = (INT32)OS_TCB_FROM_TID(processCB->threadGroupID)->basePrio;
LosTaskCB *taskCB = OS_TCB_FROM_TID(processCB->threadGroupID);
taskCB->ops->schedParamGet(taskCB, &param);
OUT:
SCHEDULER_UNLOCK(intSave);
return prio;
return param.basePrio;
}
LITE_OS_SEC_TEXT INT32 LOS_GetProcessPriority(INT32 pid)
@@ -1050,8 +1054,7 @@ STATIC VOID OsWaitInsertWaitListInOrder(LosTaskCB *runTask, LosProcessCB *proces
/* if runTask->waitFlag == OS_PROCESS_WAIT_PRO,
* this node is inserted directly into the header of the waitList
*/
(VOID)OsSchedTaskWait(list->pstNext, LOS_WAIT_FOREVER, TRUE);
(VOID)runTask->ops->wait(runTask, list->pstNext, LOS_WAIT_FOREVER);
return;
}
@@ -1202,13 +1205,10 @@ STATIC INT32 OsWait(INT32 pid, USER INT32 *status, USER siginfo_t *info, UINT32
UINT32 ret;
UINT32 intSave;
LosProcessCB *childCB = NULL;
LosProcessCB *processCB = NULL;
LosTaskCB *runTask = NULL;
LosProcessCB *processCB = OsCurrProcessGet();
LosTaskCB *runTask = OsCurrTaskGet();
SCHEDULER_LOCK(intSave);
processCB = OsCurrProcessGet();
runTask = OsCurrTaskGet();
ret = OsWaitChildProcessCheck(processCB, pid, &childCB);
if (ret != LOS_OK) {
pid = -ret;
@@ -1725,47 +1725,37 @@ STATIC UINT32 OsCopyUser(LosProcessCB *childCB, LosProcessCB *parentCB)
return LOS_OK;
}
STATIC VOID OsInitCopyTaskParam(LosProcessCB *childProcessCB, const CHAR *name, UINTPTR entry, UINT32 size,
TSK_INIT_PARAM_S *childPara)
{
LosTaskCB *mainThread = NULL;
UINT32 intSave;
SCHEDULER_LOCK(intSave);
mainThread = OsCurrTaskGet();
if (OsProcessIsUserMode(childProcessCB)) {
childPara->pfnTaskEntry = mainThread->taskEntry;
childPara->uwStackSize = mainThread->stackSize;
childPara->userParam.userArea = mainThread->userArea;
childPara->userParam.userMapBase = mainThread->userMapBase;
childPara->userParam.userMapSize = mainThread->userMapSize;
} else {
childPara->pfnTaskEntry = (TSK_ENTRY_FUNC)entry;
childPara->uwStackSize = size;
}
childPara->pcName = (CHAR *)name;
childPara->policy = mainThread->policy;
childPara->usTaskPrio = mainThread->priority;
childPara->processID = childProcessCB->processID;
if (mainThread->taskStatus & OS_TASK_FLAG_PTHREAD_JOIN) {
childPara->uwResved = LOS_TASK_ATTR_JOINABLE;
}
SCHEDULER_UNLOCK(intSave);
}
STATIC UINT32 OsCopyTask(UINT32 flags, LosProcessCB *childProcessCB, const CHAR *name, UINTPTR entry, UINT32 size)
{
LosTaskCB *runTask = OsCurrTaskGet();
TSK_INIT_PARAM_S childPara = { 0 };
UINT32 ret;
UINT32 intSave;
UINT32 taskID;
TSK_INIT_PARAM_S taskParam = { 0 };
UINT32 ret, taskID, intSave;
SchedParam param = { 0 };
OsInitCopyTaskParam(childProcessCB, name, entry, size, &childPara);
SCHEDULER_LOCK(intSave);
if (OsProcessIsUserMode(childProcessCB)) {
taskParam.pfnTaskEntry = runTask->taskEntry;
taskParam.uwStackSize = runTask->stackSize;
taskParam.userParam.userArea = runTask->userArea;
taskParam.userParam.userMapBase = runTask->userMapBase;
taskParam.userParam.userMapSize = runTask->userMapSize;
} else {
taskParam.pfnTaskEntry = (TSK_ENTRY_FUNC)entry;
taskParam.uwStackSize = size;
}
if (runTask->taskStatus & OS_TASK_FLAG_PTHREAD_JOIN) {
taskParam.uwResved = LOS_TASK_ATTR_JOINABLE;
}
ret = LOS_TaskCreateOnly(&taskID, &childPara);
runTask->ops->schedParamGet(runTask, &param);
SCHEDULER_UNLOCK(intSave);
taskParam.pcName = (CHAR *)name;
taskParam.policy = param.policy;
taskParam.usTaskPrio = param.priority;
taskParam.processID = childProcessCB->processID;
ret = LOS_TaskCreateOnly(&taskID, &taskParam);
if (ret != LOS_OK) {
if (ret == LOS_ERRNO_TSK_TCB_UNAVAILABLE) {
return LOS_EAGAIN;
@@ -1775,7 +1765,7 @@ STATIC UINT32 OsCopyTask(UINT32 flags, LosProcessCB *childProcessCB, const CHAR
LosTaskCB *childTaskCB = OS_TCB_FROM_TID(taskID);
childTaskCB->taskStatus = runTask->taskStatus;
childTaskCB->basePrio = runTask->basePrio;
childTaskCB->ops->schedParamModify(childTaskCB, &param);
if (childTaskCB->taskStatus & OS_TASK_STATUS_RUNNING) {
childTaskCB->taskStatus &= ~OS_TASK_STATUS_RUNNING;
} else {
@@ -1882,6 +1872,7 @@ STATIC UINT32 OsChildSetProcessGroupAndSched(LosProcessCB *child, LosProcessCB *
UINT32 ret;
ProcessGroup *group = NULL;
LosTaskCB *taskCB = OS_TCB_FROM_TID(child->threadGroupID);
SCHEDULER_LOCK(intSave);
if (run->group->groupID == OS_USER_PRIVILEGE_PROCESS_GROUP) {
ret = OsSetProcessGroupIDUnsafe(child->processID, child->processID, &group);
@@ -1892,7 +1883,7 @@ STATIC UINT32 OsChildSetProcessGroupAndSched(LosProcessCB *child, LosProcessCB *
}
child->processStatus &= ~OS_PROCESS_STATUS_INIT;
OsSchedTaskEnQueue(OS_TCB_FROM_TID(child->threadGroupID));
taskCB->ops->enqueue(OsSchedRunqueue(), taskCB);
SCHEDULER_UNLOCK(intSave);
(VOID)LOS_MemFree(m_aucSysMem1, group);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -43,6 +43,9 @@
#error "swtmr maxnum cannot be zero"
#endif /* LOSCFG_BASE_CORE_SWTMR_LIMIT <= 0 */
STATIC INLINE VOID SwtmrDelete(SWTMR_CTRL_S *swtmr);
STATIC INLINE UINT64 SwtmrToStart(SWTMR_CTRL_S *swtmr, UINT16 cpuid);
LITE_OS_SEC_BSS SWTMR_CTRL_S *g_swtmrCBArray = NULL; /* First address in Timer memory space */
LITE_OS_SEC_BSS UINT8 *g_swtmrHandlerPool = NULL; /* Pool of Swtmr Handler */
LITE_OS_SEC_BSS LOS_DL_LIST g_swtmrFreeList; /* Free list of Software Timer */
@@ -52,22 +55,232 @@ LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_swtmrSpin);
#define SWTMR_LOCK(state) LOS_SpinLockSave(&g_swtmrSpin, &(state))
#define SWTMR_UNLOCK(state) LOS_SpinUnlockRestore(&g_swtmrSpin, (state))
typedef struct {
SortLinkAttribute swtmrSortLink;
LosTaskCB *swtmrTask; /* software timer task id */
LOS_DL_LIST swtmrHandlerQueue; /* software timer timeout queue id */
} SwtmrRunqueue;
STATIC SwtmrRunqueue g_swtmrRunqueue[LOSCFG_KERNEL_CORE_NUM];
#ifdef LOSCFG_SWTMR_DEBUG
#define OS_SWTMR_PERIOD_TO_CYCLE(period) (((UINT64)(period) * OS_NS_PER_TICK) / OS_NS_PER_CYCLE)
STATIC SwtmrDebugData *g_swtmrDebugData = NULL;
BOOL OsSwtmrDebugDataUsed(UINT32 swtmrID)
{
if (swtmrID > LOSCFG_BASE_CORE_SWTMR_LIMIT) {
return FALSE;
}
return g_swtmrDebugData[swtmrID].swtmrUsed;
}
UINT32 OsSwtmrDebugDataGet(UINT32 swtmrID, SwtmrDebugData *data, UINT32 len, UINT8 *mode)
{
UINT32 intSave;
errno_t ret;
if ((swtmrID > LOSCFG_BASE_CORE_SWTMR_LIMIT) || (data == NULL) ||
(mode == NULL) || (len < sizeof(SwtmrDebugData))) {
return LOS_NOK;
}
SWTMR_CTRL_S *swtmr = &g_swtmrCBArray[swtmrID];
SWTMR_LOCK(intSave);
ret = memcpy_s(data, len, &g_swtmrDebugData[swtmrID], sizeof(SwtmrDebugData));
*mode = swtmr->ucMode;
SWTMR_UNLOCK(intSave);
if (ret != EOK) {
return LOS_NOK;
}
return LOS_OK;
}
#endif
STATIC VOID SwtmrDebugDataInit(VOID)
{
#ifdef LOSCFG_SWTMR_DEBUG
UINT32 size = sizeof(SwtmrDebugData) * LOSCFG_BASE_CORE_SWTMR_LIMIT;
g_swtmrDebugData = (SwtmrDebugData *)LOS_MemAlloc(m_aucSysMem1, size);
if (g_swtmrDebugData == NULL) {
PRINT_ERR("SwtmrDebugDataInit malloc failed!\n");
return;
}
(VOID)memset_s(g_swtmrDebugData, size, 0, size);
#endif
}
STATIC INLINE VOID SwtmrDebugDataUpdate(SWTMR_CTRL_S *swtmr, UINT32 ticks, UINT32 times)
{
#ifdef LOSCFG_SWTMR_DEBUG
SwtmrDebugData *data = &g_swtmrDebugData[swtmr->usTimerID];
if (data->period != ticks) {
(VOID)memset_s(&data->base, sizeof(SwtmrDebugBase), 0, sizeof(SwtmrDebugBase));
data->period = ticks;
}
data->base.startTime = swtmr->startTime;
data->base.times += times;
#endif
}
STATIC INLINE VOID SwtmrDebugDataStart(SWTMR_CTRL_S *swtmr, UINT16 cpuid)
{
#ifdef LOSCFG_SWTMR_DEBUG
SwtmrDebugData *data = &g_swtmrDebugData[swtmr->usTimerID];
data->swtmrUsed = TRUE;
data->handler = swtmr->pfnHandler;
data->cpuid = cpuid;
#endif
}
STATIC INLINE VOID SwtmrDebugWaitTimeCalculate(UINT32 swtmrID, SwtmrHandlerItemPtr swtmrHandler)
{
#ifdef LOSCFG_SWTMR_DEBUG
SwtmrDebugBase *data = &g_swtmrDebugData[swtmrID].base;
swtmrHandler->swtmrID = swtmrID;
UINT64 currTime = OsGetCurrSchedTimeCycle();
UINT64 waitTime = currTime - data->startTime;
data->waitTime += waitTime;
if (waitTime > data->waitTimeMax) {
data->waitTimeMax = waitTime;
}
data->readyStartTime = currTime;
data->waitCount++;
#endif
}
STATIC INLINE VOID SwtmrDebugDataClear(UINT32 swtmrID)
{
#ifdef LOSCFG_SWTMR_DEBUG
(VOID)memset_s(&g_swtmrDebugData[swtmrID], sizeof(SwtmrDebugData), 0, sizeof(SwtmrDebugData));
#endif
}
STATIC INLINE VOID SwtmrHandler(SwtmrHandlerItemPtr swtmrHandle)
{
#ifdef LOSCFG_SWTMR_DEBUG
UINT32 intSave;
SwtmrDebugBase *data = &g_swtmrDebugData[swtmrHandle->swtmrID].base;
UINT64 startTime = OsGetCurrSchedTimeCycle();
#endif
swtmrHandle->handler(swtmrHandle->arg);
#ifdef LOSCFG_SWTMR_DEBUG
UINT64 runTime = OsGetCurrSchedTimeCycle() - startTime;
SWTMR_LOCK(intSave);
data->runTime += runTime;
if (runTime > data->runTimeMax) {
data->runTimeMax = runTime;
}
runTime = startTime - data->readyStartTime;
data->readyTime += runTime;
if (runTime > data->readyTimeMax) {
data->readyTimeMax = runTime;
}
data->runCount++;
SWTMR_UNLOCK(intSave);
#endif
}
STATIC INLINE VOID SwtmrWake(SwtmrRunqueue *srq, UINT64 startTime, SortLinkList *sortList)
{
UINT32 intSave;
SWTMR_CTRL_S *swtmr = LOS_DL_LIST_ENTRY(sortList, SWTMR_CTRL_S, stSortList);
SwtmrHandlerItemPtr swtmrHandler = (SwtmrHandlerItemPtr)LOS_MemboxAlloc(g_swtmrHandlerPool);
LOS_ASSERT(swtmrHandler != NULL);
OsHookCall(LOS_HOOK_TYPE_SWTMR_EXPIRED, swtmr);
SWTMR_LOCK(intSave);
swtmrHandler->handler = swtmr->pfnHandler;
swtmrHandler->arg = swtmr->uwArg;
LOS_ListTailInsert(&srq->swtmrHandlerQueue, &swtmrHandler->node);
SwtmrDebugWaitTimeCalculate(swtmr->usTimerID, swtmrHandler);
if (swtmr->ucMode == LOS_SWTMR_MODE_ONCE) {
SwtmrDelete(swtmr);
if (swtmr->usTimerID < (OS_SWTMR_MAX_TIMERID - LOSCFG_BASE_CORE_SWTMR_LIMIT)) {
swtmr->usTimerID += LOSCFG_BASE_CORE_SWTMR_LIMIT;
} else {
swtmr->usTimerID %= LOSCFG_BASE_CORE_SWTMR_LIMIT;
}
} else if (swtmr->ucMode == LOS_SWTMR_MODE_NO_SELFDELETE) {
swtmr->ucState = OS_SWTMR_STATUS_CREATED;
} else {
swtmr->uwOverrun++;
swtmr->startTime = startTime;
(VOID)SwtmrToStart(swtmr, ArchCurrCpuid());
}
SWTMR_UNLOCK(intSave);
}
STATIC INLINE VOID ScanSwtmrTimeList(SwtmrRunqueue *srq)
{
UINT32 intSave;
SortLinkAttribute *swtmrSortLink = &srq->swtmrSortLink;
LOS_DL_LIST *listObject = &swtmrSortLink->sortLink;
/*
* it needs to be carefully coped with, since the swtmr is in specific sortlink
* while other cores still has the chance to process it, like stop the timer.
*/
LOS_SpinLockSave(&swtmrSortLink->spinLock, &intSave);
if (LOS_ListEmpty(listObject)) {
LOS_SpinUnlockRestore(&swtmrSortLink->spinLock, intSave);
return;
}
SortLinkList *sortList = LOS_DL_LIST_ENTRY(listObject->pstNext, SortLinkList, sortLinkNode);
UINT64 currTime = OsGetCurrSchedTimeCycle();
while (sortList->responseTime <= currTime) {
sortList = LOS_DL_LIST_ENTRY(listObject->pstNext, SortLinkList, sortLinkNode);
UINT64 startTime = GET_SORTLIST_VALUE(sortList);
OsDeleteNodeSortLink(swtmrSortLink, sortList);
LOS_SpinUnlockRestore(&swtmrSortLink->spinLock, intSave);
SwtmrWake(srq, startTime, sortList);
LOS_SpinLockSave(&swtmrSortLink->spinLock, &intSave);
if (LOS_ListEmpty(listObject)) {
break;
}
sortList = LOS_DL_LIST_ENTRY(listObject->pstNext, SortLinkList, sortLinkNode);
}
LOS_SpinUnlockRestore(&swtmrSortLink->spinLock, intSave);
return;
}
STATIC VOID SwtmrTask(VOID)
{
SwtmrHandlerItemPtr swtmrHandlePtr = NULL;
SwtmrHandlerItem swtmrHandle;
UINT32 ret, swtmrHandlerQueue;
UINT32 intSave;
UINT64 waitTime;
swtmrHandlerQueue = OsSchedSwtmrHandlerQueueGet();
SwtmrRunqueue *srq = &g_swtmrRunqueue[ArchCurrCpuid()];
LOS_DL_LIST *head = &srq->swtmrHandlerQueue;
for (;;) {
ret = LOS_QueueRead(swtmrHandlerQueue, &swtmrHandlePtr, sizeof(CHAR *), LOS_WAIT_FOREVER);
if ((ret == LOS_OK) && (swtmrHandlePtr != NULL)) {
swtmrHandle.handler = swtmrHandlePtr->handler;
swtmrHandle.arg = swtmrHandlePtr->arg;
waitTime = OsSortLinkGetNextExpireTime(OsGetCurrSchedTimeCycle(), &srq->swtmrSortLink);
if (waitTime != 0) {
SCHEDULER_LOCK(intSave);
srq->swtmrTask->ops->delay(srq->swtmrTask, waitTime);
OsHookCall(LOS_HOOK_TYPE_MOVEDTASKTODELAYEDLIST, srq->swtmrTask);
SCHEDULER_UNLOCK(intSave);
}
ScanSwtmrTimeList(srq);
while (!LOS_ListEmpty(head)) {
SwtmrHandlerItemPtr swtmrHandlePtr = LOS_DL_LIST_ENTRY(LOS_DL_LIST_FIRST(head), SwtmrHandlerItem, node);
LOS_ListDelete(&swtmrHandlePtr->node);
(VOID)memcpy_s(&swtmrHandle, sizeof(SwtmrHandlerItem), swtmrHandlePtr, sizeof(SwtmrHandlerItem));
(VOID)LOS_MemboxFree(g_swtmrHandlerPool, swtmrHandlePtr);
if (swtmrHandle.handler != NULL) {
swtmrHandle.handler(swtmrHandle.arg);
}
SwtmrHandler(&swtmrHandle);
}
}
}
@@ -94,6 +307,11 @@ STATIC UINT32 SwtmrTaskCreate(UINT16 cpuid, UINT32 *swtmrTaskID)
return ret;
}
UINT32 OsSwtmrTaskIDGetByCpuid(UINT16 cpuid)
{
return g_swtmrRunqueue[cpuid].swtmrTask->taskID;
}
BOOL OsIsSwtmrTask(const LosTaskCB *taskCB)
{
if (taskCB->taskEntry == (TSK_ENTRY_FUNC)SwtmrTask) {
@@ -111,51 +329,58 @@ LITE_OS_SEC_TEXT_INIT VOID OsSwtmrRecycle(UINT32 processID)
}
}
LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrInit(VOID)
STATIC UINT32 SwtmrBaseInit(VOID)
{
UINT32 size;
UINT16 index;
UINT32 ret;
SWTMR_CTRL_S *swtmr = NULL;
UINT32 swtmrHandlePoolSize;
UINT32 cpuid = ArchCurrCpuid();
UINT32 swtmrTaskID, swtmrHandlerQueue;
if (cpuid == 0) {
size = sizeof(SWTMR_CTRL_S) * LOSCFG_BASE_CORE_SWTMR_LIMIT;
swtmr = (SWTMR_CTRL_S *)LOS_MemAlloc(m_aucSysMem0, size); /* system resident resource */
if (swtmr == NULL) {
ret = LOS_ERRNO_SWTMR_NO_MEMORY;
goto ERROR;
}
(VOID)memset_s(swtmr, size, 0, size);
g_swtmrCBArray = swtmr;
LOS_ListInit(&g_swtmrFreeList);
for (index = 0; index < LOSCFG_BASE_CORE_SWTMR_LIMIT; index++, swtmr++) {
swtmr->usTimerID = index;
LOS_ListTailInsert(&g_swtmrFreeList, &swtmr->stSortList.sortLinkNode);
}
swtmrHandlePoolSize = LOS_MEMBOX_SIZE(sizeof(SwtmrHandlerItem), OS_SWTMR_HANDLE_QUEUE_SIZE);
g_swtmrHandlerPool = (UINT8 *)LOS_MemAlloc(m_aucSysMem1, swtmrHandlePoolSize); /* system resident resource */
if (g_swtmrHandlerPool == NULL) {
ret = LOS_ERRNO_SWTMR_NO_MEMORY;
goto ERROR;
}
ret = LOS_MemboxInit(g_swtmrHandlerPool, swtmrHandlePoolSize, sizeof(SwtmrHandlerItem));
if (ret != LOS_OK) {
ret = LOS_ERRNO_SWTMR_HANDLER_POOL_NO_MEM;
goto ERROR;
}
UINT32 size = sizeof(SWTMR_CTRL_S) * LOSCFG_BASE_CORE_SWTMR_LIMIT;
SWTMR_CTRL_S *swtmr = (SWTMR_CTRL_S *)LOS_MemAlloc(m_aucSysMem0, size); /* system resident resource */
if (swtmr == NULL) {
return LOS_ERRNO_SWTMR_NO_MEMORY;
}
ret = LOS_QueueCreate(NULL, OS_SWTMR_HANDLE_QUEUE_SIZE, &swtmrHandlerQueue, 0, sizeof(CHAR *));
(VOID)memset_s(swtmr, size, 0, size);
g_swtmrCBArray = swtmr;
LOS_ListInit(&g_swtmrFreeList);
for (UINT16 index = 0; index < LOSCFG_BASE_CORE_SWTMR_LIMIT; index++, swtmr++) {
swtmr->usTimerID = index;
LOS_ListTailInsert(&g_swtmrFreeList, &swtmr->stSortList.sortLinkNode);
}
size = LOS_MEMBOX_SIZE(sizeof(SwtmrHandlerItem), OS_SWTMR_HANDLE_QUEUE_SIZE);
g_swtmrHandlerPool = (UINT8 *)LOS_MemAlloc(m_aucSysMem1, size); /* system resident resource */
if (g_swtmrHandlerPool == NULL) {
return LOS_ERRNO_SWTMR_NO_MEMORY;
}
ret = LOS_MemboxInit(g_swtmrHandlerPool, size, sizeof(SwtmrHandlerItem));
if (ret != LOS_OK) {
ret = LOS_ERRNO_SWTMR_QUEUE_CREATE_FAILED;
goto ERROR;
return LOS_ERRNO_SWTMR_HANDLER_POOL_NO_MEM;
}
for (UINT16 index = 0; index < LOSCFG_KERNEL_CORE_NUM; index++) {
SwtmrRunqueue *srq = &g_swtmrRunqueue[index];
/* The linked list of all cores must be initialized at core 0 startup for load balancing */
OsSortLinkInit(&srq->swtmrSortLink);
LOS_ListInit(&srq->swtmrHandlerQueue);
srq->swtmrTask = NULL;
}
SwtmrDebugDataInit();
return LOS_OK;
}
LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrInit(VOID)
{
UINT32 ret;
UINT32 cpuid = ArchCurrCpuid();
UINT32 swtmrTaskID;
if (cpuid == 0) {
ret = SwtmrBaseInit();
if (ret != LOS_OK) {
goto ERROR;
}
}
ret = SwtmrTaskCreate(cpuid, &swtmrTaskID);
@@ -164,25 +389,88 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrInit(VOID)
goto ERROR;
}
OsSchedRunQueSwtmrInit(swtmrTaskID, swtmrHandlerQueue);
SwtmrRunqueue *srq = &g_swtmrRunqueue[cpuid];
srq->swtmrTask = OsGetTaskCB(swtmrTaskID);
return LOS_OK;
ERROR:
PRINT_ERR("OsSwtmrInit error! ret = %u\n", ret);
(VOID)LOS_MemFree(m_aucSysMem0, g_swtmrCBArray);
g_swtmrCBArray = NULL;
(VOID)LOS_MemFree(m_aucSysMem1, g_swtmrHandlerPool);
g_swtmrHandlerPool = NULL;
PRINT_ERR("OsSwtmrInit error! ret = %u\n", ret);
return ret;
}
/*
* Description: Start Software Timer
* Input : swtmr --- Need to start software timer
*/
LITE_OS_SEC_TEXT VOID OsSwtmrStart(SWTMR_CTRL_S *swtmr)
#ifdef LOSCFG_KERNEL_SMP
STATIC INLINE VOID FindIdleSwtmrRunqueue(UINT16 *idleCpuid)
{
SwtmrRunqueue *idleRq = &g_swtmrRunqueue[0];
UINT32 nodeNum = OsGetSortLinkNodeNum(&idleRq->swtmrSortLink);
UINT16 cpuid = 1;
do {
SwtmrRunqueue *srq = &g_swtmrRunqueue[cpuid];
UINT32 temp = OsGetSortLinkNodeNum(&srq->swtmrSortLink);
if (nodeNum > temp) {
*idleCpuid = cpuid;
nodeNum = temp;
}
cpuid++;
} while (cpuid < LOSCFG_KERNEL_CORE_NUM);
}
#endif
STATIC INLINE VOID AddSwtmr2TimeList(SortLinkList *node, UINT64 responseTime, UINT16 cpuid)
{
SwtmrRunqueue *srq = &g_swtmrRunqueue[cpuid];
OsAdd2SortLink(&srq->swtmrSortLink, node, responseTime, cpuid);
}
STATIC INLINE VOID DeSwtmrFromTimeList(SortLinkList *node)
{
#ifdef LOSCFG_KERNEL_SMP
UINT16 cpuid = OsGetSortLinkNodeCpuid(node);
#else
UINT16 cpuid = 0;
#endif
SwtmrRunqueue *srq = &g_swtmrRunqueue[cpuid];
OsDeleteFromSortLink(&srq->swtmrSortLink, node);
return;
}
STATIC VOID SwtmrAdjustCheck(UINT16 cpuid, UINT64 responseTime)
{
UINT32 ret;
UINT32 intSave;
SwtmrRunqueue *srq = &g_swtmrRunqueue[cpuid];
SCHEDULER_LOCK(intSave);
if ((srq->swtmrTask == NULL) || !OsTaskIsBlocked(srq->swtmrTask)) {
SCHEDULER_UNLOCK(intSave);
return;
}
if (responseTime >= GET_SORTLIST_VALUE(&srq->swtmrTask->sortList)) {
SCHEDULER_UNLOCK(intSave);
return;
}
ret = OsSchedTimeoutQueueAdjust(srq->swtmrTask, responseTime);
SCHEDULER_UNLOCK(intSave);
if (ret != LOS_OK) {
return;
}
if (cpuid == ArchCurrCpuid()) {
OsSchedExpireTimeUpdate();
} else {
LOS_MpSchedule(CPUID_TO_AFFI_MASK(cpuid));
}
}
STATIC UINT64 SwtmrToStart(SWTMR_CTRL_S *swtmr, UINT16 cpuid)
{
UINT32 ticks;
UINT32 times = 0;
if ((swtmr->uwOverrun == 0) && ((swtmr->ucMode == LOS_SWTMR_MODE_ONCE) ||
(swtmr->ucMode == LOS_SWTMR_MODE_OPP) ||
@@ -193,75 +481,122 @@ LITE_OS_SEC_TEXT VOID OsSwtmrStart(SWTMR_CTRL_S *swtmr)
}
swtmr->ucState = OS_SWTMR_STATUS_TICKING;
OsSchedAddSwtmr2TimeList(&swtmr->stSortList, swtmr->startTime, ticks);
OsSchedUpdateExpireTime();
return;
UINT64 period = (UINT64)ticks * OS_CYCLE_PER_TICK;
UINT64 responseTime = swtmr->startTime + period;
UINT64 currTime = OsGetCurrSchedTimeCycle();
if (responseTime < currTime) {
times = (UINT32)((currTime - swtmr->startTime) / period);
swtmr->startTime += times * period;
responseTime = swtmr->startTime + period;
PRINT_WARN("Swtmr already timeout! SwtmrID: %u\n", swtmr->usTimerID);
}
AddSwtmr2TimeList(&swtmr->stSortList, responseTime, cpuid);
SwtmrDebugDataUpdate(swtmr, ticks, times);
return responseTime;
}
/*
* Description: Start Software Timer
* Input : swtmr --- Need to start software timer
*/
STATIC INLINE VOID SwtmrStart(SWTMR_CTRL_S *swtmr)
{
UINT64 responseTime;
UINT16 idleCpu = 0;
#ifdef LOSCFG_KERNEL_SMP
FindIdleSwtmrRunqueue(&idleCpu);
#endif
swtmr->startTime = OsGetCurrSchedTimeCycle();
responseTime = SwtmrToStart(swtmr, idleCpu);
SwtmrDebugDataStart(swtmr, idleCpu);
SwtmrAdjustCheck(idleCpu, responseTime);
}
/*
* Description: Delete Software Timer
* Input : swtmr --- Need to delete software timer, When using, Ensure that it can't be NULL.
*/
STATIC INLINE VOID OsSwtmrDelete(SWTMR_CTRL_S *swtmr)
STATIC INLINE VOID SwtmrDelete(SWTMR_CTRL_S *swtmr)
{
/* insert to free list */
LOS_ListTailInsert(&g_swtmrFreeList, &swtmr->stSortList.sortLinkNode);
swtmr->ucState = OS_SWTMR_STATUS_UNUSED;
swtmr->uwOwnerPid = 0;
SwtmrDebugDataClear(swtmr->usTimerID);
}
VOID OsSwtmrWake(SchedRunQue *rq, UINT64 startTime, SortLinkList *sortList)
{
SWTMR_CTRL_S *swtmr = LOS_DL_LIST_ENTRY(sortList, SWTMR_CTRL_S, stSortList);
OsHookCall(LOS_HOOK_TYPE_SWTMR_EXPIRED, swtmr);
LOS_SpinLock(&g_swtmrSpin);
SwtmrHandlerItemPtr swtmrHandler = (SwtmrHandlerItemPtr)LOS_MemboxAlloc(g_swtmrHandlerPool);
if (swtmrHandler != NULL) {
swtmrHandler->handler = swtmr->pfnHandler;
swtmrHandler->arg = swtmr->uwArg;
if (LOS_QueueWrite(rq->swtmrHandlerQueue, swtmrHandler, sizeof(CHAR *), LOS_NO_WAIT)) {
(VOID)LOS_MemboxFree(g_swtmrHandlerPool, swtmrHandler);
}
}
if (swtmr->ucMode == LOS_SWTMR_MODE_ONCE) {
OsSwtmrDelete(swtmr);
if (swtmr->usTimerID < (OS_SWTMR_MAX_TIMERID - LOSCFG_BASE_CORE_SWTMR_LIMIT)) {
swtmr->usTimerID += LOSCFG_BASE_CORE_SWTMR_LIMIT;
} else {
swtmr->usTimerID %= LOSCFG_BASE_CORE_SWTMR_LIMIT;
}
} else if (swtmr->ucMode == LOS_SWTMR_MODE_NO_SELFDELETE) {
swtmr->ucState = OS_SWTMR_STATUS_CREATED;
} else {
swtmr->uwOverrun++;
swtmr->startTime = startTime;
OsSwtmrStart(swtmr);
}
LOS_SpinUnlock(&g_swtmrSpin);
}
VOID OsSwtmrRestart(UINT64 startTime, SortLinkList *sortList)
STATIC INLINE VOID SwtmrRestart(UINT64 startTime, SortLinkList *sortList, UINT16 cpuid)
{
UINT32 intSave;
SWTMR_CTRL_S *swtmr = LOS_DL_LIST_ENTRY(sortList, SWTMR_CTRL_S, stSortList);
SWTMR_LOCK(intSave);
swtmr->startTime = startTime;
OsSwtmrStart(swtmr);
(VOID)SwtmrToStart(swtmr, cpuid);
SWTMR_UNLOCK(intSave);
}
VOID OsSwtmrResponseTimeReset(UINT64 startTime)
{
UINT16 cpuid = ArchCurrCpuid();
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[cpuid].swtmrSortLink;
LOS_DL_LIST *listHead = &swtmrSortLink->sortLink;
LOS_DL_LIST *listNext = listHead->pstNext;
LOS_SpinLock(&swtmrSortLink->spinLock);
while (listNext != listHead) {
SortLinkList *sortList = LOS_DL_LIST_ENTRY(listNext, SortLinkList, sortLinkNode);
OsDeleteNodeSortLink(swtmrSortLink, sortList);
LOS_SpinUnlock(&swtmrSortLink->spinLock);
SwtmrRestart(startTime, sortList, cpuid);
LOS_SpinLock(&swtmrSortLink->spinLock);
listNext = listNext->pstNext;
}
LOS_SpinUnlock(&swtmrSortLink->spinLock);
}
STATIC INLINE BOOL SwtmrRunqueueFind(SortLinkAttribute *swtmrSortLink, SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
{
LOS_DL_LIST *listObject = &swtmrSortLink->sortLink;
LOS_DL_LIST *list = listObject->pstNext;
LOS_SpinLock(&swtmrSortLink->spinLock);
while (list != listObject) {
SortLinkList *listSorted = LOS_DL_LIST_ENTRY(list, SortLinkList, sortLinkNode);
if (checkFunc((UINTPTR)listSorted, arg)) {
LOS_SpinUnlock(&swtmrSortLink->spinLock);
return TRUE;
}
list = list->pstNext;
}
LOS_SpinUnlock(&swtmrSortLink->spinLock);
return FALSE;
}
STATIC BOOL SwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
{
for (UINT16 cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[ArchCurrCpuid()].swtmrSortLink;
if (SwtmrRunqueueFind(swtmrSortLink, checkFunc, arg)) {
return TRUE;
}
}
return FALSE;
}
BOOL OsSwtmrWorkQueueFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
{
UINT32 intSave;
SWTMR_LOCK(intSave);
BOOL find = OsSchedSwtmrTimeListFind(checkFunc, arg);
BOOL find = SwtmrTimeListFind(checkFunc, arg);
SWTMR_UNLOCK(intSave);
return find;
}
@@ -273,7 +608,8 @@ BOOL OsSwtmrWorkQueueFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
LITE_OS_SEC_TEXT UINT32 OsSwtmrGetNextTimeout(VOID)
{
UINT64 currTime = OsGetCurrSchedTimeCycle();
UINT64 time = (OsSortLinkGetNextExpireTime(currTime, &OsSchedRunQue()->swtmrSortLink) / OS_CYCLE_PER_TICK);
SwtmrRunqueue *srq = &g_swtmrRunqueue[ArchCurrCpuid()];
UINT64 time = (OsSortLinkGetNextExpireTime(currTime, &srq->swtmrSortLink) / OS_CYCLE_PER_TICK);
if (time > OS_INVALID_VALUE) {
time = OS_INVALID_VALUE;
}
@@ -284,14 +620,12 @@ LITE_OS_SEC_TEXT UINT32 OsSwtmrGetNextTimeout(VOID)
* Description: Stop of Software Timer interface
* Input : swtmr --- the software timer control handler
*/
LITE_OS_SEC_TEXT STATIC VOID OsSwtmrStop(SWTMR_CTRL_S *swtmr)
STATIC VOID SwtmrStop(SWTMR_CTRL_S *swtmr)
{
OsSchedDeSwtmrFromTimeList(&swtmr->stSortList);
swtmr->ucState = OS_SWTMR_STATUS_CREATED;
swtmr->uwOverrun = 0;
OsSchedUpdateExpireTime();
DeSwtmrFromTimeList(&swtmr->stSortList);
}
/*
@@ -389,11 +723,10 @@ LITE_OS_SEC_TEXT UINT32 LOS_SwtmrStart(UINT16 swtmrID)
* then start the swtmr again.
*/
case OS_SWTMR_STATUS_TICKING:
OsSwtmrStop(swtmr);
SwtmrStop(swtmr);
/* fall-through */
case OS_SWTMR_STATUS_CREATED:
swtmr->startTime = OsGetCurrSchedTimeCycle();
OsSwtmrStart(swtmr);
SwtmrStart(swtmr);
break;
default:
ret = LOS_ERRNO_SWTMR_STATUS_INVALID;
@@ -433,7 +766,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_SwtmrStop(UINT16 swtmrID)
ret = LOS_ERRNO_SWTMR_NOT_STARTED;
break;
case OS_SWTMR_STATUS_TICKING:
OsSwtmrStop(swtmr);
SwtmrStop(swtmr);
break;
default:
ret = LOS_ERRNO_SWTMR_STATUS_INVALID;
@@ -511,10 +844,10 @@ LITE_OS_SEC_TEXT UINT32 LOS_SwtmrDelete(UINT16 swtmrID)
ret = LOS_ERRNO_SWTMR_NOT_CREATED;
break;
case OS_SWTMR_STATUS_TICKING:
OsSwtmrStop(swtmr);
SwtmrStop(swtmr);
/* fall-through */
case OS_SWTMR_STATUS_CREATED:
OsSwtmrDelete(swtmr);
SwtmrDelete(swtmr);
break;
default:
ret = LOS_ERRNO_SWTMR_STATUS_INVALID;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -90,19 +90,23 @@ VOID OsSetMainTask()
{
UINT32 i;
CHAR *name = "osMain";
SchedParam schedParam = { 0 };
schedParam.policy = LOS_SCHED_RR;
schedParam.basePrio = OS_PROCESS_PRIORITY_HIGHEST;
schedParam.priority = OS_TASK_PRIORITY_LOWEST;
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
g_mainTask[i].taskStatus = OS_TASK_STATUS_UNUSED;
g_mainTask[i].taskID = LOSCFG_BASE_CORE_TSK_LIMIT;
g_mainTask[i].processID = OS_KERNEL_PROCESS_GROUP;
g_mainTask[i].basePrio = OS_TASK_PRIORITY_HIGHEST;
g_mainTask[i].priority = OS_TASK_PRIORITY_LOWEST;
#ifdef LOSCFG_KERNEL_SMP_LOCKDEP
g_mainTask[i].lockDep.lockDepth = 0;
g_mainTask[i].lockDep.waitLock = NULL;
#endif
(VOID)strncpy_s(g_mainTask[i].taskName, OS_TCB_NAME_LEN, name, OS_TCB_NAME_LEN - 1);
LOS_ListInit(&g_mainTask[i].lockList);
(VOID)OsSchedParamInit(&g_mainTask[i], schedParam.policy, &schedParam, NULL);
}
}
@@ -120,13 +124,11 @@ VOID OsTaskInsertToRecycleList(LosTaskCB *taskCB)
LITE_OS_SEC_TEXT_INIT VOID OsTaskJoinPostUnsafe(LosTaskCB *taskCB)
{
LosTaskCB *resumedTask = NULL;
if (taskCB->taskStatus & OS_TASK_FLAG_PTHREAD_JOIN) {
if (!LOS_ListEmpty(&taskCB->joinList)) {
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(taskCB->joinList)));
LosTaskCB *resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(taskCB->joinList)));
OsTaskWakeClearPendMask(resumedTask);
OsSchedTaskWake(resumedTask);
resumedTask->ops->wake(resumedTask);
}
}
taskCB->taskStatus |= OS_TASK_STATUS_EXIT;
@@ -144,7 +146,8 @@ LITE_OS_SEC_TEXT UINT32 OsTaskJoinPendUnsafe(LosTaskCB *taskCB)
if ((taskCB->taskStatus & OS_TASK_FLAG_PTHREAD_JOIN) && LOS_ListEmpty(&taskCB->joinList)) {
OsTaskWaitSetPendMask(OS_TASK_WAIT_JOIN, taskCB->taskID, LOS_WAIT_FOREVER);
return OsSchedTaskWait(&taskCB->joinList, LOS_WAIT_FOREVER, TRUE);
LosTaskCB *runTask = OsCurrTaskGet();
return runTask->ops->wait(runTask, &taskCB->joinList, LOS_WAIT_FOREVER);
}
return LOS_EINVAL;
@@ -203,7 +206,7 @@ EXIT:
UINT32 OsGetIdleTaskId(VOID)
{
return OsSchedGetRunQueIdle();
return OsSchedRunqueueIdleGet();
}
LITE_OS_SEC_TEXT_INIT UINT32 OsIdleTaskCreate(VOID)
@@ -216,18 +219,21 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsIdleTaskCreate(VOID)
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)OsIdleTask;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE;
taskInitParam.pcName = "Idle";
taskInitParam.policy = LOS_SCHED_IDLE;
taskInitParam.usTaskPrio = OS_TASK_PRIORITY_LOWEST;
taskInitParam.processID = OsGetIdleProcessID();
#ifdef LOSCFG_KERNEL_SMP
taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid());
#endif
ret = LOS_TaskCreateOnly(&idleTaskID, &taskInitParam);
if (ret != LOS_OK) {
return ret;
}
LosTaskCB *idleTask = OS_TCB_FROM_TID(idleTaskID);
idleTask->taskStatus |= OS_TASK_FLAG_SYSTEM_TASK;
OsSchedRunQueIdleInit(idleTaskID);
OsSchedSetIdleTaskSchedParam(idleTask);
OsSchedRunqueueIdleInit(idleTaskID);
return ret;
return LOS_TaskResume(idleTaskID);
}
/*
@@ -369,12 +375,11 @@ STATIC VOID OsTaskResourcesToFree(LosTaskCB *taskCB)
LITE_OS_SEC_TEXT VOID OsTaskCBRecycleToFree()
{
LosTaskCB *taskCB = NULL;
UINT32 intSave;
SCHEDULER_LOCK(intSave);
while (!LOS_ListEmpty(&g_taskRecycleList)) {
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_taskRecycleList));
LosTaskCB *taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_taskRecycleList));
LOS_ListDelete(&taskCB->pendList);
SCHEDULER_UNLOCK(intSave);
@@ -391,8 +396,6 @@ LITE_OS_SEC_TEXT VOID OsTaskCBRecycleToFree()
*/
LITE_OS_SEC_TEXT_INIT VOID OsTaskEntry(UINT32 taskID)
{
LosTaskCB *taskCB = NULL;
LOS_ASSERT(!OS_TID_CHECK_INVALID(taskID));
/*
@@ -403,7 +406,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsTaskEntry(UINT32 taskID)
LOS_SpinUnlock(&g_taskSpin);
(VOID)LOS_IntUnLock();
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
taskCB->joinRetval = taskCB->taskEntry(taskCB->args[0], taskCB->args[1],
taskCB->args[2], taskCB->args[3]); /* 2 & 3: just for args array index */
if (!(taskCB->taskStatus & OS_TASK_FLAG_PTHREAD_JOIN)) {
@@ -463,10 +466,8 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskStackAlloc(VOID **topStack, UINT32 stack
*topStack = (VOID *)LOS_MemAllocAlign(pool, stackSize, LOSCFG_STACK_POINT_ALIGN_SIZE);
}
LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskCBInitBase(LosTaskCB *taskCB,
const VOID *stackPtr,
const VOID *topStack,
const TSK_INIT_PARAM_S *initParam)
STATIC VOID TaskCBBaseInit(LosTaskCB *taskCB, const VOID *stackPtr, const VOID *topStack,
const TSK_INIT_PARAM_S *initParam)
{
taskCB->stackPointer = (VOID *)stackPtr;
taskCB->args[0] = initParam->auwArgs[0]; /* 0~3: just for args array index */
@@ -475,7 +476,6 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskCBInitBase(LosTaskCB *taskCB,
taskCB->args[3] = initParam->auwArgs[3];
taskCB->topOfStack = (UINTPTR)topStack;
taskCB->stackSize = initParam->uwStackSize;
taskCB->priority = initParam->usTaskPrio;
taskCB->taskEntry = initParam->pfnTaskEntry;
taskCB->signal = SIGNAL_NONE;
@@ -484,7 +484,6 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskCBInitBase(LosTaskCB *taskCB,
taskCB->cpuAffiMask = (initParam->usCpuAffiMask) ?
initParam->usCpuAffiMask : LOSCFG_KERNEL_CPU_MASK;
#endif
taskCB->policy = (initParam->policy == LOS_SCHED_FIFO) ? LOS_SCHED_FIFO : LOS_SCHED_RR;
taskCB->taskStatus = OS_TASK_STATUS_INIT;
if (initParam->uwResved & LOS_TASK_ATTR_JOINABLE) {
taskCB->taskStatus |= OS_TASK_FLAG_PTHREAD_JOIN;
@@ -500,10 +499,13 @@ STATIC UINT32 OsTaskCBInit(LosTaskCB *taskCB, const TSK_INIT_PARAM_S *initParam,
{
UINT32 ret;
UINT32 numCount;
SchedParam schedParam = { 0 };
UINT16 policy = (initParam->policy == LOS_SCHED_NORMAL) ? LOS_SCHED_RR : initParam->policy;
OsTaskCBInitBase(taskCB, stackPtr, topStack, initParam);
TaskCBBaseInit(taskCB, stackPtr, topStack, initParam);
numCount = OsProcessAddNewTask(initParam->processID, taskCB);
schedParam.policy = policy;
numCount = OsProcessAddNewTask(initParam->processID, taskCB, &schedParam);
#ifdef LOSCFG_KERNEL_VM
taskCB->futex.index = OS_INVALID_VALUE;
if (taskCB->taskStatus & OS_TASK_FLAG_USER_MODE) {
@@ -514,6 +516,11 @@ STATIC UINT32 OsTaskCBInit(LosTaskCB *taskCB, const TSK_INIT_PARAM_S *initParam,
}
#endif
ret = OsSchedParamInit(taskCB, policy, &schedParam, initParam);
if (ret != LOS_OK) {
return ret;
}
if (initParam->pcName != NULL) {
ret = (UINT32)OsSetTaskName(taskCB, initParam->pcName, FALSE);
if (ret == LOS_OK) {
@@ -530,7 +537,6 @@ STATIC UINT32 OsTaskCBInit(LosTaskCB *taskCB, const TSK_INIT_PARAM_S *initParam,
LITE_OS_SEC_TEXT LosTaskCB *OsGetFreeTaskCB(VOID)
{
UINT32 intSave;
LosTaskCB *taskCB = NULL;
SCHEDULER_LOCK(intSave);
if (LOS_ListEmpty(&g_losFreeTask)) {
@@ -539,7 +545,7 @@ LITE_OS_SEC_TEXT LosTaskCB *OsGetFreeTaskCB(VOID)
return NULL;
}
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_losFreeTask));
LosTaskCB *taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_losFreeTask));
LOS_ListDelete(LOS_DL_LIST_FIRST(&g_losFreeTask));
SCHEDULER_UNLOCK(intSave);
@@ -550,8 +556,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S
{
UINT32 intSave, errRet;
VOID *topStack = NULL;
VOID *stackPtr = NULL;
LosTaskCB *taskCB = NULL;
VOID *pool = NULL;
errRet = OsTaskCreateParamCheck(taskID, initParam, &pool);
@@ -559,7 +563,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S
return errRet;
}
taskCB = OsGetFreeTaskCB();
LosTaskCB *taskCB = OsGetFreeTaskCB();
if (taskCB == NULL) {
errRet = LOS_ERRNO_TSK_TCB_UNAVAILABLE;
goto LOS_ERREND;
@@ -576,7 +580,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S
goto LOS_ERREND_REWIND_SYNC;
}
stackPtr = OsTaskStackInit(taskCB->taskID, initParam->uwStackSize, topStack, TRUE);
VOID *stackPtr = OsTaskStackInit(taskCB->taskID, initParam->uwStackSize, topStack, TRUE);
errRet = OsTaskCBInit(taskCB, initParam, stackPtr, topStack);
if (errRet != LOS_OK) {
goto LOS_ERREND_TCB_INIT;
@@ -630,7 +634,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreate(UINT32 *taskID, TSK_INIT_PARAM_S *in
LosTaskCB *taskCB = OS_TCB_FROM_TID(*taskID);
SCHEDULER_LOCK(intSave);
OsSchedTaskEnQueue(taskCB);
taskCB->ops->enqueue(OsSchedRunqueue(), taskCB);
SCHEDULER_UNLOCK(intSave);
/* in case created task not running on this core,
@@ -647,13 +651,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskResume(UINT32 taskID)
{
UINT32 intSave;
UINT32 errRet;
LosTaskCB *taskCB = NULL;
BOOL needSched = FALSE;
if (OS_TID_CHECK_INVALID(taskID)) {
return LOS_ERRNO_TSK_ID_INVALID;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
/* clear pending signal */
@@ -667,7 +671,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskResume(UINT32 taskID)
OS_GOTO_ERREND();
}
BOOL needSched = OsSchedResume(taskCB);
errRet = taskCB->ops->resume(taskCB, &needSched);
SCHEDULER_UNLOCK(intSave);
LOS_MpSchedule(OS_MP_CPU_ALL);
@@ -675,7 +679,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskResume(UINT32 taskID)
LOS_Schedule();
}
return LOS_OK;
return errRet;
LOS_ERREND:
SCHEDULER_UNLOCK(intSave);
@@ -723,9 +727,7 @@ LITE_OS_SEC_TEXT_INIT STATIC BOOL OsTaskSuspendCheckOnRun(LosTaskCB *taskCB, UIN
LITE_OS_SEC_TEXT STATIC UINT32 OsTaskSuspend(LosTaskCB *taskCB)
{
UINT32 errRet;
UINT16 tempStatus;
tempStatus = taskCB->taskStatus;
UINT16 tempStatus = taskCB->taskStatus;
if (tempStatus & OS_TASK_STATUS_UNUSED) {
return LOS_ERRNO_TSK_NOT_CREATED;
}
@@ -739,21 +741,19 @@ LITE_OS_SEC_TEXT STATIC UINT32 OsTaskSuspend(LosTaskCB *taskCB)
return errRet;
}
OsSchedSuspend(taskCB);
return LOS_OK;
return taskCB->ops->suspend(taskCB);
}
LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskSuspend(UINT32 taskID)
{
UINT32 intSave;
LosTaskCB *taskCB = NULL;
UINT32 errRet;
if (OS_TID_CHECK_INVALID(taskID)) {
return LOS_ERRNO_TSK_ID_INVALID;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
if (taskCB->taskStatus & OS_TASK_FLAG_SYSTEM_TASK) {
return LOS_ERRNO_TSK_OPERATE_SYSTEM_TASK;
}
@@ -842,11 +842,11 @@ LITE_OS_SEC_TEXT VOID OsInactiveTaskDelete(LosTaskCB *taskCB)
OsTaskReleaseHoldLock(taskCB);
OsSchedTaskExit(taskCB);
taskCB->ops->exit(taskCB);
if (taskStatus & OS_TASK_STATUS_PENDING) {
LosMux *mux = (LosMux *)taskCB->taskMux;
if (LOS_MuxIsValid(mux) == TRUE) {
OsMuxBitmapRestore(mux, taskCB, (LosTaskCB *)mux->owner);
OsMuxBitmapRestore(mux, NULL, taskCB);
}
}
@@ -872,6 +872,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
if (taskCB == OsCurrTaskGet()) {
if (!OsPreemptable()) {
return LOS_ERRNO_TSK_DELETE_LOCKED;
}
OsRunningTaskToExit(taskCB, OS_PRO_EXIT_OK);
return LOS_NOK;
}
@@ -900,20 +904,22 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
LOS_ERREND:
SCHEDULER_UNLOCK(intSave);
if (ret == LOS_OK) {
LOS_Schedule();
}
return ret;
}
LITE_OS_SEC_TEXT UINT32 LOS_TaskDelay(UINT32 tick)
{
UINT32 intSave;
LosTaskCB *runTask = NULL;
if (OS_INT_ACTIVE) {
PRINT_ERR("In interrupt not allow delay task!\n");
return LOS_ERRNO_TSK_DELAY_IN_INT;
}
runTask = OsCurrTaskGet();
LosTaskCB *runTask = OsCurrTaskGet();
if (runTask->taskStatus & OS_TASK_FLAG_SYSTEM_TASK) {
OsBackTrace();
return LOS_ERRNO_TSK_OPERATE_SYSTEM_TASK;
@@ -928,39 +934,37 @@ LITE_OS_SEC_TEXT UINT32 LOS_TaskDelay(UINT32 tick)
}
SCHEDULER_LOCK(intSave);
OsSchedDelay(runTask, tick);
UINT32 ret = runTask->ops->delay(runTask, OS_SCHED_TICK_TO_CYCLE(tick));
OsHookCall(LOS_HOOK_TYPE_MOVEDTASKTODELAYEDLIST, runTask);
SCHEDULER_UNLOCK(intSave);
return LOS_OK;
return ret;
}
LITE_OS_SEC_TEXT_MINOR UINT16 LOS_TaskPriGet(UINT32 taskID)
{
UINT32 intSave;
LosTaskCB *taskCB = NULL;
UINT16 priority;
SchedParam param = { 0 };
if (OS_TID_CHECK_INVALID(taskID)) {
return (UINT16)OS_INVALID;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
SCHEDULER_UNLOCK(intSave);
return (UINT16)OS_INVALID;
}
priority = taskCB->priority;
taskCB->ops->schedParamGet(taskCB, &param);
SCHEDULER_UNLOCK(intSave);
return priority;
return param.priority;
}
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskPriSet(UINT32 taskID, UINT16 taskPrio)
{
UINT32 intSave;
LosTaskCB *taskCB = NULL;
SchedParam param = { 0 };
if (taskPrio > OS_TASK_PRIORITY_LOWEST) {
return LOS_ERRNO_TSK_PRIOR_ERROR;
@@ -970,7 +974,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskPriSet(UINT32 taskID, UINT16 taskPrio)
return LOS_ERRNO_TSK_ID_INVALID;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
if (taskCB->taskStatus & OS_TASK_FLAG_SYSTEM_TASK) {
return LOS_ERRNO_TSK_OPERATE_SYSTEM_TASK;
}
@@ -981,11 +985,15 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskPriSet(UINT32 taskID, UINT16 taskPrio)
return LOS_ERRNO_TSK_NOT_CREATED;
}
BOOL isReady = OsSchedModifyTaskSchedParam(taskCB, taskCB->policy, taskPrio);
taskCB->ops->schedParamGet(taskCB, &param);
param.priority = taskPrio;
BOOL needSched = taskCB->ops->schedParamModify(taskCB, &param);
SCHEDULER_UNLOCK(intSave);
LOS_MpSchedule(OS_MP_CPU_ALL);
if (isReady && OS_SCHEDULER_ACTIVE) {
if (needSched && OS_SCHEDULER_ACTIVE) {
LOS_Schedule();
}
return LOS_OK;
@@ -1015,7 +1023,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskYield(VOID)
SCHEDULER_LOCK(intSave);
/* reset timeslice of yielded task */
OsSchedYield();
runTask->ops->yield(runTask);
SCHEDULER_UNLOCK(intSave);
return LOS_OK;
}
@@ -1045,7 +1053,7 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_TaskUnlock(VOID)
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInfo)
{
UINT32 intSave;
LosTaskCB *taskCB = NULL;
SchedParam param = { 0 };
if (taskInfo == NULL) {
return LOS_ERRNO_TSK_PTR_NULL;
@@ -1055,7 +1063,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInf
return LOS_ERRNO_TSK_ID_INVALID;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
SCHEDULER_UNLOCK(intSave);
@@ -1068,8 +1076,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInf
taskInfo->uwSP = ArchSPGet();
}
taskCB->ops->schedParamGet(taskCB, &param);
taskInfo->usTaskStatus = taskCB->taskStatus;
taskInfo->usTaskPrio = taskCB->priority;
taskInfo->usTaskPrio = param.priority;
taskInfo->uwStackSize = taskCB->stackSize;
taskInfo->uwTopOfStack = taskCB->topOfStack;
taskInfo->uwEventMask = taskCB->eventMask;
@@ -1113,7 +1122,6 @@ LITE_OS_SEC_TEXT BOOL OsTaskCpuAffiSetUnsafe(UINT32 taskID, UINT16 newCpuAffiMas
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskCpuAffiSet(UINT32 taskID, UINT16 cpuAffiMask)
{
LosTaskCB *taskCB = NULL;
BOOL needSched = FALSE;
UINT32 intSave;
UINT16 currCpuMask;
@@ -1126,7 +1134,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskCpuAffiSet(UINT32 taskID, UINT16 cpuAffiMa
return LOS_ERRNO_TSK_CPU_AFFINITY_MASK_ERR;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
SCHEDULER_UNLOCK(intSave);
@@ -1147,7 +1155,6 @@ LITE_OS_SEC_TEXT_MINOR UINT16 LOS_TaskCpuAffiGet(UINT32 taskID)
{
#ifdef LOSCFG_KERNEL_SMP
#define INVALID_CPU_AFFI_MASK 0
LosTaskCB *taskCB = NULL;
UINT16 cpuAffiMask;
UINT32 intSave;
@@ -1155,7 +1162,7 @@ LITE_OS_SEC_TEXT_MINOR UINT16 LOS_TaskCpuAffiGet(UINT32 taskID)
return INVALID_CPU_AFFI_MASK;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
SCHEDULER_UNLOCK(intSave);
@@ -1208,7 +1215,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTaskProcSignal(VOID)
} else if (runTask->signal & SIGNAL_AFFI) {
runTask->signal &= ~SIGNAL_AFFI;
/* pri-queue has updated, notify the target cpu */
/* priority queue has updated, notify the target cpu */
LOS_MpSchedule((UINT32)runTask->cpuAffiMask);
#endif
}
@@ -1347,21 +1354,22 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCreateUserTask(UINT32 processID, TSK_INIT_PARAM_S
LITE_OS_SEC_TEXT INT32 LOS_GetTaskScheduler(INT32 taskID)
{
UINT32 intSave;
LosTaskCB *taskCB = NULL;
INT32 policy;
SchedParam param = { 0 };
if (OS_TID_CHECK_INVALID(taskID)) {
return -LOS_EINVAL;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
policy = -LOS_EINVAL;
OS_GOTO_ERREND();
}
policy = taskCB->policy;
taskCB->ops->schedParamGet(taskCB, &param);
policy = (INT32)param.policy;
LOS_ERREND:
SCHEDULER_UNLOCK(intSave);
@@ -1370,8 +1378,8 @@ LOS_ERREND:
LITE_OS_SEC_TEXT INT32 LOS_SetTaskScheduler(INT32 taskID, UINT16 policy, UINT16 priority)
{
SchedParam param = { 0 };
UINT32 intSave;
BOOL needSched = FALSE;
if (OS_TID_CHECK_INVALID(taskID)) {
return LOS_ESRCH;
@@ -1385,8 +1393,21 @@ LITE_OS_SEC_TEXT INT32 LOS_SetTaskScheduler(INT32 taskID, UINT16 policy, UINT16
return LOS_EINVAL;
}
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
if (taskCB->taskStatus & OS_TASK_FLAG_SYSTEM_TASK) {
return LOS_EPERM;
}
SCHEDULER_LOCK(intSave);
needSched = OsSchedModifyTaskSchedParam(OS_TCB_FROM_TID(taskID), policy, priority);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
SCHEDULER_UNLOCK(intSave);
return LOS_EINVAL;
}
taskCB->ops->schedParamGet(taskCB, &param);
param.policy = policy;
param.priority = priority;
BOOL needSched = taskCB->ops->schedParamModify(taskCB, &param);
SCHEDULER_UNLOCK(intSave);
LOS_MpSchedule(OS_MP_CPU_ALL);
@@ -1411,9 +1432,15 @@ STATIC UINT32 OsTaskJoinCheck(UINT32 taskID)
return LOS_EINVAL;
}
if (taskID == OsCurrTaskGet()->taskID) {
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
if (taskCB->taskStatus & OS_TASK_FLAG_SYSTEM_TASK) {
return LOS_EPERM;
}
if (taskCB == OsCurrTaskGet()) {
return LOS_EDEADLK;
}
return LOS_OK;
}
@@ -1421,7 +1448,6 @@ UINT32 LOS_TaskJoin(UINT32 taskID, UINTPTR *retval)
{
UINT32 intSave;
LosTaskCB *runTask = OsCurrTaskGet();
LosTaskCB *taskCB = NULL;
UINT32 errRet;
errRet = OsTaskJoinCheck(taskID);
@@ -1429,7 +1455,7 @@ UINT32 LOS_TaskJoin(UINT32 taskID, UINTPTR *retval)
return errRet;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
SCHEDULER_UNLOCK(intSave);
@@ -1462,7 +1488,6 @@ UINT32 LOS_TaskDetach(UINT32 taskID)
{
UINT32 intSave;
LosTaskCB *runTask = OsCurrTaskGet();
LosTaskCB *taskCB = NULL;
UINT32 errRet;
if (OS_TID_CHECK_INVALID(taskID)) {
@@ -1473,7 +1498,7 @@ UINT32 LOS_TaskDetach(UINT32 taskID)
return LOS_EINTR;
}
taskCB = OS_TCB_FROM_TID(taskID);
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
SCHEDULER_LOCK(intSave);
if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) {
SCHEDULER_UNLOCK(intSave);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -43,7 +43,7 @@ extern "C" {
#define OS_MUX_MAGIC 0xEBCFDEA0
extern VOID OsMuxBitmapRestore(const LosMux *mutex, const LosTaskCB *taskCB, LosTaskCB *owner);
extern VOID OsMuxBitmapRestore(const LosMux *mutex, const LOS_DL_LIST *list, const LosTaskCB *runTask);
extern UINT32 OsMuxLockUnsafe(LosMux *mutex, UINT32 timeout);
extern UINT32 OsMuxTrylockUnsafe(LosMux *mutex, UINT32 timeout);
extern UINT32 OsMuxUnlockUnsafe(LosTaskCB *taskCB, LosMux *mutex, BOOL *needSched);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -295,11 +295,6 @@ STATIC INLINE BOOL OsProcessIsUserMode(const LosProcessCB *processCB)
return (processCB->processMode == OS_USER_MODE);
}
#define LOS_SCHED_NORMAL 0U
#define LOS_SCHED_FIFO 1U
#define LOS_SCHED_RR 2U
#define LOS_SCHED_IDLE 3U
#define LOS_PRIO_PROCESS 0U
#define LOS_PRIO_PGRP 1U
#define LOS_PRIO_USER 2U
@@ -488,7 +483,7 @@ extern UINTPTR OsGetSigHandler(VOID);
extern VOID OsWaitWakeTask(LosTaskCB *taskCB, UINT32 wakePID);
extern INT32 OsSendSignalToProcessGroup(INT32 pid, siginfo_t *info, INT32 permission);
extern INT32 OsSendSignalToAllProcess(siginfo_t *info, INT32 permission);
extern UINT32 OsProcessAddNewTask(UINT32 pid, LosTaskCB *taskCB);
extern UINT32 OsProcessAddNewTask(UINT32 pid, LosTaskCB *taskCB, SchedParam *param);
extern VOID OsDeleteTaskFromProcess(LosTaskCB *taskCB);
extern VOID OsProcessThreadGroupDestroy(VOID);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -41,7 +41,7 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define OS_RWLOCK_MAGIC 0xBEFDCAU
#define OS_RWLOCK_MAGIC 0xEFDCAU
enum RwlockMode {
RWLOCK_NONE_MODE,

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -37,10 +37,13 @@
#include "los_hwi.h"
#include "hal_timer.h"
#ifdef LOSCFG_SCHED_DEBUG
#include "los_stat_pri.h"
#include "los_statistics_pri.h"
#endif
#include "los_stackinfo_pri.h"
#include "los_futex_pri.h"
#ifdef LOSCFG_KERNEL_PM
#include "los_pm_pri.h"
#endif
#include "los_signal.h"
#ifdef LOSCFG_KERNEL_CPUP
#include "los_cpup_pri.h"
@@ -48,6 +51,7 @@
#ifdef LOSCFG_KERNEL_LITEIPC
#include "hm_liteipc.h"
#endif
#include "los_mp.h"
#ifdef __cplusplus
#if __cplusplus
@@ -55,14 +59,17 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define OS_SCHED_MINI_PERIOD (OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND_MINI)
#define OS_TICK_RESPONSE_PRECISION (UINT32)((OS_SCHED_MINI_PERIOD * 75) / 100)
#define OS_SCHED_MAX_RESPONSE_TIME (UINT64)(((UINT64)-1) - 1U)
#define OS_SCHED_MINI_PERIOD (OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND_MINI)
#define OS_TICK_RESPONSE_PRECISION (UINT32)((OS_SCHED_MINI_PERIOD * 75) / 100)
#define OS_SCHED_MAX_RESPONSE_TIME OS_SORT_LINK_INVALID_TIME
#define OS_SCHED_TICK_TO_CYCLE(ticks) ((UINT64)ticks * OS_CYCLE_PER_TICK)
#define AFFI_MASK_TO_CPUID(mask) ((UINT16)((mask) - 1))
extern UINT32 g_taskScheduled;
#define OS_SCHEDULER_ACTIVE (g_taskScheduled & (1U << ArchCurrCpuid()))
#define OS_SCHEDULER_ALL_ACTIVE (g_taskScheduled == LOSCFG_KERNEL_CPU_MASK)
typedef struct TagTaskCB LosTaskCB;
typedef BOOL (*SCHED_TL_FIND_FUNC)(UINTPTR, UINTPTR);
STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
@@ -76,53 +83,65 @@ typedef enum {
INT_PEND_TICK = 0x2, /* pending tick */
} SchedFlag;
#define OS_PRIORITY_QUEUE_NUM 32
typedef struct {
SortLinkAttribute taskSortLink; /* task sort link */
SortLinkAttribute swtmrSortLink; /* swtmr sort link */
UINT64 responseTime; /* Response time for current CPU tick interrupts */
UINT32 responseID; /* The response ID of the current CPU tick interrupt */
UINT32 idleTaskID; /* idle task id */
UINT32 taskLockCnt; /* task lock flag */
UINT32 swtmrTaskID; /* software timer task id */
UINT32 swtmrHandlerQueue; /* software timer timeout queue id */
UINT32 schedFlag; /* pending scheduler flag */
} SchedRunQue;
LOS_DL_LIST priQueList[OS_PRIORITY_QUEUE_NUM];
UINT32 readyTasks[OS_PRIORITY_QUEUE_NUM];
UINT32 queueBitmap;
} HPFQueue;
extern SchedRunQue g_schedRunQue[LOSCFG_KERNEL_CORE_NUM];
typedef struct {
HPFQueue queueList[OS_PRIORITY_QUEUE_NUM];
UINT32 queueBitmap;
} HPFRunqueue;
STATIC INLINE SchedRunQue *OsSchedRunQue(VOID)
typedef struct {
SortLinkAttribute timeoutQueue; /* task timeout queue */
HPFRunqueue *hpfRunqueue;
UINT64 responseTime; /* Response time for current CPU tick interrupts */
UINT32 responseID; /* The response ID of the current CPU tick interrupt */
UINT32 idleTaskID; /* idle task id */
UINT32 taskLockCnt; /* task lock flag */
UINT32 schedFlag; /* pending scheduler flag */
} SchedRunqueue;
extern SchedRunqueue g_schedRunqueue[LOSCFG_KERNEL_CORE_NUM];
VOID OsSchedExpireTimeUpdate(VOID);
STATIC INLINE SchedRunqueue *OsSchedRunqueue(VOID)
{
return &g_schedRunQue[ArchCurrCpuid()];
return &g_schedRunqueue[ArchCurrCpuid()];
}
STATIC INLINE SchedRunQue *OsSchedRunQueByID(UINT16 id)
STATIC INLINE SchedRunqueue *OsSchedRunqueueByID(UINT16 id)
{
return &g_schedRunQue[id];
return &g_schedRunqueue[id];
}
STATIC INLINE UINT32 OsSchedLockCountGet(VOID)
{
return OsSchedRunQue()->taskLockCnt;
return OsSchedRunqueue()->taskLockCnt;
}
STATIC INLINE VOID OsSchedLockSet(UINT32 count)
{
OsSchedRunQue()->taskLockCnt = count;
OsSchedRunqueue()->taskLockCnt = count;
}
STATIC INLINE VOID OsSchedLock(VOID)
{
OsSchedRunQue()->taskLockCnt++;
OsSchedRunqueue()->taskLockCnt++;
}
STATIC INLINE VOID OsSchedUnlock(VOID)
{
OsSchedRunQue()->taskLockCnt--;
OsSchedRunqueue()->taskLockCnt--;
}
STATIC INLINE BOOL OsSchedUnlockResch(VOID)
{
SchedRunQue *rq = OsSchedRunQue();
SchedRunqueue *rq = OsSchedRunqueue();
if (rq->taskLockCnt > 0) {
rq->taskLockCnt--;
if ((rq->taskLockCnt == 0) && (rq->schedFlag & INT_PEND_RESCH) && OS_SCHEDULER_ACTIVE) {
@@ -135,13 +154,13 @@ STATIC INLINE BOOL OsSchedUnlockResch(VOID)
STATIC INLINE BOOL OsSchedIsLock(VOID)
{
return (OsSchedRunQue()->taskLockCnt != 0);
return (OsSchedRunqueue()->taskLockCnt != 0);
}
/* Check if preemptible with counter flag */
STATIC INLINE BOOL OsPreemptable(VOID)
{
SchedRunQue *rq = OsSchedRunQue();
SchedRunqueue *rq = OsSchedRunqueue();
/*
* Unlike OsPreemptableInSched, the int may be not disabled when OsPreemptable
* is called, needs manually disable interrupt, to prevent current task from
@@ -160,7 +179,7 @@ STATIC INLINE BOOL OsPreemptable(VOID)
STATIC INLINE BOOL OsPreemptableInSched(VOID)
{
BOOL preemptible = FALSE;
SchedRunQue *rq = OsSchedRunQue();
SchedRunqueue *rq = OsSchedRunqueue();
#ifdef LOSCFG_KERNEL_SMP
/*
@@ -180,85 +199,61 @@ STATIC INLINE BOOL OsPreemptableInSched(VOID)
return preemptible;
}
STATIC INLINE UINT32 OsSchedGetRunQueIdle(VOID)
STATIC INLINE UINT32 OsSchedRunqueueIdleGet(VOID)
{
return OsSchedRunQue()->idleTaskID;
return OsSchedRunqueue()->idleTaskID;
}
STATIC INLINE VOID OsSchedRunQuePendingSet(VOID)
STATIC INLINE VOID OsSchedRunqueuePendingSet(VOID)
{
OsSchedRunQue()->schedFlag |= INT_PEND_RESCH;
OsSchedRunqueue()->schedFlag |= INT_PEND_RESCH;
}
#ifdef LOSCFG_KERNEL_SMP
STATIC INLINE VOID FindIdleRunQue(UINT16 *idleCpuID)
{
SchedRunQue *idleRq = OsSchedRunQueByID(0);
UINT32 nodeNum = OsGetSortLinkNodeNum(&idleRq->taskSortLink) + OsGetSortLinkNodeNum(&idleRq->swtmrSortLink);
UINT16 cpuID = 1;
do {
SchedRunQue *rq = OsSchedRunQueByID(cpuID);
UINT32 temp = OsGetSortLinkNodeNum(&rq->taskSortLink) + OsGetSortLinkNodeNum(&rq->swtmrSortLink);
if (nodeNum > temp) {
*idleCpuID = cpuID;
nodeNum = temp;
}
cpuID++;
} while (cpuID < LOSCFG_KERNEL_CORE_NUM);
}
#endif
#define LOS_SCHED_NORMAL 0U
#define LOS_SCHED_FIFO 1U
#define LOS_SCHED_RR 2U
#define LOS_SCHED_IDLE 3U
STATIC INLINE VOID OsSchedAddTask2TimeList(SortLinkList *node, UINT64 startTime, UINT32 waitTicks)
{
UINT16 idleCpu = 0;
#ifdef LOSCFG_KERNEL_SMP
FindIdleRunQue(&idleCpu);
#endif
SchedRunQue *rq = OsSchedRunQueByID(idleCpu);
UINT64 responseTime = startTime + (UINT64)waitTicks * OS_CYCLE_PER_TICK;
OsAdd2SortLink(&rq->taskSortLink, node, responseTime, idleCpu);
}
typedef struct {
UINT16 policy;
UINT16 basePrio;
UINT16 priority;
UINT32 timeSlice;
} SchedParam;
STATIC INLINE UINT32 OsSchedSwtmrHandlerQueueGet(VOID)
{
return OsSchedRunQue()->swtmrHandlerQueue;
}
typedef struct {
UINT16 policy; /* This field must be present for all scheduling policies and must be the first in the structure */
UINT16 basePrio;
UINT16 priority;
UINT32 initTimeSlice;
UINT32 priBitmap; /**< Bitmap for recording the change of task priority, the priority can not be greater than 31 */
} SchedHPF;
STATIC INLINE VOID OsSchedDeTaskFromTimeList(SortLinkList *node)
{
#ifdef LOSCFG_KERNEL_SMP
SchedRunQue *rq = OsSchedRunQueByID(node->cpuid);
#else
SchedRunQue *rq = OsSchedRunQueByID(0);
#endif
OsDeleteFromSortLink(&rq->taskSortLink, node);
}
typedef struct {
union {
SchedHPF hpf;
} Policy;
} SchedPolicy;
STATIC INLINE VOID OsSchedAddSwtmr2TimeList(SortLinkList *node, UINT64 startTime, UINT32 waitTicks)
{
UINT16 idleCpu = 0;
#ifdef LOSCFG_KERNEL_SMP
FindIdleRunQue(&idleCpu);
#endif
SchedRunQue *rq = OsSchedRunQueByID(idleCpu);
UINT64 responseTime = startTime + (UINT64)waitTicks * OS_CYCLE_PER_TICK;
OsAdd2SortLink(&rq->swtmrSortLink, node, responseTime, idleCpu);
}
STATIC INLINE VOID OsSchedDeSwtmrFromTimeList(SortLinkList *node)
{
#ifdef LOSCFG_KERNEL_SMP
SchedRunQue *rq = OsSchedRunQueByID(node->cpuid);
#else
SchedRunQue *rq = OsSchedRunQueByID(0);
#endif
OsDeleteFromSortLink(&rq->swtmrSortLink, node);
}
VOID OsSchedRunQueIdleInit(UINT32 idleTaskID);
VOID OsSchedRunQueSwtmrInit(UINT32 swtmrTaskID, UINT32 swtmrQueue);
VOID OsSchedRunQueInit(VOID);
BOOL OsSchedSwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg);
typedef struct {
VOID (*dequeue)(SchedRunqueue *rq, LosTaskCB *taskCB);
VOID (*enqueue)(SchedRunqueue *rq, LosTaskCB *taskCB);
VOID (*start)(SchedRunqueue *rq, LosTaskCB *taskCB);
VOID (*exit)(LosTaskCB *taskCB);
UINT32 (*wait)(LosTaskCB *runTask, LOS_DL_LIST *list, UINT32 timeout);
VOID (*wake)(LosTaskCB *taskCB);
BOOL (*schedParamModify)(LosTaskCB *taskCB, const SchedParam *param);
UINT32 (*schedParamGet)(const LosTaskCB *taskCB, SchedParam *param);
UINT32 (*delay)(LosTaskCB *taskCB, UINT64 waitTime);
VOID (*yield)(LosTaskCB *taskCB);
UINT32 (*suspend)(LosTaskCB *taskCB);
UINT32 (*resume)(LosTaskCB *taskCB, BOOL *needSched);
UINT64 (*deadlineGet)(const LosTaskCB *taskCB);
VOID (*timeSliceUpdate)(SchedRunqueue *rq, LosTaskCB *taskCB, UINT64 currTime);
INT32 (*schedParamCompare)(const SchedPolicy *sp1, const SchedPolicy *sp2);
VOID (*priorityInheritance)(LosTaskCB *owner, const SchedParam *param);
VOID (*priorityRestore)(LosTaskCB *owner, const LOS_DL_LIST *list, const SchedParam *param);
} SchedOps;
/**
* @ingroup los_sched
@@ -348,23 +343,31 @@ BOOL OsSchedSwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg);
*/
#define OS_TASK_STATUS_EXIT 0x0100U
#define OS_TASK_STATUS_BLOCKED (OS_TASK_STATUS_INIT | OS_TASK_STATUS_PENDING | \
OS_TASK_STATUS_DELAY | OS_TASK_STATUS_PEND_TIME)
/**
* @ingroup los_task
* Flag that indicates the task or task control block status.
*
* The delayed operation of this task is frozen.
*/
#define OS_TASK_STATUS_FROZEN 0x0200U
#define OS_TCB_NAME_LEN 32
typedef struct {
typedef struct TagTaskCB {
VOID *stackPointer; /**< Task stack pointer */
UINT16 taskStatus; /**< Task status */
/* The scheduling */
UINT16 basePrio;
UINT16 priority; /**< Task priority */
UINT16 policy;
UINT64 startTime; /**< The start time of each phase of task */
UINT64 waitTime; /**< Task delay time, tick number */
UINT64 irqStartTime; /**< Interrupt start time */
UINT32 irqUsedTime; /**< Interrupt consumption time */
UINT32 initTimeSlice; /**< Task init time slice */
INT32 timeSlice; /**< Task remaining time slice */
UINT32 waitTimes; /**< Task delay time, tick number */
SortLinkList sortList; /**< Task sortlink node */
const SchedOps *ops;
SchedPolicy sp;
UINT32 stackSize; /**< Task stack size */
UINTPTR topOfStack; /**< Task stack top */
@@ -379,8 +382,6 @@ typedef struct {
LOS_DL_LIST threadList; /**< thread list */
UINT32 eventMask; /**< Event mask */
UINT32 eventMode; /**< Event mode */
UINT32 priBitMap; /**< BitMap for recording the change of task priority,
the priority can not be greater than 31 */
#ifdef LOSCFG_KERNEL_CPUP
OsCpupBase taskCpup; /**< task cpu usage */
#endif
@@ -468,7 +469,7 @@ STATIC INLINE VOID OsCurrUserTaskSet(UINTPTR thread)
ArchCurrUserTaskSet(thread);
}
STATIC INLINE VOID OsSchedIrqUpdateUsedTime(VOID)
STATIC INLINE VOID OsSchedIrqUsedTimeUpdate(VOID)
{
LosTaskCB *runTask = OsCurrTaskGet();
runTask->irqUsedTime = OsGetCurrSchedTimeCycle() - runTask->irqStartTime;
@@ -480,6 +481,123 @@ STATIC INLINE VOID OsSchedIrqStartTime(VOID)
runTask->irqStartTime = OsGetCurrSchedTimeCycle();
}
#ifdef LOSCFG_KERNEL_SMP
STATIC INLINE VOID IdleRunqueueFind(UINT16 *idleCpuid)
{
SchedRunqueue *idleRq = OsSchedRunqueueByID(0);
UINT32 nodeNum = OsGetSortLinkNodeNum(&idleRq->timeoutQueue);
UINT16 cpuid = 1;
do {
SchedRunqueue *rq = OsSchedRunqueueByID(cpuid);
UINT32 temp = OsGetSortLinkNodeNum(&rq->timeoutQueue);
if (nodeNum > temp) {
*idleCpuid = cpuid;
nodeNum = temp;
}
cpuid++;
} while (cpuid < LOSCFG_KERNEL_CORE_NUM);
}
#endif
STATIC INLINE VOID OsSchedTimeoutQueueAdd(LosTaskCB *taskCB, UINT64 responseTime)
{
#ifdef LOSCFG_KERNEL_SMP
UINT16 cpuid = AFFI_MASK_TO_CPUID(taskCB->cpuAffiMask);
if (cpuid >= LOSCFG_KERNEL_CORE_NUM) {
cpuid = 0;
IdleRunqueueFind(&cpuid);
}
#else
UINT16 cpuid = 0;
#endif
SchedRunqueue *rq = OsSchedRunqueueByID(cpuid);
OsAdd2SortLink(&rq->timeoutQueue, &taskCB->sortList, responseTime, cpuid);
#ifdef LOSCFG_KERNEL_SMP
if ((cpuid != ArchCurrCpuid()) && (responseTime < rq->responseTime)) {
rq->schedFlag |= INT_PEND_TICK;
LOS_MpSchedule(CPUID_TO_AFFI_MASK(cpuid));
}
#endif
}
STATIC INLINE VOID OsSchedTimeoutQueueDelete(LosTaskCB *taskCB)
{
SortLinkList *node = &taskCB->sortList;
#ifdef LOSCFG_KERNEL_SMP
SchedRunqueue *rq = OsSchedRunqueueByID(node->cpuid);
#else
SchedRunqueue *rq = OsSchedRunqueueByID(0);
#endif
UINT64 oldResponseTime = GET_SORTLIST_VALUE(node);
OsDeleteFromSortLink(&rq->timeoutQueue, node);
if (oldResponseTime <= rq->responseTime) {
rq->responseTime = OS_SCHED_MAX_RESPONSE_TIME;
}
}
STATIC INLINE UINT32 OsSchedTimeoutQueueAdjust(LosTaskCB *taskCB, UINT64 responseTime)
{
UINT32 ret;
SortLinkList *node = &taskCB->sortList;
#ifdef LOSCFG_KERNEL_SMP
UINT16 cpuid = node->cpuid;
#else
UINT16 cpuid = 0;
#endif
SchedRunqueue *rq = OsSchedRunqueueByID(cpuid);
ret = OsSortLinkAdjustNodeResponseTime(&rq->timeoutQueue, node, responseTime);
if (ret == LOS_OK) {
rq->schedFlag |= INT_PEND_TICK;
}
return ret;
}
STATIC INLINE VOID SchedTaskFreeze(LosTaskCB *taskCB)
{
UINT64 responseTime;
#ifdef LOSCFG_KERNEL_PM
if (!OsIsPmMode()) {
return;
}
#endif
if (!(taskCB->taskStatus & (OS_TASK_STATUS_PEND_TIME | OS_TASK_STATUS_DELAY))) {
return;
}
responseTime = GET_SORTLIST_VALUE(&taskCB->sortList);
OsSchedTimeoutQueueDelete(taskCB);
SET_SORTLIST_VALUE(&taskCB->sortList, responseTime);
taskCB->taskStatus |= OS_TASK_STATUS_FROZEN;
return;
}
STATIC INLINE VOID SchedTaskUnfreeze(LosTaskCB *taskCB)
{
UINT64 currTime, responseTime;
if (!(taskCB->taskStatus & OS_TASK_STATUS_FROZEN)) {
return;
}
taskCB->taskStatus &= ~OS_TASK_STATUS_FROZEN;
currTime = OsGetCurrSchedTimeCycle();
responseTime = GET_SORTLIST_VALUE(&taskCB->sortList);
if (responseTime > currTime) {
OsSchedTimeoutQueueAdd(taskCB, responseTime);
return;
}
SET_SORTLIST_VALUE(&taskCB->sortList, OS_SORT_LINK_INVALID_TIME);
if (taskCB->taskStatus & OS_TASK_STATUS_PENDING) {
LOS_ListDelete(&taskCB->pendList);
}
taskCB->taskStatus &= ~OS_TASK_STATUS_BLOCKED;
return;
}
/*
* Schedule flag, one bit represents one core.
* This flag is used to prevent kernel scheduling before OSStartToRun.
@@ -492,25 +610,59 @@ STATIC INLINE VOID OsSchedIrqStartTime(VOID)
g_taskScheduled &= ~(1U << (cpuid)); \
} while (0);
VOID OsSchedSetIdleTaskSchedParam(LosTaskCB *idleTask);
VOID OsSchedResetSchedResponseTime(UINT64 responseTime);
VOID OsSchedUpdateExpireTime(VOID);
STATIC INLINE LosTaskCB *HPFRunqueueTopTaskGet(HPFRunqueue *rq)
{
LosTaskCB *newTask = NULL;
UINT32 baseBitmap = rq->queueBitmap;
#ifdef LOSCFG_KERNEL_SMP
UINT32 cpuid = ArchCurrCpuid();
#endif
while (baseBitmap) {
UINT32 basePrio = CLZ(baseBitmap);
HPFQueue *queueList = &rq->queueList[basePrio];
UINT32 bitmap = queueList->queueBitmap;
while (bitmap) {
UINT32 priority = CLZ(bitmap);
LOS_DL_LIST_FOR_EACH_ENTRY(newTask, &queueList->priQueList[priority], LosTaskCB, pendList) {
#ifdef LOSCFG_KERNEL_SMP
if (newTask->cpuAffiMask & (1U << cpuid)) {
#endif
return newTask;
#ifdef LOSCFG_KERNEL_SMP
}
#endif
}
bitmap &= ~(1U << (OS_PRIORITY_QUEUE_NUM - priority - 1));
}
baseBitmap &= ~(1U << (OS_PRIORITY_QUEUE_NUM - basePrio - 1));
}
return NULL;
}
VOID HPFSchedPolicyInit(SchedRunqueue *rq);
VOID HPFTaskSchedParamInit(LosTaskCB *taskCB, UINT16 policy,
const SchedParam *parentParam, const TSK_INIT_PARAM_S *param);
VOID HPFProcessDefaultSchedParamGet(SchedParam *param);
VOID IdleTaskSchedParamInit(LosTaskCB *taskCB);
INT32 OsSchedParamCompare(const LosTaskCB *task1, const LosTaskCB *task2);
VOID OsSchedPriorityInheritance(LosTaskCB *owner, const SchedParam *param);
UINT32 OsSchedParamInit(LosTaskCB *taskCB, UINT16 policy,
const SchedParam *parentParam, const TSK_INIT_PARAM_S *param);
VOID OsSchedProcessDefaultSchedParamGet(UINT16 policy, SchedParam *param);
VOID OsSchedResponseTimeReset(UINT64 responseTime);
VOID OsSchedToUserReleaseLock(VOID);
VOID OsSchedTaskDeQueue(LosTaskCB *taskCB);
VOID OsSchedTaskEnQueue(LosTaskCB *taskCB);
UINT32 OsSchedTaskWait(LOS_DL_LIST *list, UINT32 timeout, BOOL needSched);
VOID OsSchedTaskWake(LosTaskCB *resumedTask);
BOOL OsSchedModifyTaskSchedParam(LosTaskCB *taskCB, UINT16 policy, UINT16 priority);
BOOL OsSchedModifyProcessSchedParam(UINT32 pid, UINT16 policy, UINT16 priority);
VOID OsSchedSuspend(LosTaskCB *taskCB);
BOOL OsSchedResume(LosTaskCB *taskCB);
VOID OsSchedDelay(LosTaskCB *runTask, UINT32 tick);
VOID OsSchedYield(VOID);
VOID OsSchedTaskExit(LosTaskCB *taskCB);
VOID OsSchedTick(VOID);
UINT32 OsSchedInit(VOID);
VOID OsSchedStart(VOID);
VOID OsSchedRunqueueIdleInit(UINT32 idleTaskID);
VOID OsSchedRunqueueInit(VOID);
/*
* This function simply picks the next task and switches to it.
* Current task needs to already be in the right state or the right
@@ -525,14 +677,6 @@ VOID OsSchedIrqEndCheckNeedSched(VOID);
*/
LOS_DL_LIST *OsSchedLockPendFindPos(const LosTaskCB *runTask, LOS_DL_LIST *lockList);
#ifdef LOSCFG_SCHED_TICK_DEBUG
VOID OsSchedDebugRecordData(VOID);
#endif
UINT32 OsShellShowTickRespo(VOID);
UINT32 OsShellShowSchedParam(VOID);
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -61,11 +61,11 @@ STATIC INLINE VOID OsSemDbgTimeUpdateHook(UINT32 semID)
return;
}
/* Update the SEM_DEBUG_CB of the semaphore when created or deleted */
extern VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creater, UINT16 count);
STATIC INLINE VOID OsSemDbgUpdateHook(UINT32 semID, TSK_ENTRY_FUNC creater, UINT16 count)
extern VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creator, UINT16 count);
STATIC INLINE VOID OsSemDbgUpdateHook(UINT32 semID, TSK_ENTRY_FUNC creator, UINT16 count)
{
#ifdef LOSCFG_DEBUG_SEMAPHORE
OsSemDbgUpdate(semID, creater, count);
OsSemDbgUpdate(semID, creator, count);
#endif
return;
}

View File

@@ -72,28 +72,42 @@ STATIC INLINE UINT64 OsGetSortLinkNextExpireTime(SortLinkAttribute *sortHeader,
LOS_DL_LIST *head = &sortHeader->sortLink;
LOS_DL_LIST *list = head->pstNext;
LOS_SpinLock(&sortHeader->spinLock);
if (LOS_ListEmpty(head)) {
LOS_SpinUnlock(&sortHeader->spinLock);
return OS_SORT_LINK_INVALID_TIME - tickPrecision;
}
SortLinkList *listSorted = LOS_DL_LIST_ENTRY(list, SortLinkList, sortLinkNode);
if (listSorted->responseTime <= (startTime + tickPrecision)) {
LOS_SpinUnlock(&sortHeader->spinLock);
return startTime + tickPrecision;
}
LOS_SpinUnlock(&sortHeader->spinLock);
return listSorted->responseTime;
}
STATIC INLINE UINT32 OsGetSortLinkNodeNum(SortLinkAttribute *head)
STATIC INLINE UINT32 OsGetSortLinkNodeNum(const SortLinkAttribute *head)
{
return head->nodeNum;
}
STATIC INLINE UINT16 OsGetSortLinkNodeCpuid(const SortLinkList *node)
{
#ifdef LOSCFG_KERNEL_SMP
return node->cpuid;
#else
return 0;
#endif
}
VOID OsSortLinkInit(SortLinkAttribute *sortLinkHeader);
VOID OsAdd2SortLink(SortLinkAttribute *head, SortLinkList *node, UINT64 responseTime, UINT16 idleCpu);
VOID OsDeleteFromSortLink(SortLinkAttribute *head, SortLinkList *node);
UINT64 OsSortLinkGetTargetExpireTime(UINT64 currTime, const SortLinkList *targetSortList);
UINT64 OsSortLinkGetNextExpireTime(UINT64 currTime, const SortLinkAttribute *sortLinkHeader);
UINT32 OsSortLinkAdjustNodeResponseTime(SortLinkAttribute *head, SortLinkList *node, UINT64 responseTime);
#ifdef __cplusplus
#if __cplusplus

View File

@@ -40,11 +40,6 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct {
UINT64 runtime;
UINT32 contexSwitch;
} SchedPercpu;
typedef struct {
UINT64 allRuntime;
UINT64 runTime;
@@ -56,9 +51,17 @@ typedef struct {
UINT64 pendCount;
UINT64 waitSchedTime; /* task status is ready to running times */
UINT64 waitSchedCount;
SchedPercpu schedPercpu[LOSCFG_KERNEL_CORE_NUM];
} SchedStat;
#ifdef LOSCFG_SCHED_DEBUG
#ifdef LOSCFG_SCHED_TICK_DEBUG
VOID OsSchedDebugRecordData(VOID);
UINT32 OsShellShowTickResponse(VOID);
UINT32 OsShellShowSchedStatistics(VOID);
UINT32 OsSchedDebugInit(VOID);
#endif
#endif
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -66,6 +66,10 @@ typedef struct {
SWTMR_PROC_FUNC handler; /**< Callback function that handles software timer timeout */
UINTPTR arg; /**< Parameter passed in when the callback function
that handles software timer timeout is called */
LOS_DL_LIST node;
#ifdef LOSCFG_SWTMR_DEBUG
UINT32 swtmrID;
#endif
} SwtmrHandlerItem;
/**
@@ -100,13 +104,42 @@ extern SWTMR_CTRL_S *g_swtmrCBArray;
* @see LOS_SwtmrStop
*/
extern UINT32 OsSwtmrGetNextTimeout(VOID);
extern BOOL OsIsSwtmrTask(const LosTaskCB *taskCB);
extern VOID OsSwtmrRestart(UINT64 startTime, SortLinkList *sortList);
extern VOID OsSwtmrWake(SchedRunQue *rq, UINT64 currTime, SortLinkList *sortList);
extern VOID OsSwtmrResponseTimeReset(UINT64 startTime);
extern UINT32 OsSwtmrInit(VOID);
extern VOID OsSwtmrRecycle(UINT32 processID);
extern BOOL OsSwtmrWorkQueueFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg);
extern SPIN_LOCK_S g_swtmrSpin;
extern UINT32 OsSwtmrTaskIDGetByCpuid(UINT16 cpuid);
#ifdef LOSCFG_SWTMR_DEBUG
typedef struct {
UINT64 startTime;
UINT64 waitTimeMax;
UINT64 waitTime;
UINT64 waitCount;
UINT64 readyStartTime;
UINT64 readyTime;
UINT64 readyTimeMax;
UINT64 runTime;
UINT64 runTimeMax;
UINT64 runCount;
UINT32 times;
} SwtmrDebugBase;
typedef struct {
SwtmrDebugBase base;
SWTMR_PROC_FUNC handler;
UINT32 period;
UINT32 cpuid;
BOOL swtmrUsed;
} SwtmrDebugData;
extern BOOL OsSwtmrDebugDataUsed(UINT32 swtmrID);
extern UINT32 OsSwtmrDebugDataGet(UINT32 swtmrID, SwtmrDebugData *data, UINT32 len, UINT8 *mode);
#endif
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -73,7 +73,7 @@ extern SPIN_LOCK_S g_taskSpin;
*
* The task control block is unused.
*/
#define OS_TASK_STATUS_UNUSED 0x0200U
#define OS_TASK_STATUS_UNUSED 0x0400U
/**
* @ingroup los_task
@@ -81,7 +81,7 @@ extern SPIN_LOCK_S g_taskSpin;
*
* The task is joinable.
*/
#define OS_TASK_FLAG_PTHREAD_JOIN 0x0400U
#define OS_TASK_FLAG_PTHREAD_JOIN 0x0800U
/**
* @ingroup los_task
@@ -89,7 +89,7 @@ extern SPIN_LOCK_S g_taskSpin;
*
* The task is user mode task.
*/
#define OS_TASK_FLAG_USER_MODE 0x0800U
#define OS_TASK_FLAG_USER_MODE 0x1000U
/**
* @ingroup los_task
@@ -97,7 +97,7 @@ extern SPIN_LOCK_S g_taskSpin;
*
* The task is system-level task, like idle, swtmr and etc.
*/
#define OS_TASK_FLAG_SYSTEM_TASK 0x1000U
#define OS_TASK_FLAG_SYSTEM_TASK 0x2000U
/**
* @ingroup los_task
@@ -105,7 +105,7 @@ extern SPIN_LOCK_S g_taskSpin;
*
* The task is no-delete system task, like resourceTask.
*/
#define OS_TASK_FLAG_NO_DELETE 0x2000U
#define OS_TASK_FLAG_NO_DELETE 0x4000U
/**
* @ingroup los_task
@@ -113,15 +113,7 @@ extern SPIN_LOCK_S g_taskSpin;
*
* Kills the thread during process exit.
*/
#define OS_TASK_FLAG_EXIT_KILL 0x4000U
/**
* @ingroup los_task
* Flag that indicates the task or task control block status.
*
* The delayed operation of this task is frozen.
*/
#define OS_TASK_FLAG_FREEZE 0x8000U
#define OS_TASK_FLAG_EXIT_KILL 0x8000U
/**
* @ingroup los_task

View File

@@ -59,9 +59,9 @@ extern "C" {
const CHAR *OsGetRegionNameOrFilePath(LosVmMapRegion *region);
INT32 OsRegionOverlapCheckUnlock(LosVmSpace *space, LosVmMapRegion *region);
UINT32 OsShellCmdProcessVmUsage(LosVmSpace *space);
VOID OsShellCmdProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm);
VOID OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm);
VOID OsKProcessPmUsage(LosVmSpace *kAspace, UINT32 *actualPm);
UINT32 OsShellCmdProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm);
UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm);
UINT32 OsKProcessPmUsage(LosVmSpace *kAspace, UINT32 *actualPm);
VOID OsDumpAspace(LosVmSpace *space);
UINT32 OsCountRegionPages(LosVmSpace *space, LosVmMapRegion *region, UINT32 *pssPages);
UINT32 OsCountAspacePages(LosVmSpace *space);
@@ -70,7 +70,7 @@ VOID OsVmPhysDump(VOID);
VOID OsVmPhysUsedInfoGet(UINT32 *usedCount, UINT32 *totalCount);
INT32 OsRegionOverlapCheck(LosVmSpace *space, LosVmMapRegion *region);
VOID OsDumpPte(VADDR_T vaddr);
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space);
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space);
CHAR *OsArchFlagsToStr(const UINT32 archFlags);
#ifdef __cplusplus

View File

@@ -193,7 +193,7 @@ VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB);
LosFilePage *OsPageCacheAlloc(struct page_mapping *mapping, VM_OFFSET_T pgoff);
LosFilePage *OsFindGetEntry(struct page_mapping *mapping, VM_OFFSET_T pgoff);
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr);
VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
VOID OsDelMapInfo(LosVmMapRegion *region, LosVmPgFault *pgFault, BOOL cleanDirty);
VOID OsFileCacheFlush(struct page_mapping *mapping);
@@ -208,7 +208,7 @@ VOID OsDeletePageCacheLru(LosFilePage *page);
VOID OsPageRefDecNoLock(LosFilePage *page);
VOID OsPageRefIncLocked(LosFilePage *page);
int OsTryShrinkMemory(size_t nPage);
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, int off, int len);
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, int off, int len);
#ifdef LOSCFG_DEBUG_VERSION
VOID ResetPageCacheHitInfo(int *try, int *hit);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -147,7 +147,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 OsEventReadImp(PEVENT_CB_S eventCB, UINT32 eventM
runTask->eventMode = mode;
runTask->taskEvent = eventCB;
OsTaskWaitSetPendMask(OS_TASK_WAIT_EVENT, eventMask, timeout);
ret = OsSchedTaskWait(&eventCB->stEventList, timeout, TRUE);
ret = runTask->ops->wait(runTask, &eventCB->stEventList, timeout);
if (ret == LOS_ERRNO_TSK_TIMEOUT) {
return LOS_ERRNO_EVENT_READ_TIMEOUT;
}
@@ -185,7 +185,7 @@ LITE_OS_SEC_TEXT STATIC UINT8 OsEventResume(LosTaskCB *resumedTask, const PEVENT
resumedTask->taskEvent = NULL;
OsTaskWakeClearPendMask(resumedTask);
OsSchedTaskWake(resumedTask);
resumedTask->ops->wake(resumedTask);
}
return exitFlag;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -118,10 +118,10 @@ STATIC VOID OsFutexShowTaskNodeAttr(const LOS_DL_LIST *futexList)
lastNode = OS_FUTEX_FROM_QUEUELIST(queueList);
if (!LOS_ListEmpty(&(lastNode->pendList))) {
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(lastNode->pendList)));
PRINTK(" %u(%u) ->", taskCB->taskID, taskCB->priority);
PRINTK(" %u ->", taskCB->taskID);
} else {
taskCB = LOS_DL_LIST_ENTRY(lastNode, LosTaskCB, futex);
PRINTK(" %u(%d) ->", taskCB->taskID, -1);
PRINTK(" %u ->", taskCB->taskID);
}
queueList = queueList->pstNext;
if (queueList == &tempNode->queueList) {
@@ -336,20 +336,19 @@ STATIC INT32 OsFutexInsertFindFormBackToFront(LOS_DL_LIST *queueList, const LosT
{
LOS_DL_LIST *listHead = queueList;
LOS_DL_LIST *listTail = queueList->pstPrev;
FutexNode *tempNode = NULL;
LosTaskCB *taskTail = NULL;
for (; listHead != listTail; listTail = listTail->pstPrev) {
tempNode = OS_FUTEX_FROM_QUEUELIST(listTail);
FutexNode *tempNode = OS_FUTEX_FROM_QUEUELIST(listTail);
tempNode = OsFutexDeleteAlreadyWakeTaskAndGetNext(tempNode, NULL, FALSE);
if (tempNode == NULL) {
return LOS_NOK;
}
taskTail = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(tempNode->pendList)));
if (runTask->priority >= taskTail->priority) {
LosTaskCB *taskTail = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(tempNode->pendList)));
INT32 ret = OsSchedParamCompare(runTask, taskTail);
if (ret >= 0) {
LOS_ListHeadInsert(&(tempNode->queueList), &(node->queueList));
return LOS_OK;
} else if (runTask->priority < taskTail->priority) {
} else {
if (listTail->pstPrev == listHead) {
LOS_ListTailInsert(&(tempNode->queueList), &(node->queueList));
return LOS_OK;
@@ -364,26 +363,25 @@ STATIC INT32 OsFutexInsertFindFromFrontToBack(LOS_DL_LIST *queueList, const LosT
{
LOS_DL_LIST *listHead = queueList;
LOS_DL_LIST *listTail = queueList->pstPrev;
FutexNode *tempNode = NULL;
LosTaskCB *taskHead = NULL;
for (; listHead != listTail; listHead = listHead->pstNext) {
tempNode = OS_FUTEX_FROM_QUEUELIST(listHead);
FutexNode *tempNode = OS_FUTEX_FROM_QUEUELIST(listHead);
tempNode = OsFutexDeleteAlreadyWakeTaskAndGetNext(tempNode, NULL, FALSE);
if (tempNode == NULL) {
return LOS_NOK;
}
taskHead = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(tempNode->pendList)));
LosTaskCB *taskHead = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(tempNode->pendList)));
/* High priority comes before low priority,
* in the case of the same priority, after the current node
*/
if (runTask->priority >= taskHead->priority) {
INT32 ret = OsSchedParamCompare(runTask, taskHead);
if (ret >= 0) {
if (listHead->pstNext == listTail) {
LOS_ListHeadInsert(&(tempNode->queueList), &(node->queueList));
return LOS_OK;
}
continue;
} else if (runTask->priority < taskHead->priority) {
} else {
LOS_ListTailInsert(&(tempNode->queueList), &(node->queueList));
return LOS_OK;
}
@@ -414,10 +412,9 @@ STATIC INT32 OsFutexInsertTasktoPendList(FutexNode **firstNode, FutexNode *node,
{
LosTaskCB *taskHead = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&((*firstNode)->pendList)));
LOS_DL_LIST *queueList = &((*firstNode)->queueList);
FutexNode *tailNode = NULL;
LosTaskCB *taskTail = NULL;
if (run->priority < taskHead->priority) {
INT32 ret1 = OsSchedParamCompare(run, taskHead);
if (ret1 < 0) {
/* The one with the highest priority is inserted at the top of the queue */
LOS_ListTailInsert(queueList, &(node->queueList));
OsFutexReplaceQueueListHeadNode(*firstNode, node);
@@ -425,16 +422,16 @@ STATIC INT32 OsFutexInsertTasktoPendList(FutexNode **firstNode, FutexNode *node,
return LOS_OK;
}
if (LOS_ListEmpty(queueList) && (run->priority >= taskHead->priority)) {
if (LOS_ListEmpty(queueList) && (ret1 >= 0)) {
/* Insert the next position in the queue with equal priority */
LOS_ListHeadInsert(queueList, &(node->queueList));
return LOS_OK;
}
tailNode = OS_FUTEX_FROM_QUEUELIST(LOS_DL_LIST_LAST(queueList));
taskTail = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(tailNode->pendList)));
if ((run->priority >= taskTail->priority) ||
((run->priority - taskHead->priority) > (taskTail->priority - run->priority))) {
FutexNode *tailNode = OS_FUTEX_FROM_QUEUELIST(LOS_DL_LIST_LAST(queueList));
LosTaskCB *taskTail = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(tailNode->pendList)));
INT32 ret2 = OsSchedParamCompare(taskTail, run);
if ((ret2 <= 0) || (ret1 > ret2)) {
return OsFutexInsertFindFormBackToFront(queueList, run, node);
}
@@ -524,7 +521,7 @@ STATIC INT32 OsFutexWaitParamCheck(const UINT32 *userVaddr, UINT32 flags, UINT32
}
if (!absTime) {
return LOS_EINVAL;
return LOS_ETIMEDOUT;
}
return LOS_OK;
@@ -569,7 +566,7 @@ STATIC INT32 OsFutexInsertTaskToHash(LosTaskCB **taskCB, FutexNode **node, const
return LOS_OK;
}
STATIC INT32 OsFutexWaitTask(const UINT32 *userVaddr, const UINT32 flags, const UINT32 val, const UINT32 timeOut)
STATIC INT32 OsFutexWaitTask(const UINT32 *userVaddr, const UINT32 flags, const UINT32 val, const UINT32 timeout)
{
INT32 futexRet;
UINT32 intSave, lockVal;
@@ -600,9 +597,9 @@ STATIC INT32 OsFutexWaitTask(const UINT32 *userVaddr, const UINT32 flags, const
}
SCHEDULER_LOCK(intSave);
OsTaskWaitSetPendMask(OS_TASK_WAIT_FUTEX, futexKey, timeOut);
OsSchedTaskWait(&(node->pendList), timeOut, FALSE);
OsSchedLock();
OsTaskWaitSetPendMask(OS_TASK_WAIT_FUTEX, futexKey, timeout);
taskCB->ops->wait(taskCB, &(node->pendList), timeout);
LOS_SpinUnlock(&g_taskSpin);
futexRet = OsFutexUnlock(&hashNode->listLock);
@@ -639,17 +636,17 @@ EXIT_UNLOCK_ERR:
INT32 OsFutexWait(const UINT32 *userVaddr, UINT32 flags, UINT32 val, UINT32 absTime)
{
INT32 ret;
UINT32 timeOut = LOS_WAIT_FOREVER;
UINT32 timeout = LOS_WAIT_FOREVER;
ret = OsFutexWaitParamCheck(userVaddr, flags, absTime);
if (ret) {
return ret;
}
if (absTime != LOS_WAIT_FOREVER) {
timeOut = OsNS2Tick((UINT64)absTime * OS_SYS_NS_PER_US);
timeout = OsNS2Tick((UINT64)absTime * OS_SYS_NS_PER_US);
}
return OsFutexWaitTask(userVaddr, flags, val, timeOut);
return OsFutexWaitTask(userVaddr, flags, val, timeout);
}
STATIC INT32 OsFutexWakeParamCheck(const UINT32 *userVaddr, UINT32 flags)
@@ -693,7 +690,7 @@ STATIC VOID OsFutexCheckAndWakePendTask(FutexNode *headNode, const INT32 wakeNum
node = *nextNode;
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(node->pendList)));
OsTaskWakeClearPendMask(taskCB);
OsSchedTaskWake(taskCB);
taskCB->ops->wake(taskCB);
*wakeAny = TRUE;
*nextNode = OS_FUTEX_FROM_QUEUELIST(LOS_DL_LIST_FIRST(&(node->queueList)));
if (node != headNode) {

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -257,40 +257,36 @@ LITE_OS_SEC_TEXT UINT32 LOS_MuxDestroy(LosMux *mutex)
return LOS_OK;
}
STATIC VOID OsMuxBitmapSet(const LosMux *mutex, const LosTaskCB *runTask, LosTaskCB *owner)
STATIC VOID OsMuxBitmapSet(const LosMux *mutex, const LosTaskCB *runTask)
{
if ((owner->priority > runTask->priority) && (mutex->attr.protocol == LOS_MUX_PRIO_INHERIT)) {
LOS_BitmapSet(&(owner->priBitMap), owner->priority);
(VOID)OsSchedModifyTaskSchedParam(owner, owner->policy, runTask->priority);
}
}
VOID OsMuxBitmapRestore(const LosMux *mutex, const LosTaskCB *taskCB, LosTaskCB *owner)
{
UINT16 bitMapPri;
if (mutex->attr.protocol != LOS_MUX_PRIO_INHERIT) {
return;
}
if (owner->priority >= taskCB->priority) {
bitMapPri = LOS_LowBitGet(owner->priBitMap);
if (bitMapPri != LOS_INVALID_BIT_INDEX) {
LOS_BitmapClr(&(owner->priBitMap), bitMapPri);
OsSchedModifyTaskSchedParam(owner, owner->policy, bitMapPri);
}
} else {
if (LOS_HighBitGet(owner->priBitMap) != taskCB->priority) {
LOS_BitmapClr(&(owner->priBitMap), taskCB->priority);
}
SchedParam param = { 0 };
LosTaskCB *owner = (LosTaskCB *)mutex->owner;
INT32 ret = OsSchedParamCompare(owner, runTask);
if (ret > 0) {
runTask->ops->schedParamGet(runTask, &param);
owner->ops->priorityInheritance(owner, &param);
}
}
VOID OsMuxBitmapRestore(const LosMux *mutex, const LOS_DL_LIST *list, const LosTaskCB *runTask)
{
if (mutex->attr.protocol != LOS_MUX_PRIO_INHERIT) {
return;
}
SchedParam param = { 0 };
LosTaskCB *owner = (LosTaskCB *)mutex->owner;
runTask->ops->schedParamGet(runTask, &param);
owner->ops->priorityRestore(owner, list, &param);
}
STATIC UINT32 OsMuxPendOp(LosTaskCB *runTask, LosMux *mutex, UINT32 timeout)
{
UINT32 ret;
LOS_DL_LIST *node = NULL;
LosTaskCB *owner = NULL;
if ((mutex->muxList.pstPrev == NULL) || (mutex->muxList.pstNext == NULL)) {
/* This is for mutex macro initialization. */
@@ -303,9 +299,11 @@ STATIC UINT32 OsMuxPendOp(LosTaskCB *runTask, LosMux *mutex, UINT32 timeout)
mutex->muxCount++;
mutex->owner = (VOID *)runTask;
LOS_ListTailInsert(&runTask->lockList, &mutex->holdList);
if ((mutex->attr.protocol == LOS_MUX_PRIO_PROTECT) && (runTask->priority > mutex->attr.prioceiling)) {
LOS_BitmapSet(&runTask->priBitMap, runTask->priority);
(VOID)OsSchedModifyTaskSchedParam(runTask, runTask->policy, mutex->attr.prioceiling);
if (mutex->attr.protocol == LOS_MUX_PRIO_PROTECT) {
SchedParam param = { 0 };
runTask->ops->schedParamGet(runTask, &param);
param.priority = mutex->attr.prioceiling;
runTask->ops->priorityInheritance(runTask, &param);
}
return LOS_OK;
}
@@ -323,27 +321,23 @@ STATIC UINT32 OsMuxPendOp(LosTaskCB *runTask, LosMux *mutex, UINT32 timeout)
return LOS_EDEADLK;
}
OsMuxBitmapSet(mutex, runTask, (LosTaskCB *)mutex->owner);
OsMuxBitmapSet(mutex, runTask);
owner = (LosTaskCB *)mutex->owner;
runTask->taskMux = (VOID *)mutex;
node = OsSchedLockPendFindPos(runTask, &mutex->muxList);
LOS_DL_LIST *node = OsSchedLockPendFindPos(runTask, &mutex->muxList);
if (node == NULL) {
ret = LOS_NOK;
return ret;
}
OsTaskWaitSetPendMask(OS_TASK_WAIT_MUTEX, (UINTPTR)mutex, timeout);
ret = OsSchedTaskWait(node, timeout, TRUE);
ret = runTask->ops->wait(runTask, node, timeout);
if (ret == LOS_ERRNO_TSK_TIMEOUT) {
OsMuxBitmapRestore(mutex, NULL, runTask);
runTask->taskMux = NULL;
ret = LOS_ETIMEDOUT;
}
if (timeout != LOS_WAIT_FOREVER) {
OsMuxBitmapRestore(mutex, runTask, owner);
}
return ret;
}
@@ -440,50 +434,23 @@ LITE_OS_SEC_TEXT UINT32 LOS_MuxTrylock(LosMux *mutex)
return ret;
}
STATIC VOID OsMuxPostOpSub(LosTaskCB *taskCB, LosMux *mutex)
{
LosTaskCB *pendedTask = NULL;
UINT16 bitMapPri;
if (!LOS_ListEmpty(&mutex->muxList)) {
bitMapPri = LOS_HighBitGet(taskCB->priBitMap);
LOS_DL_LIST_FOR_EACH_ENTRY(pendedTask, (&mutex->muxList), LosTaskCB, pendList) {
if (bitMapPri != pendedTask->priority) {
LOS_BitmapClr(&taskCB->priBitMap, pendedTask->priority);
}
}
}
bitMapPri = LOS_LowBitGet(taskCB->priBitMap);
LOS_BitmapClr(&taskCB->priBitMap, bitMapPri);
(VOID)OsSchedModifyTaskSchedParam((LosTaskCB *)mutex->owner, ((LosTaskCB *)mutex->owner)->policy, bitMapPri);
}
STATIC UINT32 OsMuxPostOp(LosTaskCB *taskCB, LosMux *mutex, BOOL *needSched)
{
LosTaskCB *resumedTask = NULL;
if (LOS_ListEmpty(&mutex->muxList)) {
LOS_ListDelete(&mutex->holdList);
mutex->owner = NULL;
return LOS_OK;
}
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(mutex->muxList)));
if (mutex->attr.protocol == LOS_MUX_PRIO_INHERIT) {
if (resumedTask->priority > taskCB->priority) {
if (LOS_HighBitGet(taskCB->priBitMap) != resumedTask->priority) {
LOS_BitmapClr(&taskCB->priBitMap, resumedTask->priority);
}
} else if (taskCB->priBitMap != 0) {
OsMuxPostOpSub(taskCB, mutex);
}
}
LosTaskCB *resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(mutex->muxList)));
OsMuxBitmapRestore(mutex, &mutex->muxList, resumedTask);
mutex->muxCount = 1;
mutex->owner = (VOID *)resumedTask;
LOS_ListDelete(&mutex->holdList);
LOS_ListTailInsert(&resumedTask->lockList, &mutex->holdList);
OsTaskWakeClearPendMask(resumedTask);
OsSchedTaskWake(resumedTask);
resumedTask->ops->wake(resumedTask);
resumedTask->taskMux = NULL;
if (needSched != NULL) {
*needSched = TRUE;
@@ -494,8 +461,6 @@ STATIC UINT32 OsMuxPostOp(LosTaskCB *taskCB, LosMux *mutex, BOOL *needSched)
UINT32 OsMuxUnlockUnsafe(LosTaskCB *taskCB, LosMux *mutex, BOOL *needSched)
{
UINT16 bitMapPri;
if (mutex->magic != OS_MUX_MAGIC) {
return LOS_EBADF;
}
@@ -517,11 +482,9 @@ UINT32 OsMuxUnlockUnsafe(LosTaskCB *taskCB, LosMux *mutex, BOOL *needSched)
}
if (mutex->attr.protocol == LOS_MUX_PRIO_PROTECT) {
bitMapPri = LOS_HighBitGet(taskCB->priBitMap);
if (bitMapPri != LOS_INVALID_BIT_INDEX) {
LOS_BitmapClr(&taskCB->priBitMap, bitMapPri);
(VOID)OsSchedModifyTaskSchedParam(taskCB, taskCB->policy, bitMapPri);
}
SchedParam param = { 0 };
taskCB->ops->schedParamGet(taskCB, &param);
taskCB->ops->priorityRestore(taskCB, NULL, &param);
}
/* Whether a task block the mutex lock. */

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -223,6 +223,7 @@ STATIC VOID OsQueueBufferOperate(LosQueueCB *queueCB, UINT32 operateType, VOID *
PRINT_ERR("get msgdatasize failed\n");
return;
}
msgDataSize = (*bufferSize < msgDataSize) ? *bufferSize : msgDataSize;
if (memcpy_s(bufferAddr, *bufferSize, queueNode, msgDataSize) != EOK) {
PRINT_ERR("copy message to buffer failed\n");
return;
@@ -249,9 +250,7 @@ STATIC UINT32 OsQueueOperateParamCheck(const LosQueueCB *queueCB, UINT32 queueID
return LOS_ERRNO_QUEUE_NOT_CREATE;
}
if (OS_QUEUE_IS_READ(operateType) && (*bufferSize < (queueCB->queueSize - sizeof(UINT32)))) {
return LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALL;
} else if (OS_QUEUE_IS_WRITE(operateType) && (*bufferSize > (queueCB->queueSize - sizeof(UINT32)))) {
if (OS_QUEUE_IS_WRITE(operateType) && (*bufferSize > (queueCB->queueSize - sizeof(UINT32)))) {
return LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG;
}
return LOS_OK;
@@ -259,15 +258,13 @@ STATIC UINT32 OsQueueOperateParamCheck(const LosQueueCB *queueCB, UINT32 queueID
UINT32 OsQueueOperate(UINT32 queueID, UINT32 operateType, VOID *bufferAddr, UINT32 *bufferSize, UINT32 timeout)
{
LosQueueCB *queueCB = NULL;
LosTaskCB *resumedTask = NULL;
UINT32 ret;
UINT32 readWrite = OS_QUEUE_READ_WRITE_GET(operateType);
UINT32 intSave;
OsHookCall(LOS_HOOK_TYPE_QUEUE_READ, (LosQueueCB *)GET_QUEUE_HANDLE(queueID), operateType, *bufferSize, timeout);
SCHEDULER_LOCK(intSave);
queueCB = (LosQueueCB *)GET_QUEUE_HANDLE(queueID);
LosQueueCB *queueCB = (LosQueueCB *)GET_QUEUE_HANDLE(queueID);
ret = OsQueueOperateParamCheck(queueCB, queueID, operateType, bufferSize);
if (ret != LOS_OK) {
goto QUEUE_END;
@@ -284,8 +281,9 @@ UINT32 OsQueueOperate(UINT32 queueID, UINT32 operateType, VOID *bufferAddr, UINT
goto QUEUE_END;
}
LosTaskCB *runTask = OsCurrTaskGet();
OsTaskWaitSetPendMask(OS_TASK_WAIT_QUEUE, queueCB->queueID, timeout);
ret = OsSchedTaskWait(&queueCB->readWriteList[readWrite], timeout, TRUE);
ret = runTask->ops->wait(runTask, &queueCB->readWriteList[readWrite], timeout);
if (ret == LOS_ERRNO_TSK_TIMEOUT) {
ret = LOS_ERRNO_QUEUE_TIMEOUT;
goto QUEUE_END;
@@ -297,9 +295,9 @@ UINT32 OsQueueOperate(UINT32 queueID, UINT32 operateType, VOID *bufferAddr, UINT
OsQueueBufferOperate(queueCB, operateType, bufferAddr, bufferSize);
if (!LOS_ListEmpty(&queueCB->readWriteList[!readWrite])) {
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&queueCB->readWriteList[!readWrite]));
LosTaskCB *resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&queueCB->readWriteList[!readWrite]));
OsTaskWakeClearPendMask(resumedTask);
OsSchedTaskWake(resumedTask);
resumedTask->ops->wake(resumedTask);
SCHEDULER_UNLOCK(intSave);
LOS_MpSchedule(OS_MP_CPU_ALL);
LOS_Schedule();

View File

@@ -40,7 +40,7 @@
#ifdef LOSCFG_DEBUG_QUEUE
typedef struct {
TSK_ENTRY_FUNC creater; /* The task entry who created this queue */
TSK_ENTRY_FUNC creator; /* The task entry who created this queue */
UINT64 lastAccessTime; /* The last access time */
} QueueDebugCB;
STATIC QueueDebugCB *g_queueDebugArray = NULL;
@@ -74,7 +74,7 @@ VOID OsQueueDbgTimeUpdate(UINT32 queueID)
VOID OsQueueDbgUpdate(UINT32 queueID, TSK_ENTRY_FUNC entry)
{
QueueDebugCB *queueDebug = &g_queueDebugArray[GET_QUEUE_INDEX(queueID)];
queueDebug->creater = entry;
queueDebug->creator = entry;
queueDebug->lastAccessTime = LOS_TickCountGet();
return;
}
@@ -91,8 +91,8 @@ STATIC INLINE VOID OsQueueInfoOutPut(const LosQueueCB *node)
STATIC INLINE VOID OsQueueOpsOutput(const QueueDebugCB *node)
{
PRINTK("TaskEntry of creater:0x%p, Latest operation time: 0x%llx\n",
node->creater, node->lastAccessTime);
PRINTK("TaskEntry of creator:0x%p, Latest operation time: 0x%llx\n",
node->creator, node->lastAccessTime);
}
STATIC VOID SortQueueIndexArray(UINT32 *indexArray, UINT32 count)
@@ -149,7 +149,7 @@ VOID OsQueueCheck(VOID)
&g_queueDebugArray[index], sizeof(QueueDebugCB));
SCHEDULER_UNLOCK(intSave);
if ((queueNode.queueState == OS_QUEUE_UNUSED) ||
((queueNode.queueState == OS_QUEUE_INUSED) && (queueDebugNode.creater == NULL))) {
((queueNode.queueState == OS_QUEUE_INUSED) && (queueDebugNode.creator == NULL))) {
continue;
}
if ((queueNode.queueState == OS_QUEUE_INUSED) &&

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -37,7 +37,6 @@
#include "los_exc.h"
#include "los_sched_pri.h"
#ifdef LOSCFG_BASE_IPC_RWLOCK
#define RWLOCK_COUNT_MASK 0x00FFFFFFU
@@ -97,7 +96,7 @@ UINT32 LOS_RwlockDestroy(LosRwlock *rwlock)
return LOS_OK;
}
STATIC UINT32 OsRwlockCheck(LosRwlock *rwlock)
STATIC UINT32 OsRwlockCheck(const LosRwlock *rwlock)
{
if (rwlock == NULL) {
return LOS_EINVAL;
@@ -120,7 +119,7 @@ STATIC BOOL OsRwlockPriCompare(LosTaskCB *runTask, LOS_DL_LIST *rwList)
{
if (!LOS_ListEmpty(rwList)) {
LosTaskCB *highestTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(rwList));
if (runTask->priority < highestTask->priority) {
if (OsSchedParamCompare(runTask, highestTask) < 0) {
return TRUE;
}
return FALSE;
@@ -164,7 +163,7 @@ STATIC UINT32 OsRwlockRdPendOp(LosTaskCB *runTask, LosRwlock *rwlock, UINT32 tim
* is lower than the first pended write task, current read task will be pended.
*/
LOS_DL_LIST *node = OsSchedLockPendFindPos(runTask, &(rwlock->readList));
ret = OsSchedTaskWait(node, timeout, TRUE);
ret = runTask->ops->wait(runTask, node, timeout);
if (ret == LOS_ERRNO_TSK_TIMEOUT) {
return LOS_ETIMEDOUT;
}
@@ -205,7 +204,7 @@ STATIC UINT32 OsRwlockWrPendOp(LosTaskCB *runTask, LosRwlock *rwlock, UINT32 tim
* write task will be pended.
*/
LOS_DL_LIST *node = OsSchedLockPendFindPos(runTask, &(rwlock->writeList));
ret = OsSchedTaskWait(node, timeout, TRUE);
ret = runTask->ops->wait(runTask, node, timeout);
if (ret == LOS_ERRNO_TSK_TIMEOUT) {
ret = LOS_ETIMEDOUT;
}
@@ -355,7 +354,7 @@ STATIC UINT32 OsRwlockGetMode(LOS_DL_LIST *readList, LOS_DL_LIST *writeList)
}
LosTaskCB *pendedReadTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(readList));
LosTaskCB *pendedWriteTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(writeList));
if (pendedWriteTask->priority <= pendedReadTask->priority) {
if (OsSchedParamCompare(pendedWriteTask, pendedReadTask) <= 0) {
return RWLOCK_WRITEFIRST_MODE;
}
return RWLOCK_READFIRST_MODE;
@@ -365,7 +364,6 @@ STATIC UINT32 OsRwlockPostOp(LosRwlock *rwlock, BOOL *needSched)
{
UINT32 rwlockMode;
LosTaskCB *resumedTask = NULL;
UINT16 pendedWriteTaskPri;
rwlock->rwCount = 0;
rwlock->writeOwner = NULL;
@@ -378,29 +376,29 @@ STATIC UINT32 OsRwlockPostOp(LosRwlock *rwlock, BOOL *needSched)
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(rwlock->writeList)));
rwlock->rwCount = -1;
rwlock->writeOwner = (VOID *)resumedTask;
OsSchedTaskWake(resumedTask);
resumedTask->ops->wake(resumedTask);
if (needSched != NULL) {
*needSched = TRUE;
}
return LOS_OK;
}
/* In this case, rwlock will wake the valid pended read task. */
if (rwlockMode == RWLOCK_READFIRST_MODE) {
pendedWriteTaskPri = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(rwlock->writeList)))->priority;
}
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(rwlock->readList)));
rwlock->rwCount = 1;
OsSchedTaskWake(resumedTask);
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(rwlock->readList)));
resumedTask->ops->wake(resumedTask);
while (!LOS_ListEmpty(&(rwlock->readList))) {
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(rwlock->readList)));
if ((rwlockMode == RWLOCK_READFIRST_MODE) && (resumedTask->priority >= pendedWriteTaskPri)) {
break;
if (rwlockMode == RWLOCK_READFIRST_MODE) {
LosTaskCB *pendedWriteTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(rwlock->writeList)));
if (OsSchedParamCompare(resumedTask, pendedWriteTask) >= 0) {
break;
}
}
if (rwlock->rwCount == INT8_MAX) {
return EINVAL;
}
rwlock->rwCount++;
OsSchedTaskWake(resumedTask);
resumedTask->ops->wake(resumedTask);
}
if (needSched != NULL) {
*needSched = TRUE;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -225,7 +225,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_SemPend(UINT32 semHandle, UINT32 timeout)
OsHookCall(LOS_HOOK_TYPE_SEM_PEND, semPended, runTask, timeout);
OsTaskWaitSetPendMask(OS_TASK_WAIT_SEM, semPended->semID, timeout);
retErr = OsSchedTaskWait(&semPended->semList, timeout, TRUE);
retErr = runTask->ops->wait(runTask, &semPended->semList, timeout);
if (retErr == LOS_ERRNO_TSK_TIMEOUT) {
retErr = LOS_ERRNO_SEM_TIMEOUT;
}
@@ -237,10 +237,8 @@ OUT:
LITE_OS_SEC_TEXT UINT32 OsSemPostUnsafe(UINT32 semHandle, BOOL *needSched)
{
LosSemCB *semPosted = NULL;
LosTaskCB *resumedTask = NULL;
semPosted = GET_SEM(semHandle);
LosSemCB *semPosted = GET_SEM(semHandle);
if ((semPosted->semID != semHandle) || (semPosted->semStat == OS_SEM_UNUSED)) {
return LOS_ERRNO_SEM_INVALID;
}
@@ -254,7 +252,7 @@ LITE_OS_SEC_TEXT UINT32 OsSemPostUnsafe(UINT32 semHandle, BOOL *needSched)
if (!LOS_ListEmpty(&semPosted->semList)) {
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(semPosted->semList)));
OsTaskWakeClearPendMask(resumedTask);
OsSchedTaskWake(resumedTask);
resumedTask->ops->wake(resumedTask);
if (needSched != NULL) {
*needSched = TRUE;
}

View File

@@ -80,7 +80,7 @@ STATIC VOID OsSemPendedTaskNamePrint(LosSemCB *semNode)
typedef struct {
UINT16 origSemCount; /* Number of original available semaphores */
UINT64 lastAccessTime; /* The last operation time */
TSK_ENTRY_FUNC creater; /* The task entry who created this sem */
TSK_ENTRY_FUNC creator; /* The task entry who created this sem */
} SemDebugCB;
STATIC SemDebugCB *g_semDebugArray = NULL;
@@ -110,10 +110,10 @@ VOID OsSemDbgTimeUpdate(UINT32 semID)
return;
}
VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creater, UINT16 count)
VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creator, UINT16 count)
{
SemDebugCB *semDebug = &g_semDebugArray[GET_SEM_INDEX(semID)];
semDebug->creater = creater;
semDebug->creator = creator;
semDebug->lastAccessTime = LOS_TickCountGet();
semDebug->origSemCount = count;
return;
@@ -133,7 +133,7 @@ STATIC VOID OsSemSort(UINT32 *semIndexArray, UINT32 usedCount)
/* It will Print out ALL the Used Semaphore List. */
PRINTK("Used Semaphore List: \n");
PRINTK("\r\n SemID Count OriginalCount Creater(TaskEntry) LastAccessTime\n");
PRINTK("\r\n SemID Count OriginalCount Creator(TaskEntry) LastAccessTime\n");
PRINTK(" ------ ------ ------------- ------------------ -------------- \n");
SCHEDULER_LOCK(intSave);
@@ -145,11 +145,11 @@ STATIC VOID OsSemSort(UINT32 *semIndexArray, UINT32 usedCount)
(VOID)memcpy_s(&semNode, sizeof(LosSemCB), semCB, sizeof(LosSemCB));
(VOID)memcpy_s(&semDebug, sizeof(SemDebugCB), &g_semDebugArray[semIndexArray[i]], sizeof(SemDebugCB));
SCHEDULER_UNLOCK(intSave);
if ((semNode.semStat != OS_SEM_USED) || (semDebug.creater == NULL)) {
if ((semNode.semStat != OS_SEM_USED) || (semDebug.creator == NULL)) {
continue;
}
PRINTK(" 0x%-07x0x%-07u0x%-14u%-22p0x%llx\n", semNode.semID, semDebug.origSemCount,
semNode.semCount, semDebug.creater, semDebug.lastAccessTime);
semNode.semCount, semDebug.creator, semDebug.lastAccessTime);
if (!LOS_ListEmpty(&semNode.semList)) {
OsSemPendedTaskNamePrint(semCB);
}
@@ -170,7 +170,7 @@ UINT32 OsSemInfoGetFullData(VOID)
for (i = 0; i < LOSCFG_BASE_IPC_SEM_LIMIT; i++) {
semNode = GET_SEM(i);
semDebug = &g_semDebugArray[i];
if ((semNode->semStat == OS_SEM_USED) && (semDebug->creater != NULL)) {
if ((semNode->semStat == OS_SEM_USED) && (semDebug->creator != NULL)) {
usedSemCnt++;
}
}
@@ -190,7 +190,7 @@ UINT32 OsSemInfoGetFullData(VOID)
for (i = 0; i < LOSCFG_BASE_IPC_SEM_LIMIT; i++) {
semNode = GET_SEM(i);
semDebug = &g_semDebugArray[i];
if ((semNode->semStat != OS_SEM_USED) || (semDebug->creater == NULL)) {
if ((semNode->semStat != OS_SEM_USED) || (semDebug->creator == NULL)) {
continue;
}
*(semIndexArray + count) = i;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -78,7 +78,6 @@ STATIC VOID OsMoveTmpInfoToUnbInfo(sig_cb *sigcb, INT32 signo)
/* delete tmpinfo from tmpList. */
*prevHook = tmpInfoNode->next;
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
tmpInfoNode = *prevHook;
break;
}
prevHook = &tmpInfoNode->next;
@@ -129,7 +128,7 @@ STATIC INLINE VOID OsSigWaitTaskWake(LosTaskCB *taskCB, INT32 signo)
if (!LOS_ListEmpty(&sigcb->waitList) && OsSigIsMember(&sigcb->sigwaitmask, signo)) {
OsMoveTmpInfoToUnbInfo(sigcb, signo);
OsTaskWakeClearPendMask(taskCB);
OsSchedTaskWake(taskCB);
taskCB->ops->wake(taskCB);
OsSigEmptySet(&sigcb->sigwaitmask);
}
}
@@ -152,19 +151,19 @@ STATIC UINT32 OsPendingTaskWake(LosTaskCB *taskCB, INT32 signo)
break;
case OS_TASK_WAIT_JOIN:
OsTaskWakeClearPendMask(taskCB);
OsSchedTaskWake(taskCB);
taskCB->ops->wake(taskCB);
break;
case OS_TASK_WAIT_SIGNAL:
OsSigWaitTaskWake(taskCB, signo);
break;
case OS_TASK_WAIT_LITEIPC:
OsTaskWakeClearPendMask(taskCB);
OsSchedTaskWake(taskCB);
taskCB->ops->wake(taskCB);
break;
case OS_TASK_WAIT_FUTEX:
OsFutexNodeDeleteFromFutexHash(&taskCB->futex, TRUE, NULL, NULL);
OsTaskWakeClearPendMask(taskCB);
OsSchedTaskWake(taskCB);
taskCB->ops->wake(taskCB);
break;
default:
break;
@@ -284,7 +283,7 @@ static int SigProcessSignalHandler(LosTaskCB *tcb, void *arg)
return 0;
}
/* If the default tcb is not setted, then set this one as default. */
/* If the default tcb is not set, then set this one as default. */
if (!info->defaultTcb) {
info->defaultTcb = tcb;
}
@@ -305,7 +304,7 @@ static int SigProcessSignalHandler(LosTaskCB *tcb, void *arg)
/* Is this signal unblocked on this thread? */
isMember = OsSigIsMember(&tcb->sig.sigprocmask, info->sigInfo->si_signo);
if ((!isMember) && (!info->receivedTcb) && (tcb != info->awakenedTcb)) {
/* if unblockedTcb of this signal is not setted, then set it. */
/* if unblockedTcb of this signal is not set, then set it. */
if (!info->unblockedTcb) {
info->unblockedTcb = tcb;
}
@@ -567,7 +566,7 @@ int OsSigTimedWaitNoLock(sigset_t *set, siginfo_t *info, unsigned int timeout)
sigcb->sigwaitmask |= *set;
OsTaskWaitSetPendMask(OS_TASK_WAIT_SIGNAL, sigcb->sigwaitmask, timeout);
ret = OsSchedTaskWait(&sigcb->waitList, timeout, TRUE);
ret = task->ops->wait(task, &sigcb->waitList, timeout);
if (ret == LOS_ERRNO_TSK_TIMEOUT) {
ret = -EAGAIN;
}

View File

@@ -498,7 +498,7 @@ STATIC INLINE VOID OsLmsReallocMergeNodeMark(struct OsMemNodeHead *node)
}
g_lms->simpleMark((UINTPTR)node + OS_MEM_NODE_HEAD_SIZE, (UINTPTR)OS_MEM_NEXT_NODE(node),
LMS_SHADOW_ACCESSABLE_U8);
LMS_SHADOW_ACCESSIBLE_U8);
}
STATIC INLINE VOID OsLmsReallocSplitNodeMark(struct OsMemNodeHead *node)
@@ -918,7 +918,7 @@ STATIC UINT32 OsMemPoolAdd(VOID *pool, UINT32 size)
return LOS_OK;
}
STATIC UINT32 OsMemPoolDelete(VOID *pool)
STATIC UINT32 OsMemPoolDelete(const VOID *pool)
{
UINT32 ret = LOS_NOK;
VOID *nextPool = NULL;

View File

@@ -36,7 +36,7 @@
#include "shcmd.h"
#include "shell.h"
#define OS_ALL_SWTMR_MASK 0xffffffff
#define SWTMR_STRLEN 12
LITE_OS_SEC_DATA_MINOR STATIC CHAR g_shellSwtmrMode[][SWTMR_STRLEN] = {
@@ -57,13 +57,7 @@ STATIC VOID OsPrintSwtmrMsg(const SWTMR_CTRL_S *swtmr)
UINT32 ticks = 0;
(VOID)LOS_SwtmrTimeGet(swtmr->usTimerID, &ticks);
PRINTK("0x%08x "
"%-7s "
"%-6s "
"%-6u "
"%-6u "
"0x%08x "
"%p\n",
PRINTK("%7u%10s%8s%12u%7u%#12x%#12x\n",
swtmr->usTimerID % LOSCFG_BASE_CORE_SWTMR_LIMIT,
g_shellSwtmrStatus[swtmr->ucState],
g_shellSwtmrMode[swtmr->ucMode],
@@ -75,34 +69,15 @@ STATIC VOID OsPrintSwtmrMsg(const SWTMR_CTRL_S *swtmr)
STATIC INLINE VOID OsPrintSwtmrMsgHead(VOID)
{
PRINTK("\r\nSwTmrID State Mode Interval Count Arg handlerAddr\n");
PRINTK("---------- ------- ------- --------- ------- ---------- --------\n");
PRINTK("\r\nSwTmrID State Mode Interval Count Arg handlerAddr\n");
}
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdSwtmrInfoGet(INT32 argc, const UINT8 **argv)
STATIC UINT32 SwtmrBaseInfoGet(UINT32 timerID)
{
#define OS_ALL_SWTMR_MASK 0xffffffff
SWTMR_CTRL_S *swtmr = g_swtmrCBArray;
SWTMR_CTRL_S *swtmr1 = g_swtmrCBArray;
UINT16 index;
size_t timerID;
UINT16 num = 0;
CHAR *endPtr = NULL;
if (argc > 1) {
PRINTK("\nUsage: swtmr [ID]\n");
return OS_ERROR;
}
if (argc == 0) {
timerID = OS_ALL_SWTMR_MASK;
} else {
timerID = strtoul((CHAR *)argv[0], &endPtr, 0);
if ((endPtr == NULL) || (*endPtr != 0) || (timerID > LOSCFG_BASE_CORE_SWTMR_LIMIT)) {
PRINTK("\nswtmr ID can't access %s.\n", argv[0]);
return OS_ERROR;
}
}
for (index = 0; index < LOSCFG_BASE_CORE_SWTMR_LIMIT; index++, swtmr1++) {
if (swtmr1->ucState == 0) {
@@ -112,13 +87,13 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdSwtmrInfoGet(INT32 argc, const UINT8 **a
if (num == LOSCFG_BASE_CORE_SWTMR_LIMIT) {
PRINTK("\r\nThere is no swtmr was created!\n");
return OS_ERROR;
return LOS_NOK;
}
if (timerID == OS_ALL_SWTMR_MASK) {
OsPrintSwtmrMsgHead();
for (index = 0; index < LOSCFG_BASE_CORE_SWTMR_LIMIT; index++, swtmr++) {
if (swtmr->ucState != 0) {
OsPrintSwtmrMsgHead();
OsPrintSwtmrMsg(swtmr);
}
}
@@ -135,6 +110,70 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdSwtmrInfoGet(INT32 argc, const UINT8 **a
return LOS_OK;
}
#ifdef LOSCFG_SWTMR_DEBUG
STATIC VOID OsSwtmrTimeInfoShow(VOID)
{
UINT8 mode;
SwtmrDebugData data;
PRINTK("SwtmrID Cpuid Mode Period(us) WaitTime(us) WaitMax(us) RTime(us) RTimeMax(us) ReTime(us)"
" ReTimeMax(us) RunCount LostNum Handler\n");
for (UINT32 index = 0; index < LOSCFG_BASE_CORE_SWTMR_LIMIT; index++) {
if (!OsSwtmrDebugDataUsed(index)) {
continue;
}
UINT32 ret = OsSwtmrDebugDataGet(index, &data, sizeof(SwtmrDebugData), &mode);
if (ret != LOS_OK) {
break;
}
SwtmrDebugBase *base = &data.base;
UINT64 waitTime = ((base->waitTime / base->waitCount) * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
UINT64 waitTimeMax = (base->waitTimeMax * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
UINT64 runTime = ((base->runTime / base->runCount) * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
UINT64 runTimeMax = (base->runTimeMax * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
UINT64 readyTime = ((base->readyTime / base->runCount) * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
UINT64 readyTimeMax = (base->readyTimeMax * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
PRINTK("%4u%10u%7s%14u%13llu%12llu%10llu%13llu%10llu%14llu%15llu%11u%#12x\n",
index, data.cpuid, g_shellSwtmrMode[mode], data.period * OS_US_PER_TICK, waitTime, waitTimeMax,
runTime, runTimeMax, readyTime, readyTimeMax, base->runCount, base->times, data.handler);
}
}
#endif
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdSwtmrInfoGet(INT32 argc, const CHAR **argv)
{
UINT32 timerID;
CHAR *endPtr = NULL;
if (argc > 1) {
goto SWTMR_HELP;
}
if (argc == 0) {
timerID = OS_ALL_SWTMR_MASK;
#ifdef LOSCFG_SWTMR_DEBUG
} else if (strcmp("-t", argv[0]) == 0) {
OsSwtmrTimeInfoShow();
return LOS_OK;
#endif
} else {
timerID = strtoul(argv[0], &endPtr, 0);
if ((endPtr == NULL) || (*endPtr != 0) || (timerID > LOSCFG_BASE_CORE_SWTMR_LIMIT)) {
PRINTK("\nswtmr ID can't access %s.\n", argv[0]);
return LOS_NOK;
}
}
return SwtmrBaseInfoGet(timerID);
SWTMR_HELP:
PRINTK("Usage:\n");
PRINTK(" swtmr --- Information about all created software timers.\n");
PRINTK(" swtmr ID --- Specifies information about a software timer.\n");
return LOS_OK;
}
SHELLCMD_ENTRY(swtmr_shellcmd, CMD_TYPE_EX, "swtmr", 1, (CmdCallBackFunc)OsShellCmdSwtmrInfoGet);
#endif /* LOSCFG_SHELL */

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -52,7 +52,7 @@
#include "fs/file.h"
#endif
#include "los_sched_pri.h"
#include "los_swtmr_pri.h"
#define OS_PROCESS_MEM_INFO 0x2U
#define OS_PROCESS_INFO_LEN (g_processMaxNum * (sizeof(LosProcessCB)))
@@ -63,46 +63,45 @@
#define OS_PROCESS_CPUP_LEN (g_processMaxNum * sizeof(CPUP_INFO_S))
#define OS_PROCESS_AND_TASK_CPUP_LEN ((g_processMaxNum + g_taskMaxNum) * sizeof(CPUP_INFO_S))
#define OS_PROCESS_CPUP_ALLINFO_LEN (OS_PROCESS_AND_TASK_CPUP_LEN * 3)
STATIC VOID TaskCpupInfoBaseGet(UINTPTR base, const CPUP_INFO_S **, const CPUP_INFO_S **, const CPUP_INFO_S **);
STATIC VOID ProcessCpupInfoBaseGet(UINTPTR base, const CPUP_INFO_S **, const CPUP_INFO_S **, const CPUP_INFO_S **);
#else
#define OS_PROCESS_CPUP_ALLINFO_LEN 0
#endif
#define OS_PROCESS_ALL_INFO_LEN (g_processMaxNum * (sizeof(LosProcessCB) + sizeof(UINT32)) + \
OS_PROCESS_CPUP_ALLINFO_LEN + OS_PROCESS_UID_INFO_LEN)
#ifdef LOSCFG_KERNEL_CPUP
LITE_OS_SEC_BSS STATIC CPUP_INFO_S *processCpupAll = NULL;
LITE_OS_SEC_BSS STATIC CPUP_INFO_S *processCpup10s = NULL;
LITE_OS_SEC_BSS STATIC CPUP_INFO_S *processCpup1s = NULL;
LITE_OS_SEC_BSS STATIC CPUP_INFO_S *taskCpupAll = NULL;
LITE_OS_SEC_BSS STATIC CPUP_INFO_S *taskCpup10s = NULL;
LITE_OS_SEC_BSS STATIC CPUP_INFO_S *taskCpup1s = NULL;
#endif
STATIC UINT32 *taskWaterLine = NULL;
#define OS_INVALID_SEM_ID 0xFFFFFFFF
#define OS_TASK_WATER_LINE_SIZE (g_taskMaxNum * sizeof(UINT32))
#define OS_TASK_INFO_LEN (g_taskMaxNum * sizeof(LosTaskCB))
#define OS_TASK_ALL_INFO_LEN (g_taskMaxNum * (sizeof(LosTaskCB) + sizeof(UINT32)))
#define OS_TASK_SCHED_INFO_LEN (g_taskMaxNum * sizeof(SchedParam))
#define OS_TASK_ALL_INFO_LEN (g_taskMaxNum * (sizeof(LosTaskCB) + sizeof(UINT32) + sizeof(SchedParam)))
#undef SHOW
#ifdef LOSCFG_FS_VFS
#if defined(LOSCFG_BLACKBOX) && defined(LOSCFG_SAVE_EXCINFO)
#define SaveExcInfo(arg, ...) WriteExcInfoToBuf(arg, ##__VA_ARGS__)
#else
#define SaveExcInfo(arg, ...)
#endif
#define PROCESS_INFO_SHOW(seqBuf, arg...) do { \
if (seqBuf != NULL) { \
(void)LosBufPrintf((struct SeqBuf *)seqBuf, ##arg); \
#define SHOW(arg...) do { \
if (seqBuf != NULL) { \
(void)LosBufPrintf((struct SeqBuf *)seqBuf, ##arg); \
} else { \
PRINTK(arg); \
} \
SaveExcInfo(arg); \
} while (0)
#else
#define PROCESS_INFO_SHOW(seqBuf, arg...) PRINTK(arg)
#define SHOW(arg...) PRINTK(arg)
#endif
LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellCmdProcessMode(UINT16 mode)
#define VM_INDEX PROCESS_VM_INDEX
#define SM_INDEX PROCESS_SM_INDEX
#define PM_INDEX PROCESS_PM_INDEX
#define CPUP_MULT LOS_CPUP_PRECISION_MULT
STATIC UINT8 *ConvertProcessModeToString(UINT16 mode)
{
if (mode == OS_KERNEL_MODE) {
return (UINT8 *)"kernel";
@@ -113,7 +112,7 @@ LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellCmdProcessMode(UINT16 mode)
return (UINT8 *)"ERROR";
}
LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellCmdSchedPolicy(UINT16 policy)
STATIC UINT8 *ConvertSchedPolicyToString(UINT16 policy)
{
if (policy == LOS_SCHED_RR) {
return (UINT8 *)"RR";
@@ -126,7 +125,7 @@ LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellCmdSchedPolicy(UINT16 policy)
return (UINT8 *)"ERROR";
}
LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellProcessStatus(UINT16 status)
STATIC UINT8 *ConvertProcessStatusToString(UINT16 status)
{
if (status & OS_PROCESS_STATUS_ZOMBIES) {
return (UINT8 *)"Zombies";
@@ -140,118 +139,123 @@ LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellProcessStatus(UINT16 status)
return (UINT8 *)"Pending";
}
STATIC VOID OsShellCmdProcessTitle(VOID *seqBuf, UINT16 flag)
STATIC VOID ProcessInfoTitle(VOID *seqBuf, UINT16 flag)
{
PROCESS_INFO_SHOW(seqBuf, "\r\n PID PPID PGID UID Status ");
if (flag & OS_PROCESS_MEM_INFO) {
PROCESS_INFO_SHOW(seqBuf, "VirtualMem ShareMem PhysicalMem ");
}
SHOW("\r\n PID PPID PGID UID Mode Status Policy Priority MTID TTotal");
if (flag & OS_PROCESS_INFO_ALL) {
if (flag & OS_PROCESS_MEM_INFO) {
SHOW(" VirtualMem ShareMem PhysicalMem");
}
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "CPUUSE CPUUSE10s CPUUSE1s ");
SHOW(" CPUUSE CPUUSE10s CPUUSE1s");
#endif /* LOSCFG_KERNEL_CPUP */
PROCESS_INFO_SHOW(seqBuf, "Policy Priority MTID TaskTotal Mode ");
} else {
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "CPUUSE10s ");
SHOW(" CPUUSE10s");
#endif /* LOSCFG_KERNEL_CPUP */
}
PROCESS_INFO_SHOW(seqBuf, " PName\n");
SHOW(" PName\n");
}
STATIC VOID OsShellCmdProcessInfoShow(const LosProcessCB *processCB, const INT32 *group,
const UINT32 *memArray, VOID *seqBuf, UINT16 flag)
STATIC VOID AllProcessDataShow(const LosProcessCB *pcbArray, const SchedParam *param,
UINTPTR cpupInfo, VOID *seqBuf, UINT16 flag)
{
const UINT32 *procMemUsage = NULL;
const INT32 *group = (const INT32 *)((UINTPTR)pcbArray + OS_PROCESS_INFO_LEN);
const INT32 *user = (const INT32 *)((UINTPTR)group + OS_PROCESS_GROUP_INFO_LEN);
UINT32 pid = processCB->processID;
PROCESS_INFO_SHOW(seqBuf, "%5u%6d%5d%10d%8s", pid, (INT32)processCB->parentProcessID, group[pid], user[pid],
OsShellProcessStatus(processCB->processStatus));
if (flag & OS_PROCESS_MEM_INFO) {
procMemUsage = &memArray[pid * PROCESS_VM_INDEX_MAX];
PROCESS_INFO_SHOW(seqBuf, "%#11x%#9x%#12x", procMemUsage[PROCESS_VM_INDEX], procMemUsage[PROCESS_SM_INDEX],
procMemUsage[PROCESS_PM_INDEX]);
}
if (flag & OS_PROCESS_INFO_ALL) {
const UINT32 *memArray = (const UINT32 *)((UINTPTR)pcbArray + OS_PROCESS_ALL_INFO_LEN);
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "%4u.%-2u%7u.%-2u%6u.%-2u ",
processCpupAll[pid].usage / LOS_CPUP_PRECISION_MULT,
processCpupAll[pid].usage % LOS_CPUP_PRECISION_MULT,
processCpup10s[pid].usage / LOS_CPUP_PRECISION_MULT,
processCpup10s[pid].usage % LOS_CPUP_PRECISION_MULT,
processCpup1s[pid].usage / LOS_CPUP_PRECISION_MULT,
processCpup1s[pid].usage % LOS_CPUP_PRECISION_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
PROCESS_INFO_SHOW(seqBuf, "%6s%9u%5d%10u%7s ",
OsShellCmdSchedPolicy(LOS_SCHED_RR), OS_TCB_FROM_TID(processCB->threadGroupID)->basePrio,
(INT32)processCB->threadGroupID, processCB->threadNumber,
OsShellCmdProcessMode(processCB->processMode));
} else {
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "%7u.%-2u ",
processCpup10s[pid].usage / LOS_CPUP_PRECISION_MULT,
processCpup10s[pid].usage % LOS_CPUP_PRECISION_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
}
PROCESS_INFO_SHOW(seqBuf, " %-32s\n", processCB->processName);
}
const CPUP_INFO_S *cpupAll = NULL;
const CPUP_INFO_S *cpup10s = NULL;
const CPUP_INFO_S *cpup1s = NULL;
ProcessCpupInfoBaseGet(cpupInfo, &cpupAll, &cpup10s, &cpup1s);
#else
(VOID)cpupInfo;
#endif
STATIC VOID OsShellCmdAllProcessInfoShow(const LosProcessCB *pcbArray, const INT32 *group,
const UINT32 *memArray, VOID *seqBuf, UINT16 flag)
{
const LosProcessCB *processCB = NULL;
UINT32 pid;
for (pid = 1; pid < g_processMaxNum; ++pid) {
processCB = pcbArray + pid;
for (UINT32 pid = 1; pid < g_processMaxNum; ++pid) {
const LosProcessCB *processCB = pcbArray + pid;
if (OsProcessIsUnused(processCB)) {
continue;
}
OsShellCmdProcessInfoShow(processCB, group, memArray, seqBuf, flag);
SHOW("%5u%6d%5d%6d%7s%8s%7s%9u%5u%7u", pid, (INT32)processCB->parentProcessID, group[pid], user[pid],
ConvertProcessModeToString(processCB->processMode), ConvertProcessStatusToString(processCB->processStatus),
ConvertSchedPolicyToString(LOS_SCHED_RR), param[processCB->threadGroupID].basePrio,
processCB->threadGroupID, processCB->threadNumber);
if (flag & OS_PROCESS_INFO_ALL) {
if (flag & OS_PROCESS_MEM_INFO) {
const UINT32 *memUsage = &memArray[pid * PROCESS_VM_INDEX_MAX];
SHOW("%#11x%#9x%#12x", memUsage[VM_INDEX], memUsage[SM_INDEX], memUsage[PM_INDEX]);
}
#ifdef LOSCFG_KERNEL_CPUP
SHOW("%4u.%-2u%7u.%-2u%6u.%-2u ", cpupAll[pid].usage / CPUP_MULT, cpupAll[pid].usage % CPUP_MULT,
cpup10s[pid].usage / CPUP_MULT, cpup10s[pid].usage % CPUP_MULT,
cpup1s[pid].usage / CPUP_MULT, cpup1s[pid].usage % CPUP_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
} else {
#ifdef LOSCFG_KERNEL_CPUP
SHOW("%7u.%-2u ", cpup10s[pid].usage / CPUP_MULT, cpup10s[pid].usage % CPUP_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
}
SHOW("%-32s\n", processCB->processName);
}
}
#ifdef LOSCFG_KERNEL_VM
STATIC VOID OsProcessMemUsageGet(UINT32 *memArray)
STATIC VOID ProcessMemUsageGet(LosProcessCB *pcbArray)
{
UINT32 pid;
LosProcessCB *processCB = NULL;
UINT32 *proMemUsage = NULL;
UINT32 intSave, memUsed;
UINT32 *memArray = (UINT32 *)((UINTPTR)pcbArray + OS_PROCESS_ALL_INFO_LEN);
for (pid = 0; pid < g_processMaxNum; ++pid) {
processCB = g_processCBArray + pid;
for (UINT32 pid = 0; pid < g_processMaxNum; ++pid) {
const LosProcessCB *processCB = g_processCBArray + pid;
UINT32 *proMemUsage = &memArray[pid * PROCESS_VM_INDEX_MAX];
SCHEDULER_LOCK(intSave);
if (OsProcessIsUnused(processCB)) {
SCHEDULER_UNLOCK(intSave);
pcbArray[pid].processStatus = OS_PROCESS_FLAG_UNUSED;
continue;
}
proMemUsage = &memArray[pid * PROCESS_VM_INDEX_MAX];
LosVmSpace *vmSpace = processCB->vmSpace;
SCHEDULER_UNLOCK(intSave);
/* Process memory usage statistics, idle task defaults to 0 */
if (pid == OsGetIdleProcessID()) {
proMemUsage[PROCESS_VM_INDEX] = 0;
proMemUsage[PROCESS_SM_INDEX] = 0;
proMemUsage[PROCESS_PM_INDEX] = 0;
proMemUsage[VM_INDEX] = 0;
proMemUsage[SM_INDEX] = 0;
proMemUsage[PM_INDEX] = 0;
} else if (vmSpace == LOS_GetKVmSpace()) {
(VOID)OsShellCmdProcessPmUsage(vmSpace, &proMemUsage[SM_INDEX], &proMemUsage[PM_INDEX]);
proMemUsage[VM_INDEX] = proMemUsage[PM_INDEX];
} else {
proMemUsage[PROCESS_VM_INDEX] = OsShellCmdProcessVmUsage(processCB->vmSpace);
OsShellCmdProcessPmUsage(processCB->vmSpace, &proMemUsage[PROCESS_SM_INDEX],
&proMemUsage[PROCESS_PM_INDEX]);
memUsed = OsShellCmdProcessVmUsage(vmSpace);
if (memUsed == 0) {
pcbArray[pid].processStatus = OS_PROCESS_FLAG_UNUSED;
continue;
}
proMemUsage[VM_INDEX] = memUsed;
memUsed = OsShellCmdProcessPmUsage(vmSpace, &proMemUsage[SM_INDEX], &proMemUsage[PM_INDEX]);
if (memUsed == 0) {
pcbArray[pid].processStatus = OS_PROCESS_FLAG_UNUSED;
}
}
}
}
#endif
#define OS_TASK_STATUS_MASK 0x00FF
STATIC VOID OsProcessInfoGet(LosProcessCB **pcbArray, INT32 **group,
UINT32 **memArray, LosTaskCB **tcbArray,
UINT16 flag)
STATIC VOID ProcessInfoGet(LosProcessCB **pcbArray, LosTaskCB **tcbArray, SchedParam **schedParam)
{
*group = (INT32 *)((UINTPTR)*pcbArray + OS_PROCESS_INFO_LEN);
INT32 *user = (INT32 *)((UINTPTR)*group + OS_PROCESS_GROUP_INFO_LEN);
INT32 *group = (INT32 *)((UINTPTR)*pcbArray + OS_PROCESS_INFO_LEN);
INT32 *user = (INT32 *)((UINTPTR)group + OS_PROCESS_GROUP_INFO_LEN);
SchedParam *param = (SchedParam *)((UINTPTR)*tcbArray + OS_TASK_INFO_LEN);
*schedParam = param;
for (UINT32 tid = 0; tid < g_taskMaxNum; tid++) {
LosTaskCB *taskCB = *tcbArray + tid;
const LosTaskCB *taskCB = *tcbArray + tid;
if (OsTaskIsUnused(taskCB)) {
continue;
}
@@ -260,18 +264,19 @@ STATIC VOID OsProcessInfoGet(LosProcessCB **pcbArray, INT32 **group,
if (!OsProcessIsDead(processCB) && !OsProcessIsInit(processCB)) {
processCB->processStatus |= (taskCB->taskStatus & OS_TASK_STATUS_MASK);
}
taskCB->ops->schedParamGet(taskCB, &param[tid]);
}
for (UINT32 pid = 0; pid < g_processMaxNum; ++pid) {
LosProcessCB *processCB = *pcbArray + pid;
const LosProcessCB *processCB = *pcbArray + pid;
if (OsProcessIsUnused(processCB)) {
continue;
}
if (processCB->group != NULL) {
(*group)[processCB->processID] = processCB->group->groupID;
group[processCB->processID] = processCB->group->groupID;
} else {
(*group)[processCB->processID] = -1;
group[processCB->processID] = -1;
}
#ifdef LOSCFG_SECURITY_CAPABILITY
@@ -284,47 +289,28 @@ STATIC VOID OsProcessInfoGet(LosProcessCB **pcbArray, INT32 **group,
user[processCB->processID] = 0;
#endif
}
#ifdef LOSCFG_KERNEL_CPUP
processCpupAll = (CPUP_INFO_S *)((UINTPTR)user + OS_PROCESS_UID_INFO_LEN);
taskCpupAll = (CPUP_INFO_S *)((UINTPTR)processCpupAll + OS_PROCESS_CPUP_LEN);
processCpup10s = (CPUP_INFO_S *)((UINTPTR)processCpupAll + OS_PROCESS_AND_TASK_CPUP_LEN);
taskCpup10s = (CPUP_INFO_S *)((UINTPTR)processCpup10s + OS_PROCESS_CPUP_LEN);
processCpup1s = (CPUP_INFO_S *)((UINTPTR)processCpup10s + OS_PROCESS_AND_TASK_CPUP_LEN);
taskCpup1s = (CPUP_INFO_S *)((UINTPTR)processCpup1s + OS_PROCESS_CPUP_LEN);
(VOID)OsGetAllProcessAndTaskCpuUsageUnsafe(CPUP_ALL_TIME, processCpupAll, OS_PROCESS_AND_TASK_CPUP_LEN);
(VOID)OsGetAllProcessAndTaskCpuUsageUnsafe(CPUP_LAST_TEN_SECONDS, processCpup10s, OS_PROCESS_AND_TASK_CPUP_LEN);
(VOID)OsGetAllProcessAndTaskCpuUsageUnsafe(CPUP_LAST_ONE_SECONDS, processCpup1s, OS_PROCESS_AND_TASK_CPUP_LEN);
#endif
#ifdef LOSCFG_KERNEL_VM
if (flag & OS_PROCESS_MEM_INFO) {
*memArray = (UINT32 *)((UINTPTR)*pcbArray + OS_PROCESS_ALL_INFO_LEN);
OsProcessMemUsageGet(*memArray);
}
#endif
}
STATIC VOID OsShellCmdProcessInfoData(const LosProcessCB *pcbArray, const INT32 *group,
const UINT32 *memArray, VOID *seqBuf, UINT16 flag)
STATIC VOID ProcessInfoShow(const LosProcessCB *pcbArray, const SchedParam *param,
UINTPTR cpupInfo, VOID *seqBuf, UINT16 flag)
{
#ifdef LOSCFG_KERNEL_CPUP
const CPUP_INFO_S *cpupAll = NULL;
const CPUP_INFO_S *cpup10s = NULL;
const CPUP_INFO_S *cpup1s = NULL;
ProcessCpupInfoBaseGet(cpupInfo, &cpupAll, &cpup10s, &cpup1s);
UINT32 pid = OsGetIdleProcessID();
UINT32 sysUsage = LOS_CPUP_PRECISION - processCpupAll[pid].usage;
UINT32 sysUsage = LOS_CPUP_PRECISION - cpupAll[pid].usage;
PROCESS_INFO_SHOW(seqBuf, "\n allCpu(%%): %4u.%02u sys, %4u.%02u idle\n",
sysUsage / LOS_CPUP_PRECISION_MULT,
sysUsage % LOS_CPUP_PRECISION_MULT,
processCpupAll[pid].usage / LOS_CPUP_PRECISION_MULT,
processCpupAll[pid].usage % LOS_CPUP_PRECISION_MULT);
SHOW("\n allCpu(%%): %4u.%02u sys, %4u.%02u idle\n", sysUsage / CPUP_MULT, sysUsage % CPUP_MULT,
cpupAll[pid].usage / CPUP_MULT, cpupAll[pid].usage % CPUP_MULT);
#endif
OsShellCmdProcessTitle(seqBuf, flag);
OsShellCmdAllProcessInfoShow(pcbArray, group, memArray, seqBuf, flag);
ProcessInfoTitle(seqBuf, flag);
AllProcessDataShow(pcbArray, param, cpupInfo, seqBuf, flag);
}
LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellCmdConvertTskStatus(UINT16 taskStatus)
STATIC UINT8 *ConvertTaskStatusToString(UINT16 taskStatus)
{
if (taskStatus & OS_TASK_STATUS_INIT) {
return (UINT8 *)"Init";
@@ -332,6 +318,8 @@ LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellCmdConvertTskStatus(UINT16 taskStatus)
return (UINT8 *)"Running";
} else if (taskStatus & OS_TASK_STATUS_READY) {
return (UINT8 *)"Ready";
} else if (taskStatus & OS_TASK_STATUS_FROZEN) {
return (UINT8 *)"Frozen";
} else if (taskStatus & OS_TASK_STATUS_SUSPENDED) {
return (UINT8 *)"Suspended";
} else if (taskStatus & OS_TASK_STATUS_DELAY) {
@@ -349,26 +337,30 @@ LITE_OS_SEC_TEXT_MINOR UINT8 *OsShellCmdConvertTskStatus(UINT16 taskStatus)
return (UINT8 *)"Invalid";
}
STATIC VOID OsShellCmdTaskWaterLineGet(const LosTaskCB *allTaskArray)
STATIC VOID TaskWaterLineGet(UINTPTR waterLineBase, LosTaskCB *tcbArray)
{
const LosTaskCB *taskCB = NULL;
UINT32 loop;
UINT32 intSave;
UINT32 *taskWaterLine = (UINT32 *)waterLineBase;
for (loop = 0; loop < g_taskMaxNum; ++loop) {
taskCB = allTaskArray + loop;
for (UINT32 tid = 0; tid < g_taskMaxNum; ++tid) {
const LosTaskCB *taskCB = g_taskCBArray + tid;
SCHEDULER_LOCK(intSave);
if (OsTaskIsUnused(taskCB)) {
SCHEDULER_UNLOCK(intSave);
tcbArray[tid].taskStatus = OS_TASK_STATUS_UNUSED;
continue;
}
(VOID)OsStackWaterLineGet((const UINTPTR *)((UINTPTR)taskCB->topOfStack + taskCB->stackSize),
(const UINTPTR *)taskCB->topOfStack, &taskWaterLine[taskCB->taskID]);
SCHEDULER_UNLOCK(intSave);
}
}
#ifdef LOSCFG_SHELL_CMD_DEBUG
#define OS_PEND_REASON_MAX_LEN 20
STATIC CHAR *OsShellCheckTaskWaitFlag(const LosTaskCB *taskCB, UINTPTR *lockID)
STATIC CHAR *CheckTaskWaitFlag(const LosTaskCB *taskCB, UINTPTR *lockID)
{
*lockID = taskCB->waitID;
switch (taskCB->waitFlag) {
@@ -403,24 +395,23 @@ STATIC CHAR *OsShellCheckTaskWaitFlag(const LosTaskCB *taskCB, UINTPTR *lockID)
return NULL;
}
STATIC VOID OsShellCmdCheckTaskPend(const LosTaskCB *taskCB, CHAR *pendReason, UINT32 maxLen, UINTPTR *lockID)
STATIC VOID TaskPendingReasonInfoGet(const LosTaskCB *taskCB, CHAR *pendReason, UINT32 maxLen, UINTPTR *lockID)
{
CHAR *reason = NULL;
LosTaskCB *owner = NULL;
if (!(taskCB->taskStatus & OS_TASK_STATUS_PENDING)) {
reason = (CHAR *)OsShellCmdConvertTskStatus(taskCB->taskStatus);
reason = (CHAR *)ConvertTaskStatusToString(taskCB->taskStatus);
goto EXIT;
}
reason = OsShellCheckTaskWaitFlag(taskCB, lockID);
reason = CheckTaskWaitFlag(taskCB, lockID);
if (reason == NULL) {
reason = "Others";
}
if (taskCB->taskMux != NULL) {
*lockID = (UINTPTR)taskCB->taskMux;
owner = ((LosMux *)taskCB->taskMux)->owner;
LosTaskCB *owner = ((LosMux *)taskCB->taskMux)->owner;
if (owner != NULL) {
if (snprintf_s(pendReason, maxLen, maxLen - 1, "Mutex-%u", owner->taskID) == EOK) {
return;
@@ -435,103 +426,133 @@ EXIT:
}
#endif
STATIC VOID OsShellCmdTskInfoTitle(VOID *seqBuf, UINT16 flag)
STATIC VOID TaskInfoTitle(VOID *seqBuf, UINT16 flag)
{
PROCESS_INFO_SHOW(seqBuf, "\r\n TID PID ");
SHOW("\r\n TID PID");
#ifdef LOSCFG_KERNEL_SMP
PROCESS_INFO_SHOW(seqBuf, "Affi CPU ");
SHOW(" Affi CPU");
#endif
PROCESS_INFO_SHOW(seqBuf, " Status StackSize WaterLine ");
SHOW(" Status Policy Priority StackSize WaterLine");
if (flag & OS_PROCESS_INFO_ALL) {
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "CPUUSE CPUUSE10s CPUUSE1s ");
SHOW(" CPUUSE CPUUSE10s CPUUSE1s");
#endif /* LOSCFG_KERNEL_CPUP */
#ifdef LOSCFG_SHELL_CMD_DEBUG
PROCESS_INFO_SHOW(seqBuf, " StackPoint TopOfStack PendReason LockID ");
SHOW(" StackPoint TopOfStack PendReason LockID");
#endif
PROCESS_INFO_SHOW(seqBuf, "Policy Priority ");
} else {
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "CPUUSE10s ");
SHOW(" CPUUSE10s ");
#endif /* LOSCFG_KERNEL_CPUP */
}
PROCESS_INFO_SHOW(seqBuf, " MEMUSE TaskName\n");
SHOW(" TaskName\n");
}
STATIC INLINE VOID OsShellTskInfoData(const LosTaskCB *taskCB, VOID *seqBuf, UINT16 flag)
STATIC VOID AllTaskInfoDataShow(const LosTaskCB *allTaskArray, UINTPTR cpupInfo, VOID *seqBuf, UINT16 flag)
{
#ifdef LOSCFG_SHELL_CMD_DEBUG
UINTPTR lockID = 0;
CHAR pendReason[OS_PEND_REASON_MAX_LEN] = { 0 };
#endif
PROCESS_INFO_SHOW(seqBuf, " %4u%5u", taskCB->taskID, taskCB->processID);
#ifdef LOSCFG_KERNEL_SMP
PROCESS_INFO_SHOW(seqBuf, "%#5x%4d ", taskCB->cpuAffiMask, (INT16)(taskCB->currCpu));
#endif
PROCESS_INFO_SHOW(seqBuf, "%12s%#10x%#10x", OsShellCmdConvertTskStatus(taskCB->taskStatus),
taskCB->stackSize, taskWaterLine[taskCB->taskID]);
if (flag & OS_PROCESS_INFO_ALL) {
const SchedParam *param = (const SchedParam *)((UINTPTR)allTaskArray + OS_TASK_INFO_LEN);
const UINT32 *waterLine = (const UINT32 *)((UINTPTR)allTaskArray + OS_TASK_INFO_LEN + OS_TASK_SCHED_INFO_LEN);
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "%4u.%-2u%7u.%-2u%6u.%-2u ",
taskCpupAll[taskCB->taskID].usage / LOS_CPUP_PRECISION_MULT,
taskCpupAll[taskCB->taskID].usage % LOS_CPUP_PRECISION_MULT,
taskCpup10s[taskCB->taskID].usage / LOS_CPUP_PRECISION_MULT,
taskCpup10s[taskCB->taskID].usage % LOS_CPUP_PRECISION_MULT,
taskCpup1s[taskCB->taskID].usage / LOS_CPUP_PRECISION_MULT,
taskCpup1s[taskCB->taskID].usage % LOS_CPUP_PRECISION_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
#ifdef LOSCFG_SHELL_CMD_DEBUG
OsShellCmdCheckTaskPend(taskCB, pendReason, OS_PEND_REASON_MAX_LEN, &lockID);
PROCESS_INFO_SHOW(seqBuf, "%#12x%#12x%11s%#11x", taskCB->stackPointer, taskCB->topOfStack, pendReason, lockID);
const CPUP_INFO_S *cpupAll = NULL;
const CPUP_INFO_S *cpup10s = NULL;
const CPUP_INFO_S *cpup1s = NULL;
TaskCpupInfoBaseGet(cpupInfo, &cpupAll, &cpup10s, &cpup1s);
#else
(VOID)cpupInfo;
#endif
PROCESS_INFO_SHOW(seqBuf, "%7s%9u", OsShellCmdSchedPolicy(taskCB->policy), taskCB->priority);
} else {
#ifdef LOSCFG_KERNEL_CPUP
PROCESS_INFO_SHOW(seqBuf, "%7u.%-2u ",
taskCpup10s[taskCB->taskID].usage / LOS_CPUP_PRECISION_MULT,
taskCpup10s[taskCB->taskID].usage % LOS_CPUP_PRECISION_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
}
PROCESS_INFO_SHOW(seqBuf, "%#10x %-32s\n", OsTaskMemUsage(taskCB->taskID), taskCB->taskName);
}
STATIC VOID OsShellCmdAllTaskInfoData(const LosTaskCB *allTaskArray, VOID *seqBuf, UINT16 flag)
{
const LosTaskCB *taskCB = NULL;
UINT32 pid;
UINT32 loop;
for (pid = 1; pid < g_processMaxNum; ++pid) {
for (loop = 0; loop < g_taskMaxNum; ++loop) {
taskCB = allTaskArray + loop;
for (UINT32 pid = 1; pid < g_processMaxNum; ++pid) {
for (UINT32 tid = 0; tid < g_taskMaxNum; ++tid) {
const LosTaskCB *taskCB = allTaskArray + tid;
if (OsTaskIsUnused(taskCB) || (taskCB->processID != pid)) {
continue;
}
#ifdef LOSCFG_SHELL_CMD_DEBUG
UINTPTR lockID = 0;
CHAR pendReason[OS_PEND_REASON_MAX_LEN] = { 0 };
#endif
SHOW(" %4u%5u", tid, taskCB->processID);
OsShellTskInfoData(taskCB, seqBuf, flag);
#ifdef LOSCFG_KERNEL_SMP
SHOW("%#5x%4d ", taskCB->cpuAffiMask, (INT16)(taskCB->currCpu));
#endif
SHOW("%9s%7s%9u%#10x%#10x", ConvertTaskStatusToString(taskCB->taskStatus),
ConvertSchedPolicyToString(param[tid].policy), param[tid].priority, taskCB->stackSize, waterLine[tid]);
if (flag & OS_PROCESS_INFO_ALL) {
#ifdef LOSCFG_KERNEL_CPUP
SHOW("%4u.%-2u%7u.%-2u%6u.%-2u ", cpupAll[tid].usage / CPUP_MULT, cpupAll[tid].usage % CPUP_MULT,
cpup10s[tid].usage / CPUP_MULT, cpup10s[tid].usage % CPUP_MULT,
cpup1s[tid].usage / CPUP_MULT, cpup1s[tid].usage % CPUP_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
#ifdef LOSCFG_SHELL_CMD_DEBUG
TaskPendingReasonInfoGet(taskCB, pendReason, OS_PEND_REASON_MAX_LEN, &lockID);
SHOW("%#12x%#12x%11s%#11x", taskCB->stackPointer, taskCB->topOfStack, pendReason, lockID);
#endif
} else {
#ifdef LOSCFG_KERNEL_CPUP
SHOW("%8u.%-2u ", cpup10s[tid].usage / CPUP_MULT, cpup10s[tid].usage % CPUP_MULT);
#endif /* LOSCFG_KERNEL_CPUP */
}
SHOW(" %-32s\n", taskCB->taskName);
}
}
}
STATIC VOID OsShellCmdTskInfoData(const LosTaskCB *allTaskArray, VOID *seqBuf, UINT16 flag)
STATIC VOID TaskInfoData(const LosTaskCB *allTaskArray, UINTPTR cpupInfo, VOID *seqBuf, UINT16 flag)
{
OsShellCmdTskInfoTitle(seqBuf, flag);
OsShellCmdAllTaskInfoData(allTaskArray, seqBuf, flag);
TaskInfoTitle(seqBuf, flag);
AllTaskInfoDataShow(allTaskArray, cpupInfo, seqBuf, flag);
}
STATIC VOID OsProcessAndTaskInfoGet(LosProcessCB **pcbArray, INT32 **group, LosTaskCB **tcbArray,
UINT32 **memArray, UINT16 flag)
#ifdef LOSCFG_KERNEL_CPUP
STATIC VOID TaskCpupInfoBaseGet(UINTPTR base, const CPUP_INFO_S **cpupAll,
const CPUP_INFO_S **cpup10s, const CPUP_INFO_S **cpup1s)
{
BOOL lockFlag = FALSE;
UINT32 intSave = 0;
UINT32 processInfoLen = OS_PROCESS_ALL_INFO_LEN;
UINTPTR processCpupAll = base + OS_PROCESS_UID_INFO_LEN;
*cpupAll = (CPUP_INFO_S *)(processCpupAll + OS_PROCESS_CPUP_LEN);
UINTPTR processCpup10s = processCpupAll + OS_PROCESS_AND_TASK_CPUP_LEN;
*cpup10s = (CPUP_INFO_S *)(processCpup10s + OS_PROCESS_CPUP_LEN);
UINTPTR processCpup1s = processCpup10s + OS_PROCESS_AND_TASK_CPUP_LEN;
*cpup1s = (CPUP_INFO_S *)(processCpup1s + OS_PROCESS_CPUP_LEN);
}
if (LOS_SpinHeld(&g_taskSpin) == FALSE) {
SCHEDULER_LOCK(intSave);
lockFlag = TRUE;
}
STATIC VOID ProcessCpupInfoBaseGet(UINTPTR base, const CPUP_INFO_S **cpupAll,
const CPUP_INFO_S **cpup10s, const CPUP_INFO_S **cpup1s)
{
*cpupAll = (CPUP_INFO_S *)(base + OS_PROCESS_UID_INFO_LEN);
*cpup10s = (CPUP_INFO_S *)((UINTPTR)*cpupAll + OS_PROCESS_AND_TASK_CPUP_LEN);
*cpup1s = (CPUP_INFO_S *)((UINTPTR)*cpup10s + OS_PROCESS_AND_TASK_CPUP_LEN);
}
STATIC VOID TaskCpupInfoGet(UINTPTR base)
{
UINT32 intSave;
CPUP_INFO_S *processCpupAll = (CPUP_INFO_S *)(base + OS_PROCESS_UID_INFO_LEN);
CPUP_INFO_S *processCpup10s = (CPUP_INFO_S *)((UINTPTR)processCpupAll + OS_PROCESS_AND_TASK_CPUP_LEN);
CPUP_INFO_S *processCpup1s = (CPUP_INFO_S *)((UINTPTR)processCpup10s + OS_PROCESS_AND_TASK_CPUP_LEN);
SCHEDULER_LOCK(intSave);
(VOID)OsGetAllProcessAndTaskCpuUsageUnsafe(CPUP_ALL_TIME, processCpupAll, OS_PROCESS_AND_TASK_CPUP_LEN);
SCHEDULER_UNLOCK(intSave);
SCHEDULER_LOCK(intSave);
(VOID)OsGetAllProcessAndTaskCpuUsageUnsafe(CPUP_LAST_TEN_SECONDS, processCpup10s, OS_PROCESS_AND_TASK_CPUP_LEN);
SCHEDULER_UNLOCK(intSave);
SCHEDULER_LOCK(intSave);
(VOID)OsGetAllProcessAndTaskCpuUsageUnsafe(CPUP_LAST_ONE_SECONDS, processCpup1s, OS_PROCESS_AND_TASK_CPUP_LEN);
SCHEDULER_UNLOCK(intSave);
}
#endif
/*
* | pcb | group | user | task and process cpup | process mem | tcb | sched param | task water line |
*/
STATIC VOID ProcessAndTaskInfoGet(LosProcessCB **pcbArray, LosTaskCB **tcbArray,
SchedParam **schedParam, UINTPTR *cpupInfo, UINT16 flag)
{
UINT32 intSave;
UINT32 processInfoLen = OS_PROCESS_ALL_INFO_LEN;
#ifdef LOSCFG_KERNEL_VM
if (flag & OS_PROCESS_MEM_INFO) {
@@ -539,25 +560,35 @@ STATIC VOID OsProcessAndTaskInfoGet(LosProcessCB **pcbArray, INT32 **group, LosT
}
#endif
SCHEDULER_LOCK(intSave);
(VOID)memcpy_s(*pcbArray, OS_PROCESS_INFO_LEN, g_processCBArray, OS_PROCESS_INFO_LEN);
*tcbArray = (LosTaskCB *)((UINTPTR)*pcbArray + processInfoLen);
(VOID)memcpy_s(*tcbArray, OS_TASK_INFO_LEN, g_taskCBArray, OS_TASK_INFO_LEN);
OsProcessInfoGet(pcbArray, group, memArray, tcbArray, flag);
taskWaterLine = (UINT32 *)((UINTPTR)*tcbArray + OS_TASK_INFO_LEN);
OsShellCmdTaskWaterLineGet(*tcbArray);
if (lockFlag == TRUE) {
SCHEDULER_UNLOCK(intSave);
ProcessInfoGet(pcbArray, tcbArray, schedParam);
SCHEDULER_UNLOCK(intSave);
#ifdef LOSCFG_KERNEL_CPUP
*cpupInfo = (UINTPTR)*pcbArray + OS_PROCESS_INFO_LEN + OS_PROCESS_GROUP_INFO_LEN;
TaskCpupInfoGet(*cpupInfo);
#endif
#ifdef LOSCFG_KERNEL_VM
if (flag & OS_PROCESS_MEM_INFO) {
ProcessMemUsageGet(*pcbArray);
}
#endif
TaskWaterLineGet((UINTPTR)*tcbArray + OS_TASK_INFO_LEN + OS_TASK_SCHED_INFO_LEN, *tcbArray);
}
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdTskInfoGet(UINT32 taskID, VOID *seqBuf, UINT16 flag)
{
UINT32 size;
LosProcessCB *pcbArray = NULL;
INT32 *group = NULL;
LosTaskCB *tcbArray = NULL;
UINT32 *memArray = NULL;
SchedParam *schedParam = NULL;
UINTPTR cpupInfo = 0;
if (taskID == OS_ALL_TASK_MASK) {
if (flag & OS_PROCESS_MEM_INFO) {
@@ -571,9 +602,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdTskInfoGet(UINT32 taskID, VOID *seqBuf,
return LOS_NOK;
}
(VOID)memset_s(pcbArray, size, 0, size);
OsProcessAndTaskInfoGet(&pcbArray, &group, &tcbArray, &memArray, flag);
OsShellCmdProcessInfoData(pcbArray, group, memArray, seqBuf, flag);
OsShellCmdTskInfoData(tcbArray, seqBuf, flag);
ProcessAndTaskInfoGet(&pcbArray, &tcbArray, &schedParam, &cpupInfo, flag);
ProcessInfoShow(pcbArray, schedParam, cpupInfo, seqBuf, flag);
TaskInfoData(tcbArray, cpupInfo, seqBuf, flag);
(VOID)LOS_MemFree(m_aucSysMem1, pcbArray);
}
@@ -595,16 +626,20 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv)
if (argc == 1) {
if (strcmp("-a", argv[0]) == 0) {
flag |= OS_PROCESS_INFO_ALL;
#ifdef LOSCFG_SCHED_DEBUG
#ifdef LOSCFG_SCHED_TICK_DEBUG
} else if (strcmp("-i", argv[0]) == 0) {
if (!OsShellShowTickRespo()) {
if (!OsShellShowTickResponse()) {
return LOS_OK;
}
goto TASK_HELP;
#endif
} else if (strcmp("-t", argv[0]) == 0) {
if (!OsShellShowSchedParam()) {
if (!OsShellShowSchedStatistics()) {
return LOS_OK;
}
goto TASK_HELP;
#endif
} else {
goto TASK_HELP;
}
@@ -614,7 +649,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv)
TASK_HELP:
PRINTK("Unknown option: %s\n", argv[0]);
PRINTK("usage: task or task -a\n");
PRINTK("Usage:\n");
PRINTK(" task --- Basic information about all created processes.\n");
PRINTK(" task -a --- Complete information about all created processes.\n");
return LOS_NOK;
}

View File

@@ -190,11 +190,7 @@ VOID OsLockDepCheckIn(SPIN_LOCK_S *lock)
{
UINT32 intSave;
enum LockDepErrType checkResult = LOCKDEP_SUCCESS;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
VOID *requestAddr = (VOID *)__builtin_return_address(1);
#else
VOID *requestAddr = (VOID *)__builtin_return_address(0);
#endif
LosTaskCB *current = OsCurrTaskGet();
LockDep *lockDep = &current->lockDep;
LosTaskCB *lockOwner = NULL;
@@ -275,12 +271,8 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
{
UINT32 intSave;
INT32 depth;
enum LockDepErrType checkResult = LOCKDEP_SUCCESS;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
enum LockDepErrType checkResult;
VOID *requestAddr = (VOID *)__builtin_return_address(1);
#else
VOID *requestAddr = (VOID *)__builtin_return_address(0);
#endif
LosTaskCB *current = OsCurrTaskGet();
LosTaskCB *owner = NULL;
LockDep *lockDep = NULL;

Some files were not shown because too many files have changed in this diff Show More