Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Sep 2019 17:00:48 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        John Baldwin <jhb@FreeBSD.org>, Warner Losh <imp@bsdimp.com>, Philip Paeps <philip@freebsd.org>
Cc:        "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: What value HZ?
Message-ID:  <416f023f2dbf08198c75af0873fa112797179be0.camel@freebsd.org>
In-Reply-To: <f2a0fc0b-f051-1137-96b4-61176d9225dd@FreeBSD.org>
References:  <201909060119.x861JWrG006910@repo.freebsd.org> <4917d7507b6ea6c360dccda261f53052aa085f2b.camel@freebsd.org> <5EE266EE-E650-48D8-9B0E-E674AD026470@freebsd.org> <3cb6429acc7e520932d2c906d1cac47540156355.camel@freebsd.org> <8F03EA29-0F3F-4321-9241-78F7C924FDE1@freebsd.org> <CANCZdfr6pz19NCLmsua6iGzusotrcHN=u47RH7Y1PdM4rnomZA@mail.gmail.com> <9BC03B61-F8B5-476C-AD34-9DEA5230BFCF@freebsd.org> <CANCZdfqbp%2BU3=0EM2n3bhg4DwXd_PVjvEYjGyQhkE5-MK-3-QA@mail.gmail.com> <f2a0fc0b-f051-1137-96b4-61176d9225dd@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2019-09-09 at 13:38 -0400, John Baldwin wrote:
> On 9/6/19 9:46 PM, Warner Losh wrote:
> > I'm top posting here, since this thread from a recent commit gives the
> > context
> > 
> > I'm proposing basically the following patch:
> > 
> > diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
> > index c0025c07eed..bb92afb6449 100644
> > --- a/sys/kern/subr_param.c
> > +++ b/sys/kern/subr_param.c
> > @@ -61,11 +61,7 @@ __FBSDID("$FreeBSD$");
> >   */
> > 
> >  #ifndef HZ
> > -#  if defined(__mips__) || defined(__arm__) || defined(__riscv)
> > -#    define    HZ 100
> > -#  else
> > -#    define    HZ 1000
> > -#  endif
> > +#  define      HZ 1000
> >  #  ifndef HZ_VM
> >  #    define    HZ_VM 100
> >  #  endif
> > 
> > Along with removing HZ from almost all the kernel config files in arm and
> > mips where it is already 1000. I'm agnostic about riscv, so would also be
> > open to just removing the first two clauses from the #if the diff shows me
> > removing.
> 
> I think this sounds fine.  On x86 we use hz=100 instead of 1000 in VMs via
> a runtime test.

Why?  Was this done before or after the advent of event timers and the
tickless kernel?  If done before, does it still make sense today?

>   I suspect if anything we might want to take that same factor
> into account here.  Thus, it makes sense for mips MALTA configs (most often
> run under qemu) to use 100, and/or to add a runtime test for qemu that switches
> from 1000 to 100.  Similarly, for riscv we probably want to use 100 under
> qemu and spike, but 1000 on actual hardware via either kernel config options
> or runtime checks.

Why?  I dunno about MALTA, but for riscv, when I look at the code I see
a timer.c that implements one-shot event timers (and actually doesn't
support periodic mode event timers at all).  The timer.c code is
standard, not optional, so one-shot event timers are always available,
and the kernel should always run in tickless mode.  That being the
case, what advantage is there to a lower HZ?

-- Ian





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