Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
a254dac5
提交
a254dac5
3月 22, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'scale-amd64' of
git+ssh://amsterdam.csail.mit.edu/home/am0/6.828/xv6
into scale-amd64
上级
3415014f
6a342251
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
59 行增加
和
37 行删除
+59
-37
.dir-locals.el
.dir-locals.el
+9
-0
asharing.cc
bin/asharing.cc
+44
-34
mtrace.h
include/mtrace.h
+4
-2
proc.cc
kernel/proc.cc
+1
-0
rnd.cc
kernel/rnd.cc
+1
-1
没有找到文件。
.dir-locals.el
0 → 100644
浏览文件 @
a254dac5
((
c-mode
(
indent-tabs-mode
.
nil
)
(
c-file-style
.
"bsd"
)
(
c-basic-offset
.
2
))
(
c++-mode
(
indent-tabs-mode
.
nil
)
(
c-file-style
.
"bsd"
)
(
c-basic-offset
.
2
))
)
bin/asharing.cc
浏览文件 @
a254dac5
...
@@ -4,8 +4,11 @@
...
@@ -4,8 +4,11 @@
#include "user.h"
#include "user.h"
#include "fcntl.h"
#include "fcntl.h"
#include "mtrace.h"
#include "mtrace.h"
#include "pthread.h"
static
int
cpu
;
static
int
cpu
;
static
pthread_barrier_t
bar
;
enum
{
ncore
=
8
};
void
void
next
()
next
()
...
@@ -18,60 +21,67 @@ next()
...
@@ -18,60 +21,67 @@ next()
cpu
++
;
cpu
++
;
}
}
void
void
*
vmsharing
(
void
)
vmsharing
(
void
*
arg
)
{
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
u64
i
=
(
u64
)
arg
;
next
();
volatile
char
*
p
=
(
char
*
)(
0x40000UL
+
i
*
4096
);
volatile
char
*
p
=
(
char
*
)(
0x40000UL
+
i
*
4096
);
mtenable
(
"xv6-mapsharing"
);
mtenable
(
"xv6-mapsharing"
);
if
(
map
((
void
*
)
p
,
4096
)
<
0
)
if
(
map
((
void
*
)
p
,
4096
)
<
0
)
die
(
"map failed"
);
die
(
"map failed"
);
mtdisable
(
"xv6-mapsharing"
);
mtdisable
(
"xv6-mapsharing"
);
mtenable
(
"xv6-mapsharing"
);
mtenable
(
"xv6-mapsharing"
);
if
(
unmap
((
void
*
)
p
,
4096
)
<
0
)
if
(
unmap
((
void
*
)
p
,
4096
)
<
0
)
die
(
"unmap failed"
);
die
(
"unmap failed"
);
mtdisable
(
"xv6-mapsharing"
);
mtdisable
(
"xv6-mapsharing"
);
}
return
0
;
}
}
void
void
*
fssharing
(
void
)
fssharing
(
void
*
arg
)
{
{
u64
i
=
(
u64
)
arg
;
// Note that we keep these files open; otherwise all of these
// Note that we keep these files open; otherwise all of these
// operations will share the abstract FD object and we won't get any
// operations will share the abstract FD object and we won't get any
// results.
// results.
next
();
char
filename
[
32
];
mtenable
(
"xv6-fssharing"
);
snprintf
(
filename
,
sizeof
(
filename
),
"f%d"
,
i
);
open
(
"a"
,
O_CREATE
|
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
next
();
open
(
filename
,
O_CREATE
|
O_RDWR
);
mtenable
(
"xv6-fssharing"
);
open
(
"b"
,
O_CREATE
|
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
next
();
pthread_barrier_wait
(
&
bar
);
mtenable
(
"xv6-fssharing"
);
open
(
"a"
,
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
next
();
for
(
u64
j
=
0
;
j
<
ncore
;
j
++
)
{
mtenable
(
"xv6-fssharing"
);
snprintf
(
filename
,
sizeof
(
filename
),
"f%d"
,
j
);
open
(
"b"
,
O_RDWR
);
open
(
filename
,
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
}
return
0
;
}
}
int
int
main
(
int
ac
,
char
**
av
)
main
(
int
ac
,
char
**
av
)
{
{
void
*
(
*
op
)(
void
*
)
=
0
;
if
(
ac
==
2
&&
strcmp
(
av
[
1
],
"vm"
)
==
0
)
if
(
ac
==
2
&&
strcmp
(
av
[
1
],
"vm"
)
==
0
)
vmsharing
()
;
op
=
vmsharing
;
else
if
(
ac
==
2
&&
strcmp
(
av
[
1
],
"fs"
)
==
0
)
else
if
(
ac
==
2
&&
strcmp
(
av
[
1
],
"fs"
)
==
0
)
fssharing
()
;
op
=
fssharing
;
else
else
fprintf
(
1
,
"usage: %s vm|fs
\n
"
,
av
[
0
]);
fprintf
(
1
,
"usage: %s vm|fs
\n
"
,
av
[
0
]);
if
(
op
)
{
mtenable_type
(
mtrace_record_ascope
,
"xv6-asharing"
);
pthread_barrier_init
(
&
bar
,
0
,
ncore
);
for
(
u64
i
=
0
;
i
<
ncore
;
i
++
)
{
next
();
pthread_t
tid
;
pthread_create
(
&
tid
,
0
,
op
,
(
void
*
)
i
);
}
mtdisable
(
"xv6-asharing"
);
}
}
}
include/mtrace.h
浏览文件 @
a254dac5
...
@@ -33,8 +33,9 @@ char* strncpy(char *s, const char *t, size_t n);
...
@@ -33,8 +33,9 @@ char* strncpy(char *s, const char *t, size_t n);
mtrace_lock_register(RET_IP(), ptr, lockname(ptr), mtrace_lockop_release, 0)
mtrace_lock_register(RET_IP(), ptr, lockname(ptr), mtrace_lockop_release, 0)
// Enable/disable all mtrace logging
// Enable/disable all mtrace logging
#define mtenable(name) mtrace_enable_set(1, name)
#define mtenable(name) mtrace_enable_set(mtrace_record_movement, name)
#define mtdisable(name) mtrace_enable_set(0, name)
#define mtenable_type(type, name) mtrace_enable_set(type, name)
#define mtdisable(name) mtrace_enable_set(mtrace_record_disable, name)
// Log the number of operations
// Log the number of operations
static
inline
void
mtops
(
u64
n
)
static
inline
void
mtops
(
u64
n
)
...
@@ -54,6 +55,7 @@ static inline void mtops(u64 n)
...
@@ -54,6 +55,7 @@ static inline void mtops(u64 n)
#define mtrec(cpu) do { } while (0)
#define mtrec(cpu) do { } while (0)
#define mtign(cpu) do { } while (0)
#define mtign(cpu) do { } while (0)
#define mtenable(name) do { } while (0)
#define mtenable(name) do { } while (0)
#define mtenable_type(type, name) do { } while (0)
#define mtdisable(name) do { } while (0)
#define mtdisable(name) do { } while (0)
#define mtops(n) do { } while (0)
#define mtops(n) do { } while (0)
#endif
#endif
kernel/proc.cc
浏览文件 @
a254dac5
...
@@ -361,6 +361,7 @@ fork(int flags)
...
@@ -361,6 +361,7 @@ fork(int flags)
np
->
parent
=
myproc
();
np
->
parent
=
myproc
();
*
np
->
tf
=
*
myproc
()
->
tf
;
*
np
->
tf
=
*
myproc
()
->
tf
;
np
->
cpu_pin
=
myproc
()
->
cpu_pin
;
// Clear %eax so that fork returns 0 in the child.
// Clear %eax so that fork returns 0 in the child.
np
->
tf
->
rax
=
0
;
np
->
tf
->
rax
=
0
;
...
...
kernel/rnd.cc
浏览文件 @
a254dac5
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
struct
seed
{
struct
seed
{
u64
v
;
u64
v
;
}
__m
a
palign__
;
}
__mpalign__
;
static
struct
seed
seeds
[
NCPU
]
__mpalign__
;
static
struct
seed
seeds
[
NCPU
]
__mpalign__
;
u64
u64
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论