Port-vax archive

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

Re: SIMH CPU-idleing support



Valeriy E. Ushakov <uwe%stderr.spb.ru@localhost> wrote:

>> If SIMH can be adjusted for NetBSD-5 that'd still be great though, it's
>> worth looking into.
> 
> Relevant portion of NetBSD 4 "idle" looked like this:
> 
>        mtpr    $1,$PR_IPL              # IPL cannot be 0 because we are
>                                        # running on the interrupt stack
>                                        # and may get interrupts
> 
> 1:      tstl    _C_LABEL(sched_whichqs) # Anything ready to run?
>        beql    1b                      # no, run the idle loop again.
> 
> but now we have idle_loop() written in C (sys/kern_idle.c), run at
> spl0.  It calls cpu_idle() to do cpu specific power-saving, which
> native VAX doesn't have, so it's a no-op macro.  Since idle loop is
> not at IPL 0, not 1, simh idle loop detection heuristic doesn't work.

Meanwhile as a quick hack (my laptop was getting quite hot otherwise)
I've just added

--- kern_idle.c 22 Jul 2010 04:11:28 +0400      1.21
+++ kern_idle.c 18 Nov 2010 23:31:15 +0300      
@@ -64,6 +64,10 @@
 
        KERNEL_UNLOCK_ALL(l, NULL);
        l->l_stat = LSONPROC;
+
+#ifdef __vax__
+       s = splraiseipl(makeiplcookie(1)); /* for SIMH idle detection */
+#endif
        for (;;) {
                LOCKDEBUG_BARRIER(NULL, 0);
                KASSERT((l->l_flag & LW_IDLE) != 0);
@@ -85,11 +89,18 @@
                                }
                        }
                }
+
+#ifdef __vax__
+               splx(s);
+#endif
                KASSERT(l->l_mutex == l->l_cpu->ci_schedstate.spc_lwplock);
                lwp_lock(l);
                mi_switch(l);
                KASSERT(curlwp == l);
                KASSERT(l->l_stat == LSONPROC);
+#ifdef __vax__
+               s = splraiseipl(makeiplcookie(1)); /* for SIMH idle detection */
+#endif
        }
 }
 
or you can just define vax cpu_idle to (splraiseipl(makeiplcookie(1))),
I guess.

-uwe



Home | Main Index | Thread Index | Old Index