lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210523212418.GG29980@hoboy.vegasvil.org>
Date:   Sun, 23 May 2021 14:24:18 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Yangbo Lu <yangbo.lu@....com>
Cc:     netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next, v2, 1/7] ptp: add ptp virtual clock driver framework

On Fri, May 21, 2021 at 12:36:13PM +0800, Yangbo Lu wrote:
> This patch is to add ptp virtual clock driver framework
> which just exports essential APIs.
> 
> A new member is added for ptp_clock_info structure. Device driver
> can provide initial cyclecounter info for ptp virtual clock via
> this member, before normally registering ptp clock.

Why not provide this in the PHC class layer, and make it work for
every driver without alteration?

> +/**
> + * struct ptp_vclock_cc - ptp virtual clock cycle counter info
> + *
> + * @cc:               cyclecounter structure
> + * @refresh_interval: time interval to refresh time counter, to avoid 64-bit
> + *                    overflow during delta conversion. For example, with
> + *                    cc.mult value 2^28,  there are 36 bits left of cycle
> + *                    counter. With 1 ns counter resolution, the overflow time
> + *                    is 2^36 ns which is 68.7 s. The refresh_interval may be
> + *                    (60 * HZ) less than 68.7 s.
> + * @mult_factor:      parameter for cc.mult adjustment calculation, see below
> + * @div_factor:       parameter for cc.mult adjustment calculation, see below

Just use  mult = 2147483648 = 0x80000000 and div = 31.

Read the real PHC using .gettime() and then mask off the high 32 bits.

Arrange a kthread to read once every 4 (better 2) seconds to keep the
time value correct.

See?

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ