This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM335x: Kernel boot time optimization

I am re basing kernel from 4.19 to 5.10 for our customized am335x board

In 4.19 "customize_machine" was executing fast and random number generator executing after some time
as in log

[    0.100390] calling  customize_machine+0x0/0x38 @ 1
[    0.103268] audit: type=2000 audit(0.092:1): state=initialized audit_enabled=0 res=1
[    0.105919] OMAP GPIO hardware version 0.1
[    0.106057] probe of 44e07000.gpio returned 1 after 0 usecs
[    0.107064] probe of 4804c000.gpio returned 1 after 0 usecs
[    0.108112] probe of 481ac000.gpio returned 1 after 0 usecs
[    0.109061] probe of 481ae000.gpio returned 1 after 0 usecs
[    0.114144] probe of 50000000.gpmc returned 0 after 0 usecs
[    0.115921] initcall customize_machine+0x0/0x38 returned 0 after 15625 usecs
[    0.115939] calling  init_atags_procfs+0x0/0x110 @ 1

[    0.610968] calling  omap_rng_driver_init+0x0/0x28 @ 1
[    0.611885] omap_rng 48310000.rng: Random Number Generator ver. 20
[    0.611940] probe of 48310000.rng returned 1 after 777 usecs
[    0.612020] initcall omap_rng_driver_init+0x0/0x28 returned 0 after 1008 usecs
[    0.612029] calling  drm_kms_helper_init+0x0/0x28 @ 1
[    0.612075] initcall drm_kms_helper_init+0x0/0x28 returned 0 after 35 usecs
[    0.612082] calling  drm_core_init+0x0/0xf8 @ 1
[    0.612160] initcall drm_core_init+0x0/0xf8 returned 0 after 64 usecs
[    0.612169] calling  tilcdc_drm_init+0x0/0x40 @ 1
[    0.612782] probe of panel returned 1 after 347 usecs
[    0.614254] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    0.614263] [drm] No driver support for vblank timestamp query.
[    0.614452] random: fast init done
[    0.614594] random: crng init done

but in 5.10  "customize_machine" taking more time and random init "random: fast init done"
occurring in between "customize_machine"  because of that it taking 1 second extra to boot
as in log

[    0.042043] calling  customize_machine+0x0/0x30 @ 1
[    0.048436] audit: type=2000 audit(0.032:1): state=initialized audit_enabled=0 res=1
[    1.032405] random: fast init done
[    1.042450] initcall customize_machine+0x0/0x30 returned 0 after 976562 usecs
[    1.042469] calling  init_atags_procfs+0x0/0x108 @ 1

[    1.722308] calling  omap_rng_driver_init+0x0/0x20 @ 1
[    1.723237] omap_rng 48310000.rng: Random Number Generator ver. 20
[    1.723398] initcall omap_rng_driver_init+0x0/0x20 returned 0 after 1041 usecs
[    1.723411] calling  drm_kms_helper_init+0x0/0x20 @ 1
[    1.723453] initcall drm_kms_helper_init+0x0/0x20 returned 0 after 32 usecs
[    1.723462] calling  drm_core_init+0x0/0xc8 @ 1
[    1.723545] initcall drm_core_init+0x0/0xc8 returned 0 after 68 usecs
[    1.723556] calling  tilcdc_drm_init+0x0/0x34 @ 1
[    1.725869] random: crng init done


any suggestion to reduce time in "customize_machine" and call "random: fast init done" after some time

  • Hi,

    There is no maintainable way to adjust kernel module boot order to move random init later, and its order shouldn't matter in the overall Linux boot process.

    Regarding the running time of customize_machine(), you would have to profile it to understand why it takes much longer in kernel v5.10. TI has not released kernel v5.10 for AM335x, so we won't be able to provide much support on this matter. But here is the call flow in customize_machine() after a quick code review.

    customize_machine()                    in arch/arm/kernel/setup.c
        init_machine()
            omap_generic_init()            in arch/arm/mach-omap2/board-generic.c
                pdata_quirks_init()        in arch/arm/mach-omap2/pdata-quirks.c
                omap_soc_device_init()     in arch/arm/mach-omap2/id.c
                    soc_device_register()  in drivers/base/soc.c