Skip to contentSkip to conversation

LoongArch: use EXCCODE_INT_START instead of hard coded value

PATCH In review Enze Li 2 participants 5 messages Feb 24, 2023 – Mar 13, 2023 LoongArch

lore
Share & tools
lore

Enze Li

author
#0 lore raw

PATCH 1/1 LoongArch: use EXCCODE_INT_START instead of hard coded value

The for loop in per_cpu_trap_init function use a hard coded length while setting default exception handler. Use the proper define instead of hard coded value.

---
 arch/loongarch/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/traps.c +1 -1
index de8ebe20b666..7d5784eccf19 100644
@@ -755,7 +755,7 @@ void per_cpu_trap_init(int cpu)
 
 	/* Initialise exception handlers */
 	if (cpu == 0)
-		for (i = 0; i < 64; i++)
+		for (i = 0; i < EXCCODE_INT_START; i++)
 			set_handler(i * VECSIZE, handle_reserved, VECSIZE);
 
 	tlb_init(cpu);

base-commit: 804f6d04b1adae9602edbd6410c0ba3a556964fe

Signature · 1 line
2.39.2
author
#1 lore raw

Hi Huacai,

Kindly PING for this tiny patch. :)

Thanks,
Enze

Quoted 27 lines · Enze Li

The for loop in per_cpu_trap_init function use a hard coded length while
setting default exception handler. Use the proper define instead of hard coded value.

---
 arch/loongarch/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/traps.c +1 -1
index de8ebe20b666..7d5784eccf19 100644
@@ -755,7 +755,7 @@ void per_cpu_trap_init(int cpu)
 
 	/* Initialise exception handlers */
 	if (cpu == 0)
-		for (i = 0; i < 64; i++)
+		for (i = 0; i < EXCCODE_INT_START; i++)
 			set_handler(i * VECSIZE, handle_reserved,
 VECSIZE);
 

tlb_init(cpu);

base-commit: 804f6d04b1adae9602edbd6410c0ba3a556964fe

maintainer
#2 lore raw

Though EXCCODE_INT_START is 64, its meaning is not suitable in this case.

Huacai

Quoted 37 lines · Enze Li

Hi Huacai,

Kindly PING for this tiny patch. :)

Thanks,
Enze

Quoted 27 lines · Enze Li

The for loop in per_cpu_trap_init function use a hard coded length while
setting default exception handler. Use the proper define instead of hard coded value.

---
 arch/loongarch/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/traps.c +1 -1
index de8ebe20b666..7d5784eccf19 100644
@@ -755,7 +755,7 @@ void per_cpu_trap_init(int cpu)
 
      /* Initialise exception handlers */
      if (cpu == 0)
-             for (i = 0; i < 64; i++)
+             for (i = 0; i < EXCCODE_INT_START; i++)
                      set_handler(i * VECSIZE, handle_reserved,
 VECSIZE);
 
      tlb_init(cpu);

base-commit: 804f6d04b1adae9602edbd6410c0ba3a556964fe

author
#3 lore raw

Hi Huacai,

Thanks for your review :)

Quoted 2 lines · Huacai Chen

Though EXCCODE_INT_START is 64, its meaning is not suitable in this case.

Humm...Yeah. Sharing the same macro may make things difficult to understand.

What about defining a new macro to indicate this? Something like EXCCODE_NOR_NUM or EXCCODE_EXC_NUM?

For a newcomer, thank you in advance for your patience.

Thanks,
Enze

Quoted 41 lines

Huacai

Quoted 37 lines · Enze Li

Hi Huacai,

Kindly PING for this tiny patch. :)

Thanks,
Enze

Quoted 29 lines · Enze Li

The for loop in per_cpu_trap_init function use a hard coded length
while
setting default exception handler. Use the proper define instead of
hard coded value.

---
 arch/loongarch/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/traps.c +1 -1
index de8ebe20b666..7d5784eccf19 100644
@@ -755,7 +755,7 @@ void per_cpu_trap_init(int cpu)
 
      /* Initialise exception handlers */
      if (cpu == 0)
-             for (i = 0; i < 64; i++)
+             for (i = 0; i < EXCCODE_INT_START; i++)
                      set_handler(i * VECSIZE, handle_reserved,
 VECSIZE);
 
      tlb_init(cpu);

base-commit: 804f6d04b1adae9602edbd6410c0ba3a556964fe

maintainer
#4 lore raw
Quoted 6 lines · Enze Li

Hi Huacai,

Thanks for your review :)

On Mon, 2023-03-13 at 15:52 +0800, Huacai Chen wrote:

Quoted 8 lines
Quoted 2 lines

Though EXCCODE_INT_START is 64, its meaning is not suitable in this case.

Humm...Yeah. Sharing the same macro may make things difficult to understand.

What about defining a new macro to indicate this? Something like EXCCODE_NOR_NUM or EXCCODE_EXC_NUM?

I prefer to keep it as original.

Huacai

Quoted 49 lines

For a newcomer, thank you in advance for your patience.

Thanks,
Enze

Quoted 41 lines

Huacai

Quoted 37 lines · Enze Li

Hi Huacai,

Kindly PING for this tiny patch. :)

Thanks,
Enze

Quoted 29 lines · Enze Li

The for loop in per_cpu_trap_init function use a hard coded length
while
setting default exception handler. Use the proper define instead of
hard coded value.

---
 arch/loongarch/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/traps.c +1 -1
index de8ebe20b666..7d5784eccf19 100644
@@ -755,7 +755,7 @@ void per_cpu_trap_init(int cpu)
 
      /* Initialise exception handlers */
      if (cpu == 0)
-             for (i = 0; i < 64; i++)
+             for (i = 0; i < EXCCODE_INT_START; i++)
                      set_handler(i * VECSIZE, handle_reserved,
 VECSIZE);
 
      tlb_init(cpu);

base-commit: 804f6d04b1adae9602edbd6410c0ba3a556964fe