Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
a37c850d
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
464
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a37c850d
编写于
9月 22, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 22, 2021
浏览文件
操作
浏览文件
下载
差异文件
!622 解决OsLockDepCheckIn异常处理中存在锁嵌套调用 导致死锁异常信息不正常输出问题
Merge pull request !622 from wanghao-free/OpenHarmony_1.0.1_release
上级
80e24fa9
1eca7a50
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
18 deletion
+45
-18
kernel/base/mp/los_lockdep.c
kernel/base/mp/los_lockdep.c
+45
-18
未找到文件。
kernel/base/mp/los_lockdep.c
浏览文件 @
a37c850d
...
...
@@ -44,6 +44,8 @@ extern "C" {
#if (LOSCFG_KERNEL_SMP_LOCKDEP == YES)
#define PRINT_BUF_SIZE 256
#define LOCKDEP_GET_NAME(lockDep, index) (((SPIN_LOCK_S *)((lockDep)->heldLocks[(index)].lockPtr))->name)
#define LOCKDEP_GET_ADDR(lockDep, index) ((lockDep)->heldLocks[(index)].lockAddr)
...
...
@@ -107,6 +109,31 @@ WEAK VOID OsLockDepPanic(enum LockDepErrType errType)
while
(
1
)
{}
}
STATIC
VOID
OsLockDepPrint
(
const
CHAR
*
fmt
,
va_list
ap
)
{
UINT32
len
;
CHAR
buf
[
PRINT_BUF_SIZE
]
=
{
0
};
len
=
vsnprintf_s
(
buf
,
PRINT_BUF_SIZE
,
PRINT_BUF_SIZE
-
1
,
fmt
,
ap
);
if
((
len
==
-
1
)
&&
(
*
buf
==
'\0'
))
{
/* parameter is illegal or some features in fmt dont support */
UartPuts
(
"OsLockDepPrint is error
\n
"
,
strlen
(
"OsLockDepPrint is error
\n
"
)
+
1
,
0
);
return
;
}
*
(
buf
+
len
)
=
'\0'
;
UartPuts
(
buf
,
len
,
0
);
}
STATIC
VOID
OsPrintLockDepInfo
(
const
CHAR
*
fmt
,
...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
OsLockDepPrint
(
fmt
,
ap
);
va_end
(
ap
);
}
STATIC
VOID
OsLockDepDumpLock
(
const
LosTaskCB
*
task
,
const
SPIN_LOCK_S
*
lock
,
const
VOID
*
requestAddr
,
enum
LockDepErrType
errType
)
{
...
...
@@ -114,24 +141,24 @@ STATIC VOID OsLockDepDumpLock(const LosTaskCB *task, const SPIN_LOCK_S *lock,
const
LockDep
*
lockDep
=
&
task
->
lockDep
;
const
LosTaskCB
*
temp
=
task
;
PrintExc
Info
(
"lockdep check failed
\n
"
);
PrintExc
Info
(
"error type : %s
\n
"
,
OsLockDepErrorStringGet
(
errType
));
PrintExc
Info
(
"request addr : 0x%x
\n
"
,
requestAddr
);
OsPrintLockDep
Info
(
"lockdep check failed
\n
"
);
OsPrintLockDep
Info
(
"error type : %s
\n
"
,
OsLockDepErrorStringGet
(
errType
));
OsPrintLockDep
Info
(
"request addr : 0x%x
\n
"
,
requestAddr
);
while
(
1
)
{
PrintExc
Info
(
"task name : %s
\n
"
,
temp
->
taskName
);
PrintExc
Info
(
"task id : %u
\n
"
,
temp
->
taskID
);
PrintExc
Info
(
"cpu num : %u
\n
"
,
temp
->
currCpu
);
PrintExc
Info
(
"start dumping lockdep infomation
\n
"
);
OsPrintLockDep
Info
(
"task name : %s
\n
"
,
temp
->
taskName
);
OsPrintLockDep
Info
(
"task id : %u
\n
"
,
temp
->
taskID
);
OsPrintLockDep
Info
(
"cpu num : %u
\n
"
,
temp
->
currCpu
);
OsPrintLockDep
Info
(
"start dumping lockdep infomation
\n
"
);
for
(
i
=
0
;
i
<
lockDep
->
lockDepth
;
i
++
)
{
if
(
lockDep
->
heldLocks
[
i
].
lockPtr
==
lock
)
{
PrintExc
Info
(
"[%d] %s <-- addr:0x%x
\n
"
,
i
,
LOCKDEP_GET_NAME
(
lockDep
,
i
),
OsPrintLockDep
Info
(
"[%d] %s <-- addr:0x%x
\n
"
,
i
,
LOCKDEP_GET_NAME
(
lockDep
,
i
),
LOCKDEP_GET_ADDR
(
lockDep
,
i
));
}
else
{
PrintExc
Info
(
"[%d] %s
\n
"
,
i
,
LOCKDEP_GET_NAME
(
lockDep
,
i
));
OsPrintLockDep
Info
(
"[%d] %s
\n
"
,
i
,
LOCKDEP_GET_NAME
(
lockDep
,
i
));
}
}
PrintExc
Info
(
"[%d] %s <-- now
\n
"
,
i
,
lock
->
name
);
OsPrintLockDep
Info
(
"[%d] %s <-- now
\n
"
,
i
,
lock
->
name
);
if
(
errType
==
LOCKDEP_ERR_DEAD_LOCK
)
{
temp
=
lock
->
owner
;
...
...
@@ -144,7 +171,6 @@ STATIC VOID OsLockDepDumpLock(const LosTaskCB *task, const SPIN_LOCK_S *lock,
}
}
OsLockDepPanic
(
errType
);
}
STATIC
BOOL
OsLockDepCheckDependancy
(
const
LosTaskCB
*
current
,
LosTaskCB
*
lockOwner
)
...
...
@@ -172,7 +198,7 @@ VOID OsLockDepCheckIn(SPIN_LOCK_S *lock)
{
UINT32
intSave
;
enum
LockDepErrType
checkResult
=
LOCKDEP_SUCEESS
;
VOID
*
requestAddr
=
(
VOID
*
)
__builtin_return_address
(
0
);
VOID
*
requestAddr
=
(
VOID
*
)
__builtin_return_address
(
1
);
LosTaskCB
*
current
=
OsCurrTaskGet
();
LockDep
*
lockDep
=
&
current
->
lockDep
;
LosTaskCB
*
lockOwner
=
NULL
;
...
...
@@ -211,11 +237,12 @@ OUT:
lockDep
->
waitLock
=
lock
;
lockDep
->
heldLocks
[
lockDep
->
lockDepth
].
lockAddr
=
requestAddr
;
lockDep
->
heldLocks
[
lockDep
->
lockDepth
].
waitTime
=
OsLockDepGetCycles
();
/* start time */
}
else
{
OsLockDepDumpLock
(
current
,
lock
,
requestAddr
,
checkResult
)
;
OsLockDepRelease
(
intSave
);
return
;
}
OsLockDepDumpLock
(
current
,
lock
,
requestAddr
,
checkResult
);
OsLockDepRelease
(
intSave
);
OsLockDepPanic
(
checkResult
);
}
VOID
OsLockDepRecord
(
SPIN_LOCK_S
*
lock
)
...
...
@@ -253,7 +280,7 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
UINT32
intSave
;
INT32
depth
;
enum
LockDepErrType
checkResult
=
LOCKDEP_SUCEESS
;
VOID
*
requestAddr
=
(
VOID
*
)
__builtin_return_address
(
0
);
VOID
*
requestAddr
=
(
VOID
*
)
__builtin_return_address
(
1
);
LosTaskCB
*
current
=
OsCurrTaskGet
();
LosTaskCB
*
owner
=
NULL
;
LockDep
*
lockDep
=
NULL
;
...
...
@@ -265,7 +292,8 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
if
(
owner
==
SPINLOCK_OWNER_INIT
)
{
checkResult
=
LOCKDEP_ERR_UNLOCK_WITOUT_LOCK
;
OsLockDepDumpLock
(
current
,
lock
,
requestAddr
,
checkResult
);
goto
OUT
;
OsLockDepRelease
(
intSave
);
OsLockDepPanic
(
checkResult
);
}
lockDep
=
&
owner
->
lockDep
;
...
...
@@ -294,7 +322,6 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
lock
->
cpuid
=
(
UINT32
)(
-
1
);
lock
->
owner
=
SPINLOCK_OWNER_INIT
;
OUT:
OsLockDepRelease
(
intSave
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录