[U-Boot] [PATCH v2 0/21] Add tracing functionality to U-Boot

Simon Glass sjg at chromium.org
Tue Jun 11 20:14:32 CEST 2013


This series adds a tracing feature to U-Boot which is useful for
profiling boot time and other purposes.

The core trace library relies on standard gcc function instrumentation
and a microsecond timer which should work correctly on almost any
architecture. Generic board is used to avoid the need to add the same
code in multiple places (CONFIG_SYS_GENERIC_BOARD).

Tracing must be built into the U-Boot image at build time, but can be
paused and resumed while running. A trace buffer is used to collect
trace information. This buffer can then be transmitted to a host for
processing. A host-based processing tool is provided which converts the
data to the same format used by Linux, and that can be read by the
pytimechart GUI tool.

A U-Boot 'trace' command provides access to the trace information,
including support for writing it to memory in a few forms.

Support is provided for stopping tracing at the last possible moment in
the bootm process (just before U-Boot jumps to the OS). This is done with
a new 'fake go' command, which allows bootm to go through the motions of
an OS boot without actually committing to it. Once the 'fake go' is
complete, U-Boot can stop tracing and continue execution to transmit the
trace information to the host, before jumping to the OS for real.

The system is tested on sandbox, x86 and smdk5250/snow. It may work
correctly on Tegra and other machines but unfortunately has not been
tested. A simple test script is provided for sandbox, along with
documentation on how to use the feature.

This feature has been successfully used alongside bootstage to locate
bottlenecks and reduce overall boot time.

Changes in v2:
- Add cast to clarfy argument type on sandbox and x86
- Add new patch to convert PCI inline functions to static inline
- Add new patch to enable tracing on Exynos5
- Add new patch to enable tracing on coreboot
- Add new patch to fix FIT compile error for x86
- Add new patch to fix compiler warning in do_mem_loop()
- Add new patch to support tracing on x86
- Add notification that the trace test has passed
- Adjust printf() type to avoid warning on x86
- Change init sequence so that mon_len is set up before trace
- Fix bracket typo
- Fix missing BOOTM_STATE_OS_PREP in do_bootm()
- Fix tag to use : instead of ;
- Rebase on top of mainline
- Remove unneeded debug printf()s for non RFC version
- Update board_f support for new mainline relocaddr use

Simon Glass (21):
  pci: Convert extern inline functions to static inline
  x86: Correct missing local variable in bootm
  Fix missing return in do_mem_loop()
  Show stdout on error in fit-test
  bootstage: Correct printf types
  Add function to print a number with grouped digits
  Add trace library
  Add a trace command
  Support tracing in config.mk when enabled
  Add trace support to generic board
  Add proftool to decode profile data
  sandbox: Support trace feature
  Add a simple test for sandbox trace
  Clarify bootm OS arguments
  Refactor the bootm command to reduce code duplication
  Add a 'fake' go command to the bootm command
  arm: Implement the 'fake' go command
  exynos: Avoid function instrumentation for microsecond timer
  exynos: config: Add tracing options
  x86: Support tracing function
  x86: config: Add tracing options

 Makefile                               |   3 +-
 arch/arm/cpu/armv7/s5p-common/timer.c  |   2 +-
 arch/arm/include/asm/arch-exynos/cpu.h |  10 +-
 arch/arm/lib/bootm.c                   |  33 +-
 arch/microblaze/lib/bootm.c            |   4 +-
 arch/nios2/lib/bootm.c                 |   4 +-
 arch/openrisc/lib/bootm.c              |   4 +-
 arch/sandbox/cpu/cpu.c                 |   2 +-
 arch/sandbox/cpu/os.c                  |   2 +-
 arch/x86/include/asm/global_data.h     |   2 +-
 arch/x86/include/asm/msr.h             |   3 +-
 arch/x86/include/asm/u-boot-x86.h      |   2 +-
 arch/x86/lib/bootm.c                   |   2 +
 arch/x86/lib/gcc.c                     |   4 +-
 arch/x86/lib/tsc_timer.c               |   6 +-
 common/Makefile                        |   1 +
 common/board_f.c                       |  17 +-
 common/board_r.c                       |  11 +
 common/bootstage.c                     |  26 +-
 common/cmd_bootm.c                     | 514 ++++++++++++++-------------
 common/cmd_mem.c                       |   2 +
 common/cmd_trace.c                     | 133 +++++++
 common/image-fdt.c                     |  13 +-
 common/image.c                         |  22 +-
 config.mk                              |  11 +-
 doc/README.trace                       | 361 +++++++++++++++++++
 include/asm-generic/global_data.h      |   3 +
 include/common.h                       |   4 +
 include/configs/coreboot.h             |   7 +
 include/configs/exynos5250-dt.h        |   8 +
 include/configs/sandbox.h              |  13 +
 include/image.h                        |  17 +-
 include/pci.h                          |   4 +-
 include/trace.h                        | 125 +++++++
 include/vsprintf.h                     |  11 +
 lib/Makefile                           |   1 +
 lib/trace.c                            | 379 ++++++++++++++++++++
 lib/vsprintf.c                         |  16 +
 test/image/test-fit.py                 |  19 +-
 test/trace/test-trace.sh               |  89 +++++
 tools/.gitignore                       |   1 +
 tools/Makefile                         |   6 +
 tools/proftool.c                       | 611 +++++++++++++++++++++++++++++++++
 43 files changed, 2164 insertions(+), 344 deletions(-)
 create mode 100644 common/cmd_trace.c
 create mode 100644 doc/README.trace
 create mode 100644 include/trace.h
 create mode 100644 lib/trace.c
 create mode 100755 test/trace/test-trace.sh
 create mode 100644 tools/proftool.c

-- 
1.8.3



More information about the U-Boot mailing list