[U-Boot] [PATCH 0/4] Big acceleration of Kbuild performance

Masahiro Yamada yamada.m at jp.panasonic.com
Thu Feb 27 15:28:20 CET 2014


Kbuild brought about many advantages for us but
a significant performance regression was reported by
Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

1/4 through 3/4 are preparation for 4/4.

4/4 is what we really want to do.
By applying it, I think Kbuild will get much faster.

Simon,
Could you post the result of "time" command?
I want to know how fast Kbuild will be on your computer.

 How to apply this series ?
 --------------------------

This series depends on my other patches.

 [1] "Kbuild: A collection of trivial refactoring" series

  8/8 is not applicable any more.
  Please apply 1/8 thru 7/8.

 [2] kbuild: consolidate PLATFORM_LIBS
   http://patchwork.ozlabs.org/patch/324808/

Please apply above beforehand.

Instead, you can also try my local branch for easy test.

I pushed my local branch to my GitHub page.
Please try the following.

 (1) git clone git://github.com/masahir0y/u-boot-kbuild.git
 (2) cd u-boot-kbuild
 (3) git checkout optimize_v1

 How to test this series?
 ------------------------

This series is not big patches, but it might be difficult
to understand if Kbuild can build the equivalent outputs.

Are compiler options really handled the same as before?
The answer is Yes.

I examined ".*.cmd" files carefully.

And also I used md5sum to prove this series
still produces the same result as before.

You can double-check it by following the below steps.
Use my local branch.

 (1) git clone git://github.com/masahir0y/u-boot-kbuild.git
 (2) cd u-boot-kbuild
 (3) git checkout before_optimize_v1
 (4) Run "./MAKEALL"
     MD5SUM will be displayed. Dump all log to a file
 (5) git checkout optimize_v1
 (6) Run "./MAKEALL"
     MD5SUM will be displayed. Dump all log to another file
 (7) Compare files between (4) and (6)

Please notice commit 4542e50 (MAKEALL: Display MD5SUM)
This commit modifies MAKEALL to display MD5SUM of
 - ./u-boot.bin
 - spl/u-boot-spl.bin
 - tpl/u-boot-tpl.bin
 - examples/standalone/hello_world.bin



Masahiro Yamada (4):
  kbuild,blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
  kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBS
  config.mk: specify the exact path to standalone linker script
  kbuild: improve Kbuild speed

 Makefile                                | 13 +++++++------
 arch/arm/cpu/arm720t/tegra114/config.mk | 19 -------------------
 arch/arm/cpu/arm720t/tegra124/config.mk |  7 -------
 arch/arm/cpu/arm720t/tegra20/config.mk  | 10 ----------
 arch/arm/cpu/arm720t/tegra30/config.mk  | 19 -------------------
 arch/arm/lib/Makefile                   | 13 ++-----------
 arch/blackfin/config.mk                 |  1 +
 arch/mips/cpu/mips32/config.mk          |  3 ++-
 arch/mips/cpu/mips64/config.mk          |  3 ++-
 arch/mips/cpu/xburst/config.mk          |  3 ++-
 arch/mips/lib/Makefile                  |  7 +------
 arch/nds32/config.mk                    |  3 ++-
 arch/powerpc/lib/Makefile               |  6 +-----
 arch/sh/lib/Makefile                    | 14 ++------------
 arch/sparc/config.mk                    |  4 +++-
 arch/x86/config.mk                      |  2 +-
 board/bct-brettl2/config.mk             | 13 -------------
 board/bf518f-ezbrd/config.mk            | 13 -------------
 board/bf526-ezbrd/config.mk             | 13 -------------
 board/bf527-ad7160-eval/config.mk       | 13 -------------
 board/bf527-ezkit/config.mk             | 13 -------------
 board/bf527-sdp/config.mk               |  5 -----
 board/bf533-ezkit/config.mk             |  5 -----
 board/bf533-stamp/config.mk             |  5 -----
 board/bf537-stamp/config.mk             |  5 -----
 board/bf538f-ezkit/config.mk            |  5 -----
 board/bf548-ezkit/config.mk             |  5 -----
 board/bf561-acvilon/config.mk           |  5 -----
 board/bf561-ezkit/config.mk             |  5 -----
 board/br4/config.mk                     | 15 ---------------
 board/cm-bf527/config.mk                | 13 -------------
 board/cm-bf533/config.mk                |  5 -----
 board/cm-bf537e/config.mk               |  5 -----
 board/cm-bf537u/config.mk               |  5 -----
 board/cm-bf548/config.mk                |  5 -----
 board/cm-bf561/config.mk                |  5 -----
 board/ip04/config.mk                    |  5 -----
 board/pr1/config.mk                     | 15 ---------------
 board/tcm-bf518/config.mk               | 13 -------------
 board/tcm-bf537/config.mk               |  5 -----
 config.mk                               | 28 ++++++++++++++++++++--------
 examples/standalone/Makefile            |  5 ++---
 include/configs/bct-brettl2.h           |  2 +-
 include/configs/bf518f-ezbrd.h          |  2 +-
 include/configs/bf526-ezbrd.h           |  1 +
 include/configs/bf527-ad7160-eval.h     |  2 +-
 include/configs/bf527-ezkit.h           |  2 +-
 include/configs/bf527-sdp.h             |  2 +-
 include/configs/bf533-ezkit.h           |  2 +-
 include/configs/bf533-stamp.h           |  1 +
 include/configs/bf537-stamp.h           |  1 +
 include/configs/bf538f-ezkit.h          |  2 +-
 include/configs/bf548-ezkit.h           |  1 +
 include/configs/bf561-acvilon.h         |  2 +-
 include/configs/bf561-ezkit.h           |  1 +
 include/configs/br4.h                   |  2 +-
 include/configs/cm-bf527.h              |  2 +-
 include/configs/cm-bf533.h              |  2 +-
 include/configs/cm-bf537e.h             |  1 +
 include/configs/cm-bf537u.h             |  2 +-
 include/configs/cm-bf548.h              |  1 +
 include/configs/cm-bf561.h              |  2 +-
 include/configs/ip04.h                  |  1 +
 include/configs/pr1.h                   |  2 +-
 include/configs/tcm-bf518.h             |  2 +-
 include/configs/tcm-bf537.h             |  2 +-
 include/configs/tegra-common.h          |  4 ++++
 lib/Makefile                            |  2 ++
 scripts/Makefile.build                  | 10 +++++-----
 scripts/Makefile.lib                    |  7 +++----
 spl/Makefile                            |  9 ++++-----
 71 files changed, 90 insertions(+), 338 deletions(-)
 delete mode 100644 arch/arm/cpu/arm720t/tegra114/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra124/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra20/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk
 delete mode 100644 board/bct-brettl2/config.mk
 delete mode 100644 board/bf518f-ezbrd/config.mk
 delete mode 100644 board/bf526-ezbrd/config.mk
 delete mode 100644 board/bf527-ad7160-eval/config.mk
 delete mode 100644 board/bf527-ezkit/config.mk
 delete mode 100644 board/br4/config.mk
 delete mode 100644 board/cm-bf527/config.mk
 delete mode 100644 board/pr1/config.mk
 delete mode 100644 board/tcm-bf518/config.mk

-- 
1.8.3.2



More information about the U-Boot mailing list