public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 00/19] efi_loader: non-volatile variables support
Date: Tue, 5 Nov 2019 14:18:24 +0900	[thread overview]
Message-ID: <20191105051823.GA22427@linaro.org> (raw)
In-Reply-To: <20191104160003.1B04C24009F@gemini.denx.de>

Wolfgang,

On Mon, Nov 04, 2019 at 05:00:03PM +0100, Wolfgang Denk wrote:
> Dear Takahiro,
> 
> In message <20191101060434.GV10448@linaro.org> you wrote:
> >
> > > This is even worse, as instead of adding a single argument to a
> > > function call you are adding two full fucntion calls.
> > > 
> > > But why would that be needed?
> > > 
> > > U-Boot is strictly single tasking.  You always know what the current
> > > context is, and nobody will change it behind your back.
> > > 
> > > And UEFI functions are not being called in random places, they are
> > > limited to a small set of UEFI commands, right?  So why do you not
> > > just enter UEFI context when you start executing UEFI code, and
> > > restore the rpevious state when returning to non-UEFI U-Boot?
> >
> > Can you elaborate What you mean by "entering UEFI context"?
> 
> You wrote:
> 
> | So do you always admit the following coding?
> | ===8<===
> |   (in some UEFI function)
> |   ...
> |   old_ctx = env_set_context(ctx_uefi);
> |   env_set(var, value);
> |   env_set_context(old_ctx);
> |   ...
> | ===>8===
> 
> In this code, the function call ``env_set_context(ctx_uefi)'' would
> enter the UEFI context, right?  This is what I mean.

My point is not there. See below.

> > What I'm thinking of here is that we would add one more member field, which
> > is a pointer to my "env_context," in GD and change it in env_set_context().
> > This can be defined even as an inline function.
> 
> Yes, this is OK - I think I understood this already.

So we get one step closer.

> What I mean is that such a call of env_set_context() is not needed
> for each and every call of other env_*() functions.
> 
> If I understand correctly, only the UEFI specific commands will
> actually care about UEFI contexts - most likely no code outside
> cmd/nvedit_efi.c ?

No. There are a couple of reasons:
1) Other commands include cmd/bootefi.c (and cmd/efidebug.c).
2) Any EFI application, once kicked off, can directly call EFI APIs.
3) Bunch of EFI features (either services or protocols) fundamentally
   reply on U-Boot native functionality, including devices (disk,
   network, console, ...), file systems and so on.

   So calling such UEFI interfaces may eventually end up with invoking
   env_*() *indirectly*. I don't come up with good examples (probably,
   network is a candidate) now but such a situation will be quite likely
   and we should not exclude such a possibility in the future.

> So you have pretty clear entry and exit points into and from the
> UEFI world, and it should be sufficient to set and restore this
> context only then.

My point is what entry or exit points are.
They cannot be at each command, but *each* API.
So, let me repeat this example:
===8<===
   (in some UEFI function)
   ...
   old_ctx = env_set_context(ctx_uefi);
   env_set(var, value);
   env_set_context(old_ctx);
   ...
===>8===

This can be at most relaxed to:
===8<===
some_efi_api(...)
{
   old_ctx = env_set_context(ctx_uefi);
   ...
   (env_get(var1);)
   ...
   env_set(var2, value);
   ...
   env_set_context(old_ctx);

   return;
}
===>8===
It is merely a matter of optimization.
This is the reason that I want to introduce env_set_context().

Thanks,
-Takahiro Akashi

> > I don't see why you deny such a simple solution with lots of flexibility.
> 
> I am concerned about code size and execution speed.  So far, you did
> not provide any such numbers, even though I repeatedly asked for the
> size impact, especially for non-UEFI systems.
> 
> Please keep in mind that there are many cases where we need access
> to the environment already in SPL, and on all systems where security
> plays any role we must have the same set of features enabled for the
> environment code in SPL and TPL (if these need access to the
> envronment) as in U-Boot proper, and memory is a precious resource
> there.
> 
> Best regards,
> 
> Wolfgang Denk
> 
> -- 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> You may call me by my name, Wirth, or by my value, Worth.
> - Nicklaus Wirth

      parent reply	other threads:[~2019-11-05  5:18 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05  8:21 [U-Boot] [PATCH v5 00/19] efi_loader: non-volatile variables support AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 01/19] env: extend interfaces allowing for env contexts AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 02/19] env: define env context for U-Boot environment AKASHI Takahiro
2019-09-05 19:43   ` Heinrich Schuchardt
2019-09-06  0:41     ` AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 03/19] env: nowhere: rework with new env interfaces AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 04/19] env: flash: support multiple env contexts AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 05/19] env: fat: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 06/19] hashtable: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 07/19] api: converted with new env interfaces AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 08/19] arch: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 09/19] board: " AKASHI Takahiro
2019-09-05 12:02   ` Lukasz Majewski
2019-09-06  0:34     ` AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 10/19] cmd: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 11/19] common: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 12/19] disk: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 13/19] drivers: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 14/19] fs: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 15/19] lib: converted with new env interfaces (except efi_loader) AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 16/19] net: converted with new env interfaces AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 17/19] post: " AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 18/19] env, efi_loader: define env context for UEFI variables AKASHI Takahiro
2019-09-05 19:37   ` Heinrich Schuchardt
2019-09-06  0:54     ` AKASHI Takahiro
2019-09-05  8:21 ` [U-Boot] [PATCH v5 19/19] efi_loader: variable: rework with new env interfaces AKASHI Takahiro
2019-09-05  8:31 ` [U-Boot] [PATCH v5 00/19] efi_loader: non-volatile variables support AKASHI Takahiro
2019-10-01  6:28 ` AKASHI Takahiro
2019-10-23  6:53   ` AKASHI Takahiro
2019-10-25  7:06     ` Wolfgang Denk
2019-10-25  7:56       ` AKASHI Takahiro
2019-10-25 13:25         ` Wolfgang Denk
2019-10-28  1:14           ` AKASHI Takahiro
2019-10-29 13:28             ` Wolfgang Denk
2019-11-01  6:04               ` AKASHI Takahiro
2019-11-04 16:00                 ` Wolfgang Denk
2019-11-04 16:16                   ` Tom Rini
2019-11-05  5:18                   ` AKASHI Takahiro [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=20191105051823.GA22427@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --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