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]
Date: Wed, 8 May 2024 19:48:12 -0700
From: Mahesh Bandewar (महेश बंडेवार) <maheshb@...gle.com>
To: Richard Cochran <richardcochran@...il.com>
Cc: Netdev <netdev@...r.kernel.org>, Linux <linux-kernel@...r.kernel.org>, 
	David Miller <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, 
	Thomas Gleixner <tglx@...utronix.de>, Arnd Bergmann <arnd@...db.de>, Sagi Maimon <maimon.sagi@...il.com>, 
	Jonathan Corbet <corbet@....net>, John Stultz <jstultz@...gle.com>, 
	Mahesh Bandewar <mahesh@...dewar.net>
Subject: Re: [PATCHv4 net-next] ptp/ioctl: support MONOTONIC_RAW timestamps
 for PTP_SYS_OFFSET_EXTENDED

On Tue, May 7, 2024 at 9:44 PM Richard Cochran <richardcochran@...il.com> wrote:
>
> On Thu, May 02, 2024 at 02:10:47PM -0700, Mahesh Bandewar wrote:
>
> > @@ -457,14 +459,34 @@ static inline ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp,
> >
> >  static inline void ptp_read_system_prets(struct ptp_system_timestamp *sts)
> >  {
> > -     if (sts)
> > -             ktime_get_real_ts64(&sts->pre_ts);
> > +     if (sts) {
> > +             switch (sts->clockid) {
> > +             case CLOCK_REALTIME:
> > +                     ktime_get_real_ts64(&sts->pre_ts);
> > +                     break;
> > +             case CLOCK_MONOTONIC_RAW:
> > +                     ktime_get_raw_ts64(&sts->pre_ts);
> > +                     break;
>
> Why not add CLOCK_MONOTONIC as well?
> That would be useful in many cases.
>
In fact my original implementation had it but my use case is really
CLOCK_MONOTONIC_RAW, however, the general opinion on the thread was to
implement what is needed now and if someone needs (CLOCK_MONOTONIC),
it can be added at that time. So I removed it.

> > +/*
> > + * ptp_sys_offset_extended - data structure for IOCTL operation
> > + *                        PTP_SYS_OFFSET_EXTENDED
> > + *
> > + * @n_samples:       Desired number of measurements.
> > + * @clockid: clockid of a clock-base used for pre/post timestamps.
> > + * @rsv:     Reserved for future use.
> > + * @ts:              Array of samples in the form [pre-TS, PHC, post-TS]. The
> > + *           kernel provides @n_samples.
> > + *
> > + * History:
> > + * v1: Initial implementation.
> > + *
> > + * v2: Use the first word of the reserved-field for @clockid. That's
> > + *     backward compatible since v1 expects all three reserved words
> > + *     (@rsv[3]) to be 0 while the clockid (first word in v2) for
> > + *     CLOCK_REALTIME is '0'.
>
> This is not really appropriate for a source code comment.  The
> un-merged patch series iterations are preserved at lore.kernel in case
> someone needs that.
>
This was added in rev3
(Also this is the API version-history which intends to track how the
fields have changed / morphed and not to be confused with the patch
versions)

> The "backward compatible" information really wants to be in the commit
> message.
>
I have the last paragraph in the commit log about compatibility.


Thanks for the comments,
--mahesh..

> Thanks,
> Richard
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ