linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: KASLR: Fix sync_icache() trapped in loop when synci_step is zero
@ 2020-12-02  3:00 Jinyang He
  2020-12-02 10:39 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 7+ messages in thread
From: Jinyang He @ 2020-12-02  3:00 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel

Reading synci_step by using rdhwr instruction may return zero if no cache
need be synchronized. On the one hand, to make sure all load operation and
store operation finished we do __sync() for every platform. On the other
hand, some platform need operate synci one time although step is zero.

Signed-off-by: Jinyang He <hejinyang@loongson.cn>
---
 arch/mips/kernel/relocate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index 57bdd276..47aeb33 100644
--- a/arch/mips/kernel/relocate.c
+++ b/arch/mips/kernel/relocate.c
@@ -64,7 +64,7 @@ static void __init sync_icache(void *kbase, unsigned long kernel_length)
 			: "r" (kbase));
 
 		kbase += step;
-	} while (kbase < kend);
+	} while (step && kbase < kend);
 
 	/* Completion barrier */
 	__sync();
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-08  6:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-02  3:00 [PATCH] MIPS: KASLR: Fix sync_icache() trapped in loop when synci_step is zero Jinyang He
2020-12-02 10:39 ` Thomas Bogendoerfer
2020-12-03  3:29   ` Jinyang He
2020-12-08  6:46     ` Maciej W. Rozycki
2020-12-03  4:02   ` Jiaxun Yang
2020-12-04 12:14     ` Thomas Bogendoerfer
2020-12-07 15:35   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).