Re: Very Early boot time stamps support

From: Abderrahmane Benbachir
Date: Wed Nov 29 2017 - 19:48:53 EST



Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> a ÃcritÂ:

Hi Abderrahmane,

I'm implementing a feature in ftrace to enable very early function tracing,
I'm using tsc when x86_tsc feature is available, but it seems that you did
similar work in your patch "[PATCH v9 0/6] Early boot time stamps for x86".

I need to record timestamps at the start of start_kernel(), the first
function to be traced is set_task_stack_end_magic.

Early boot time stamps are available only after platforms are
initialized. This happens in:

start_kernel()
setup_arch()
kvmclock_init() <-- right after this call.

This was a request from Thomas, not to invent a new TSC calibration,
and instead rely on what is already available.
This seems related to kvm/hypervisor, is there any available TSC calibration
that could be used independently from kvm ?


So, while not covering the whole boot process, early boot clock is
still initialized pretty early.

Here a few ideas how to make early boot clock to initialize earlier.

2. We could initialize TSC earlier only on those CPUs where hardware
tells us specifically TSC frequency i.e. cpuinfo(15) is available. See
native_calibrate_tsc() for an example. This is true for all the latest
Intel CPUs. Unfortunately, this does not work with qemu, as it returns
some garbage in cpuinfo(15), even when processor supports this feature
natively.
Is this a bug in Qemu ?