Subject: cpu_fork() initial SPL / NTP stability.
To: None <port-alpha@netbsd.org>
From: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
List: port-alpha
Date: 04/12/2001 15:15:59
Bill Sommerfeld <sommerfeld@netbsd.org> wrote;

> Paul Kranenberg recently found and fixed a bug in the sparc port:
> kernel thread main functions were invoked running at
> splhigh()/splclock() because cpu_fork() did not (re)set the saved IPL
> of the newly created process.
> 
> This appears to cause sporadic high interrupt latency since interrupts
> are masked while a kernel process is running, leading to (among other
> things) poor clock stability as measured by NTP.
>    ...
> Portmasters should investigate and verify that newly-forked kernel
> threads run with low IPL.

The spl bug for kernel thread was found and fixed in NetBSD/mips long
time ago by making sure that proc0 is created in spl0 state.

        memset(proc0.p_addr, 0, USPACE);
        curpcb = &proc0.p_addr->u_pcb;
        curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */

Tohru Nishimura
Information Technology Centre
Nara Institute of Science and Technology