#1727 closed defect (wontfix)

Reading of timestamps is not atomic in general

Reported by: Sebastian Huber Owned by: Joel Sherrill
Priority: normal Milestone: 4.11
Component: score Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

We use

int64_t

or

struct timespec {

long tv_nsec;
long tv_sec;

};

for timestamps in the Score (Timestamp_Control). The read of such values is in general not atomic. We should provide a function

void _Timestamp_Get( Timestamp_Control *val )

for atomic reads of timestamps. We can use interrupt enable/disable for this, or exploit the monotonic property of timestamps:

do {

s0 = val->tv_sec;
ns0 = val->tv_nsec;
RTEMS_COMPILER_MEMORY_BARRIER();
s1 = val->tv_sec;

} while (s0 != s1);

I prefer the interrupt enable/disable variant.

Change History (3)

comment:1 Changed on Dec 21, 2010 at 1:25:33 PM by Sebastian Huber

Replying to comment:1:

There is currently no _Timestamp_Get method. Are you proposing to add one that
is atomic?

Yes, we have no _Timestamp_Get() method currently, and we need one.

If so, there will also need to be a _Timestamp_Get_unprotected.

Ok.

comment:2 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:3 Changed on Dec 18, 2014 at 9:23:06 AM by Sebastian Huber

Description: modified (diff)
Resolution: wontfix
Status: newclosed

In _TOD_Get_with_nanoseconds() interrupts are disabled for the snapshot. No plans to add a general _Timestamp_Get(). The timestamp implementation should be replaced with FreeBSD timecounters.

Note: See TracTickets for help on using tickets.