On Tue, Jun 13, 2017 at 12:02:16PM -0600, Brian Olson wrote:
> @@ -73,7 +73,7 @@ double clockadj_get_freq(clockid_t clkid)
>                 pr_err("failed to read out the clock frequency adjustment: 
> %m");
>         } else {
>                 f = tx.freq / 65.536;
> -               if (clkid == CLOCK_REALTIME && realtime_nominal_tick)
> +               if (clkid == CLOCK_REALTIME && realtime_nominal_tick && 
> tx.tick)
>                         f += 1e3 * realtime_hz * (tx.tick - 
> realtime_nominal_tick);
> 
> 
> I think this older version of the kernel (2.6.32-504.el6.x86_64)  is 
> returning 0 for tx.tick.

Now I recall this is a known bug that was fixed in linux-3.9.
clock_adjtime() updated the struct timex when it returned zero, but
not with positive values (e.g. TIME_ERROR).

The linuxptp code actually has a workaround for this bug, allowing
clockadj_get_freq() to return 0 even if it's not the correct value,
but apparently I broke it later with the ticks.

> Any thoughts on whether this is a valid fix?

Yes, that should fix the workaround. Can you please submit it as a git
patch to linuxptp-devel?

Another is to run "ntptime -m 0 -s 0" before starting phc2sys, so
clock_adjtime() returns valid data.

> I also had to make another small change to get the latest code to build on 
> RHEL 6.8:
> 
> diff --git a/rtnl.c b/rtnl.c
> index 251b5f3..1266731 100644
> --- a/rtnl.c
> +++ b/rtnl.c
> @@ -17,6 +17,7 @@
>   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>   */
>  #include <asm/types.h>
> +#include <sys/socket.h>
>  #include <linux/netlink.h>
>  #include <linux/rtnetlink.h>
>  #include <net/if.h>

It would be nice to fix this too.

Thanks,

-- 
Miroslav Lichvar

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to