Re: [PATCH] of: overlay: user space synchronization
From: Alan Tull
Date: Mon Oct 15 2018 - 16:39:37 EST
On Mon, Oct 15, 2018 at 1:09 PM Frank Rowand <frowand.list@xxxxxxxxx> wrote:
>
> On 10/15/18 01:24, Geert Uytterhoeven wrote:
> >
> > Please say explicitly that tree_version contains a 32-bit unsigned
> > decimal number, which is incremented before and after every change.
> > I had to deduce that from the code.
>
> Good point. I'll add that.
Looking at the code, tree_version being odd or even means something.
tree_version is incremented every time the of_mutex is locked or
unlocked, such that:
* tree_version is odd == of_mutex is locked and the tree is
currently be in the process of being changed
* tree_version is even == of_version is unlocked again and the
changes are finished.
How about making this explicit in the interface by breaking it up into
two attributes:
/sys/firmware/devicetree/tree_lock == "locked" or "unlocked". If the
tree is locked, you know that the tree may still be changing and the
sysfs can't be trusted to be stable yet. Or maybe even more
specifically tree_overlay_lock?
/sys/firmware/devicetree/tree_version = a u32 that is incremented once
for every overlay added or removed.
Alan
>
>
> >
> > IMHO that is more important than having the sample script here.
> >
> > Gr{oetje,eeting}s,
> >
> > Geert
> >
>