John Baldwin wrote:
> Currently, sparc64 SMP panics before getting out of single user mode
> because there is an optimization case in cpu_switch() (if we are
> switching back to the same thread, we just return right away) that
> doesn't set td_state to TDS_RUNNING.  Also, according to Peter, the
> code in ia64's cpu_switch() doesn't work either.  Rather than try to
> fix this in the assembler though, I think it is easier to just set
> the thread state once in C at the end of choosethread().  It is a
> lot easier to maintain down the road.  The patch to do this is at
> http://www.freebsd.org/~jhb/patches/kse_switch.patch
> 
> It has been tested on sparc64, alpha, and i386 all with SMP.  I
> would like to commit it soonish.  Comments?

I like your patch much better.  I had to use this alternative change
to the ia64 source - the cvs version doesn't compile.

ie: Change this:
@@ -283,6 +283,12 @@
        st8     [r14]=r4                // set r13->pc_curthread
        mov     ar.k7=r4
        ;;
+// Julian's guess at settinghte thread state
+       add     r15=TD_STATE,r4
+       ;;
+       mov     [r15]=TDS_RUNNING
+       ;;
+// end of  julian's guess
        add     r15=TD_PCB,r4
        ;;
        ld8     r15=[r15]

to something more like this:
@@ -284,8 +284,11 @@
        mov     ar.k7=r4
        ;;
        add     r15=TD_PCB,r4
+       add     r16=TD_STATE,r4
+       mov     r17=TDS_RUNNING
        ;;
        ld8     r15=[r15]
+       st8     [r16]=r17
        ;;
        add     r15=PCB_PMAP,r15        // &pcb_pmap
        ;;

I think I'd rather that we did it in C, since we have a convenient spot
to do it.  My feeble attempt isn't exactly optimal either.  I'd expect
the compiler to do an increasingly [over time] better job.

Cheers,
-Peter
--
Peter Wemm - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to