Re: [PATCH v6 1/4] sched/clock: interface to allow timestamps early in boot

From: Pavel Tatashin
Date: Mon Oct 09 2017 - 12:36:04 EST



Urgh, that's horrific.

Can't we simply make sched_clock() go earlier? (we're violating "notsc"
in any case and really should kill that option).

Then we can do something like so on top...


Hi Peter,

I've been thinking about your proposal, and I have one concern: sched_clock() can be implemented two ways either via pv_time_ops.sched_clock vectors when CONFIG_PARAVIRT is defined

sched_clock()
paravirt_sched_clock()
PVOP_CALL0(unsigned long long, pv_time_ops.sched_clock);

Or native via alias

sched_clock()
native_sched_clock()

Using sched_clock_early() approach makes early time stamps work with both cases when it is determined that tsc can be used simple_udelay_calibration(). (As we agreed I am going to change notsc to use tsc=unstable path.)

It may be not the most efficient clock for some virtualizations to use rdtsc directly, but since this is for early boot only, and not something that is going to be used after machine is booted it is OK.

Pavel