[ntp:hackers] [Gpsd-dev] Possible shm problem: Structure alignment?

Eric Raymond esr at thyrsus.com
Sat Mar 26 05:15:04 UTC 2011

Dave Hart <hart at ntp.org>:
> 0.  Leave existing reflcock_shm.c shared memory structure definition
> in place for backwards compat, allow user to control which variant to
> use via ntp.conf.  I'm not sure what the default should be.

The new one.  Because the old one, as has been pointed out, is not really safe.

> 4.  Switch to nanosecond resolution for timestamps.

I heartily approve.

> 6.  Switch from sysv to POSIX named shared memory to broaden supported
> platforms.  Assumption here is there are no interesting systems which
> support sysv shared memory but not POSIX.

Probably correct.

> 7.  Mark all members volatile to bar access re-ordering by the
> compiler.  Guard the declaration with extern "C" when pulled into C++
> code to use C volatile semantics.


> 8.  Come to agreement on the consistency protocol for one writer,
> multiple readers, including use of memory barriers where available,
> but do not require memory barrier support from the compiler, as (IIUC)
> x86/x64 do not need them for volatile atomic accesses to be coherent
> across processors, and the ovewhelming majority of current
> refclock_shm users are on x86 or x64.

Gary Miller has a lot of experience with this kind of design.  I have
less, but I'm not exactly a n00b at it either.  To the extent that we
can be helpful, we will be.  If not joggling the elbow of a lead you
pick for the task is the most helpful thing we can do, we'll do that.

I have some thoughts about your protocol choice which I'll put in a
separate email.

> Thanks for all the lively participation.  I think we've come a long
> way towards consensus.

Gary Miller is the logical person to lead GPSD's contribution.  I have
100% trust in his skill and judgment everywhere near the NTP/SHM issues;
thus, GPSD will cheerfully and rapidly execute on any consensus he is part of.
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

More information about the hackers mailing list