Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
c020c6f1
提交
c020c6f1
2月 13, 2012
创建
作者:
Nickolai Zeldovich
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lockstat build fix
上级
d164ddab
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
4 行删除
+15
-4
kalloc.c
kalloc.c
+2
-0
lockstat.h
lockstat.h
+10
-1
spinlock.cc
spinlock.cc
+3
-3
没有找到文件。
kalloc.c
浏览文件 @
c020c6f1
...
@@ -305,10 +305,12 @@ verifyfree(char *ptr, u64 nbytes)
...
@@ -305,10 +305,12 @@ verifyfree(char *ptr, u64 nbytes)
// Search for pointers in the ptr region
// Search for pointers in the ptr region
u64
x
=
*
(
uptr
*
)
p
;
u64
x
=
*
(
uptr
*
)
p
;
if
(
KBASE
<
x
&&
x
<
KBASE
+
(
128ull
<<
30
))
{
if
(
KBASE
<
x
&&
x
<
KBASE
+
(
128ull
<<
30
))
{
#if 0 /* maybe once this code is C++ */
struct klockstat *kls = (struct klockstat *) x;
struct klockstat *kls = (struct klockstat *) x;
if (kls->magic == LOCKSTAT_MAGIC)
if (kls->magic == LOCKSTAT_MAGIC)
panic("LOCKSTAT_MAGIC %p(%lu):%p->%p",
panic("LOCKSTAT_MAGIC %p(%lu):%p->%p",
ptr, nbytes, p, kls);
ptr, nbytes, p, kls);
#endif
}
}
}
}
#endif
#endif
...
...
lockstat.h
浏览文件 @
c020c6f1
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
#define LOCKSTAT_MAGIC 0xb4cd79c1b2e46f40ull
#define LOCKSTAT_MAGIC 0xb4cd79c1b2e46f40ull
#if __cplusplus
#include "gc.hh"
struct
cpulockstat
{
struct
cpulockstat
{
u64
acquires
;
u64
acquires
;
u64
contends
;
u64
contends
;
...
@@ -18,11 +21,17 @@ struct lockstat {
...
@@ -18,11 +21,17 @@ struct lockstat {
struct
cpulockstat
cpu
[
NCPU
]
__mpalign__
;
struct
cpulockstat
cpu
[
NCPU
]
__mpalign__
;
};
};
struct
klockstat
{
struct
klockstat
:
public
rcu_freed
{
u64
magic
;
u64
magic
;
LIST_ENTRY
(
klockstat
)
link
;
LIST_ENTRY
(
klockstat
)
link
;
struct
lockstat
s
;
struct
lockstat
s
;
klockstat
()
:
rcu_freed
(
"klockstat"
)
{}
virtual
~
klockstat
()
{}
};
};
#else
struct
klockstat
;
#endif
#define LOCKSTAT_START 1
#define LOCKSTAT_START 1
#define LOCKSTAT_STOP 2
#define LOCKSTAT_STOP 2
...
...
spinlock.cc
浏览文件 @
c020c6f1
...
@@ -114,7 +114,7 @@ static struct spinlock lockstat_lock = {
...
@@ -114,7 +114,7 @@ static struct spinlock lockstat_lock = {
void
void
lockstat_init
(
struct
spinlock
*
lk
)
lockstat_init
(
struct
spinlock
*
lk
)
{
{
lk
->
stat
=
(
struct
klockstat
*
)
kmalloc
(
sizeof
(
*
lk
->
stat
)
);
lk
->
stat
=
new
klockstat
(
);
if
(
lk
->
stat
==
NULL
)
if
(
lk
->
stat
==
NULL
)
return
;
return
;
...
@@ -145,8 +145,8 @@ lockstat_clear(void)
...
@@ -145,8 +145,8 @@ lockstat_clear(void)
if
(
stat
->
magic
==
0
)
{
if
(
stat
->
magic
==
0
)
{
LIST_REMOVE
(
stat
,
link
);
LIST_REMOVE
(
stat
,
link
);
// So verifyfree doesn't follow le_next
// So verifyfree doesn't follow le_next
stat
->
link
.
le_next
=
(
struct
klockstat
*
)
NULL
;
stat
->
link
.
le_next
=
0
;
gc_delayed
(
stat
,
kmfree
);
gc_delayed
(
stat
);
}
else
{
}
else
{
memset
(
&
stat
->
s
.
cpu
,
0
,
sizeof
(
stat
->
s
.
cpu
));
memset
(
&
stat
->
s
.
cpu
,
0
,
sizeof
(
stat
->
s
.
cpu
));
}
}
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论