tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Check in cpu_switchto triggering crash with PARANOIA on



On 22/02/2021 04:15, Alan Fisher wrote:
Hello,

I've been trying to get the evbmips port working on a new chip recently,
and in the process I've tried building the kernel with PARANOIA enabled.
This has resulted in a crash on startup, and I am wondering if it is
surfacing a bug. Here is what's happening:

Some code under an #ifdef PARANOIA in cpu_switchto checks whether the
IPL is IPL_SCHED, and if not, throws a trap. According to the manpage
for cpu_switchto(9), the current IPL level being IPL_SCHED is a
precondition for cpu_switchto(), so this check seems to make sense. The
callstack looks like this:

cpu_switchto  - this causes a trap when the check fails - manpage says
IPL must be IPL_SCHED
mi_switch - manpage says IPL must be IPL_SCHED
yield - manpage doesn't say anything about IPL_SCHED, and IPL is not
changed in this routine


    276 yield(void)
    277 {
    278 	struct lwp *l = curlwp;
    279
    280 	KERNEL_UNLOCK_ALL(l, &l->l_biglocks);
    281 	lwp_lock(l);

lwp_lock will raise the IPL to IPL_SCHED. spc_{lock,mutex} are used by
lwp_lock (maybe others)
HTH,

Nick


Home | Main Index | Thread Index | Old Index