Re: [PATCH 3/3] s390/time: Add PtP driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 15, 2024 at 12:54:14PM +0200, Sven Schnelle wrote:
> Add a small PtP driver which allows user space to get
> the values of the physical and tod clock. This allows
> programs like chrony to use STP as clock source and
> steer the kernel clock. The physical clock can be used
> as a debugging aid to get the clock without any additional
> offsets like STP steering or LPAR offset.
> 
> Signed-off-by: Sven Schnelle <svens@xxxxxxxxxxxxx>

...

> +static __always_inline unsigned long eitod_to_ns(union tod_clock *clk)
> +{
> +	clk->eitod -= TOD_UNIX_EPOCH;
> +	return ((clk->eitod >> 9) * 125) + (((clk->eitod & 0x1ff) * 125) >> 9);
> +}

This is quite odd ;). This helper modifies the input union, which may
be very surprising to callers. It subtracts TOD_UNIX_EPOCH, which may
also be surprising, especially since we don't do that for tod_to_ns().

In addition the input value contains 72 bits, while the output value
is truncated to the lower 64 bits.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux