> 5. What if the TSC is not available as a usable timecounter? In that
> case libc should fall back on the system call. But we need a way
> to communicate what the timecounter is and detect when we switch
> timecounters. Maybe adding a timecounter ID to the page will help
> here. But then MD code in libc will have to check the ID and
> dispatch to the right timecounter read function.
I fixed 1--4 and 6, but with 5 the solutions I found are a bit
convoluted and involve string passing and parsing if we are to pass this
information to libc.
Would it be acceptable to add a memember to struct timecounter that
states whether the clock is libc ready or not? This means that when you
add support for a new clock in libc you also have to touch the kernel to
set that bit...
On the other hand the code would be clean and safe:
if (timekeep == NULL || timekeep->tc_supported)
clock_gettime();
/* rest of wrapper function */
What do you think?