First of all, this "solution" is only valid for a very restricted set of
systems and breaks others in very subtle ways.
FYI, the architecture name is x86, which handles 32bit/64bit, various
vendors and hypervisors. It's not 'arch/mymachine'.
So this needs to be integrated into the existing TSC/CPU calibration
mechanism which works across all supported systems. And that means, that
early TSC calibration can't be done before x86_init.oem.arch_setup() and
hypervisor_init_platform() have been invoked.
By that time, which is still pretty early in the boot process:
- boot_cpu_data has been preinitialized
- calibration functions setup has been done
Putting the early TSC initialization after hypervisor_init_platform() makes
this available for _ALL_ systems/platforms as infrastructure and allows the
platforms to add the required bits of support via a new set of function
pointers in struct x86_platform_ops, which btw. is a proper form of
abstraction.
The time between x86_64_start_kernel() and that point is in the low single
digit millisecond range or less than a millisecond and therefor completely
irrelevant. The first timestamps before that point will be 0 as they used
to be.
You can argue in circles about that, it's simply not debatable.
But that's only the sched clock part of the problem. If this early
sched_clock() is available, then this needs to be fed into the setup of
timekeeping as well, otherwise dmesg tells 50 seconds into boot and clock
monotonic/boottime say 5, which would be confusing at best. That has not be
solved in the first step, but definitely before something like this is
going to be merged.