Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
bd6aeeff
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bd6aeeff
编写于
10月 03, 2007
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MIPS] SMP: Implement smp_call_function_mask().
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
9966db25
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
40 deletion
+30
-40
arch/mips/kernel/gdb-stub.c
arch/mips/kernel/gdb-stub.c
+5
-5
arch/mips/kernel/smp.c
arch/mips/kernel/smp.c
+16
-35
include/asm-mips/smp.h
include/asm-mips/smp.h
+9
-0
未找到文件。
arch/mips/kernel/gdb-stub.c
浏览文件 @
bd6aeeff
...
...
@@ -676,15 +676,18 @@ static void kgdb_wait(void *arg)
static
int
kgdb_smp_call_kgdb_wait
(
void
)
{
#ifdef CONFIG_SMP
cpumask_t
mask
=
cpu_online_map
;
struct
call_data_struct
data
;
int
i
,
cpus
=
num_online_cpus
()
-
1
;
int
cpu
=
smp_processor_id
();
int
cpus
;
/*
* Can die spectacularly if this CPU isn't yet marked online
*/
BUG_ON
(
!
cpu_online
(
cpu
));
cpu_clear
(
cpu
,
mask
);
cpus
=
cpus_weight
(
mask
);
if
(
!
cpus
)
return
0
;
...
...
@@ -711,10 +714,7 @@ static int kgdb_smp_call_kgdb_wait(void)
call_data
=
&
data
;
mb
();
/* Send a message to all other CPUs and wait for them to respond */
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
if
(
cpu_online
(
i
)
&&
i
!=
cpu
)
core_send_ipi
(
i
,
SMP_CALL_FUNCTION
);
core_send_ipi_mask
(
mask
,
SMP_CALL_FUNCTION
);
/* Wait for response */
/* FIXME: lock-up detection, backtrace on lock-up */
...
...
arch/mips/kernel/smp.c
浏览文件 @
bd6aeeff
...
...
@@ -97,6 +97,8 @@ struct call_data_struct *call_data;
/*
* Run a function on all other CPUs.
*
* <mask> cpuset_t of all processors to run the function on.
* <func> The function to run. This must be fast and non-blocking.
* <info> An arbitrary pointer to pass to the function.
* <retry> If true, keep retrying until ready.
...
...
@@ -121,18 +123,20 @@ struct call_data_struct *call_data;
* Spin waiting for call_lock
* Deadlock Deadlock
*/
int
smp_call_function
(
void
(
*
func
)
(
void
*
info
),
void
*
info
,
int
retry
,
int
wait
)
int
smp_call_function
_mask
(
cpumask_t
mask
,
void
(
*
func
)
(
void
*
info
)
,
void
*
info
,
int
retry
,
int
wait
)
{
struct
call_data_struct
data
;
int
i
,
cpus
=
num_online_cpus
()
-
1
;
int
cpu
=
smp_processor_id
();
int
cpus
;
/*
* Can die spectacularly if this CPU isn't yet marked online
*/
BUG_ON
(
!
cpu_online
(
cpu
));
cpu_clear
(
cpu
,
mask
);
cpus
=
cpus_weight
(
mask
);
if
(
!
cpus
)
return
0
;
...
...
@@ -151,9 +155,7 @@ int smp_call_function (void (*func) (void *info), void *info, int retry,
smp_mb
();
/* Send a message to all other CPUs and wait for them to respond */
for_each_online_cpu
(
i
)
if
(
i
!=
cpu
)
core_send_ipi
(
i
,
SMP_CALL_FUNCTION
);
core_send_ipi_mask
(
mask
,
SMP_CALL_FUNCTION
);
/* Wait for response */
/* FIXME: lock-up detection, backtrace on lock-up */
...
...
@@ -169,6 +171,11 @@ int smp_call_function (void (*func) (void *info), void *info, int retry,
return
0
;
}
int
smp_call_function
(
void
(
*
func
)
(
void
*
info
),
void
*
info
,
int
retry
,
int
wait
)
{
return
smp_call_function_mask
(
cpu_online_map
,
func
,
info
,
retry
,
wait
);
}
void
smp_call_function_interrupt
(
void
)
{
...
...
@@ -199,8 +206,7 @@ void smp_call_function_interrupt(void)
int
smp_call_function_single
(
int
cpu
,
void
(
*
func
)
(
void
*
info
),
void
*
info
,
int
retry
,
int
wait
)
{
struct
call_data_struct
data
;
int
me
;
int
ret
,
me
;
/*
* Can die spectacularly if this CPU isn't yet marked online
...
...
@@ -219,33 +225,8 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
return
0
;
}
/* Can deadlock when called with interrupts disabled */
WARN_ON
(
irqs_disabled
());
data
.
func
=
func
;
data
.
info
=
info
;
atomic_set
(
&
data
.
started
,
0
);
data
.
wait
=
wait
;
if
(
wait
)
atomic_set
(
&
data
.
finished
,
0
);
spin_lock
(
&
smp_call_lock
);
call_data
=
&
data
;
smp_mb
();
/* Send a message to the other CPU */
core_send_ipi
(
cpu
,
SMP_CALL_FUNCTION
);
/* Wait for response */
/* FIXME: lock-up detection, backtrace on lock-up */
while
(
atomic_read
(
&
data
.
started
)
!=
1
)
barrier
();
if
(
wait
)
while
(
atomic_read
(
&
data
.
finished
)
!=
1
)
barrier
();
call_data
=
NULL
;
spin_unlock
(
&
smp_call_lock
);
ret
=
smp_call_function_mask
(
cpumask_of_cpu
(
cpu
),
func
,
info
,
retry
,
wait
);
put_cpu
();
return
0
;
...
...
include/asm-mips/smp.h
浏览文件 @
bd6aeeff
...
...
@@ -60,6 +60,15 @@ extern cpumask_t phys_cpu_present_map;
*/
extern
void
core_send_ipi
(
int
cpu
,
unsigned
int
action
);
static
inline
void
core_send_ipi_mask
(
cpumask_t
mask
,
unsigned
int
action
)
{
unsigned
int
i
;
for_each_cpu_mask
(
i
,
mask
)
core_send_ipi
(
i
,
action
);
}
/*
* Firmware CPU startup hook
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录