mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Do I really need 3 buckets for state?
@ 2019-01-24 15:28 Ian Abbott
  2019-01-25  5:53 ` Ulrich Ölmann
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Abbott @ 2019-01-24 15:28 UTC (permalink / raw)
  To: Barebox List

Hi,

Back when I was determining how to partition the spi-nor flash on my 
embedded device, I reserved two erase blocks (each of size 65536) for 
use as a barebox state partition.  I wasn't using it for anything at the 
time.  Now I want to use it to hold bootstate information for barebox 
bootchooser (for use in combination with rauc to handle system updates).

I am using backend-type="raw"; backend-storage-type="circular"; and 
backend-stridesize=<0x40>;.  It all works fine except that I get a 
warning from barebox:

Failed to initialize desired amount of buckets, only 2 of 3 succeeded

I have "fixed" the warning with a local patch to reduce the 
'desired_buckets' constant in "common/state/backend_storage.c" from 3 to 2.

My question is, how much trouble am I letting myself in for with this 
local patch?  I assume the state driver will only erase and update 1 
bucket at a time when the buckets are full.  Do I really need 3 buckets 
or will 2 buckets be enough?

Best regards,
Ian Abbott.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Do I really need 3 buckets for state?
  2019-01-24 15:28 Do I really need 3 buckets for state? Ian Abbott
@ 2019-01-25  5:53 ` Ulrich Ölmann
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Ölmann @ 2019-01-25  5:53 UTC (permalink / raw)
  To: barebox

Hi Ian,

On Thu, Jan 24 2019 at 16:28 +0100, Ian Abbott <abbotti@mev.co.uk> wrote:
> Back when I was determining how to partition the spi-nor flash on my
> embedded device, I reserved two erase blocks (each of size 65536) for
> use as a barebox state partition.  I wasn't using it for anything at the
> time.  Now I want to use it to hold bootstate information for barebox
> bootchooser (for use in combination with rauc to handle system updates).
>
> I am using backend-type="raw"; backend-storage-type="circular"; and
> backend-stridesize=<0x40>;.

the documentation is not correct here: for the case of spi-nor flash the
stridesize is not used at all (and therefore not needed in the
devicetree). Instead each bucket is searched in reverse direction
starting from the end for non 0xff bytes and a magic value to see where
the last copy of the state variables has been written to, see [1].

> It all works fine except that I get a warning from barebox:
>
> Failed to initialize desired amount of buckets, only 2 of 3 succeeded
>
> I have "fixed" the warning with a local patch to reduce the
> 'desired_buckets' constant in "common/state/backend_storage.c" from 3 to 2.
>
> My question is, how much trouble am I letting myself in for with this
> local patch?  I assume the state driver will only erase and update 1
> bucket at a time when the buckets are full.

Correct, this is done in state_storage_write(), see [2].

> Do I really need 3 buckets or will 2 buckets be enough?

This depends on how much redundancy you need to sleep well...

Best regards
Ulrich


[1] https://github.com/saschahauer/barebox/blob/master/common/state/backend_bucket_circular.c#L388
[2] https://github.com/saschahauer/barebox/blob/master/common/state/backend_storage.c#L52
--
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-25  5:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 15:28 Do I really need 3 buckets for state? Ian Abbott
2019-01-25  5:53 ` Ulrich Ölmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox