[PATCH] elf: Simplify software TM implementation in _dl_find_object

Szabolcs Nagy szabolcs.nagy@arm.com
Fri Jan 7 16:08:54 GMT 2022


The 01/07/2022 16:56, Florian Weimer wrote:
> * Szabolcs Nagy:
> 
> > The 01/07/2022 14:41, Florian Weimer wrote:
> >> With the current set of fences, the version update at the start
> >> of the TM write operation is redundant.  Also use relaxed MO stores
> >> during the dlclose update, and skip any version changes there.
> >> 
> >> Suggested-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
> >> 
> >> ---
> >> Initial testing looks good, but I'll keep the aarch64 and powerpc64le
> >> tests running in a loop for a while.
> >
> > looks good to me except
> >
> >> @@ -282,15 +279,6 @@ _dlfo_mappings_end_update (void)
> >>    atomic_thread_fence_release ();
> >>    __atomic_wide_counter_fetch_add_relaxed (&_dlfo_loaded_mappings_version, 1);
> >>  }
> >
> > i think the v += 1 does not have to be atomic so
> >
> >  start_version = load_relaxed (&ver);
> >  store_relaxed (&ver, start_version + 1);
> >
> > or if we can change the api to pass start_version
> > that may be clearer.
> 
> The 32-bit wide counter needs to be atomic.  We can't use a straight
> store in that case.
> 
> Should I break abstraction and write through for the 64-bit case?

i didn't think about that.

but it seems there is a

__atomic_wide_counter_add_relaxed

which seems to do the right thing.


More information about the Libc-alpha mailing list