public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC, PATCH v4 00/16] efi_loader: non-volatile variables support
Date: Fri, 19 Jul 2019 08:50:18 +0200	[thread overview]
Message-ID: <20190719065018.968BE240049@gemini.denx.de> (raw)
In-Reply-To: <20190717082525.891-1-takahiro.akashi@linaro.org>

Dear Takahiro,

In message <20190717082525.891-1-takahiro.akashi@linaro.org> you wrote:
> # In version 4 of this patch set, the implementation is changed to meet
> # Wolfgang's requirements.

Thanks.

> * Each variable may have a third attribute, "variable storage."
>   There are three new flags defined:
>   ('flags' are a bit-wise representation of attributes.)
>
>     ENV_FLAGS_VARSTORAGE_VOLATILE: A variable only exists during runtime.
>     ENV_FLAGS_VARSTORAGE_NON_VOLATILE: A variable is persistent, but explicit
>         "load" and "save" command is required.
>     ENV_FLAGS_VARSTORAGE_NON_VOLATILE_AUTOSAVE: A variable is persistent,
>         any change will be written back to storage immediately.

Urgh... ENV_FLAGS_VARSTORAGE_NON_VOLATILE_AUTOSAVE is way too long,
and unnecessary complicated.  And we don't need 3 new flags, as ENV_FLAGS_VARSTORAGE_NON_VOLATILE
is the default anyway.

Please just define

	ENV_FLAGS_VOLATILE
and
	ENV_FLAGS_AUTOSAVE

> * Following those extensions, new interfaces are introduced:
>   for hashtable,
>     hsearch_r -> hsearch_ext
>     hmatch_r  -> hmatch_ext
>     hdelete_r -> hdelete_ext
>     himport_r -> himport_ext
>     hexport_r -> hexport_ext
>   for env,
>     env_save   -> env_save_ext
>     env_load   -> env_load_ext
>     env_import -> env_import_ext
>     env_export -> env_export_ext

Why do we need all these _ext names?  Please don't.  Just give the
newly added functions new names.

> * There is one thing visible to users; *Exported* variables now have
>   attribute information, which is appended to variable's name
>   in a format of ":xxx"
>   For example, 
>     => printenv
>        arch:san=arm
>        baudrate:san=115200
>        board:san=qemu-arm
>        ...
>   This information is necessary to preserve attributes across reboot
>   (save/load).

NAK. ':' is a legal character in a variable name, so you cannot use
it here for new purposes. For example:

	=> setenv baudrate:san foo
	=> printenv baudrate:san
	baudrate:san=foo

> * Each environment storage driver must be modified so as to be aware
>   of contexts. (See flash and fat in my patch set.)

I dislike this.  Can we not do all the different handling in a
central place, and basically leave the storage handlers unchanged?
They do not need to know about contexts; they just do the I/O.

> Known issues/restriction/TODO:
> * Existing interfaces may be marked obsolute or deleted in the future.

Which "existing interfaces" are you talking about?

> * ENV_IS_NOWHERE doesn't work if we want to disable U-Boot environment,
>   but still want to enable UEFI (hence UEFI variables).
>
>     -> One solution would be to add *intermediate* configurations
>        to set ENV_IS_NOWHERE properly in such a case.

Please explain what you have in ind here.  What I'm guessing from
this short description sounds not so good to me, but you may have
better ideas...

> * Any context won't have VARSTORAGE_NON_VOLATILE and
>   VARSTORAGE_NON_VOLATILE_AUTOSAVE entries at the same time. This is
>   because it will make "save" operation ugly and unnecessarily complicated
>   as we discussed in ML.

NAK.  Both the VOLATILE and the AUTOSAVE properties are interesting
features, and should be available to normale U-Boot environment
variables.  So the U-Boot context must support all variantes of
"normal" (persistent, non-autosave), volatile and autosave variables
at the same time.  If you don't need this for UEFI, ok.  But we want
to have this for U-Boot.

>     -> In this sense, NON_VOLATILE[or _AUTOSAVE] should be attributed
>        to a context itself.

No.  This is NOT what we need.

> * env_load() may lose some of compatibility; It now always imports variables
>   *without* clearing existing entries (i.e. H_NOCLEAR specified) in order
>   to support multiple contexts simultaneously.

NAK. This must ne fixed.

> * Unfortunately, some of existing U-Boot variables seem to be
>   "volatile" in nature. For example, we will see errors at boot time:
> 	...
> 	Loading Environment from Flash... OK
> 	## Error inserting "fdtcontroladdr" variable, errno=22
> 	In:    pl011 at 9000000
> 	Out:   pl011 at 9000000
> 	Err:   pl011 at 9000000
> 	## Error inserting "stdin" variable, errno=22
> 	## Error inserting "stdout" variable, errno=22
> 	## Error inserting "stderr" variable, errno=22
>
>     -> We will have to changes their attributes one-by-one.
> 	(Those can also be set through ENV_FLAGS_LIST_STATIC in env_flags.h).

I think your approach to fix this is wrong.  The problem should not
happen in the first place.  And no,  stdin/stdout/stderr are _not_
volatile.

> * As described above, attribute information is visible to users.
>   I'm afraid that it might lead to any incompatibility somewhere.
>   (I don't notice any issues though.)

Correct, the current code is incompatible.  This must be solved
differently.  Colon is a legal character in a variable name.

> * The whole area of storage will be saved at *every* update of
>   one UEFI variable. It should be optimized if possible.

This is only true for UEFI storage, right?

> You can also define a non-volatile variable from command interface:
> => setenv -e -nv FOO baa

This makes no sense.  Being non-volatile is the default.  This must
remain as is.  Only "volatile" and "autosave" are new attributes.

More comments with the patches...

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
It usually takes more than three weeks to prepare  a  good  impromptu
speech.                                                  - Mark Twain

  parent reply	other threads:[~2019-07-19  6:50 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  8:25 [U-Boot] [RFC, PATCH v4 00/16] efi_loader: non-volatile variables support AKASHI Takahiro
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 01/16] hashtable: extend interfaces to handle entries with context AKASHI Takahiro
2019-07-19  6:58   ` Wolfgang Denk
2019-07-19  7:44     ` AKASHI Takahiro
2019-07-19  9:49       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 02/16] env: extend interfaces to import/export U-Boot environment per context AKASHI Takahiro
2019-07-19  7:38   ` Wolfgang Denk
2019-07-19  8:15     ` AKASHI Takahiro
2019-07-19 10:04       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 03/16] env: extend interfaces to label variable with context AKASHI Takahiro
2019-07-19  8:09   ` Wolfgang Denk
2019-07-19  8:25     ` AKASHI Takahiro
2019-07-19 13:06       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 04/16] env: flash: add U-Boot environment context support AKASHI Takahiro
2019-07-19  8:14   ` Wolfgang Denk
2019-07-19  8:30     ` AKASHI Takahiro
2019-07-19 13:11       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 05/16] env: fat: " AKASHI Takahiro
2019-07-19  8:21   ` Wolfgang Denk
2019-07-19  8:35     ` AKASHI Takahiro
2019-07-19 13:14       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 06/16] env: add variable storage attribute support AKASHI Takahiro
2019-07-19  8:35   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 07/16] env: add/expose attribute helper functions for hashtable AKASHI Takahiro
2019-07-19  8:36   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 08/16] hashtable: import/export entries with flags AKASHI Takahiro
2019-07-19  8:38   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 09/16] hashtable: extend hdelete_ext for autosave AKASHI Takahiro
2019-07-19  8:41   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 10/16] env: save non-volatile variables only AKASHI Takahiro
2019-07-19  8:45   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 11/16] env: save a context immediately if 'autosave' variable is changed AKASHI Takahiro
2019-07-19  8:48   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 12/16] env: extend interfaces to get/set attributes AKASHI Takahiro
2019-07-19  8:50   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 13/16] cmd: env: show variable storage attribute in "env flags" command AKASHI Takahiro
2019-07-19  9:05   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC,PATCH v4 14/16] env: fat: support UEFI context AKASHI Takahiro
2019-07-19  9:08   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 15/16] env, efi_loader: define flags for well-known global UEFI variables AKASHI Takahiro
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 16/16] efi_loader: variable: rework with new extended env interfaces AKASHI Takahiro
2019-07-17 18:53   ` Heinrich Schuchardt
2019-07-18  0:13     ` AKASHI Takahiro
2019-07-17 19:05 ` [U-Boot] [RFC, PATCH v4 00/16] efi_loader: non-volatile variables support Heinrich Schuchardt
2019-07-18  0:04   ` AKASHI Takahiro
2019-07-19  6:50 ` Wolfgang Denk [this message]
2019-07-19  7:36   ` AKASHI Takahiro
2019-07-19  9:41     ` Wolfgang Denk

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=20190719065018.968BE240049@gemini.denx.de \
    --to=wd@denx.de \
    --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