cvs commit: src/sys/alpha/alpha trap.c src/sys/i386/i386 trap.c
src/sys/ia64/ia64 trap.c src/sys/kern kern_thread.c
src/sys/sparc64/sparc64 trap.c
John Baldwin
jhb at FreeBSD.org
Mon Apr 21 10:21:59 PDT 2003
On 19-Apr-2003 David Xu wrote:
> er, I found some code in i386/i386/trap.c:
>
> PROC_LOCK(p);
> if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) {
> mtx_lock_spin(&sched_lock);
> thread_exit();
> /* NOTREACHED */
> }
> PROC_UNLOCK(p);
1.246 (jhb 18-Apr-03): PROC_LOCK(p);
1.228 (julian 29-Jun-02): if ((p->p_flag & P_WEXIT) && (p-
>p_singlethread != td)) {
1.228 (julian 29-Jun-02): mtx_lock_spin(&sched_loc
k);
1.228 (julian 29-Jun-02): thread_exit();
1.228 (julian 29-Jun-02): /* NOTREACHED */
1.228 (julian 29-Jun-02): }
1.246 (jhb 18-Apr-03): PROC_UNLOCK(p);
> The P_WEXIT and p_singlethread will never be set at same
> time. see kern_exit.c. so the code never be executed.
> replacing P_WEXIT with P_SINGLE_EXIT will work,
> and because 1:1 thread borrows KSE code, so you now need code
> like this:
>
> PROC_LOCK(p);
> if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) {
> mtx_lock_spin(&sched_lock);
> if (p->p_flag & P_THREADED)
> thread_exit();
> else
> thr_exit();
> /* NOTREACHED */
> }
> PROC_UNLOCK(p);
Well, I'm only fixing locking, I'll leave fixing internal KSE bugs to
you. :) If you wanted to consolidate this code into a thread_kern_enter()
or some such that would work for me.
> I suggest remove such code from trap.c, just keep it in kernel
> thread control code (e.g kern_thread.c or kern_thr.c) to reduce
> maintain overhead.
>
> David Xu
>
> ----- Original Message -----
> From: "John Baldwin" <jhb at FreeBSD.org>
> To: <src-committers at FreeBSD.org>; <cvs-src at FreeBSD.org>; <cvs-all at FreeBSD.org>
> Sent: Saturday, April 19, 2003 4:20 AM
> Subject: cvs commit: src/sys/alpha/alpha trap.c src/sys/i386/i386 trap.c src/sys/ia64/ia64 trap.c
> src/sys/kern kern_thread.c src/sys/sparc64/sparc64 trap.c
>
>
>> jhb 2003/04/18 13:20:00 PDT
>>
>> FreeBSD src repository
>>
>> Modified files:
>> sys/alpha/alpha trap.c
>> sys/i386/i386 trap.c
>> sys/ia64/ia64 trap.c
>> sys/kern kern_thread.c
>> sys/sparc64/sparc64 trap.c
>> Log:
>> Use the proc lock to protect p_singlethread and a P_WEXIT test. This
>> fixes a couple of potential KSE panics on non-i386 arch's that weren't
>> holding the proc lock when calling thread_exit().
>>
>> Revision Changes Path
>> 1.111 +2 -1 src/sys/alpha/alpha/trap.c
>> 1.246 +2 -2 src/sys/i386/i386/trap.c
>> 1.73 +3 -1 src/sys/ia64/ia64/trap.c
>> 1.117 +2 -2 src/sys/kern/kern_thread.c
>> 1.59 +2 -1 src/sys/sparc64/sparc64/trap.c
>
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
More information about the cvs-src
mailing list