diff mbox series

MIPS: cpu-features: Use boot_cpu_type for CPU type based features

Message ID 20230607055122.26175-1-jiaxun.yang@flygoat.com (mailing list archive)
State Accepted
Commit 5487a7b60695a92cf998350e4beac17144c91fcd
Headers show
Series MIPS: cpu-features: Use boot_cpu_type for CPU type based features | expand

Commit Message

Jiaxun Yang June 7, 2023, 5:51 a.m. UTC
Some CPU feature macros were using current_cpu_type to mark feature
availability.

However current_cpu_type will use smp_processor_id, which is prohibited
under preemptable context.

Since those features are all uniform on all CPUs in a SMP system, use
boot_cpu_type instead of current_cpu_type to fix preemptable kernel.

Cc: stable@vger.kernel.org
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/include/asm/cpu-features.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Bogendoerfer June 9, 2023, 8:24 a.m. UTC | #1
On Wed, Jun 07, 2023 at 01:51:22PM +0800, Jiaxun Yang wrote:
> Some CPU feature macros were using current_cpu_type to mark feature
> availability.
> 
> However current_cpu_type will use smp_processor_id, which is prohibited
> under preemptable context.
> 
> Since those features are all uniform on all CPUs in a SMP system, use
> boot_cpu_type instead of current_cpu_type to fix preemptable kernel.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/mips/include/asm/cpu-features.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
> index 2a0b90077b50..8c6d4a87db37 100644
> --- a/arch/mips/include/asm/cpu-features.h
> +++ b/arch/mips/include/asm/cpu-features.h
> @@ -125,7 +125,7 @@
>  ({									\
>  	int __res;							\
>  									\
> -	switch (current_cpu_type()) {					\
> +	switch (boot_cpu_type()) {					\
>  	case CPU_CAVIUM_OCTEON:						\
>  	case CPU_CAVIUM_OCTEON_PLUS:					\
>  	case CPU_CAVIUM_OCTEON2:					\
> @@ -373,7 +373,7 @@
>  ({									\
>  	int __res;							\
>  									\
> -	switch (current_cpu_type()) {					\
> +	switch (boot_cpu_type()) {					\
>  	case CPU_M14KC:							\
>  	case CPU_74K:							\
>  	case CPU_1074K:							\
> -- 
> 2.39.2 (Apple Git-143)

applied to mips-next.

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 2a0b90077b50..8c6d4a87db37 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -125,7 +125,7 @@ 
 ({									\
 	int __res;							\
 									\
-	switch (current_cpu_type()) {					\
+	switch (boot_cpu_type()) {					\
 	case CPU_CAVIUM_OCTEON:						\
 	case CPU_CAVIUM_OCTEON_PLUS:					\
 	case CPU_CAVIUM_OCTEON2:					\
@@ -373,7 +373,7 @@ 
 ({									\
 	int __res;							\
 									\
-	switch (current_cpu_type()) {					\
+	switch (boot_cpu_type()) {					\
 	case CPU_M14KC:							\
 	case CPU_74K:							\
 	case CPU_1074K:							\