Skip to contentSkip to conversation

LoongArch: Align FPU register state to 32 bytes

PATCH Applied Lisa Robinson 2 participants 5 messages Mar 30 – Apr 15 LoongArch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LoongArch: Align FPU register state to 32 bytes

Move fpr to the beginning of struct loongarch_fpu so it is naturally aligned to FPU_ALIGN (32 bytes), improving 256-bit SIMD (LASX) context switch performance.

---
 arch/loongarch/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/processor.h +1 -1
index c3bc44b5f5b3..ce8b953f8c79 100644
@@ -80,10 +80,10 @@ BUILD_FPR_ACCESS(32)
 BUILD_FPR_ACCESS(64)
 
 struct loongarch_fpu {
+	union fpureg	fpr[NUM_FPU_REGS];
 	uint64_t	fcc;	/* 8x8 */
 	uint32_t	fcsr;
 	uint32_t	ftop;
-	union fpureg	fpr[NUM_FPU_REGS];
 };
 
 struct loongarch_lbt {
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw

Applied, thanks.

Huacai

Quoted 29 lines · Lisa Robinson

Move fpr to the beginning of struct loongarch_fpu so it is naturally aligned to FPU_ALIGN (32 bytes), improving 256-bit SIMD (LASX) context switch performance.

---
 arch/loongarch/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/processor.h +1 -2
index c3bc44b5f5b3..ce8b953f8c79 100644
@@ -80,10 +80,10 @@ BUILD_FPR_ACCESS(32)
 BUILD_FPR_ACCESS(64)
 
 struct loongarch_fpu {
+       union fpureg    fpr[NUM_FPU_REGS];
        uint64_t        fcc;    /* 8x8 */
        uint32_t        fcsr;
        uint32_t        ftop;
-       union fpureg    fpr[NUM_FPU_REGS];
 };
 
 struct loongarch_lbt {
--

2.53.0

maintainer
#2 lore raw
Quoted 2 lines · Huacai Chen

Applied, thanks.

I'm sorry, I reverted this patch because it breaks the partial copy optimization in arch_dup_task_struct().

Huacai

Quoted 33 lines

Huacai

Quoted 29 lines · Lisa Robinson

Move fpr to the beginning of struct loongarch_fpu so it is naturally aligned to FPU_ALIGN (32 bytes), improving 256-bit SIMD (LASX) context switch performance.

---
 arch/loongarch/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/processor.h +1 -2
index c3bc44b5f5b3..ce8b953f8c79 100644
@@ -80,10 +80,10 @@ BUILD_FPR_ACCESS(32)
 BUILD_FPR_ACCESS(64)
 
 struct loongarch_fpu {
+       union fpureg    fpr[NUM_FPU_REGS];
        uint64_t        fcc;    /* 8x8 */
        uint32_t        fcsr;
        uint32_t        ftop;
-       union fpureg    fpr[NUM_FPU_REGS];
 };
 
 struct loongarch_lbt {
--

2.53.0

maintainer
#3 lore raw
Quoted 6 lines · Huacai Chen
Quoted 2 lines · Huacai Chen

Applied, thanks.

I'm sorry, I reverted this patch because it breaks the partial copy optimization in arch_dup_task_struct().

Fixed as this:
https://github.com/chenhuacai/linux/commit/c1365bc97d609438809d5d44d338adfc09767d6f

Huacai

Quoted 36 lines

Huacai

Quoted 33 lines

Huacai

Quoted 29 lines · Lisa Robinson

Move fpr to the beginning of struct loongarch_fpu so it is naturally aligned to FPU_ALIGN (32 bytes), improving 256-bit SIMD (LASX) context switch performance.

---
 arch/loongarch/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/processor.h +1 -2
index c3bc44b5f5b3..ce8b953f8c79 100644
@@ -80,10 +80,10 @@ BUILD_FPR_ACCESS(32)
 BUILD_FPR_ACCESS(64)
 
 struct loongarch_fpu {
+       union fpureg    fpr[NUM_FPU_REGS];
        uint64_t        fcc;    /* 8x8 */
        uint32_t        fcsr;
        uint32_t        ftop;
-       union fpureg    fpr[NUM_FPU_REGS];
 };
 
 struct loongarch_lbt {
--

2.53.0

#4 lore raw
Quoted 10 lines · Huacai Chen
Quoted 6 lines · Huacai Chen
Quoted 2 lines · Huacai Chen

Applied, thanks.

I'm sorry, I reverted this patch because it breaks the partial copy optimization in arch_dup_task_struct().

Fixed as this:
https://github.com/chenhuacai/linux/commit/c1365bc97d609438809d5d44d338adfc09767d6f

Thanks for catching and fixing this.

Lisa

Quoted 39 lines

Huacai

Quoted 36 lines

Huacai

Quoted 33 lines

Huacai

Quoted 29 lines · Lisa Robinson

Move fpr to the beginning of struct loongarch_fpu so it is naturally aligned to FPU_ALIGN (32 bytes), improving 256-bit SIMD (LASX) context switch performance.

---
 arch/loongarch/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/processor.h +1 -2
index c3bc44b5f5b3..ce8b953f8c79 100644
@@ -80,10 +80,10 @@ BUILD_FPR_ACCESS(32)
 BUILD_FPR_ACCESS(64)
 
 struct loongarch_fpu {
+       union fpureg    fpr[NUM_FPU_REGS];
        uint64_t        fcc;    /* 8x8 */
        uint32_t        fcsr;
        uint32_t        ftop;
-       union fpureg    fpr[NUM_FPU_REGS];
 };
 
 struct loongarch_lbt {
--

2.53.0