Re: [RFC patch 7/7] timekeeping: Hack to use fine grained timestamps during boot

From: Mark Salyzyn
Date: Tue Nov 28 2017 - 15:29:47 EST


On 11/28/2017 11:45 AM, Steven Rostedt wrote:
On Tue, 28 Nov 2017 11:10:02 -0800
Mark Salyzyn <salyzyn@xxxxxxxxxxx> wrote:

There is no guarantee of sequential order of delivery for kernel prints.
But isn't the timestamp taken with the logbuf_lock, and then delivered
to the printk buffer? That would guarantee that all events will be in
order, and the timestamps be sequential. They are serialized by the
logbuf_lock.

-- Steve

To get closer to a sequential order of event delivery by timestamp, you really should take a global timestamp (I know, local clock is _not_ a global timestamp) first thing and as close to the event as possible, before anything else, and outside of a lock which is merely a synchronization action.

A) event came first, got preempted by the scheduler before lock.

B) multiple events came in order while lock held, random selection of which one gets the lock once released.

C) scheduling differences between FIFO, BATCH, low priority, cgroup limits, interrupt, especially since an event is usually generated _after_ the fact related to an activity.

We do not have a guarantee of sequential order, outside the scope of this RFC. We accept this behavior as it is good enough for the most part, and we are all smart adults here, we can figure it out when things get strange.

-- Mark