Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 2024 09:51:37 -0400
From:      Warner Losh <imp@bsdimp.com>
To:        Cy Schubert <Cy.Schubert@cschubert.com>
Cc:        Nuno Teixeira <eduardo@freebsd.org>, Warner Losh <imp@freebsd.org>,  src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>,  "<dev-commits-src-main@freebsd.org>" <dev-commits-src-main@freebsd.org>
Subject:   Re: git: 108de784513d - main - Redefine CLOCK_BOOTTIME to alias CLOCK_MONOTONIC, not CLOCK_UPTIME
Message-ID:  <CANCZdfpp4sOHxygKuYF%2BpyBb8K_Nm3tXo75zpwo2e3w9hsAS9w@mail.gmail.com>
In-Reply-To: <20240601133156.8EB804B0@slippy.cwsent.com>
References:  <202405311447.44VEl1G1078199@gitrepo.freebsd.org> <CAFDf7ULP1X_LgDOrKhMEFF7AgBQPPaJGhbRsaNcUpUOBo9JN9g@mail.gmail.com> <CANCZdfpMvorgKYx6pCL7_q6BW3AqZSDwryKHg_cV%2Byt_E-FbOQ@mail.gmail.com> <20240601133156.8EB804B0@slippy.cwsent.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Sat, Jun 1, 2024 at 9:31 AM Cy Schubert <Cy.Schubert@cschubert.com>
wrote:

> In message
> <CANCZdfpMvorgKYx6pCL7_q6BW3AqZSDwryKHg_cV+yt_E-FbOQ@mail.gmail.c
> om>
> , Warner Losh writes:
> > --0000000000000d72080619d34a39
> > Content-Type: text/plain; charset="UTF-8"
> > Content-Transfer-Encoding: quoted-printable
> >
> > On Sat, Jun 1, 2024, 4:37=E2=80=AFAM Nuno Teixeira <eduardo@freebsd.org>
> wr=
> > ote:
> >
> > > Hello,
> > >
> > > Having issues building graphics/mesa-dri:
> > >
> > > ../src/intel/common/xe/intel_gem.c:72:9: error: duplicate case value
> '4'
> > >    72 |    case CLOCK_BOOTTIME:
> > >       |         ^
> > > /usr/include/sys/_clock_id.h:81:25: note: expanded from macro
> > > 'CLOCK_BOOTTIME'
> > >    81 | #define CLOCK_BOOTTIME          CLOCK_MONOTONIC
> > >       |                                 ^
> > > /usr/include/sys/_clock_id.h:56:26: note: expanded from macro
> > > 'CLOCK_MONOTONIC'
> > >    56 | #define CLOCK_MONOTONIC         4
> > >       |                                 ^
> > > ../src/intel/common/xe/intel_gem.c:66:9: note: previous case defined
> here
> > >    66 |    case CLOCK_MONOTONIC:
> > >       |         ^
> > > /usr/include/sys/_clock_id.h:56:26: note: expanded from macro
> > > 'CLOCK_MONOTONIC'
> > >    56 | #define CLOCK_MONOTONIC         4
> > >       |                                 ^
> > > 1 error generated.
> > >
> >
> > Mesa needs to be updated to not assume these are distinct values.
>
> You should be able to resolve this with,
>
> --- src/intel/common/xe/intel_gem.c.orig        2024-05-22
> 09:48:39.000000000 -0700
> +++ src/intel/common/xe/intel_gem.c     2024-06-01 06:28:22.268439000 -0700
> @@ -69,8 +69,10 @@
>  #endif
>     case CLOCK_REALTIME:
>  #ifdef CLOCK_BOOTTIME
> +#if CLOCK_BOOTTIME != CLOCK_MONOTONIC
>     case CLOCK_BOOTTIME:
>  #endif
> +#endif
>  #ifdef CLOCK_TAI
>     case CLOCK_TAI:
>  #endif
>

Yea, that should do it. I was going to look at this when I got back from
BSDcan (mostly because
my talk is this morning), but thanks for beating me to it.  I woke up grump
and it was bugging me
on the walk over to the conference I was a little short in my first reply,
but since you proposed a
fix, I feel less guilty... :) Thanks!

Warner

Warner

Warner

> --
> Cheers,
> Cy Schubert <Cy.Schubert@cschubert.com>
> FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
> NTP:           <cy@nwtime.org>    Web:  https://nwtime.org
>
>                         e^(i*pi)+1=0
>
>
> >
> > Warner
> >
> >
> > > Thanks
> > >
> > > Warner Losh <imp@freebsd.org> escreveu (sexta, 31/05/2024 =C3=A0(s)
> 15:47=
> > ):
> > >
> > >> The branch main has been updated by imp:
> > >>
> > >> URL:
> > >>
> https://cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe850e7b003a73e=
> > 26b5b54caa
> > >>
> > >> commit 108de784513d87bbe850e7b003a73e26b5b54caa
> > >> Author:     Val Packett <val@packett.cool>
> > >> AuthorDate: 2024-05-31 14:45:02 +0000
> > >> Commit:     Warner Losh <imp@FreeBSD.org>
> > >> CommitDate: 2024-05-31 14:45:02 +0000
> > >>
> > >>     Redefine CLOCK_BOOTTIME to alias CLOCK_MONOTONIC, not CLOCK_UPTIME
> > >>
> > >>     The suspend-awareness situation with monotonic clocks across
> platfor=
> > ms
> > >>     is kind of a mess, let's try not making it worse.
> > >>
> > >>     On Linux, CLOCK_MONOTONIC does NOT count suspended time, and
> > >>     CLOCK_BOOTTIME was introduced to INCLUDE suspended time.
> > >>
> > >>     On OpenBSD, CLOCK_MONOTONIC DOES count suspended time, and
> > >> CLOCK_UPTIME
> > >>     was introduced to EXCLUDE suspended time.
> > >>
> > >>     On macOS, it's the same as OpenBSD, but with CLOCK_UPTIME_RAW.
> > >>
> > >>     Right now, we do not have a monotonic clock that counts suspended
> > >> time.
> > >>     We have CLOCK_UPTIME as a distinct ID alias, and CLOCK_BOOTTIME
> as a
> > >>     preprocessor alias, both being effectively `CLOCK_MONOTONIC` for
> now=
> > .
> > >>
> > >>     When we introduce a suspend-aware clock in the future, it would
> make=
> >  a
> > >>     lot more sense to do it the OpenBSD/macOS way, i.e. to make
> > >>     CLOCK_MONOTONIC include suspended time and make CLOCK_UPTIME
> exclude
> > >> it,
> > >>     because that's what the name CLOCK_UPTIME implies: a deviation
> from
> > >> the
> > >>     default intended for the uptime command to allow it to only show
> the
> > >>     time the system was actually up and not suspended.
> > >>
> > >>     Let's change the define right now to make sure software using the
> > >> define
> > >>     would not end up using the ID of the wrong clock in the future,
> and
> > >> fix
> > >>     the IDs in the Linux compat code to match the expected changes
> too.
> > >>
> > >>     See https://bugzilla.mozilla.org/show_bug.cgi?id=3D1824084
> > >>     for more discussion.
> > >>
> > >>     Fixes:          155f15118a77 ("clock_gettime: Add Linux aliases
> for
> > >> CLOCK_*")
> > >>     Fixes:          25ada637362d ("Map Linux CLOCK_BOOTTIME to native
> > >> CLOCK_UPTIME.")
> > >>     Sponsored by:   https://www.patreon.com/valpackett
> > >>     Reviewed by:    kib, imp
> > >>     Differential Revision:  https://reviews.freebsd.org/D39270
> > >> ---
> > >>  sys/compat/linux/linux_time.c | 6 +++---
> > >>  sys/sys/_clock_id.h           | 2 +-
> > >>  2 files changed, 4 insertions(+), 4 deletions(-)
> > >>
> > >> diff --git a/sys/compat/linux/linux_time.c
> b/sys/compat/linux/linux_time=
> > .c
> > >> index e9e5cf075210..f4dd26dd3d2a 100644
> > >> --- a/sys/compat/linux/linux_time.c
> > >> +++ b/sys/compat/linux/linux_time.c
> > >> @@ -287,7 +287,7 @@ linux_to_native_clockid(clockid_t *n, clockid_t l)
> > >>                 *n =3D CLOCK_REALTIME;
> > >>                 break;
> > >>         case LINUX_CLOCK_MONOTONIC:
> > >> -               *n =3D CLOCK_MONOTONIC;
> > >> +               *n =3D CLOCK_UPTIME;
> > >>                 break;
> > >>         case LINUX_CLOCK_PROCESS_CPUTIME_ID:
> > >>                 *n =3D CLOCK_PROCESS_CPUTIME_ID;
> > >> @@ -300,10 +300,10 @@ linux_to_native_clockid(clockid_t *n, clockid_t
> l)
> > >>                 break;
> > >>         case LINUX_CLOCK_MONOTONIC_COARSE:
> > >>         case LINUX_CLOCK_MONOTONIC_RAW:
> > >> -               *n =3D CLOCK_MONOTONIC_FAST;
> > >> +               *n =3D CLOCK_UPTIME_FAST;
> > >>                 break;
> > >>         case LINUX_CLOCK_BOOTTIME:
> > >> -               *n =3D CLOCK_UPTIME;
> > >> +               *n =3D CLOCK_MONOTONIC;
> > >>                 break;
> > >>         case LINUX_CLOCK_REALTIME_ALARM:
> > >>         case LINUX_CLOCK_BOOTTIME_ALARM:
> > >> diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h
> > >> index 47a551428dc3..728346a0f0ab 100644
> > >> --- a/sys/sys/_clock_id.h
> > >> +++ b/sys/sys/_clock_id.h
> > >> @@ -78,7 +78,7 @@
> > >>   * Linux compatible names.
> > >>   */
> > >>  #if __BSD_VISIBLE
> > >> -#define        CLOCK_BOOTTIME          CLOCK_UPTIME
> > >> +#define        CLOCK_BOOTTIME          CLOCK_MONOTONIC
> > >>  #define        CLOCK_REALTIME_COARSE   CLOCK_REALTIME_FAST
> > >>  #define        CLOCK_MONOTONIC_COARSE  CLOCK_MONOTONIC_FAST
> > >>  #endif
> > >>
> > >>
> > >
> > > --
> > > Nuno Teixeira
> > > FreeBSD UNIX:  <eduardo@FreeBSD.org>   Web:  https://FreeBSD.org
> > >
> >
> > --0000000000000d72080619d34a39
> > Content-Type: text/html; charset="UTF-8"
> > Content-Transfer-Encoding: quoted-printable
> >
> > <div dir=3D"ltr"><div dir=3D"auto"><div><br><br><div
> class=3D"gmail_quote">=
> > <div dir=3D"ltr" class=3D"gmail_attr">On Sat, Jun 1, 2024,
> 4:37=E2=80=AFAM =
> > Nuno Teixeira &lt;<a href=3D"mailto:eduardo@freebsd.org"
> target=3D"_blank">=
> > eduardo@freebsd.org</a>&gt; wrote:<br></div><blockquote
> class=3D"gmail_quot=
> > e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc
> solid;padding-left:1ex">=
> > <div dir=3D"ltr"><div>Hello,</div><div><br></div><div>Having issues
> buildin=
> > g
> graphics/mesa-dri:</div><div><br></div><div>../src/intel/common/xe/intel_=
> > gem.c:72:9: error: duplicate case value &#39;4&#39;<br>=C2=A0 =C2=A072 |
> =
> > =C2=A0 =C2=A0case CLOCK_BOOTTIME:<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0
> =C2=A0 =
> > =C2=A0 =C2=A0 ^<br>/usr/include/sys/_clock_id.h:81:25: note: expanded
> from =
> > macro &#39;CLOCK_BOOTTIME&#39;<br>=C2=A0 =C2=A081 | #define
> CLOCK_BOOTTIME =
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CLOCK_MONOTONIC<br>=C2=A0 =C2=A0
> =C2=A0 |=
> >  =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> =C2=
> > =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> ^<br>/usr/include/sys/_clock_id.h:56=
> > :26: note: expanded from macro &#39;CLOCK_MONOTONIC&#39;<br>=C2=A0
> =C2=A056=
> >  | #define CLOCK_MONOTONIC =C2=A0 =C2=A0 =C2=A0 =C2=A0 4<br>=C2=A0
> =C2=A0 =
> > =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> =C2=
> > =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> ^<br>../src/intel/common/xe/i=
> > ntel_gem.c:66:9: note: previous case defined here<br>=C2=A0 =C2=A066 |
> =C2=
> > =A0 =C2=A0case CLOCK_MONOTONIC:<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0
> =C2=
> > =A0 =C2=A0 ^<br>/usr/include/sys/_clock_id.h:56:26: note: expanded from
> mac=
> > ro &#39;CLOCK_MONOTONIC&#39;<br>=C2=A0 =C2=A056 | #define
> CLOCK_MONOTONIC =
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 4<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0
> =C2=
> > =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> =C2=A0 =
> > =C2=A0 =C2=A0 =C2=A0 ^<br>1 error
> generated.</div></div></blockquote></div>=
> > </div><div dir=3D"auto"><br></div><div dir=3D"auto"><div
> class=3D"gmail_quo=
> > te"><div>Mesa needs to be updated to not assume these are distinct
> values.<=
> > /div><div><br></div><div>Warner</div><div>=C2=A0</div><blockquote
> class=3D"=
> > gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc
> solid;padding-=
> > left:1ex"><div dir=3D"ltr"><div><font color=3D"#888888">Thanks<br
> clear=3D"=
> > all"></font></div><div></div></div><br><div class=3D"gmail_quote"><div
> dir=
> > =3D"ltr" class=3D"gmail_attr">Warner Losh &lt;<a href=3D"mailto:
> imp@freebsd=
> > .org" rel=3D"noreferrer" target=3D"_blank">imp@freebsd.org</a>&gt;
> escreveu=
> >  (sexta, 31/05/2024 =C3=A0(s) 15:47):<br></div><blockquote
> class=3D"gmail_q=
> > uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid
> rgb(204,204,2=
> > 04);padding-left:1ex">The branch main has been updated by imp:<br>
> > <br>
> > URL: <a href=3D"
> https://cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe=
> > 850e7b003a73e26b5b54caa" rel=3D"noreferrer noreferrer"
> target=3D"_blank">ht=
> > tps://
> cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe850e7b003a73e26b5b=
> > 54caa</a><br>
> > <br>
> > commit 108de784513d87bbe850e7b003a73e26b5b54caa<br>
> > Author:=C2=A0 =C2=A0 =C2=A0Val Packett &lt;val@packett.cool&gt;<br>
> > AuthorDate: 2024-05-31 14:45:02 +0000<br>
> > Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
> > CommitDate: 2024-05-31 14:45:02 +0000<br>
> > <br>
> > =C2=A0 =C2=A0 Redefine CLOCK_BOOTTIME to alias CLOCK_MONOTONIC, not
> CLOCK_U=
> > PTIME<br>
> > <br>
> > =C2=A0 =C2=A0 The suspend-awareness situation with monotonic clocks
> across =
> > platforms<br>
> > =C2=A0 =C2=A0 is kind of a mess, let&#39;s try not making it worse.<br>
> > <br>
> > =C2=A0 =C2=A0 On Linux, CLOCK_MONOTONIC does NOT count suspended time,
> and<=
> > br>
> > =C2=A0 =C2=A0 CLOCK_BOOTTIME was introduced to INCLUDE suspended
> time.<br>
> > <br>
> > =C2=A0 =C2=A0 On OpenBSD, CLOCK_MONOTONIC DOES count suspended time, and
> CL=
> > OCK_UPTIME<br>
> > =C2=A0 =C2=A0 was introduced to EXCLUDE suspended time.<br>
> > <br>
> > =C2=A0 =C2=A0 On macOS, it&#39;s the same as OpenBSD, but with
> CLOCK_UPTIME=
> > _RAW.<br>
> > <br>
> > =C2=A0 =C2=A0 Right now, we do not have a monotonic clock that counts
> suspe=
> > nded time.<br>
> > =C2=A0 =C2=A0 We have CLOCK_UPTIME as a distinct ID alias, and
> CLOCK_BOOTTI=
> > ME as a<br>
> > =C2=A0 =C2=A0 preprocessor alias, both being effectively
> `CLOCK_MONOTONIC` =
> > for now.<br>
> > <br>
> > =C2=A0 =C2=A0 When we introduce a suspend-aware clock in the future, it
> wou=
> > ld make a<br>
> > =C2=A0 =C2=A0 lot more sense to do it the OpenBSD/macOS way, i.e. to
> make<b=
> > r>
> > =C2=A0 =C2=A0 CLOCK_MONOTONIC include suspended time and make
> CLOCK_UPTIME =
> > exclude it,<br>
> > =C2=A0 =C2=A0 because that&#39;s what the name CLOCK_UPTIME implies: a
> devi=
> > ation from the<br>
> > =C2=A0 =C2=A0 default intended for the uptime command to allow it to
> only s=
> > how the<br>
> > =C2=A0 =C2=A0 time the system was actually up and not suspended.<br>
> > <br>
> > =C2=A0 =C2=A0 Let&#39;s change the define right now to make sure
> software u=
> > sing the define<br>
> > =C2=A0 =C2=A0 would not end up using the ID of the wrong clock in the
> futur=
> > e, and fix<br>
> > =C2=A0 =C2=A0 the IDs in the Linux compat code to match the expected
> change=
> > s too.<br>
> > <br>
> > =C2=A0 =C2=A0 See <a href=3D"
> https://bugzilla.mozilla.org/show_bug.cgi?id=
> > =3D1824084" rel=3D"noreferrer noreferrer" target=3D"_blank">
> https://bugzill=
> > a.mozilla.org/show_bug.cgi?id=3D1824084</a><br>
> > =C2=A0 =C2=A0 for more discussion.<br>
> > <br>
> > =C2=A0 =C2=A0 Fixes:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 155f15118a77
> (&quot;=
> > clock_gettime: Add Linux aliases for CLOCK_*&quot;)<br>
> > =C2=A0 =C2=A0 Fixes:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 25ada637362d
> (&quot;=
> > Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.&quot;)<br>
> > =C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0<a href=3D"
> https://www.patreon.com/=
> > valpackett" rel=3D"noreferrer noreferrer" target=3D"_blank">
> https://www.pat=
> > reon.com/valpackett</a><br>
> > =C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 kib, imp<br>
> > =C2=A0 =C2=A0 Differential Revision:=C2=A0 <a href=3D"
> https://reviews.freeb=
> > sd.org/D39270" rel=3D"noreferrer noreferrer" target=3D"_blank">
> https://revi=
> > ews.freebsd.org/D39270</a><br>
> > ---<br>
> > =C2=A0sys/compat/linux/linux_time.c | 6 +++---<br>
> > =C2=A0sys/sys/_clock_id.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 2
> +-<br=
> > >
> > =C2=A02 files changed, 4 insertions(+), 4 deletions(-)<br>
> > <br>
> > diff --git a/sys/compat/linux/linux_time.c
> b/sys/compat/linux/linux_time.c<=
> > br>
> > index e9e5cf075210..f4dd26dd3d2a 100644<br>
> > --- a/sys/compat/linux/linux_time.c<br>
> > +++ b/sys/compat/linux/linux_time.c<br>
> > @@ -287,7 +287,7 @@ linux_to_native_clockid(clockid_t *n, clockid_t
> l)<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *n =3D
> CLOCK_REALTI=
> > ME;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_MONOTONIC:<br>
> > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D
> CLOCK_MONOTO=
> > NIC;<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D
> CLOCK_UPTIME=
> > ;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_PROCESS_CPUTIME_ID:<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *n =3D
> CLOCK_PROCES=
> > S_CPUTIME_ID;<br>
> > @@ -300,10 +300,10 @@ linux_to_native_clockid(clockid_t *n, clockid_t
> l)<br=
> > >
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_MONOTONIC_COARSE:<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_MONOTONIC_RAW:<br>
> > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D
> CLOCK_MONOTO=
> > NIC_FAST;<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D
> CLOCK_UPTIME=
> > _FAST;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_BOOTTIME:<br>
> > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D
> CLOCK_UPTIME=
> > ;<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D
> CLOCK_MONOTO=
> > NIC;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_REALTIME_ALARM:<br>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_BOOTTIME_ALARM:<br>
> > diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h<br>
> > index 47a551428dc3..728346a0f0ab 100644<br>
> > --- a/sys/sys/_clock_id.h<br>
> > +++ b/sys/sys/_clock_id.h<br>
> > @@ -78,7 +78,7 @@<br>
> > =C2=A0 * Linux compatible names.<br>
> > =C2=A0 */<br>
> > =C2=A0#if __BSD_VISIBLE<br>
> > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_BOOTTIME=C2=A0 =C2=A0 =C2=A0
> =C2=
> > =A0 =C2=A0 CLOCK_UPTIME<br>
> > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_BOOTTIME=C2=A0 =C2=A0 =C2=A0
> =C2=
> > =A0 =C2=A0 CLOCK_MONOTONIC<br>
> > =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_REALTIME_COARSE=C2=A0
> =C2=A0=
> > CLOCK_REALTIME_FAST<br>
> > =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_MONOTONIC_COARSE=C2=A0
> CLOCK=
> > _MONOTONIC_FAST<br>
> > =C2=A0#endif<br>
> > <br>
> > </blockquote></div><br clear=3D"all"><br><span
> class=3D"gmail_signature_pre=
> > fix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><div
> dir=3D"l=
> > tr"><div><font color=3D"#888888">Nuno
> Teixeira</font></div><div><div><font =
> > color=3D"#888888">
> > FreeBSD UNIX:=C2=A0 &lt;eduardo@FreeBSD.org&gt;=C2=A0 =C2=A0Web:=C2=A0
> <a h=
> > ref=3D"https://FreeBSD.org" rel=3D"noreferrer noreferrer"
> target=3D"_blank"=
> > >https://FreeBSD.org</a><br></font></div></div></div></div>;
> > </blockquote></div></div></div>
> > </div>
> >
> > --0000000000000d72080619d34a39--
> >
>
>
>

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 1, 2024 at 9:31 AM Cy Schubert &lt;<a href="mailto:Cy.Schubert@cschubert.com">Cy.Schubert@cschubert.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In message &lt;CANCZdfpMvorgKYx6pCL7_q6BW3AqZSDwryKHg_cV+yt_E-FbOQ@mail.gmail.c<br>
om&gt;<br>
, Warner Losh writes:<br>
&gt; --0000000000000d72080619d34a39<br>
&gt; Content-Type: text/plain; charset=&quot;UTF-8&quot;<br>
&gt; Content-Transfer-Encoding: quoted-printable<br>
&gt;<br>
&gt; On Sat, Jun 1, 2024, 4:37=E2=80=AFAM Nuno Teixeira &lt;<a href="mailto:eduardo@freebsd.org" target="_blank">eduardo@freebsd.org</a>&gt; wr=<br>
&gt; ote:<br>
&gt;<br>
&gt; &gt; Hello,<br>
&gt; &gt;<br>
&gt; &gt; Having issues building graphics/mesa-dri:<br>
&gt; &gt;<br>
&gt; &gt; ../src/intel/common/xe/intel_gem.c:72:9: error: duplicate case value &#39;4&#39;<br>
&gt; &gt;    72 |    case CLOCK_BOOTTIME:<br>
&gt; &gt;       |         ^<br>
&gt; &gt; /usr/include/sys/_clock_id.h:81:25: note: expanded from macro<br>
&gt; &gt; &#39;CLOCK_BOOTTIME&#39;<br>
&gt; &gt;    81 | #define CLOCK_BOOTTIME          CLOCK_MONOTONIC<br>
&gt; &gt;       |                                 ^<br>
&gt; &gt; /usr/include/sys/_clock_id.h:56:26: note: expanded from macro<br>
&gt; &gt; &#39;CLOCK_MONOTONIC&#39;<br>
&gt; &gt;    56 | #define CLOCK_MONOTONIC         4<br>
&gt; &gt;       |                                 ^<br>
&gt; &gt; ../src/intel/common/xe/intel_gem.c:66:9: note: previous case defined here<br>
&gt; &gt;    66 |    case CLOCK_MONOTONIC:<br>
&gt; &gt;       |         ^<br>
&gt; &gt; /usr/include/sys/_clock_id.h:56:26: note: expanded from macro<br>
&gt; &gt; &#39;CLOCK_MONOTONIC&#39;<br>
&gt; &gt;    56 | #define CLOCK_MONOTONIC         4<br>
&gt; &gt;       |                                 ^<br>
&gt; &gt; 1 error generated.<br>
&gt; &gt;<br>
&gt;<br>
&gt; Mesa needs to be updated to not assume these are distinct values.<br>
<br>
You should be able to resolve this with,<br>
<br>
--- src/intel/common/xe/intel_gem.c.orig        2024-05-22 09:48:39.000000000 -0700<br>
+++ src/intel/common/xe/intel_gem.c     2024-06-01 06:28:22.268439000 -0700<br>
@@ -69,8 +69,10 @@<br>
 #endif<br>
    case CLOCK_REALTIME:<br>
 #ifdef CLOCK_BOOTTIME<br>
+#if CLOCK_BOOTTIME != CLOCK_MONOTONIC<br>
    case CLOCK_BOOTTIME:<br>
 #endif<br>
+#endif<br>
 #ifdef CLOCK_TAI<br>
    case CLOCK_TAI:<br>
 #endif<br></blockquote><div><br></div><div>Yea, that should do it. I was going to look at this when I got back from BSDcan (mostly because</div><div>my talk is this morning), but thanks for beating me to it.  I woke up grump and it was bugging me</div><div>on the walk over to the conference I was a little short in my first reply, but since you proposed a</div><div>fix, I feel less guilty... :) Thanks!</div><div><br></div><div>Warner</div><div><br></div><div>Warner</div><div><br></div><div>Warner </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-- <br>
Cheers,<br>
Cy Schubert &lt;<a href="mailto:Cy.Schubert@cschubert.com" target="_blank">Cy.Schubert@cschubert.com</a>&gt;<br>
FreeBSD UNIX:  &lt;cy@FreeBSD.org&gt;   Web:  <a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br>;
NTP:           &lt;<a href="mailto:cy@nwtime.org" target="_blank">cy@nwtime.org</a>&gt;    Web:  <a href="https://nwtime.org" rel="noreferrer" target="_blank">https://nwtime.org</a><br>;
<br>
                        e^(i*pi)+1=0<br>
<br>
<br>
&gt;<br>
&gt; Warner<br>
&gt;<br>
&gt;<br>
&gt; &gt; Thanks<br>
&gt; &gt;<br>
&gt; &gt; Warner Losh &lt;<a href="mailto:imp@freebsd.org" target="_blank">imp@freebsd.org</a>&gt; escreveu (sexta, 31/05/2024 =C3=A0(s) 15:47=<br>
&gt; ):<br>
&gt; &gt;<br>
&gt; &gt;&gt; The branch main has been updated by imp:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; URL:<br>
&gt; &gt;&gt; <a href="https://cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe850e7b003a73e=" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe850e7b003a73e=</a><br>;
&gt; 26b5b54caa<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; commit 108de784513d87bbe850e7b003a73e26b5b54caa<br>
&gt; &gt;&gt; Author:     Val Packett &lt;val@packett.cool&gt;<br>
&gt; &gt;&gt; AuthorDate: 2024-05-31 14:45:02 +0000<br>
&gt; &gt;&gt; Commit:     Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; &gt;&gt; CommitDate: 2024-05-31 14:45:02 +0000<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     Redefine CLOCK_BOOTTIME to alias CLOCK_MONOTONIC, not CLOCK_UPTIME<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     The suspend-awareness situation with monotonic clocks across platfor=<br>
&gt; ms<br>
&gt; &gt;&gt;     is kind of a mess, let&#39;s try not making it worse.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     On Linux, CLOCK_MONOTONIC does NOT count suspended time, and<br>
&gt; &gt;&gt;     CLOCK_BOOTTIME was introduced to INCLUDE suspended time.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     On OpenBSD, CLOCK_MONOTONIC DOES count suspended time, and<br>
&gt; &gt;&gt; CLOCK_UPTIME<br>
&gt; &gt;&gt;     was introduced to EXCLUDE suspended time.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     On macOS, it&#39;s the same as OpenBSD, but with CLOCK_UPTIME_RAW.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     Right now, we do not have a monotonic clock that counts suspended<br>
&gt; &gt;&gt; time.<br>
&gt; &gt;&gt;     We have CLOCK_UPTIME as a distinct ID alias, and CLOCK_BOOTTIME as a<br>
&gt; &gt;&gt;     preprocessor alias, both being effectively `CLOCK_MONOTONIC` for now=<br>
&gt; .<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     When we introduce a suspend-aware clock in the future, it would make=<br>
&gt;  a<br>
&gt; &gt;&gt;     lot more sense to do it the OpenBSD/macOS way, i.e. to make<br>
&gt; &gt;&gt;     CLOCK_MONOTONIC include suspended time and make CLOCK_UPTIME exclude<br>
&gt; &gt;&gt; it,<br>
&gt; &gt;&gt;     because that&#39;s what the name CLOCK_UPTIME implies: a deviation from<br>
&gt; &gt;&gt; the<br>
&gt; &gt;&gt;     default intended for the uptime command to allow it to only show the<br>
&gt; &gt;&gt;     time the system was actually up and not suspended.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     Let&#39;s change the define right now to make sure software using the<br>
&gt; &gt;&gt; define<br>
&gt; &gt;&gt;     would not end up using the ID of the wrong clock in the future, and<br>
&gt; &gt;&gt; fix<br>
&gt; &gt;&gt;     the IDs in the Linux compat code to match the expected changes too.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=3D1824084" rel="noreferrer" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=3D1824084</a><br>;
&gt; &gt;&gt;     for more discussion.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;     Fixes:          155f15118a77 (&quot;clock_gettime: Add Linux aliases for<br>
&gt; &gt;&gt; CLOCK_*&quot;)<br>
&gt; &gt;&gt;     Fixes:          25ada637362d (&quot;Map Linux CLOCK_BOOTTIME to native<br>
&gt; &gt;&gt; CLOCK_UPTIME.&quot;)<br>
&gt; &gt;&gt;     Sponsored by:   <a href="https://www.patreon.com/valpackett" rel="noreferrer" target="_blank">https://www.patreon.com/valpackett</a><br>;
&gt; &gt;&gt;     Reviewed by:    kib, imp<br>
&gt; &gt;&gt;     Differential Revision:  <a href="https://reviews.freebsd.org/D39270" rel="noreferrer" target="_blank">https://reviews.freebsd.org/D39270</a><br>;
&gt; &gt;&gt; ---<br>
&gt; &gt;&gt;  sys/compat/linux/linux_time.c | 6 +++---<br>
&gt; &gt;&gt;  sys/sys/_clock_id.h           | 2 +-<br>
&gt; &gt;&gt;  2 files changed, 4 insertions(+), 4 deletions(-)<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time=<br>
&gt; .c<br>
&gt; &gt;&gt; index e9e5cf075210..f4dd26dd3d2a 100644<br>
&gt; &gt;&gt; --- a/sys/compat/linux/linux_time.c<br>
&gt; &gt;&gt; +++ b/sys/compat/linux/linux_time.c<br>
&gt; &gt;&gt; @@ -287,7 +287,7 @@ linux_to_native_clockid(clockid_t *n, clockid_t l)<br>
&gt; &gt;&gt;                 *n =3D CLOCK_REALTIME;<br>
&gt; &gt;&gt;                 break;<br>
&gt; &gt;&gt;         case LINUX_CLOCK_MONOTONIC:<br>
&gt; &gt;&gt; -               *n =3D CLOCK_MONOTONIC;<br>
&gt; &gt;&gt; +               *n =3D CLOCK_UPTIME;<br>
&gt; &gt;&gt;                 break;<br>
&gt; &gt;&gt;         case LINUX_CLOCK_PROCESS_CPUTIME_ID:<br>
&gt; &gt;&gt;                 *n =3D CLOCK_PROCESS_CPUTIME_ID;<br>
&gt; &gt;&gt; @@ -300,10 +300,10 @@ linux_to_native_clockid(clockid_t *n, clockid_t l)<br>
&gt; &gt;&gt;                 break;<br>
&gt; &gt;&gt;         case LINUX_CLOCK_MONOTONIC_COARSE:<br>
&gt; &gt;&gt;         case LINUX_CLOCK_MONOTONIC_RAW:<br>
&gt; &gt;&gt; -               *n =3D CLOCK_MONOTONIC_FAST;<br>
&gt; &gt;&gt; +               *n =3D CLOCK_UPTIME_FAST;<br>
&gt; &gt;&gt;                 break;<br>
&gt; &gt;&gt;         case LINUX_CLOCK_BOOTTIME:<br>
&gt; &gt;&gt; -               *n =3D CLOCK_UPTIME;<br>
&gt; &gt;&gt; +               *n =3D CLOCK_MONOTONIC;<br>
&gt; &gt;&gt;                 break;<br>
&gt; &gt;&gt;         case LINUX_CLOCK_REALTIME_ALARM:<br>
&gt; &gt;&gt;         case LINUX_CLOCK_BOOTTIME_ALARM:<br>
&gt; &gt;&gt; diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h<br>
&gt; &gt;&gt; index 47a551428dc3..728346a0f0ab 100644<br>
&gt; &gt;&gt; --- a/sys/sys/_clock_id.h<br>
&gt; &gt;&gt; +++ b/sys/sys/_clock_id.h<br>
&gt; &gt;&gt; @@ -78,7 +78,7 @@<br>
&gt; &gt;&gt;   * Linux compatible names.<br>
&gt; &gt;&gt;   */<br>
&gt; &gt;&gt;  #if __BSD_VISIBLE<br>
&gt; &gt;&gt; -#define        CLOCK_BOOTTIME          CLOCK_UPTIME<br>
&gt; &gt;&gt; +#define        CLOCK_BOOTTIME          CLOCK_MONOTONIC<br>
&gt; &gt;&gt;  #define        CLOCK_REALTIME_COARSE   CLOCK_REALTIME_FAST<br>
&gt; &gt;&gt;  #define        CLOCK_MONOTONIC_COARSE  CLOCK_MONOTONIC_FAST<br>
&gt; &gt;&gt;  #endif<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; Nuno Teixeira<br>
&gt; &gt; FreeBSD UNIX:  &lt;eduardo@FreeBSD.org&gt;   Web:  <a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br>;
&gt; &gt;<br>
&gt;<br>
&gt; --0000000000000d72080619d34a39<br>
&gt; Content-Type: text/html; charset=&quot;UTF-8&quot;<br>
&gt; Content-Transfer-Encoding: quoted-printable<br>
&gt;<br>
&gt; &lt;div dir=3D&quot;ltr&quot;&gt;&lt;div dir=3D&quot;auto&quot;&gt;&lt;div&gt;&lt;br&gt;&lt;br&gt;&lt;div class=3D&quot;gmail_quote&quot;&gt;=<br>
&gt; &lt;div dir=3D&quot;ltr&quot; class=3D&quot;gmail_attr&quot;&gt;On Sat, Jun 1, 2024, 4:37=E2=80=AFAM =<br>
&gt; Nuno Teixeira &amp;lt;&lt;a href=3D&quot;mailto:<a href="mailto:eduardo@freebsd.org" target="_blank">eduardo@freebsd.org</a>&quot; target=3D&quot;_blank&quot;&gt;=<br>
&gt; <a href="mailto:eduardo@freebsd.org" target="_blank">eduardo@freebsd.org</a>&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;&lt;/div&gt;&lt;blockquote class=3D&quot;gmail_quot=<br>
&gt; e&quot; style=3D&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex&quot;&gt;=<br>
&gt; &lt;div dir=3D&quot;ltr&quot;&gt;&lt;div&gt;Hello,&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Having issues buildin=<br>
&gt; g graphics/mesa-dri:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;../src/intel/common/xe/intel_=<br>
&gt; gem.c:72:9: error: duplicate case value &amp;#39;4&amp;#39;&lt;br&gt;=C2=A0 =C2=A072 | =<br>
&gt; =C2=A0 =C2=A0case CLOCK_BOOTTIME:&lt;br&gt;=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =<br>
&gt; =C2=A0 =C2=A0 ^&lt;br&gt;/usr/include/sys/_clock_id.h:81:25: note: expanded from =<br>
&gt; macro &amp;#39;CLOCK_BOOTTIME&amp;#39;&lt;br&gt;=C2=A0 =C2=A081 | #define CLOCK_BOOTTIME =<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CLOCK_MONOTONIC&lt;br&gt;=C2=A0 =C2=A0 =C2=A0 |=<br>
&gt;  =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=<br>
&gt; =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^&lt;br&gt;/usr/include/sys/_clock_id.h:56=<br>
&gt; :26: note: expanded from macro &amp;#39;CLOCK_MONOTONIC&amp;#39;&lt;br&gt;=C2=A0 =C2=A056=<br>
&gt;  | #define CLOCK_MONOTONIC =C2=A0 =C2=A0 =C2=A0 =C2=A0 4&lt;br&gt;=C2=A0 =C2=A0 =<br>
&gt; =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=<br>
&gt; =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^&lt;br&gt;../src/intel/common/xe/i=<br>
&gt; ntel_gem.c:66:9: note: previous case defined here&lt;br&gt;=C2=A0 =C2=A066 | =C2=<br>
&gt; =A0 =C2=A0case CLOCK_MONOTONIC:&lt;br&gt;=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=<br>
&gt; =A0 =C2=A0 ^&lt;br&gt;/usr/include/sys/_clock_id.h:56:26: note: expanded from mac=<br>
&gt; ro &amp;#39;CLOCK_MONOTONIC&amp;#39;&lt;br&gt;=C2=A0 =C2=A056 | #define CLOCK_MONOTONIC =<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 4&lt;br&gt;=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=<br>
&gt; =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =<br>
&gt; =C2=A0 =C2=A0 =C2=A0 ^&lt;br&gt;1 error generated.&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;=<br>
&gt; &lt;/div&gt;&lt;div dir=3D&quot;auto&quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div dir=3D&quot;auto&quot;&gt;&lt;div class=3D&quot;gmail_quo=<br>
&gt; te&quot;&gt;&lt;div&gt;Mesa needs to be updated to not assume these are distinct values.&lt;=<br>
&gt; /div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Warner&lt;/div&gt;&lt;div&gt;=C2=A0&lt;/div&gt;&lt;blockquote class=3D&quot;=<br>
&gt; gmail_quote&quot; style=3D&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-=<br>
&gt; left:1ex&quot;&gt;&lt;div dir=3D&quot;ltr&quot;&gt;&lt;div&gt;&lt;font color=3D&quot;#888888&quot;&gt;Thanks&lt;br clear=3D&quot;=<br>
&gt; all&quot;&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;div class=3D&quot;gmail_quote&quot;&gt;&lt;div dir=<br>
&gt; =3D&quot;ltr&quot; class=3D&quot;gmail_attr&quot;&gt;Warner Losh &amp;lt;&lt;a href=3D&quot;mailto:<a href="mailto:imp@freebsd" target="_blank">imp@freebsd</a>=<br>
&gt; .org&quot; rel=3D&quot;noreferrer&quot; target=3D&quot;_blank&quot;&gt;<a href="mailto:imp@freebsd.org" target="_blank">imp@freebsd.org</a>&lt;/a&gt;&amp;gt; escreveu=<br>
&gt;  (sexta, 31/05/2024 =C3=A0(s) 15:47):&lt;br&gt;&lt;/div&gt;&lt;blockquote class=3D&quot;gmail_q=<br>
&gt; uote&quot; style=3D&quot;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2=<br>
&gt; 04);padding-left:1ex&quot;&gt;The branch main has been updated by imp:&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; URL: &lt;a href=3D&quot;<a href="https://cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe=" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe=</a><br>;
&gt; 850e7b003a73e26b5b54caa&quot; rel=3D&quot;noreferrer noreferrer&quot; target=3D&quot;_blank&quot;&gt;ht=<br>
&gt; tps://<a href="http://cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe850e7b003a73e26b5b=" rel="noreferrer" target="_blank">cgit.FreeBSD.org/src/commit/?id=3D108de784513d87bbe850e7b003a73e26b5b=</a><br>
&gt; 54caa&lt;/a&gt;&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; commit 108de784513d87bbe850e7b003a73e26b5b54caa&lt;br&gt;<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Val Packett &amp;lt;val@packett.cool&amp;gt;&lt;br&gt;<br>
&gt; AuthorDate: 2024-05-31 14:45:02 +0000&lt;br&gt;<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &amp;lt;imp@FreeBSD.org&amp;gt;&lt;br&gt;<br>
&gt; CommitDate: 2024-05-31 14:45:02 +0000&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Redefine CLOCK_BOOTTIME to alias CLOCK_MONOTONIC, not CLOCK_U=<br>
&gt; PTIME&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 The suspend-awareness situation with monotonic clocks across =<br>
&gt; platforms&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 is kind of a mess, let&amp;#39;s try not making it worse.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 On Linux, CLOCK_MONOTONIC does NOT count suspended time, and&lt;=<br>
&gt; br&gt;<br>
&gt; =C2=A0 =C2=A0 CLOCK_BOOTTIME was introduced to INCLUDE suspended time.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 On OpenBSD, CLOCK_MONOTONIC DOES count suspended time, and CL=<br>
&gt; OCK_UPTIME&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 was introduced to EXCLUDE suspended time.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 On macOS, it&amp;#39;s the same as OpenBSD, but with CLOCK_UPTIME=<br>
&gt; _RAW.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Right now, we do not have a monotonic clock that counts suspe=<br>
&gt; nded time.&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 We have CLOCK_UPTIME as a distinct ID alias, and CLOCK_BOOTTI=<br>
&gt; ME as a&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 preprocessor alias, both being effectively `CLOCK_MONOTONIC` =<br>
&gt; for now.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 When we introduce a suspend-aware clock in the future, it wou=<br>
&gt; ld make a&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 lot more sense to do it the OpenBSD/macOS way, i.e. to make&lt;b=<br>
&gt; r&gt;<br>
&gt; =C2=A0 =C2=A0 CLOCK_MONOTONIC include suspended time and make CLOCK_UPTIME =<br>
&gt; exclude it,&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 because that&amp;#39;s what the name CLOCK_UPTIME implies: a devi=<br>
&gt; ation from the&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 default intended for the uptime command to allow it to only s=<br>
&gt; how the&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 time the system was actually up and not suspended.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Let&amp;#39;s change the define right now to make sure software u=<br>
&gt; sing the define&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 would not end up using the ID of the wrong clock in the futur=<br>
&gt; e, and fix&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 the IDs in the Linux compat code to match the expected change=<br>
&gt; s too.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 See &lt;a href=3D&quot;<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=" rel="noreferrer" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=</a><br>;
&gt; =3D1824084&quot; rel=3D&quot;noreferrer noreferrer&quot; target=3D&quot;_blank&quot;&gt;<a href="https://bugzill" rel="noreferrer" target="_blank">https://bugzill</a>=<br>;
&gt; <a href="http://a.mozilla.org/show_bug.cgi?id=3D1824084" rel="noreferrer" target="_blank">a.mozilla.org/show_bug.cgi?id=3D1824084</a>&lt;/a&gt;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 for more discussion.&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Fixes:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 155f15118a77 (&amp;quot;=<br>
&gt; clock_gettime: Add Linux aliases for CLOCK_*&amp;quot;)&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Fixes:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 25ada637362d (&amp;quot;=<br>
&gt; Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.&amp;quot;)&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0&lt;a href=3D&quot;<a href="https://www.patreon.com/=" rel="noreferrer" target="_blank">https://www.patreon.com/=</a><br>;
&gt; valpackett&quot; rel=3D&quot;noreferrer noreferrer&quot; target=3D&quot;_blank&quot;&gt;<a href="https://www.pat" rel="noreferrer" target="_blank">https://www.pat</a>=<br>;
&gt; <a href="http://reon.com/valpackett" rel="noreferrer" target="_blank">reon.com/valpackett</a>&lt;/a&gt;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 kib, imp&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 Differential Revision:=C2=A0 &lt;a href=3D&quot;<a href="https://reviews.freeb" rel="noreferrer" target="_blank">https://reviews.freeb</a>=<br>;
&gt; <a href="http://sd.org/D39270" rel="noreferrer" target="_blank">sd.org/D39270</a>&quot; rel=3D&quot;noreferrer noreferrer&quot; target=3D&quot;_blank&quot;&gt;<a href="https://revi" rel="noreferrer" target="_blank">https://revi</a>=<br>;
&gt; <a href="http://ews.freebsd.org/D39270" rel="noreferrer" target="_blank">ews.freebsd.org/D39270</a>&lt;/a&gt;&lt;br&gt;<br>
&gt; ---&lt;br&gt;<br>
&gt; =C2=A0sys/compat/linux/linux_time.c | 6 +++---&lt;br&gt;<br>
&gt; =C2=A0sys/sys/_clock_id.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 2 +-&lt;br=<br>
&gt; &gt;<br>
&gt; =C2=A02 files changed, 4 insertions(+), 4 deletions(-)&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c&lt;=<br>
&gt; br&gt;<br>
&gt; index e9e5cf075210..f4dd26dd3d2a 100644&lt;br&gt;<br>
&gt; --- a/sys/compat/linux/linux_time.c&lt;br&gt;<br>
&gt; +++ b/sys/compat/linux/linux_time.c&lt;br&gt;<br>
&gt; @@ -287,7 +287,7 @@ linux_to_native_clockid(clockid_t *n, clockid_t l)&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *n =3D CLOCK_REALTI=<br>
&gt; ME;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_MONOTONIC:&lt;br&gt;<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D CLOCK_MONOTO=<br>
&gt; NIC;&lt;br&gt;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D CLOCK_UPTIME=<br>
&gt; ;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_PROCESS_CPUTIME_ID:&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *n =3D CLOCK_PROCES=<br>
&gt; S_CPUTIME_ID;&lt;br&gt;<br>
&gt; @@ -300,10 +300,10 @@ linux_to_native_clockid(clockid_t *n, clockid_t l)&lt;br=<br>
&gt; &gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_MONOTONIC_COARSE:&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_MONOTONIC_RAW:&lt;br&gt;<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D CLOCK_MONOTO=<br>
&gt; NIC_FAST;&lt;br&gt;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D CLOCK_UPTIME=<br>
&gt; _FAST;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_BOOTTIME:&lt;br&gt;<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D CLOCK_UPTIME=<br>
&gt; ;&lt;br&gt;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*n =3D CLOCK_MONOTO=<br>
&gt; NIC;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_REALTIME_ALARM:&lt;br&gt;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 case LINUX_CLOCK_BOOTTIME_ALARM:&lt;br&gt;<br>
&gt; diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h&lt;br&gt;<br>
&gt; index 47a551428dc3..728346a0f0ab 100644&lt;br&gt;<br>
&gt; --- a/sys/sys/_clock_id.h&lt;br&gt;<br>
&gt; +++ b/sys/sys/_clock_id.h&lt;br&gt;<br>
&gt; @@ -78,7 +78,7 @@&lt;br&gt;<br>
&gt; =C2=A0 * Linux compatible names.&lt;br&gt;<br>
&gt; =C2=A0 */&lt;br&gt;<br>
&gt; =C2=A0#if __BSD_VISIBLE&lt;br&gt;<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_BOOTTIME=C2=A0 =C2=A0 =C2=A0 =C2=<br>
&gt; =A0 =C2=A0 CLOCK_UPTIME&lt;br&gt;<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_BOOTTIME=C2=A0 =C2=A0 =C2=A0 =C2=<br>
&gt; =A0 =C2=A0 CLOCK_MONOTONIC&lt;br&gt;<br>
&gt; =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_REALTIME_COARSE=C2=A0 =C2=A0=<br>
&gt; CLOCK_REALTIME_FAST&lt;br&gt;<br>
&gt; =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CLOCK_MONOTONIC_COARSE=C2=A0 CLOCK=<br>
&gt; _MONOTONIC_FAST&lt;br&gt;<br>
&gt; =C2=A0#endif&lt;br&gt;<br>
&gt; &lt;br&gt;<br>
&gt; &lt;/blockquote&gt;&lt;/div&gt;&lt;br clear=3D&quot;all&quot;&gt;&lt;br&gt;&lt;span class=3D&quot;gmail_signature_pre=<br>
&gt; fix&quot;&gt;-- &lt;/span&gt;&lt;br&gt;&lt;div dir=3D&quot;ltr&quot; class=3D&quot;gmail_signature&quot;&gt;&lt;div dir=3D&quot;l=<br>
&gt; tr&quot;&gt;&lt;div&gt;&lt;font color=3D&quot;#888888&quot;&gt;Nuno Teixeira&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font =<br>
&gt; color=3D&quot;#888888&quot;&gt;<br>
&gt; FreeBSD UNIX:=C2=A0 &amp;lt;eduardo@FreeBSD.org&amp;gt;=C2=A0 =C2=A0Web:=C2=A0 &lt;a h=<br>
&gt; ref=3D&quot;<a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a>&quot; rel=3D&quot;noreferrer noreferrer&quot; target=3D&quot;_blank&quot;=<br>
&gt; &gt;<a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a>&lt;/a&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;<br>;
&gt; &lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;<br>
&gt; &lt;/div&gt;<br>
&gt;<br>
&gt; --0000000000000d72080619d34a39--<br>
&gt;<br>
<br>
<br>
</blockquote></div></div>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpp4sOHxygKuYF%2BpyBb8K_Nm3tXo75zpwo2e3w9hsAS9w>