未验证 提交 a37d56fc 编写于 作者: A Atish Patra 提交者: Palmer Dabbelt

RISC-V: Use WRITE_ONCE instead of direct access

The secondary harts spin on couple of per cpu variables until both of
these are non-zero so it's not necessary to have any ordering here.
However, WRITE_ONCE should be used to avoid tearing.
Signed-off-by: NAtish Patra <atish.patra@wdc.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NPalmer Dabbelt <palmer@sifive.com>
上级 46373cb4
...@@ -81,8 +81,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) ...@@ -81,8 +81,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
* the spinning harts that they can continue the boot process. * the spinning harts that they can continue the boot process.
*/ */
smp_mb(); smp_mb();
__cpu_up_stack_pointer[cpu] = task_stack_page(tidle) + THREAD_SIZE; WRITE_ONCE(__cpu_up_stack_pointer[cpu],
__cpu_up_task_pointer[cpu] = tidle; task_stack_page(tidle) + THREAD_SIZE);
WRITE_ONCE(__cpu_up_task_pointer[cpu], tidle);
while (!cpu_online(cpu)) while (!cpu_online(cpu))
cpu_relax(); cpu_relax();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册