Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 2002 19:16:39 -0700
From:      Peter Wemm <peter@wemm.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        julian@FreeBSD.org, current@FreeBSD.org
Subject:   Re: Thread state 
Message-ID:  <20020712021639.ECDE8380A@overcee.wemm.org>
In-Reply-To: <XFMail.20020711184713.jhb@FreeBSD.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
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 - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020712021639.ECDE8380A>