On Thu, May 28, 2020 at 10:27:03PM +0300, Paul Irofti wrote:
> > 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();

that's what I meant, of course...

The tc_supported bit would be set in the kernel when the timecounter is
changed. I have those bits inside tc_update_timekeep() already for the
tc_counter_mask.

Reply via email to