From: Maxime Ripard <maxime.ripard@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH] u-boot: remove driver lookup loop from env_save()
Date: Thu, 12 Jul 2018 09:20:52 +0200 [thread overview]
Message-ID: <20180712072052.crasidt2pemsyuu5@flea> (raw)
In-Reply-To: <809c5831-f186-44ed-80eb-e6bd632eccf3@de.pepperl-fuchs.com>
On Thu, Jul 12, 2018 at 09:02:26AM +0200, Simon Goldschmidt wrote:
>
>
> On 11.07.2018 15:50, Maxime Ripard wrote:
> > On Wed, Jul 11, 2018 at 12:44:23PM +0200, Nicholas wrote:
> > > > > > Maybe a solution could be to have an env_save() function which
> > > > > > acts in a similar way as proposed in my patch and an
> > > > > > env_save_prio() function, which acts like the env_load()
> > > > > > i.e. looking for the best working location instead of relying
> > > > > > on what has been stored into gd-> env_load_location.
> > > > >
> > > > > I don't really see a use-case for overriding wherever the
> > > > > environment at the user-level actually. At the board level, for
> > > > > redundancy or transition, yes, definitely, but we can already do
> > > > > that.
> > > >
> > > > Well, the use case I saw was that I wanted to test redundant
> > > > environment storage. I admit this is not an end user use case but
> > > > a developer use case, so I guess you're right.
> > > >
> > > > So after fixing this endless loops I see two questions: - to which
> > > > environment do we store if the one in 'env_load_location' fails
> > > > to store?
> > >
> > > Good question. My opinion is that it strongly depends on what we want
> > > to achieve with the implementation: do we want 1) to keep the
> > > consistency between load and save, or we want 2) to guarantee to be
> > > able to load/save from at least one location?
> > >
> > > If 1) then a failure on env_save() simply fails and doesn't store
> > > anything. In other words we are multi-env when loading but single-env
> > > when storing. We are actually binding env_save() to the last
> > > env_load()'s result.
> > >
> > > If 2) then a failure on env_save() will try all the available locations
> > > but we are open to misalignments. Here we are full multi-env since
> > > env_save() and env_load() are not bound together.
> >
> > In that case, we don't want to store to a lower priority, but to a
> > higher one. Otherwise, the environment will be saved just fine, but
> > will not be read next time, which will be very confusing to the user.
> >
> > And with a higher priority, you might end up overwriting something you
> > weren't expecting to overwrite, so I'd vote 1.
>
> I agree that 1 would be best. But from reading the code, unless I'm totally
> wrong, it seems that the patch sent by Nicholas does not suffice:
>
> If no location contained a valid environment (e.g. no environment written
> yet), the lowest priority will be written as 'gd->env_load_location' is set
> to the lowest priority from iterating locations in 'env_load()'.
>
> So we might have to reset 'gd->env_load_location' to highest prio if loading
> the environment fails.
That would make sense yes.
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180712/4ca759e2/attachment.sig>
next prev parent reply other threads:[~2018-07-12 7:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-10 12:57 [U-Boot] [RFC PATCH] u-boot: remove driver lookup loop from env_save() Nicholas Faustini
2018-07-10 20:49 ` Simon Glass
2018-07-11 4:57 ` Simon Goldschmidt
2018-07-11 5:09 ` Simon Goldschmidt
2018-07-11 8:33 ` Nicholas
2018-07-11 9:48 ` Maxime Ripard
2018-07-11 10:01 ` Simon Goldschmidt
2018-07-11 10:44 ` Nicholas
2018-07-11 13:50 ` Maxime Ripard
2018-07-12 7:02 ` Simon Goldschmidt
2018-07-12 7:20 ` Maxime Ripard [this message]
2018-07-17 4:48 ` Simon Goldschmidt
2018-07-11 10:49 ` Wolfgang Denk
2018-07-11 13:47 ` Maxime Ripard
2018-07-11 13:54 ` Wolfgang Denk
2018-07-11 7:37 ` Lukasz Majewski
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=20180712072052.crasidt2pemsyuu5@flea \
--to=maxime.ripard@bootlin.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