Commit Graph

88 Commits

Author SHA1 Message Date
zhushengle 48ca854bf0 fix: 临终遗言重定向内容缺失task相关信息,对应的shell命令中申请的内存需要cacheline对齐
1.内核打印的地方支持异常时重定向打印信息
2.excinfo 命令中申请的内存64对齐
Close #I482S5

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4e8a971cc5b14f62d573bb160682089d9d50e64e
2021-09-29 16:26:31 +08:00
openharmony_ci 2c33cfce86 !599 feat: L0~L1 支持Perf
Merge pull request !599 from LiteOS/perf
2021-09-29 06:15:02 +00:00
LiteOS2021 6e0a3f10bb feat: L0-L1 支持Perf
1.【需求描述】:
         L0-L1 支持Perf,提供2种模式的配置, 及3大类型的事件配置:
         2种模式:计数模式(仅统计事件发生次数)、采样模式(收集上下文如任务ID、pc、backtrace等)。
         3种事件类型:CPU硬件事件(cycle、branch、icache、dcache等)、OS软件事件(task switch、mux pend、irq等)、高精度周期事件(cpu          clock)。
    2.【方案描述】:
         L0:
         基于事件采样原理,以性能事件为基础,当事件发生时,相应的事件计数器溢出发生中断,在中断处理函数中记录事件信息,包括当前的pc、当前运         行的任务ID以及调用栈等信息。
         L1:
         新增perf字符设备,位于“dev/perf”,通过对设备节点的read\ioctl,实现用户态perf

    BREAKING CHANGE:
    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.

    Close #I47I9A

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Ieb9b7483c85d1495df7c55bc0027f4309dff9814
2021-09-28 19:28:34 +08:00
openharmony_ci ecd9ca7781 !534 pagecache从filep改为使用vnode
Merge pull request !534 from LeonChan/pg
2021-09-15 03:51:50 +00:00
Leon Chan 38a6b804e9 feat: page cache backed by vnode instead of filep
1, change the owner of page to vnode
2, save the file path in vnode

close: #I44TBS
Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-09-14 15:31:33 +08:00
arvinzzz b3d96d166c refactor: 清理Makefile冗余项
清理Makefile冗余项,各模块Makefile里不需要再次引用公共路径,只需引用私有头文件路径

close: #I49MOO

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I2dd7189c866498896461f78bfed5444ae1d86876
2021-09-13 18:14:15 +08:00
Caoruihong a627cdba0c chore(make): simplify build scripts
remove redundant script codes

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I67695a69cccefc220ede55add9372bce0c59d7f5
2021-09-09 18:56:47 +08:00
arvinzzz 33d0c1bd0b refactor: 内核目录结构整理
1. 原kernel/common目录下属于内核拓展组件,统一移入kernel/extend管理
2. Kconfig分层,各模块自己的配置放到自己目录下管理
3. 原platform下不属于平台的公共代码抽到kernel/common下,只留板级链接脚本和一些编译脚本指向device目录下触发平台相关的编译
4. 对外公共头文件统一抽到对外include路径
5. 废弃宏,头文件清理

close: #I48KI4

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I0cf5ea81c92a8fa7b113da9cbdc8b7bc935f5aae
2021-09-08 16:36:28 +08:00
Caoruihong 463bc0546f chore(build): optimize build scripts, make Kconfig in DEVICE_PATH mandatory
$(DEVICE_PATH)/drivers/Kconfig is mandatory now.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ie9484229e2dc6e6babe0cf2daf8e4f6693163052
2021-09-01 18:45:44 +08:00
LiteOS2021 dc9ec6856f feat: L0-L1 支持Trace
1.【需求描述】
            L0~L1 支持Trace,提供两种工作模式:在线模式、离线缓存模式, 用于按时间线追踪系统事件,如任务切换、中断、ipc等。
        2.【方案描述】
            L0:
            (1).在内核模块预置静态代码桩
            (2).触发桩后,收集系统上下文信息
            (3).离线模式则写入内存,用户可通过dump导出;
            (4).在线模式通过pipeline对接IDE进行可视化解析和展示;
            L1:
            新增trace字符设备,位于"/dev/trace",通过对设备节点的read\write\ioctl,实现用户态trace;

        BREAKING CHANGE:
        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注册过滤特定中断号事件的钩子函数

        Close #I46WA0

    Signed-off-by: LiteOS2021 <dinglu@huawei.com>

Change-Id: I6a8e64794c4852f2c2980993a06180e09ec6ee0d
2021-08-31 20:29:45 +08:00
Caoruihong df35eb513d chore(make): optimize build scripts
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ibb4223ef2d032a03950263b766414ca1c021e69a
2021-08-30 17:18:21 +08:00
Caoruihong 181322a3c1 chore(make): fix and optimize some build scripts
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I2e61b7ea231be78423dc10412e0ab9a710cad8ef
2021-08-23 20:47:18 +08:00
openharmony_ci 40297a6dbc !487 多核启动及内存映射解耦
Merge pull request !487 from JerryH/smp-xxx
2021-08-20 03:54:23 +00:00
Caoruihong e1b9a6b185 chore(make): update Makefile
remove some unused Makefile code and optimize some code

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I1c31d07481bb6aee47b0c51d63d6b68316c38c88
2021-08-17 21:34:01 +08:00
Caoruihong 6549fd8be6 chore: add default group automatly if needed
the name of the default group is the same with
the directory name.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I3d889a361534adc44e3b1bedfec13efe8e1babf2
2021-08-06 12:05:56 +08:00
JerryH 3bb3173604 fix: smp启动代码解耦及内存映射关系解耦
close #I41P8Y

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I01833cf617bbc695543a865dbb994c6c22d4a0a8
2021-08-05 16:03:43 +08:00
openharmony_ci 8755dc9d35 !443 从Make编译切换到GN编译
Merge pull request !443 from Caoruihong/build_gn
2021-07-22 01:50:19 +00:00
Caoruihong a8805a65aa feat: add support for gn build system
add BUILD.gn for all kernel modules

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I018446427bf64615f2596d47862b219659b58b34
2021-07-21 15:52:40 +08:00
YOUR_NAME 35a2f3af33 fix: init进程收到子进程退出信号后,调用fork重新拉起进程,会导致系统卡死
问题原因:init进程执行信号时,线程栈底预留了部分空间给信号上下文使用,
从而导致处理信号时线程栈底比线程控制块里面记录的大,这样在fork的过程中内核
从init线程栈底copy线程上下文给新进程时,copy的不是实际运行的栈底,以致于
新进程的线程上下文不对,在实际运行时跑飞,引发系统卡死。
解决方案:在fork过程copy线程上下文时,判断是否预留了信号上下文空间,如果预留
了,则copy的栈底要基于预留后的栈底去copy线程上下文。

close: #I41HOY

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I61cb05183c78919730e3a68c1c85b72fa1decd16
2021-07-20 21:11:12 +08:00
Haryslee 9547133e64 fix:修复llvm编译环境下内核态内存调测调用栈信息解析有误的问题
背景:内核态内存调测调用栈信息在gcc编译环境下是准确的,但是llvm
编译环境下是错误的,分析知,gcc和llvm编译环境下fp和lr的对应关系
是有区别的。
修复:增加llvm编译环境下对lr解析的逻辑,并用编译宏控制。

close #I40TQS

Signed-off-by: Haryslee <lihao189@huawei.com>

Change-Id: If2a7b7a286d91e78dcff2bdeb136fda71e656a79
2021-07-15 19:35:04 +08:00
qidechun a195aac9fb feat: add blackbox for liteos_a
1、在内核增加BlackBox核心框架,对外提供模块回调接口注册和故障处理接口。
2、增加默认的系统模块适配层,处理通用内核态和用户态故障日志抓取和保存。
3、BBOX特性默认关闭,若想使用此特性,请在内核配置文件中增加如下编译选项:
LOSCFG_BLACKBOX=y
LOSCFG_SAVE_EXCINFO=y
LOSCFG_SAVE_EXCINFO可以帮助抓取更多的故障日志。
4、若已经打开BBOX特性,想快速验证此特性,请添加如下编译选项:
LOSCFG_HIDUMPER=y

Close #I406NP

Signed-off-by: qidechun <qidechun@huawei.com>
2021-07-14 09:37:35 +08:00
openharmony_ci d7387508e3 !402 消除编译告警
Merge pull request !402 from x_xiny/master
2021-07-09 08:37:20 +00:00
x_xiny e4ff04586f fix:消除编译告警
【背景】
 消除编译告警

【修改方案】
 消除编译告警

 re #I3ZC1R

 Change-Id: I594d0f57e4cbbdb246a6bef1c978a38228123a34

 Signed-off-by: x-xiny <1301913191@qq.com>

Change-Id: I1d75cdcdcf9d06ec28e541cdfea77300da7c6bb1
2021-07-08 20:30:33 +08:00
openharmony_ci 78906f4a6c !406 修正最小编译时的错误
Merge pull request !406 from Caoruihong/qemu_mini
2021-07-07 08:29:28 +00:00
Denny 55e5e29005 回退 'Pull Request !401 : 【DFX子系统】【BBoxDetector】LiteOS_A死机重启维测框架' 2021-07-07 10:29:43 +08:00
Caoruihong ac8c2c6d5b fix: minimal compile
fix compile errors in minimal compilation

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I48f4f7b27c684e2c747c1949776c5c4f9e383dec
2021-07-07 00:26:33 +08:00
qidechun 425975e481 feat: add blackbox for liteos_a
1、在内核增加BlackBox核心框架,对外提供模块回调接口注册和故障处理接口。
2、增加默认的系统模块适配层,处理通用内核态和用户态故障日志抓取和保存。

Close #I3NN7V

Signed-off-by: qidechun <qidechun@huawei.com>
2021-07-06 07:49:59 +08:00
openharmony_ci 003810284c !384 对内核中menuconfig开关的宏使用#ifdef/#ifndef来做预编译判断
Merge pull request !384 from boxi/upload
2021-07-01 07:11:13 +00:00
boxi 4e4f2d6d7e refactor: 对LiteOS_a内核中menuconfig开关的宏使用#ifdef/#ifndef做预编译处理
LiteOS_a中有部分配置宏进行了重复冗余定义,导致当头文件未被包含时,极易引入错误,
故对menuconfig配置宏进行统一处理,均使用#ifdef/#ifndef作为预编译判断方式

Close #I3YEGS

Change-Id: Ife6db770cc66de1d6199a4f3ba3950e9bfd0e71a
Signed-off-by: boxi <lewis.liulei@huawei.com>
2021-07-01 09:08:18 +08:00
openharmony_ci abbeca1cb2 !359 sysroot和CPU架构参数通过BUILD.gn传递给Make
Merge pull request !359 from Caoruihong/sysroot
2021-06-29 08:14:54 +00:00
Caoruihong 9e45086d19 chore: pass sysroot and arch related cflags by BUILD.gn
sysroot and arch related cflags are pass by BUILD.gn now.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ia6000dd7ed8a8a37e935ace49d8460a919a16566
2021-06-28 16:31:02 +08:00
Haryslee 9db3407589 feat: 基于汇编实现内核对用户态内存清零的功能
背景:LOS_UserMemClear接口原有实现是通过在内核中
申请一块堆内存并对其清零,调用copy_to_user来达到
对用户态内存清零的目的,需要使用堆内存。
修改方案:基于汇编实现内核对用户态内存清零的功能。

close #I3XXT0

Change-Id: I27cb1e45559cb75a9b330799fe427abd54f51c15
Signed-off-by: Haryslee <lihao189@huawei.com>
2021-06-26 15:31:42 +08:00
openharmony_ci 1a3f3f54e7 !302 fix: Codex告警清零
Merge pull request !302 from Far/master
2021-06-08 08:48:48 +08:00
openharmony_ci 647f3defcd !296 支持最小化特性编译,添加了一个针对qemu arm virt的样例config配置
Merge pull request !296 from Caoruihong/master
2021-06-07 22:51:46 +08:00
Far b5370af822 fix: codex clean
1. 修复可能对NULL指针解引用的场景
2. 将不修改内容的指针入参修改为const
3. 对getpgrp的返回值进行校验后再使用
4. 修复了局部变量未初始化的问题

Close #I3UOFN

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-06-07 17:08:02 +08:00
Caoruihong 744b2021b2 chore: add a mini config for qemu arm virt
support turn off as many features as possible.
current only libc and posix and bsd can not be turned off.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I1e97570c67593207a56dc11f357eca4b4a018bfd
2021-06-05 17:40:22 +08:00
openharmony_ci 2067b2f648 !256 fix: 解决kill进程时无法保证进程持有的系统资源合理释放
Merge pull request !256 from zhushengle/Sig
2021-06-03 17:00:00 +08:00
zhushengle cf89f016e9 fix: 解决kill进程时无法保证进程的已持有的内核资源合理释放.
背景: 当前信号实现原理是在系统调用结束和中断结束时检查是否有信号处理,
      如果有信号处理就切去处理信号,信号处理结束后回来继续按原来流程执行。
问题:当用户态线程在执行系统调用或缺页异常时,运行在内核态,如果此时有信
      号需要处理,且该线程已经持有了部分内核资源(如:锁,内存等), 此时如
      果有中断发生,则在中断结束时,就会去处理该信号,此时用户态线程持有
      了内核未释放的资源跑到了用户态去运行,如果该线程在用户态出现问题,
      那么它持有的内核资源就无法被释放了。
方案:用户态线程在执行系统调用和缺页异常时暂时屏蔽信号,防止此时有中断去
      处理信号,等系统调用结束或缺页异常结束时再去处理信号。
解决的问题:
  1. 执行系统调用或缺页异常时屏蔽信号,防止中断去处理信号
  2.解决无法kill 因为用户态的锁、ipc等阻塞的用户态线程
  3.进程退出方式转变为: 依次通过kill去杀死该进程的所有线程

Close #I3S0N0

Change-Id: I0c48b9c89382826191b8a9326c71b57ba84124c2
2021-05-24 14:29:37 +08:00
openharmony_ci a3cef3f176 !264 补充TODOList
Merge pull request !264 from Denny/DennyShen-master-patch-73167
2021-05-21 15:17:08 +08:00
arvinzzz 8cde768588 refactor: Refactored the kernel boot process and added a init framework
close: #I3I768

Change-Id: I4f801df4abe1a9afdf43391c28276e96a5e81513
2021-05-20 16:45:43 +08:00
zhushengle a89fb57f57 fix: Fix kernel page fault exception handling causing system exception.
Close #I3RAN4

Change-Id: Ice9bc67371ad85476ec99b46b7555d41abd93e94
2021-05-14 13:12:57 +08:00
zhushengle e840188a65 fix:User-mode exception handling runs on the thread's SVC stack.
Close #I3QFXL

Change-Id: Iaa036651415d93df231916d7534364ad3a86ed3c
2021-05-11 17:19:10 +08:00
openharmony_ci ca5555e6a5 !190 fix:solve the coupling between the kernel and the structure under ARCH
Merge pull request !190 from zhushengle/Stack
2021-05-11 11:46:40 +08:00
zhushengle 1e308db64e fix:Fixed exception not saving stack pointer of SVC mode and abnormal signal processing issues
Close #I3OAFR

Change-Id: I25b14572809b6fabb9e9d17de89a99047c02a59b
2021-05-11 09:58:54 +08:00
zhushengle f6c4f6f5da fix: Solution of conflict
Change-Id: If6304999f1dfbcdfbc1670b73ace61b8024336bd
2021-05-06 21:10:22 +08:00
openharmony_ci be4d8e74cc !201 系统异常信息保存到存储介质中的功能从shell依赖中剥离
Merge pull request !201 from zhangfanfan2/master
2021-05-06 20:44:32 +08:00
YOUR_NAME d846035f3e feature:the feature of saving system exception information to the
storage medium is separated from the shell module.

Change-Id: Id56939001d70bb92d9cc02bd7c9f55ca8b61cf5b
2021-05-06 15:18:15 +08:00
Haryslee 022768ab58 Delete redundant code
Change-Id: Id75a1b146766f448838afc80ad11cfd9d990e94e
2021-04-30 10:21:49 +08:00
openharmony_ci 28df6989f9 !185 多核情况下当系统持有调度锁异常时,无异常信息输出
Merge pull request !185 from zhangfanfan2/master
2021-04-28 08:53:15 +08:00
YOUR_NAME 5bf4d1c712 fix: no exception information output, when the system is abnormal
after holding the scheduling lock in SMP.

Change-Id: I6f148d7b36d7aa6d0df09300949f53ea3c3d63b7
2021-04-26 20:13:13 +08:00