Skip to contentSkip to conversation

x86/sev: Disable ftrace branch profiling in SEV startup code

PATCH Applied Ard Biesheuvel 2 participants 2 messages Jan 7, 2025 – Jan 15, 2025 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/sev: Disable ftrace branch profiling in SEV startup code

From: Ard Biesheuvel <[email protected]>

Ftrace branch profiling inserts absolute references to its metadata at call sites, and this implies that this kind of instrumentation cannot be used while executing from the 1:1 mapping of memory.

Therefore, disable ftrace branch profiling in the SEV startup routines, by disabling it for the entire SEV core source file.

---
 arch/x86/coco/sev/core.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/coco/sev/core.c +2 -0
index 86898547056e..b5c6c4afd1cc 100644
@@ -9,6 +9,8 @@
 
 #define pr_fmt(fmt)	"SEV: " fmt
 
+#define DISABLE_BRANCH_PROFILING
+
 #include <linux/sched/debug.h>	/* For show_regs() */
 #include <linux/percpu-defs.h>
 #include <linux/cc_platform.h>
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
merge bot Applied
#1 lore raw
The following commit has been merged into the x86/boot branch of tip:

The following commit has been merged into the x86/boot branch of tip:

Commit-ID:     cf4ca80650908628bf1c0c29e3fd236b1915d789
Gitweb:        https://git.kernel.org/tip/cf4ca80650908628bf1c0c29e3fd236b1915d789
Author:        Ard Biesheuvel <[email protected]>
AuthorDate:    Tue, 07 Jan 2025 16:18:27 +01:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Tue, 14 Jan 2025 19:10:32 +01:00

x86/sev: Disable ftrace branch profiling in SEV startup code

Ftrace branch profiling inserts absolute references to its metadata at call sites, and this implies that this kind of instrumentation cannot be used while executing from the 1:1 mapping of memory.

Therefore, disable ftrace branch profiling in the SEV startup routines, by disabling it for the entire SEV core source file.

---
 arch/x86/coco/sev/core.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/coco/sev/core.c +2 -0
index 8689854..b5c6c4a 100644
@@ -9,6 +9,8 @@
 
 #define pr_fmt(fmt)	"SEV: " fmt
 
+#define DISABLE_BRANCH_PROFILING
+
 #include <linux/sched/debug.h>	/* For show_regs() */
 #include <linux/percpu-defs.h>
 #include <linux/cc_platform.h>