On Sun, Dec 20, 2020 at 08:41:00PM +1100, Jonathan Gray wrote:
> On Sun, Dec 20, 2020 at 06:27:33AM +0000, James Cook wrote:
> > On Sat, Dec 19, 2020 at 07:33:42AM +0000, James Cook wrote:
> > > > Suggestions are welcome. In the meantime I am slowly trying to debug
> > > > this myself, mostly as a learning exercise. I've successfully built my
> > > > own bsd.rd (using the instructions on the release(8) man page) with the
> > > > intention of adding some debug output to narrow down where it's
> > > > getting stuck, but I don't know my way around the kernel code.
> > > 
> > > Minor progress: I have determined that the kernel gets at least as far
> > > as exec-ing the init process (more precisely, calling sys_execve in
> > > init_main.c).
> > 
> > I found out init gets stuck calling sleep(2) in setctty in
> > sbin/init/init.c. (Details below on how I determined that.)
> > 
> > Any idea what could cause a call to sleep to just hang indefinitely?
> > 
> 
> Can you try hpet instead of tsc?
> 
> Either sysctl kern.timecounter.hardware=acpihpet0

With (my custom) bsd.rd, that sysctl does not seem to exist, and it still hangs
on boot with the below code change.

With bsd.sp and bsd.mp, the sysctl was already set to acpihpet0. If I set it to
tsc, then "sleep 1" gets somewhat slower but doesn't take on the order of
minutes to an hour like it does with bsd.rd.

If it's relevant: I noticed the time reported by the "date" command advances
normally with bsd.sp/bsd.mp and acpihpet0 (I ran two date commands 15s apart
according to my phone timer, and got dates 15s apart). With the sysctl set to
tsc, or with bsd.rd, the time returned by date advances slowly.

(With bsd.sp and bsd.mp, I tried "disable acpihpet*" at the boot_config prompt,
but the sysctl was still set to acpihpet0 when I booted.)

> or build a kernel with something like this which will give hpet a higher
> priority than tsc.
> 
> Index: sys/dev/acpi/acpihpet.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpihpet.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 acpihpet.c
> --- sys/dev/acpi/acpihpet.c   6 Jul 2020 13:33:08 -0000       1.24
> +++ sys/dev/acpi/acpihpet.c   20 Dec 2020 09:32:40 -0000
> @@ -45,7 +45,7 @@ static struct timecounter hpet_timecount
>       0xffffffff,             /* counter_mask (32 bits) */
>       0,                      /* frequency */
>       0,                      /* name */
> -     1000,                   /* quality */
> +     2500,                   /* quality */
>       NULL,                   /* private bits */
>       0,                      /* expose to user */
>  };

-- 
James

Reply via email to