mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
In the original sbi_cpu_is_stopped(), if rc doesn't equal to the
SBI_HSM_STATE_STOPPED, it will return rc to the caller directly. But
there is a hidden problem, the rc could be SBI_HSM_STATE_STARTED, if
so, this function will report cpu stopped while the cpu isn't really
stopped.
Furthermore, from the name of cpu_is_stopped(), it gives a sense the
return value is a bool type, true means the cpu is stopped, conversely
false means the cpu is not stopped.
Here change the return value type to bool and change the callers
accordingly. This could fix the above two issues.
Fixes: f1e58583b9 ("RISC-V: Support cpu hotplug")
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://patch.msgid.link/20260413123515.48423-1-hui.wang@canonical.com
[pjw@kernel.org: cleaned up some of the pr_warn() messages]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
36 lines
972 B
C
36 lines
972 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
|
|
* Based on arch/arm64/include/asm/cpu_ops.h
|
|
*/
|
|
#ifndef __ASM_CPU_OPS_H
|
|
#define __ASM_CPU_OPS_H
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/threads.h>
|
|
|
|
/**
|
|
* struct cpu_operations - Callback operations for hotplugging CPUs.
|
|
*
|
|
* @cpu_start: Boots a cpu into the kernel.
|
|
* @cpu_stop: Makes a cpu leave the kernel. Must not fail. Called from
|
|
* the cpu being stopped.
|
|
* @cpu_is_stopped: Ensures a cpu has left the kernel. Called from another
|
|
* cpu.
|
|
*/
|
|
struct cpu_operations {
|
|
int (*cpu_start)(unsigned int cpu,
|
|
struct task_struct *tidle);
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
void (*cpu_stop)(void);
|
|
bool (*cpu_is_stopped)(unsigned int cpu);
|
|
#endif
|
|
};
|
|
|
|
extern const struct cpu_operations cpu_ops_spinwait;
|
|
extern const struct cpu_operations *cpu_ops;
|
|
void __init cpu_set_ops(void);
|
|
|
|
#endif /* ifndef __ASM_CPU_OPS_H */
|