Page MenuHomeFreeBSD

Various improvements to the atomics man page
ClosedPublic

Authored by alc on Dec 17 2017, 6:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 7:36 AM
Unknown Object (File)
Feb 9 2024, 8:22 PM
Unknown Object (File)
Dec 22 2023, 10:22 PM
Unknown Object (File)
Nov 15 2023, 9:09 AM
Unknown Object (File)
Oct 30 2023, 4:05 PM
Unknown Object (File)
Oct 14 2023, 8:10 AM
Unknown Object (File)
Sep 28 2023, 4:12 PM
Unknown Object (File)
Sep 14 2023, 5:14 PM
Subscribers

Details

Summary

Document the semantics of fences.

Add atomic_load and atomic_store, explaining why exist.

Define the synchronizes-with relationship.

Reorder and revise some of the existing text.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

share/man/man9/atomic.9
64 ↗(On Diff #36691)

atomic_load() is still only a patch.

221 ↗(On Diff #36691)

I know that this is an explicit rule e.g. in the ARM memory model. Are you sure that e.g. PowerPC ISA v3.0 store release has the same requirement ?

I mean, we indeed provide the release causality (is this the common term ?) due to using too strong barriers. I do not remember such requirement in the C11 text, but I may be wrong there for sure. If C/C++ model require such visibility, then I definitely do not object.

240 ↗(On Diff #36691)

I understand the intent but it probably should say "program' memory". The x86 store/load barrier used e.g. by seq_cst fence does access a memory.

share/man/man9/atomic.9
64 ↗(On Diff #36691)

I've taken for granted that we are going to commit it.

221 ↗(On Diff #36691)

I have not looked at the PowerPC v3.0 ISA. However, in general, you need this "causality" in order to claim that any execution of a properly synchronized program under release consistency will be equivalent to some legal execution under sequential consistency. Consider the "task queue" example that I mentioned in email last week. For the memory holding the task itself to be consistent after a long chain of enqueues and/or dequeues by various threads between the task's enqueue and its dequeue, you need causality. In particular, the threads in the middle of the chain will never actually read from the stores that defined the task, but nevertheless these stores will have to become visible through the acquires and releases by those threads.

In essence, what I've tried to do here is describe in simple terms the effects of the happens before ordering without actually defining it.

This revision is now accepted and ready to land.Dec 18 2017, 5:08 PM
share/man/man9/atomic.9
223 ↗(On Diff #36691)

I'm tempted to tweak this, and say, "... observe these stores ..."

240 ↗(On Diff #36691)

Let me think about this point. I'm not sure that adding the word "program" will really have the intended effect. I could alternatively try to describe fences as having no side effects on memory except to control ordering.

share/man/man9/atomic.9
223 ↗(On Diff #36691)

'these' sounds better, IMO. It articulates the detail.

240 ↗(On Diff #36691)

Lets leave this statement as is.

This is definitely a large improvement over the existing text!

share/man/man9/atomic.9
223 ↗(On Diff #36691)

Agreed with adding "these"

This revision was automatically updated to reflect the committed changes.

When did we introduces fences? A statement should probably be added to the HISTORY section.

In D13522#283260, @alc wrote:

When did we introduces fences? A statement should probably be added to the HISTORY section.

11.0 it seems. And atomic_load()/store() will be 11.2.