Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Mar 2022 13:35:48 -0500
From:      Shawn Webb <shawn.webb@hardenedbsd.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 84369dd52369 - main - x86: Probe the TSC frequency earlier
Message-ID:  <20220304183548.r335ihm5wyjol7dd@mutt-hbsd>
In-Reply-To: <YiJa7jmEeRrAlc0S@nuc>
References:  <202203011439.221EdtpY038505@gitrepo.freebsd.org> <20220304142447.bmo7r6syd6gsunnt@mutt-hbsd> <YiIsshB5MgS6QdU3@nuc> <20220304175226.avi2r57dvjfeyr7w@mutt-hbsd> <20220304181529.isvkyyx3qwcbt6v7@mutt-hbsd> <YiJa7jmEeRrAlc0S@nuc>

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

--725rklmhpen4lukn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Mar 04, 2022 at 01:31:10PM -0500, Mark Johnston wrote:
> On Fri, Mar 04, 2022 at 01:15:29PM -0500, Shawn Webb wrote:
> > On Fri, Mar 04, 2022 at 12:52:26PM -0500, Shawn Webb wrote:
> > > On Fri, Mar 04, 2022 at 10:13:54AM -0500, Mark Johnston wrote:
> > > > On Fri, Mar 04, 2022 at 09:24:47AM -0500, Shawn Webb wrote:
> > > > > On Tue, Mar 01, 2022 at 02:39:55PM +0000, Mark Johnston wrote:
> > > > > > The branch main has been updated by markj:
> > > > > >=20
> > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D84369dd52369cbae=
28970dca20a53d3de1719907
> > > > > >=20
> > > > > > commit 84369dd52369cbae28970dca20a53d3de1719907
> > > > > > Author:     Mark Johnston <markj@FreeBSD.org>
> > > > > > AuthorDate: 2022-03-01 14:39:35 +0000
> > > > > > Commit:     Mark Johnston <markj@FreeBSD.org>
> > > > > > CommitDate: 2022-03-01 14:39:35 +0000
> > > > > >=20
> > > > > >     x86: Probe the TSC frequency earlier
> > > > > >    =20
> > > > > >     This lets us use the TSC to implement early DELAY, limiting=
 the use of
> > > > > >     the sometimes-unreliable 8254 PIT.
> > > > > >    =20
> > > > > >     PR:             262155
> > > > > >     Reviewed by:    emaste
> > > > > >     Tested by:      emaste, mike tancsa <mike@sentex.net>, Stef=
an Hegnauer <stefan.hegnauer@gmx.ch>
> > > > > >     MFC after:      1 month
> > > > > >     Sponsored by:   The FreeBSD Foundation
> > > > > >     Differential Revision:  https://reviews.freebsd.org/D34367
> > > > > > ---
> > > > > >  sys/amd64/amd64/machdep.c |  14 +++++-
> > > > > >  sys/i386/i386/machdep.c   |  11 ++++-
> > > > > >  sys/x86/include/clock.h   |   3 +-
> > > > > >  sys/x86/isa/clock.c       |   4 +-
> > > > > >  sys/x86/x86/tsc.c         | 123 +++++++++++++++++++++++++-----=
----------------
> > > > > >  5 files changed, 94 insertions(+), 61 deletions(-)
> > > > >=20
> > > > > Hey Mark,
> > > > >=20
> > > > > Something about this commit breaks booting in Hyper-V. Reverting =
this
> > > > > particular commit makes Hyper-V happy again.
> > > >=20
> > > > The patch below might be sufficient.  I'll test it in Azure but it'=
ll
> > > > take me some time.
> > > >=20
> > > > diff --git a/sys/x86/x86/delay.c b/sys/x86/x86/delay.c
> > > > index c767250954da..95b994b15f81 100644
> > > > --- a/sys/x86/x86/delay.c
> > > > +++ b/sys/x86/x86/delay.c
> > > > @@ -89,7 +89,7 @@ delay_tc(int n)
> > > >  		return (1);
> > > >  	}
> > > >  	tc =3D timecounter;
> > > > -	if (tc->tc_quality <=3D 0)
> > > > +	if (tc =3D=3D NULL || tc->tc_quality <=3D 0)
> > > >  		return (0);
> > > >  	func =3D tc->tc_get_timecount;
> > > >  	mask =3D tc->tc_counter_mask;
> > >=20
> > > Great! I'll give this patch a try and report back.
> >=20
> > The proposed patch did not result in successful boot.
>=20
> Ok, I forgot about the dummy timecounter, so that patch did nothing.
> Can you try this one instead, please? https://reviews.freebsd.org/D34444
>=20
> I wasn't able to reproduce any problems on Azure, but there HyperV
> provides an emulated 8254 timer.

Interesting. It looks like I don't have the option to switch timers in
Hyper-V on Win11 on an Intel NUC. FWIW, it's a gen2 VM.

If you have any suggestions on how I could help debug this, please let
me know.

Thanks,

--=20
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A=
4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc

--725rklmhpen4lukn
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmIiXAIACgkQ/y5nonf4
4fr2sw/8D1gsDCL9sAWyDYzmEeqSeT2MU7Pcqi7j5tnBNrrnRUBc0MZnPBFmAj2t
k5Bq6q9+ESjRJhn80iDpWyp/drpNiBNm8VK2WPYMvSffeaDCH+60CSCtD8TkDnp5
IWL072Su1fXEpifhWhommqKld2/rqaa242eCXzbukVzNY+w66lAvNZDcqCdiiBZI
mVlOyeU6FZenzrHUUHQjmsgh2dGibQnwCF3qk+78K/AEC4dTZKP3VP0V9ObTMD69
e5RbzA06OWIqm4w08rp2ZTYtcybG7CgRjMh31RAOW8ldSL3r6lt4XkXyH/hkkeb2
5+/3evR1jA9ng0Wj9rr3rINQxTc7x3BMwcOf0pB4gR6IWYrow+L9fudQTgcXY2FX
crtPeMj6viTBM91dD8LJ4RkcER2yVXqIdHlKadq1lr/DkNmd/equbbgRWHADl+d4
KqI6SYZQfJDjrwloBCM+DJUYFQsR2UnaJOFqVB3BGjf9eV425TPZ6tMg/GYgodhR
9CSFenWkqNL22xVRRGbk3gAQ1PfJB/3f6MCmqXQ4jUCajPTND52cTrsUxVE83niL
xF8apmMz02SXt9TjmWI3PeZNehpdWlEfw5JycJ29irzrG8eieIaSoARIZvKEibuC
jahWKdH+CB/whPaO/pOb6gMKih7gYVeIpiLDvHc9CoZUaLPau34=
=j3JG
-----END PGP SIGNATURE-----

--725rklmhpen4lukn--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220304183548.r335ihm5wyjol7dd>