All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>,
	u-boot@lists.denx.de,
	 Patrick Delaunay <patrick.delaunay@foss.st.com>,
	 Patrice Chotard <patrice.chotard@foss.st.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	 Alexander Graf <agraf@csgraf.de>, Simon Glass <sjg@chromium.org>,
	Bin Meng <bmeng.cn@gmail.com>,  Peng Fan <peng.fan@nxp.com>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	 Jose Marinho <Jose.Marinho@arm.com>,
	Grant Likely <grant.likely@arm.com>,
	 Jason Liu <jason.hui.liu@nxp.com>
Subject: Re: [RESEND RFC PATCH 04/10] FWU: Add metadata access functions for GPT partitioned block devices
Date: Thu, 9 Dec 2021 09:37:10 +0200	[thread overview]
Message-ID: <CAC_iWjL4-w1EfWVAjmT3CHzoXmUVF8--51kZCGvfynPi5jowyw@mail.gmail.com> (raw)
In-Reply-To: <CAN5uoS8GraJB9r4sF+55mL-kef583jmSPXzEXw1aTiUznnpW1w@mail.gmail.com>

Hi Etienne,


[...]
> > > > +
> > > > +     /* And now the replica */
> > > > +     ret = gpt_write_metadata_partition(desc, metadata,
> > > secondary_mpart);
> > > > +     if (ret < 0) {
> > > > +             log_err("Updating secondary metadata partition failed\n");
> > > > +             return ret;
> > > > +     }
> > >
> > > So shouldn't we do something about this case?  The first partition was
> > > correctly written and the second failed.  Now if the primary GPT somehow
> > > gets corrupted the device is now unusable.
>
> The replica is not there to overcome bitflips of the storage media.
> It's here to allow updates while reliable info a still available in
> the counter part.

Sure but with this piece of code this assumption is broken.  At the
point the secondary partition fails to write, you loose that
reliability. When the next update happens you are left with one valid
and one invalid partition of metadata.

> The scheme could be to rely on only 1 instance of the fwu-metadata
> (sorry Simon) image is valid.
> A first load: load 1st instance, crap the second.
> At update: find the crapped one: write it with new data. Upon success
> crapped the alternate one.
> This is a suggestion. There are many ways to handle that.

We could change to something like that, however this is not what's
currently happening.  gpt_check_metadata_validity() is trying to check
and make sure both of the partitions are sane.  If they aren't it
tries to recover those looking at a sane partition. So the question
for really is, should we do something *here* or rely on the fact that
the next update will try to fix the broken metadata.

Cheers
/Ilias

  parent reply	other threads:[~2021-12-09  7:37 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  7:12 [RESEND RFC PATCH 00/10] FWU: Add support for FWU Multi Bank Update feature Sughosh Ganu
2021-11-25  7:12 ` [RESEND RFC PATCH 01/10] GPT: Add function to get gpt header and partition entries Sughosh Ganu
2021-11-25  7:12 ` [RESEND RFC PATCH 02/10] stm32mp: dfu: Move the ram partitions to the end of the dfu_alt_info variable Sughosh Ganu
2021-11-25  7:12 ` [RESEND RFC PATCH 03/10] FWU: Add metadata structure and functions for accessing metadata Sughosh Ganu
2021-11-26 11:35   ` Ilias Apalodimas
2021-11-29  6:38     ` Sughosh Ganu
2021-11-30 12:57   ` Heinrich Schuchardt
2021-12-01  5:36     ` Sughosh Ganu
2021-12-01  7:50       ` Ilias Apalodimas
2021-12-01  8:31         ` Sughosh Ganu
2021-12-01  7:46     ` Ilias Apalodimas
2021-12-01  6:26   ` Simon Glass
2021-12-01  6:42     ` Sughosh Ganu
2021-11-25  7:12 ` [RESEND RFC PATCH 04/10] FWU: Add metadata access functions for GPT partitioned block devices Sughosh Ganu
2021-12-01 12:26   ` Ilias Apalodimas
2021-12-02  7:43     ` Sughosh Ganu
2021-12-08 14:17       ` Etienne Carriere
2021-12-09  2:32         ` Simon Glass
2021-12-09  7:37         ` Ilias Apalodimas [this message]
2021-12-13  9:29           ` Etienne Carriere
2021-12-01 18:02   ` Simon Glass
2021-12-02  8:05     ` Sughosh Ganu
2021-12-02 13:34       ` Simon Glass
2021-12-03  5:43         ` Sughosh Ganu
2021-11-25  7:12 ` [RESEND RFC PATCH 05/10] FWU: stm32mp1: Add helper functions for accessing metadata Sughosh Ganu
2021-11-25  7:12 ` [RESEND RFC PATCH 06/10] FWU: STM32MP1: Add support to read boot index from backup register Sughosh Ganu
2021-11-25  7:12 ` [RESEND RFC PATCH 07/10] EFI: FMP: Add provision to update image's ImageTypeId in image descriptor Sughosh Ganu
2021-11-26 12:43   ` Heinrich Schuchardt
2021-11-29 11:38     ` Sughosh Ganu
2021-11-25  7:13 ` [RESEND RFC PATCH 08/10] FWU: Add boot time checks as highlighted by the FWU specification Sughosh Ganu
2021-11-25  7:13 ` [RESEND RFC PATCH 09/10] FWU: Add support for FWU Multi Bank Update feature Sughosh Ganu
2021-11-26 12:55   ` Heinrich Schuchardt
2021-11-29 11:44     ` Sughosh Ganu
2021-11-25  7:13 ` [RESEND RFC PATCH 10/10] FWU: cmd: Add a command to read metadata Sughosh Ganu
2021-11-26 12:29 ` [RESEND RFC PATCH 00/10] FWU: Add support for FWU Multi Bank Update feature Heinrich Schuchardt
2021-11-26 12:48   ` Ilias Apalodimas

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=CAC_iWjL4-w1EfWVAjmT3CHzoXmUVF8--51kZCGvfynPi5jowyw@mail.gmail.com \
    --to=ilias.apalodimas@linaro.org \
    --cc=Jose.Marinho@arm.com \
    --cc=agraf@csgraf.de \
    --cc=bmeng.cn@gmail.com \
    --cc=etienne.carriere@linaro.org \
    --cc=grant.likely@arm.com \
    --cc=jason.hui.liu@nxp.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=peng.fan@nxp.com \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=takahiro.akashi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.