From: Michal Simek <michal.simek@amd.com>
To: Simon Glass <sjg@chromium.org>,
Jerome Forissier <jerome.forissier@linaro.org>
Cc: Tom Rini <trini@konsulko.com>,
u-boot@lists.denx.de, git@xilinx.com, neal.frager@amd.com,
Christian Marangi <ansuelsmth@gmail.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Jerome Forissier <jerome.forissier@linaro.org>,
Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
Sughosh Ganu <sughosh.ganu@linaro.org>
Subject: Re: [PATCH v2 2/7] common: binman: Calling initr_binman() when BINMAN_FDT
Date: Tue, 10 Dec 2024 13:40:50 +0100 [thread overview]
Message-ID: <3ed2af58-9e45-435f-aba7-a07f775f76cf@amd.com> (raw)
In-Reply-To: <CAFLszTgR7A5N5NOpE0HX0j-DqQ5QqLR=391Y5tEJ00HPFfshTw@mail.gmail.com>
Hi Simon,
On 12/9/24 20:27, Simon Glass wrote:
> Hi Michal,
>
> On Mon, 9 Dec 2024 at 11:34, Michal Simek <michal.simek@amd.com> wrote:
>>
>>
>>
>> On 12/9/24 16:47, Simon Glass wrote:
>>> Hi,
>>>
>>> On Mon, 9 Dec 2024 at 08:32, Tom Rini <trini@konsulko.com> wrote:
>>>>
>>>> On Mon, Dec 09, 2024 at 04:26:15PM +0100, Michal Simek wrote:
>>>>>
>>>>>
>>>>> On 12/6/24 20:20, Simon Glass wrote:
>>>>>> On Fri, 1 Nov 2024 at 03:18, Michal Simek <michal.simek@amd.com> wrote:
>>>>>>>
>>>>>>> Calling empty function when BINMAN_FDT is adding +64B for nothing which is
>>>>>>> not helping on size sensitive configurations as Xilinx mini configurations.
>>>>>>>
>>>>>>> Signed-off-by: Michal Simek <michal.simek@amd.com>
>>>>>>> ---
>>>>>>>
>>>>>>> Changes in v2:
>>>>>>> - new patch
>>>>>>>
>>>>>>> From my perspective there is no reason to call empty function. It is just
>>>>>>> increase footprint for nothing and we are not far from that limit now.
>>>>>>>
>>>>>>> ---
>>>>>>> common/board_r.c | 7 +++----
>>>>>>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>>>>
>>>>>> This is a bit odd, though. Do you have LTO enabled?
>>>>>>
>>>>>
>>>>> yes LTO is enabled. And there are other candidates like this.
>>>>> Is LTO able to fix function arrays which is calling empty function?
>>>>>
>>>>> (without this patch)
>>>>>
>>>>> 00000000fffc0eb4 <initr_of_live>:
>>>>> fffc0eb4: 52800000 mov w0, #0x0 // #0
>>>>> fffc0eb8: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0ebc <initr_dm_devices>:
>>>>> fffc0ebc: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ec0: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0ec4 <initr_bootstage>:
>>>>> fffc0ec4: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ec8: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0ecc <power_init_board>:
>>>>> fffc0ecc: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ed0: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0ed4 <initr_announce>:
>>>>> fffc0ed4: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ed8: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0edc <initr_binman>:
>>>>> fffc0edc: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ee0: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0ee4 <initr_status_led>:
>>>>> fffc0ee4: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ee8: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0eec <initr_boot_led_blink>:
>>>>> fffc0eec: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ef0: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0ef4 <initr_boot_led_on>:
>>>>> fffc0ef4: 52800000 mov w0, #0x0 // #0
>>>>> fffc0ef8: d65f03c0 ret
>>>>>
>>>>> 00000000fffc0efc <initr_lmb>:
>>>>> fffc0efc: 52800000 mov w0, #0x0 // #0
>>>>> fffc0f00: d65f03c0 ret
>>>>
>>>> No, but maybe Simon would prefer if we marked all of the could-be-empty
>>>> functions as __maybe_unused and did:
>>>> CONFIG_IS_ENABLED(BINMAN_FDT, initr_binman),
>>>> etc in the list instead?
>>>
>>> Yes that looks better.
>>
>> But we are talking about using macro inside array at best with using #ifdefs.
>> Or maybe I am not seeing what you are saying.
>>
>>>
>>> Michal, see also [1] in case you can work out why it 'stopped
>>> working'. I could have sworn inlining the function was a win when it
>>> was applied, but no amount of toolchain juggling could make it be a
>>> win when I came back to it later.
>>
>> Are you saying that it worked in past?
>
> I wasn't able to verify that post facto, but I believe I do remember
> checking it at the time. If you read the original commit message:
>
> 47870afab92 initcall: Move to inline function
>
> The board_r init function was complaining that we are looping through
> an array, calling all our tiny init stubs sequentially via indirect
> function calls (which can't be speculated, so they are slow).
>
> The solution to that is pretty easy though. All we need to do is inline
> the function that loops through the functions and the compiler will
> automatically convert almost all indirect calls into direct inlined code.
>
> With this patch, the overall code size drops (by 40 bytes on riscv64)
> and boot time should become measurably faster for every target.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
>
> Despite this hopeful sentiment, I seriously doubt any improvement in boot time.
I am not able to replicate this observation on arm64 or riscv64.
Loop unrolling is not happening even if you pass -funroll-all-loops flag.
Maybe different toolchains should be used to see this behavior.
Thanks,
Michal
next prev parent reply other threads:[~2024-12-10 12:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 9:17 [PATCH v2 0/7] arm64: zynqmp: Convert platforms to use binman Michal Simek
2024-11-01 9:17 ` [PATCH v2 1/7] binman: Add option for pointing to separate description Michal Simek
2024-12-06 19:17 ` Simon Glass
2024-11-01 9:17 ` [PATCH v2 2/7] common: binman: Calling initr_binman() when BINMAN_FDT Michal Simek
2024-12-06 19:20 ` Simon Glass
2024-12-09 15:26 ` Michal Simek
2024-12-09 15:32 ` Tom Rini
2024-12-09 15:47 ` Simon Glass
2024-12-09 18:34 ` Michal Simek
2024-12-09 19:23 ` Tom Rini
2024-12-09 19:27 ` Simon Glass
2024-12-09 20:08 ` Tom Rini
2024-12-10 13:43 ` Michal Simek
2024-12-09 19:27 ` Simon Glass
2024-12-10 12:40 ` Michal Simek [this message]
2024-12-10 16:17 ` Simon Glass
2024-11-01 9:17 ` [PATCH v2 3/7] arm64: zynqmp: Describe empty binman node Michal Simek
2024-12-06 19:19 ` Simon Glass
2024-11-01 9:17 ` [PATCH v2 4/7] arm64: zynqmp: Add binman description for SOM Michal Simek
2024-12-06 19:19 ` Simon Glass
2024-11-01 9:17 ` [PATCH v2 5/7] arm64: zynqmp: Generate u-boot.itb and QSPI image via binman Michal Simek
2024-12-06 19:20 ` Simon Glass
2024-11-01 9:17 ` [PATCH v2 6/7] arm64: zynqmp: Remove mkimage fit script Michal Simek
2024-12-06 19:20 ` Simon Glass
2024-11-01 9:18 ` [PATCH v2 7/7] Makefile: Drop SPL_FIT_GENERATOR support Michal Simek
2024-12-06 19:16 ` Simon Glass
2024-11-11 11:46 ` [PATCH v2 0/7] arm64: zynqmp: Convert platforms to use binman Michal Simek
2024-11-27 7:59 ` Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ed2af58-9e45-435f-aba7-a07f775f76cf@amd.com \
--to=michal.simek@amd.com \
--cc=ansuelsmth@gmail.com \
--cc=git@xilinx.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jerome.forissier@linaro.org \
--cc=neal.frager@amd.com \
--cc=rasmus.villemoes@prevas.dk \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox