Linux EFI development
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Vincent Mailhol" <mailhol@kernel.org>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] efi/libstub: reduce size by optimizing GUID storage
Date: Fri, 04 Sep 2026 18:31:01 +0200	[thread overview]
Message-ID: <a3367987-7e21-42e2-853c-df64449af9a9@app.fastmail.com> (raw)
In-Reply-To: <20260903-libstub_guid_cleanup-v1-0-06fcb6216975@kernel.org>



On Thu, 3 Sep 2026, at 23:25, Vincent Mailhol wrote:
> The EFI stub is size-sensitive. Several call sites currently pass GUID
> macro addresses directly, or keep GUID objects as automatic local
> variables. With gcc, this materializes the GUID at the call site,
> resulting in several assembly instructions. Using static storage instead
> emits 16 bytes of GUID data and only one instruction to pass its
> address.
>
> The first two patches convert direct GUID references and automatic GUID
> variables to static storage. The last patch factors GUID objects that
> are shared within the same translation unit.
>
> For the full series, on an x86_64 build with gcc 15.3.0, bloat-o-meter
> reports:
>
>   add/remove: 21/0 grow/shrink: 0/12 up/down: 400/-1200 (-800)
>   Function                                     old     new   delta
>   tbl_guid                                       -      32     +32
>   pci_proto                                      -      32     +32
>   guid                                           -      32     +32
>   cc_guid                                        -      32     +32
>   tpm2_guid                                      -      16     +16
>   text_to_dp_guid                                -      16     +16
>   tcg2_guid                                      -      16     +16
>   smbios_guid                                    -      16     +16
>   rng_table_guid                                 -      16     +16
>   rng_proto                                      -      16     +16
>   rng_algo_raw                                   -      16     +16
>   proto                                          -      16     +16
>   linux_eventlog_guid                            -      16     +16
>   lf2_proto_guid                                 -      16     +16
>   info_guid                                      -      16     +16
>   graphics_output_guid                           -      16     +16
>   fs_proto                                       -      16     +16
>   edid_discovered_guid                           -      16     +16
>   edid_active_guid                               -      16     +16
>   console_out_device_guid                        -      16     +16
>   apple_set_os_guid                              -      16     +16
>   efi_get_memory_map                           707     696     -11
>   efi_pci_disable_bridge_busmaster            1199    1184     -15
>   efi_get_random_bytes                         216     188     -28
>   efi_remap_image                              357     328     -29
>   efi_load_initrd                             1113    1065     -48
>   efi_get_smbios_record                        283     226     -57
>   efi_random_get_seed                         1368    1297     -71
>   efi_measure_tagged_event                     935     854     -81
>   efi_retrieve_eventlog                       1686    1570    -116
>   handle_cmdline_files                        2501    2341    -160
>   efi_stub_entry                              4180    3953    -227
>   efi_setup_graphics                          2210    1853    -357
>   Total: Before=29223, After=28423, chg -2.74%
>
> See this as my penitence for adding the BLI feature: I am giving you
> back the bytes that I consumed, and even more.
>

Thanks :-)

It would be nice if we could rely on SHF_MERGE sections here, but that
doesn't seem tractable in the context of the stub.


> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
> ---
> Vincent Mailhol (3):
>       efi/libstub: move direct GUID references to static storage
>       efi/libstub: make local GUID variables static
>       efi/libstub: factor shared static GUID variables
>

Applied to efi/next

      parent reply	other threads:[~2026-09-04 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 21:25 [PATCH 0/3] efi/libstub: reduce size by optimizing GUID storage Vincent Mailhol
2026-09-03 21:25 ` [PATCH 1/3] efi/libstub: move direct GUID references to static storage Vincent Mailhol
2026-09-03 21:25 ` [PATCH 2/3] efi/libstub: make local GUID variables static Vincent Mailhol
2026-09-03 21:25 ` [PATCH 3/3] efi/libstub: factor shared static GUID variables Vincent Mailhol
2026-09-04 16:31 ` Ard Biesheuvel [this message]

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=a3367987-7e21-42e2-853c-df64449af9a9@app.fastmail.com \
    --to=ardb@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol@kernel.org \
    /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