u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: xypron.glpk@gmx.de
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>, u-boot@lists.denx.de
Subject: [RFC PATCH 0/2] Clean up protocol installation API
Date: Wed,  5 Oct 2022 18:26:00 +0300	[thread overview]
Message-ID: <20221005152603.3085754-1-ilias.apalodimas@linaro.org> (raw)

This RFC is trying to clean up the usage of the internal functions used
to manage the protocol and handle lifetimes.  Currently we arbitrarily
use either InstallProtocol, InstallMultipleProtocol and a combination of
efi_add_protocol, efi_create_handle, efi_delete_handle().  The latter
is the most problematic one since it blindly removes all protocols from
a handle and finally the handle itself.  This is prone to coding errors
Since someone might inadvertently delete a handle while other consumers
still use a protocol.

InstallProtocol is also ambiguous since the EFI spec only demands
InstallMultipleProtocol to test and guarantee a duplicate device path is
not inadvertently installed on two different handles.  So this patch
series is preparing the ground in order for InstallMultipleProtocol and
UnInstallMultipleProtocol to be used internally in U-Boot.

There is an example on bootefi.c demonstrating how the cleanup would
eventually look like.  If we agree on the direction, I'll clean up the
remaining callsites with InstallMultipleProtocol.

Size differences between old/new binary show that eventually we will
manage to reduce the overall code size by getting rid all the 
unneeded  EFI_CALL invocations

add/remove: 4/0 grow/shrink: 1/6 up/down: 1128/-892 (236)
Function                                     old     new   delta
__efi_install_multiple_protocol_interfaces       -     496    +496
__efi_uninstall_multiple_protocol_interfaces       -     412    +412
efi_uninstall_multiple_protocol_interfaces_ext       -     108    +108
efi_install_multiple_protocol_interfaces_ext       -     108    +108
efi_run_image                                288     292      +4
efi_initrd_register                          220     212      -8
efi_console_register                         344     336      -8
efi_disk_add_dev.part                        644     632     -12
efi_root_node_register                       256     240     -16
efi_uninstall_multiple_protocol_interfaces     472      84    -388
efi_install_multiple_protocol_interfaces     544      84    -460
Total: Before=547442, After=547678, chg +0.04%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Data                                         old     new   delta
Total: Before=101061, After=101061, chg +0.00%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
RO Data                                      old     new   delta
Total: Before=42925, After=42925, chg +0.00%

Ilias Apalodimas (2):
  efi_loader: define internal implementation of
    install/uninstallmultiple
  cmd: replace efi_create_handle/add_protocol with
    InstallMultipleProtocol

 cmd/bootefi.c                    |  13 ++-
 include/efi.h                    |   2 +
 include/efi_loader.h             |   6 +-
 lib/efi_loader/efi_boottime.c    | 180 ++++++++++++++++++++++++-------
 lib/efi_loader/efi_capsule.c     |  15 +--
 lib/efi_loader/efi_console.c     |  14 +--
 lib/efi_loader/efi_disk.c        |  10 +-
 lib/efi_loader/efi_load_initrd.c |  15 ++-
 lib/efi_loader/efi_root_node.c   |  44 ++++----
 9 files changed, 203 insertions(+), 96 deletions(-)

-- 
2.34.1


             reply	other threads:[~2022-10-05 15:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 15:26 Ilias Apalodimas [this message]
2022-10-05 15:26 ` [RFC PATCH 1/2] efi_loader: define internal implementations of install/uninstallmultiple Ilias Apalodimas
2022-10-06  1:49   ` AKASHI Takahiro
2022-10-06  3:02   ` Heinrich Schuchardt
2022-10-06  7:37     ` Ilias Apalodimas
2022-10-06 10:41     ` Ilias Apalodimas
2022-10-05 15:26 ` [RFC PATCH 2/2] cmd: replace efi_create_handle/add_protocol with InstallMultipleProtocol Ilias Apalodimas
2022-10-06  1:53   ` AKASHI Takahiro
2022-10-06  2:26     ` Heinrich Schuchardt
2022-10-06  7:38       ` Ilias Apalodimas
2022-10-06  9:43         ` Heinrich Schuchardt
2022-10-06  1:34 ` [RFC PATCH 0/2] Clean up protocol installation API AKASHI Takahiro
2022-10-06  6:55   ` Ilias Apalodimas
2022-10-06  9:54     ` Heinrich Schuchardt

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=20221005152603.3085754-1-ilias.apalodimas@linaro.org \
    --to=ilias.apalodimas@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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;
as well as URLs for NNTP newsgroup(s).