mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Lars Schmidt <l.schmidt@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 3/4] Documentation: bootchooser: add information about attempts_locked
Date: Tue, 17 Jun 2025 11:42:20 +0200	[thread overview]
Message-ID: <aFE4fMWOQwEqYq7b@pengutronix.de> (raw)
In-Reply-To: <23ad7e64-e59c-48f1-9dfe-56f9b3f72faa@pengutronix.de>

On Tue, Jun 17, 2025 at 11:00:10AM +0200, Lars Schmidt wrote:
> 
> On 17.06.25 10:42, Sascha Hauer wrote:
> > On Mon, Jun 16, 2025 at 05:06:56PM +0200, Lars Schmidt wrote:
> >> The new attempts_locked variable does have influence on
> >> remaining_attempts counter.
> >>
> >> While at it, also make mention in the bootstate.dtsi.
> >>
> >> Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
> >> ---
> >>  Documentation/user/bootchooser.rst | 23 +++++++++++++++++++++++
> >>  arch/arm/dts/bootstate.dtsi        |  5 +++++
> >>  2 files changed, 28 insertions(+)
> >>
> >> diff --git a/Documentation/user/bootchooser.rst b/Documentation/user/bootchooser.rst
> >> index 351e1d14e1ead6ba8d329c03c0bc7ed28b523df0..ab0b6c3fc895226f5aa4590944a2cd675a56d985 100644
> >> --- a/Documentation/user/bootchooser.rst
> >> +++ b/Documentation/user/bootchooser.rst
> >> @@ -77,6 +77,16 @@ no remaining attempts left.
> >>  To prevent ending up in an unbootable system after a number of failed boot
> >>  attempts, there is also a built-in mechanism to reset the counters to their defaults,
> >>  controlled by the ``global.bootchooser.reset_attempts`` variable.
> >> +Alternatively, counting down the remaining attempts can be disabled by
> >> +locking bootchooser boot attempts.
> >> +This is done by defining a (32-bit) ``attempts_locked`` variable in the
> >> +bootstate and setting its value to ``1`` (usually from userspace).
> >> +
> >> +The variable affects all targets, is optional and its absence is
> >> +interpreted as ``0``, meaning that attempts are decremented normally.
> >> +
> >> +The ``attempts_locked`` value does not influence the decision on which target
> >> +to boot if any, only whether to decrement the attempts when booting.
> > This describes what it does, but not what it's good for. Could you add a
> > few sentences about it?
> 
> I was hoping this is understandable if you read in the context of the already
> existing paragraph right before that: "To prevent ending up in an unbootable system....."
> As it is meant to be an alternative to global.bootchooser.reset_attempts
> 
> I didn't want to get too repetitive, but if you want, I can try to rephrase it.

How I understand it the purpose of the attempts_locked variable is that
I can mark a slot as always-use-this-one.

There are some differences to the reset_attempts approach. With
reset_attempts barebox decreases the counter and Linux increases it
again. When a board is power cycled often enough (due to an impatient
user or weak power supply) after barebox has decreased the counter but
before Linux has increased it again then we'll fall back to another slot.
This might be undesired in some cases and the attempts_lock doesn't have
this issue, but it comes with the price that a slot that gets broken
over time (filesystem corruption or the like) won't be detected anymore
and will be booted forever.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2025-06-17 11:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 15:06 [PATCH v2 0/4] Add boot slot locking to bootchooser Lars Schmidt
2025-06-16 15:06 ` [PATCH v2 1/4] bootchooser: implement locking of attempts counter Lars Schmidt
2025-06-16 15:31   ` Ahmad Fatoum
2025-06-16 15:06 ` [PATCH v2 2/4] bootchooser: extend cmd tool by option to set attempts_locked Lars Schmidt
2025-06-16 15:33   ` Ahmad Fatoum
2025-06-16 15:06 ` [PATCH v2 3/4] Documentation: bootchooser: add information about attempts_locked Lars Schmidt
2025-06-16 15:34   ` Ahmad Fatoum
2025-06-17  8:42   ` Sascha Hauer
2025-06-17  9:00     ` Lars Schmidt
2025-06-17  9:42       ` Sascha Hauer [this message]
2025-06-16 15:06 ` [PATCH v2 4/4] Documentation: migration-2025.08.0: " Lars Schmidt

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=aFE4fMWOQwEqYq7b@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=l.schmidt@pengutronix.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