Skip to contentSkip to conversation

bootstage: stash boot records to reserved mem before kernel handoff

RFC PATCH Tom Rini 2 participants 2 messages Aug 22, 2025 – Sep 16, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Tom Rini

author
#1 lore raw
Quoted 62 lines · vishnu singh

From: Vishnu Singh <[email protected]>

U-Boot now stashes its bootstage buffer into a reserved memory region whenever CONFIG_BOOTSTAGE_STASH is enabled, just before exiting to the kernel. This allows a post boot parser to read a unified timeline (SPL→U-Boot→Kernel→MCU/DSP) directly from DDR, enabling standardized and repeatable boot-time profiling across releases and SoCs.

Change summary:
Call bootstage_stash_default() in announce_and_cleanup()
when CONFIG_BOOTSTAGE_STASH is set.

Reference boot-time parser utility:
https://github.com/v-singh1/boot-time-parse

Sample boot time report:
+--------------------------------------------------------------------+
am62xx-evm Boot Time Report
+--------------------------------------------------------------------+
Device Power On : 0 ms
SPL Time : 843 ms
U-Boot Time : 2173 ms
Kernel handoff time : 462 ms
Kernel Time : 2522 ms
Total Boot Time : 6000 ms
+--------------------------------------------------------------------+

+--------------------------------------------------------------------+
Bootloader and Kernel Boot Records
+--------------------------------------------------------------------+
BOOTSTAGE_AWAKE = 0 ms (+ 0 ms)
BOOTSTAGE_START_UBOOT_F = 843 ms (+ 0 ms)
BOOTSTAGE_ACCUM_DM_F = 843 ms (+ 0 ms)
BOOTSTAGE_START_UBOOT_R = 1951 ms (+1108 ms)
BOOTSTAGE_ACCUM_DM_R = 1951 ms (+ 0 ms)
BOOTSTAGE_NET_ETH_START = 2032 ms (+ 81 ms)
BOOTSTAGE_NET_ETH_INIT = 2053 ms (+ 21 ms)
BOOTSTAGE_MAIN_LOOP = 2055 ms (+ 2 ms)
BOOTSTAGE_START_MCU = 2661 ms (+606 ms)
BOOTSTAGE_BOOTM_START = 2959 ms (+298 ms)
BOOTSTAGE_RUN_OS = 3016 ms (+ 57 ms)
BOOTSTAGE_BOOTM_HANDOFF = 3016 ms (+ 0 ms)
BOOTSTAGE_KERNEL_START = 3478 ms (+462 ms)
BOOTSTAGE_KERNEL_END = 6000 ms (+2522 ms)
+--------------------------------------------------------------------+

+--------------------------------------------------------------------+
MCU Boot Records
+--------------------------------------------------------------------+
MCU_AWAKE = 2661 ms (+ 0 ms)
BOARD_PERIPHERALS_INIT = 2661 ms (+ 0 ms)
MAIN_TASK_CREATE = 2661 ms (+ 0 ms)
FIRST_TASK = 2662 ms (+ 1 ms)
DRIVERS_OPEN = 2662 ms (+ 0 ms)
BOARD_DRIVERS_OPEN = 2662 ms (+ 0 ms)
IPC_SYNC_FOR_LINUX = 6636 ms (+3974 ms)
IPC_REGISTER_CLIENT = 6636 ms (+ 0 ms)
IPC_SUSPEND_TASK = 6636 ms (+ 0 ms)
IPC_RECEIVE_TASK = 6636 ms (+ 0 ms)
IPC_SYNC_ALL = 6787 ms (+151 ms)
+--------------------------------------------------------------------+

Quoted 1 line

In that it looks like x86 already does a similar thing, this is a good idea and I wonder if some tooling already exists to read it.

Quoted 9 lines
---
 arch/arm/lib/bootm.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/lib/bootm.c +0 -0
index 7eb764e1f4e..b01e763ff28 100644

arch/arm/lib/bootm.c static void announce_and_cleanup(int fake) · line 61

Quoted 5 lines
arch/arm/lib/bootm.c +2 -0
@@ -57,6 +57,9 @@ static void announce_and_cleanup(int fake)
 #ifdef CONFIG_BOOTSTAGE_FDT
 	bootstage_fdt_add_report();
 #endif
+	if (IS_ENABLED(CONFIG_BOOTSTAGE_STASH))
+		bootstage_stash_default();

You don't need to guard the call, the default bootstage_stash_default() is a return 0 call when CONFIG_BOOTSTAGE_STASH isn't set.

Signature · 1 line
Tom
#2 lore raw
Quoted 72 lines · Tom Rini
Quoted 62 lines · vishnu singh

From: Vishnu Singh <[email protected]>

U-Boot now stashes its bootstage buffer into a reserved memory region whenever CONFIG_BOOTSTAGE_STASH is enabled, just before exiting to the kernel. This allows a post boot parser to read a unified timeline (SPL→U-Boot→Kernel→MCU/DSP) directly from DDR, enabling standardized and repeatable boot-time profiling across releases and SoCs.

Change summary:
Call bootstage_stash_default() in announce_and_cleanup()
when CONFIG_BOOTSTAGE_STASH is set.

Reference boot-time parser utility:
https://github.com/v-singh1/boot-time-parse

Sample boot time report:
+--------------------------------------------------------------------+
am62xx-evm Boot Time Report
+--------------------------------------------------------------------+
Device Power On : 0 ms
SPL Time : 843 ms
U-Boot Time : 2173 ms
Kernel handoff time : 462 ms
Kernel Time : 2522 ms
Total Boot Time : 6000 ms
+--------------------------------------------------------------------+

+--------------------------------------------------------------------+
Bootloader and Kernel Boot Records
+--------------------------------------------------------------------+
BOOTSTAGE_AWAKE = 0 ms (+ 0 ms)
BOOTSTAGE_START_UBOOT_F = 843 ms (+ 0 ms)
BOOTSTAGE_ACCUM_DM_F = 843 ms (+ 0 ms)
BOOTSTAGE_START_UBOOT_R = 1951 ms (+1108 ms)
BOOTSTAGE_ACCUM_DM_R = 1951 ms (+ 0 ms)
BOOTSTAGE_NET_ETH_START = 2032 ms (+ 81 ms)
BOOTSTAGE_NET_ETH_INIT = 2053 ms (+ 21 ms)
BOOTSTAGE_MAIN_LOOP = 2055 ms (+ 2 ms)
BOOTSTAGE_START_MCU = 2661 ms (+606 ms)
BOOTSTAGE_BOOTM_START = 2959 ms (+298 ms)
BOOTSTAGE_RUN_OS = 3016 ms (+ 57 ms)
BOOTSTAGE_BOOTM_HANDOFF = 3016 ms (+ 0 ms)
BOOTSTAGE_KERNEL_START = 3478 ms (+462 ms)
BOOTSTAGE_KERNEL_END = 6000 ms (+2522 ms)
+--------------------------------------------------------------------+

+--------------------------------------------------------------------+
MCU Boot Records
+--------------------------------------------------------------------+
MCU_AWAKE = 2661 ms (+ 0 ms)
BOARD_PERIPHERALS_INIT = 2661 ms (+ 0 ms)
MAIN_TASK_CREATE = 2661 ms (+ 0 ms)
FIRST_TASK = 2662 ms (+ 1 ms)
DRIVERS_OPEN = 2662 ms (+ 0 ms)
BOARD_DRIVERS_OPEN = 2662 ms (+ 0 ms)
IPC_SYNC_FOR_LINUX = 6636 ms (+3974 ms)
IPC_REGISTER_CLIENT = 6636 ms (+ 0 ms)
IPC_SUSPEND_TASK = 6636 ms (+ 0 ms)
IPC_RECEIVE_TASK = 6636 ms (+ 0 ms)
IPC_SYNC_ALL = 6787 ms (+151 ms)
+--------------------------------------------------------------------+

Quoted 1 line

In that it looks like x86 already does a similar thing, this is a good idea and I wonder if some tooling already exists to read it.

Quoted 4 lines
---
  arch/arm/lib/bootm.c | 3 +++
  1 file changed, 3 insertions(+)
Quoted 12 lines

arch/arm/lib/bootm.c static void announce_and_cleanup(int fake) · line 61

Quoted 10 lines
arch/arm/lib/bootm.c +2 -0
index 7eb764e1f4e..b01e763ff28 100644
@@ -57,6 +57,9 @@ static void announce_and_cleanup(int fake)
  #ifdef CONFIG_BOOTSTAGE_FDT
  	bootstage_fdt_add_report();
  #endif
+	if (IS_ENABLED(CONFIG_BOOTSTAGE_STASH))
+		bootstage_stash_default();

You don't need to guard the call, the default bootstage_stash_default() is a return 0 call when CONFIG_BOOTSTAGE_STASH isn't set.

Will update and send the patch