I don't see how this could possibly have changed things. The changes will
change the least significant bit by one for fractional results. I've looked
at all the functions that use it and get called by the mlx driver and have
trouble seeing where it could be relevant...

Can you do an experiment to let me know which of the three functions I
changed breaks things?

Warner

On Sun, Nov 18, 2018 at 12:56 PM Allan Jude <allanj...@freebsd.org> wrote:

> On 2018-11-15 11:02, Warner Losh wrote:
> > Author: imp
> > Date: Thu Nov 15 16:02:13 2018
> > New Revision: 340450
> > URL: https://svnweb.freebsd.org/changeset/base/340450
> >
> > Log:
> >   When converting ns,us,ms to sbt, return the ceil() of the result
> >   rather than the floor(). Returning the floor means that
> >   sbttoX(Xtosbt(y)) != y for almost all values of y.  In practice, this
> >   results in a difference of at most 1 in the lsb of the sbintime_t.
> >   This difference is meaningless for all current users of these
> >   functions, but is important for the newly introduced sysctl conversion
> >   routines which implicitly rely on the transformation being idempotent.
> >
> >   Sponsored by: Netflix, Inc
> >
>
> This seems to break attaching for my mlxen(4), with or without r340451
>
> I don't understand why at this point.
>
> Nov 18 19:28:12 CA-HML3-09 kernel: mlx4_core0: <mlx4_core> mem
> 0xfbe00000-0xfbefffff,0xfa800000-0xfaffffff irq 48 at device 0.0
> numa-domain 1 on pci11
> Nov 18 19:28:12 CA-HML3-09 kernel: mlx4_core: Initializing mlx4_core
> Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: command 0x4 timed out (go
> bit not cleared)
> Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: device is going to be reset
> Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: device was reset
> successfully
> Nov 18 19:29:13 CA-HML3-09 kernel: mlx4_core0: QUERY_FW command failed,
> aborting
> Nov 18 19:29:13 CA-HML3-09 kernel: mlx4_core0: Failed to init fw, aborting.
> Nov 18 19:29:13 CA-HML3-09 kernel: device_attach: mlx4_core0 attach
> returned 5
>
> It works fine under r340449:
>
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core0: <mlx4_core> mem
> 0xfbe00000-0xfbefffff,0xfa800000-0xfaffffff irq 48 at device 0.0
> numa-domain 1 on pci11
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core: Mellanox ConnectX core
> driver v3.4.1 (October 2017)
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core: Initializing mlx4_core
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core0: Unable to determine PCI
> device chain minimum BW
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en mlx4_core0: Activating port:1
> Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: Ethernet address:
> 00:02:c9:4d:6a:e8
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlx4_core0: Port 1: Using 32
> TX rings
> Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: link state changed to DOWN
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlx4_core0: Port 1: Using 16
> RX rings
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Using 32 TX rings
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Using 16 RX rings
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Initializing port
> Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Link Down
> Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: link state changed to UP
>
>
>
> > Modified:
> >   head/sys/sys/time.h
> >
> > Modified: head/sys/sys/time.h
> >
> ==============================================================================
> > --- head/sys/sys/time.h       Thu Nov 15 08:43:17 2018        (r340449)
> > +++ head/sys/sys/time.h       Thu Nov 15 16:02:13 2018        (r340450)
> > @@ -161,6 +161,10 @@ sbttobt(sbintime_t _sbt)
> >   * Decimal<->sbt conversions.  Multiplying or dividing by SBT_1NS
> results in
> >   * large roundoff errors which sbttons() and nstosbt() avoid.
> Millisecond and
> >   * microsecond functions are also provided for completeness.
> > + *
> > + * These functions return the smallest sbt larger or equal to the
> number of
> > + * seconds requested so that sbttoX(Xtosbt(y)) == y. The 1 << 32 - 1
> term added
> > + * transforms the >> 32 from floor() to ceil().
> >   */
> >  static __inline int64_t
> >  sbttons(sbintime_t _sbt)
> > @@ -173,7 +177,7 @@ static __inline sbintime_t
> >  nstosbt(int64_t _ns)
> >  {
> >
> > -     return ((_ns * (((uint64_t)1 << 63) / 500000000)) >> 32);
> > +     return ((_ns * (((uint64_t)1 << 63) / 500000000) + (1ull << 32) -
> 1) >> 32);
> >  }
> >
> >  static __inline int64_t
> > @@ -187,7 +191,7 @@ static __inline sbintime_t
> >  ustosbt(int64_t _us)
> >  {
> >
> > -     return ((_us * (((uint64_t)1 << 63) / 500000)) >> 32);
> > +     return ((_us * (((uint64_t)1 << 63) / 500000) + (1ull << 32) - 1)
> >> 32);
> >  }
> >
> >  static __inline int64_t
> > @@ -201,7 +205,7 @@ static __inline sbintime_t
> >  mstosbt(int64_t _ms)
> >  {
> >
> > -     return ((_ms * (((uint64_t)1 << 63) / 500)) >> 32);
> > +     return ((_ms * (((uint64_t)1 << 63) / 500) + (1ull << 32) - 1) >>
> 32);
> >  }
> >
> >  /*-
> >
>
>
> --
> Allan Jude
>
>
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to