-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sunxi-6.1: Reverse commit 75317a0, fix real reason inability to load …
…kernel Reverse commit 75317a0 since this is a special case. Eliminate the real reason for the inability to boot the kernel. Linux kernel hangs in early boot on 32-bit ARM platform, when ftrace 4-byte "mcount" function call location for "_raw_spin_unlock_irqrestore" function straddles icache lines. The problem is present for (cross-compiler) GCC 10, 11, 12. It does not happen when the kernel is compiled with GCC 9, even when condition (1) is satisfied. Detailed description: https://forum.armbian.com/topic/41339-linux-image-legacy-sunxi2451-kernel-6192-is-broken-stuck-at-starting-kernel/?do=findComment&comment=196528
- Loading branch information
1 parent
d3b1817
commit d05f3b1
Showing
4 changed files
with
52 additions
and
54 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...ernel/archive/sunxi-6.1/arm-patch-call-patch_unmap-after-flushing-dcache-and-icache.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
From 3d499ba2dce4ac8716f2c9bb07f66f45d0555a19 Mon Sep 17 00:00:00 2001 | ||
From: The-going <48602507+The-going@users.noreply.github.com> | ||
Date: Fri, 12 Jul 2024 14:20:15 +0300 | ||
Subject: arm: patch: call 'patch_unmap' after flushing dcache and icache | ||
|
||
Problem: Linux kernel hangs in early boot on 32-bit ARM platform, | ||
when ftrace 4-byte "mcount" function call location for | ||
"_raw_spin_unlock_irqrestore" function straddles icache lines. | ||
|
||
1. The ftrace location for "_raw_spin_unlock_irqrestore" is NOT | ||
4-byte aligned and 4 bytes at this location straddle the instruction | ||
cache line (0x20) boundaries. | ||
|
||
The problem is present for (cross-compiler) GCC 10, 11, 12. | ||
It does not happen when the kernel is compiled with GCC 9, | ||
even when condition (1) is satisfied. | ||
|
||
Detailed description: | ||
https://forum.armbian.com/topic/41339-linux-image-legacy-sunxi2451-kernel-6192-is-broken-stuck-at-starting-kernel/?do=findComment&comment=196528 | ||
|
||
Author: @mikhailai | ||
--- | ||
arch/arm/kernel/patch.c | 9 ++++++++- | ||
1 file changed, 8 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c | ||
index e9e828b6bb30..ce0fd3aeb575 100644 | ||
--- a/arch/arm/kernel/patch.c | ||
+++ b/arch/arm/kernel/patch.c | ||
@@ -101,11 +101,18 @@ void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) | ||
|
||
if (waddr != addr) { | ||
flush_kernel_vmap_range(waddr, twopage ? size / 2 : size); | ||
- patch_unmap(FIX_TEXT_POKE0, &flags); | ||
} | ||
|
||
flush_icache_range((uintptr_t)(addr), | ||
(uintptr_t)(addr) + size); | ||
+ | ||
+ /* Can only call 'patch_unmap' after flushing dcache and icache, | ||
+ * because it calls 'raw_spin_unlock_irqrestore', but that may | ||
+ * happen to be the very function we're currently patching | ||
+ * (as it happens during the ftrace init). | ||
+ */ | ||
+ if (waddr != addr) | ||
+ patch_unmap(FIX_TEXT_POKE0, &flags); | ||
} | ||
|
||
static int __kprobes patch_text_stop_machine(void *data) | ||
-- | ||
2.35.3 | ||
|
52 changes: 0 additions & 52 deletions
52
...hive/sunxi-6.1/patches.armbian/random-Revert-handle-entropy-from-atomic-process-con.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters