RE: [PATCH v3 1/4] Add correlated clocksource deriving system time from an auxiliary clocksource
From: Hall, Christopher S
Date: Thu Sep 03 2015 - 19:20:58 EST
> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@xxxxxxxxxxxxx]
> Sent: Saturday, August 22, 2015 1:17 PM
> To: Hall, Christopher S
> Cc: Kirsher, Jeffrey T; hpa@xxxxxxxxx; mingo@xxxxxxxxxx;
> john.stultz@xxxxxxxxxx; richardcochran@xxxxxxxxx; x86@xxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; intel-wired-
> lan@xxxxxxxxxxxxxxxx; peterz@xxxxxxxxxxxxx
> Subject: Re: [PATCH v3 1/4] Add correlated clocksource deriving system time
> from an auxiliary clocksource
>
> > +/**
> > + * get_correlated_timestamp - Get a correlated timestamp
> > + *
> > + * Reads a timestamp from a device and correlates it to system time
> > + */
> > +int get_correlated_timestamp(struct correlated_ts *crt,
> > + struct correlated_cs *crs)
> > +{
> > + struct timekeeper *tk = &tk_core.timekeeper;
> > + unsigned long seq;
> > + cycles_t cycles;
> > + ktime_t base;
> > + s64 nsecs;
> > + int ret;
> > +
> > + do {
> > + seq = read_seqcount_begin(&tk_core.seq);
> > + /*
> > + * Verify that the correlated clocksoure is related to
> > + * the currently installed timekeeper clocksoure
> > + */
> > + if (tk->tkr_mono.clock != crs->related_cs)
> > + return -ENODEV;
> > +
> > + /*
> > + * Try to get a timestamp from the device.
> > + */
> > + ret = crt->get_ts(crt);
> > + if (ret)
> > + return ret;
> > +
[Re-added code for context]
In addition to the network interface, ART will be used in the audio interface as well.
We need to support the case where an audio co-processor will control the audio device.
In this case, the get_ts() function supplied by the audio driver will be very slow
(several milliseconds) and the result will be out of date by some fraction of that
amount.
This loop makes strict requirements on the latency and recency. Is it possible to relax
that requirement in some way?
For example, supply the ART value as an argument and, in the case of the realtime
clock, keep a short history of clock changes. It would fail in cases where there
are a lot of calls to adjtimex(), but it will would work most of the time.
What can you suggest? Thanks
Chris
> > + } while (read_seqcount_retry(&tk_core.seq, seq));
> > + return 0;
> > +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/