Skip to contentSkip to conversation

MIPS: Hibernate: flush TLB entries earlier

PATCH In review Huacai Chen 2 participants 3 messages Dec 19, 2014 – Dec 20, 2014 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Hibernate: flush TLB entries earlier

We found that TLB mismatch not only happens after kernel resume, but also happens during snapshot restore. So move it to the beginning of swsusp_arch_suspend().

---
 arch/mips/power/hibernate.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/mips/power/hibernate.S +2 -1
index 32a7c82..e7567c8 100644
@@ -30,6 +30,8 @@ LEAF(swsusp_arch_suspend)
 END(swsusp_arch_suspend)
 
 LEAF(swsusp_arch_resume)
+	/* Avoid TLB mismatch during and after kernel resume */
+	jal local_flush_tlb_all
 	PTR_L t0, restore_pblist
 0:
 	PTR_L t1, PBE_ADDRESS(t0)   /* source */
@@ -43,7 +45,6 @@ LEAF(swsusp_arch_resume)
 	bne t1, t3, 1b
 	PTR_L t0, PBE_NEXT(t0)
 	bnez t0, 0b
-	jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */
 	PTR_LA t0, saved_regs
 	PTR_L ra, PT_R31(t0)
 	PTR_L sp, PT_R29(t0)
Signature · 1 line
1.7.7.3
#1 lore raw
Quoted 15 lines · Huacai Chen

We found that TLB mismatch not only happens after kernel resume, but also happens during snapshot restore. So move it to the beginning of swsusp_arch_suspend().

---
 arch/mips/power/hibernate.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/mips/power/hibernate.S +0 -0
index 32a7c82..e7567c8 100644

arch/mips/power/hibernate.S LEAF(swsusp_arch_suspend) · line 34

Quoted 5 lines
arch/mips/power/hibernate.S +2 -0
@@ -30,6 +30,8 @@ LEAF(swsusp_arch_suspend)
 END(swsusp_arch_suspend)
 
 LEAF(swsusp_arch_resume)
+	/* Avoid TLB mismatch during and after kernel resume */
+	jal local_flush_tlb_all

I'd like to keep the assembler code to a minimum. Can you rename swsusp_arch_resume and create a new wrapper function in C named swsusp_arch_resume() which calls the old swsusp_arch_resume() after calling local_flush_tlb_all(), something like that?

Thanks,

Ralf

#2 lore raw

Hi, Ralf,

Maybe it is better to have two patches: the first fix the bug, and the second restructure files and functions?

Huacai

Quoted 32 lines · Ralf Baechle
Quoted 15 lines · Huacai Chen

We found that TLB mismatch not only happens after kernel resume, but also happens during snapshot restore. So move it to the beginning of swsusp_arch_suspend().

---
 arch/mips/power/hibernate.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/mips/power/hibernate.S +0 -0
index 32a7c82..e7567c8 100644

arch/mips/power/hibernate.S LEAF(swsusp_arch_suspend) · line 34

Quoted 5 lines
arch/mips/power/hibernate.S +2 -0
@@ -30,6 +30,8 @@ LEAF(swsusp_arch_suspend)
 END(swsusp_arch_suspend)
 
 LEAF(swsusp_arch_resume)
+     /* Avoid TLB mismatch during and after kernel resume */
+     jal local_flush_tlb_all

I'd like to keep the assembler code to a minimum. Can you rename swsusp_arch_resume and create a new wrapper function in C named swsusp_arch_resume() which calls the old swsusp_arch_resume() after calling local_flush_tlb_all(), something like that?

Thanks,

Ralf