Date: Mon, 7 Apr 2003 14:40:30 +0800 From: "David Xu" <davidxu@freebsd.org> To: "Daniel Eischen" <eischen@pcnet1.pcnet.com> Cc: freebsd-threads@freebsd.org Subject: Re: PS_BLOCKED Message-ID: <01f801c2fcd0$952c9800$f001a8c0@davidw2k> References: <Pine.GSO.4.10.10304060821060.1170-100000@pcnet1.pcnet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. ------=_NextPart_000_01F6_01C2FD13.A34836E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ----- Original Message -----=20 From: "Daniel Eischen" <eischen@pcnet1.pcnet.com> To: "David Xu" <davidxu@freebsd.org> Cc: <freebsd-threads@freebsd.org> Sent: Sunday, April 06, 2003 8:39 PM Subject: Re: PS_BLOCKED > I forgot to mention it, but I think I found a kernel bug also. > Sometimes when the kernel exports a context to the UTS the > %gs register isn't set; it doesn't seem to be saved in some > instances. I think it might only be when a kernel thread > is swapped out (without blocking). Does %gs always get saved, > even if the thread is interrupted by an interrupt? Please test the attached patch to see if %gs problem is fixed. David Xu ------=_NextPart_000_01F6_01C2FD13.A34836E0 Content-Type: application/octet-stream; name="kern_thread.c.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kern_thread.c.diff" Index: kern_thread.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v=0A= retrieving revision 1.112=0A= diff -u -r1.112 kern_thread.c=0A= --- kern_thread.c 2 Apr 2003 23:53:29 -0000 1.112=0A= +++ kern_thread.c 7 Apr 2003 06:35:08 -0000=0A= @@ -1242,7 +1242,9 @@=0A= PROC_UNLOCK(p);=0A= td->td_kse =3D NULL;=0A= td->td_state =3D TDS_INACTIVE;=0A= +#if 0=0A= td->td_proc =3D NULL;=0A= +#endif=0A= td->td_ksegrp =3D NULL;=0A= td->td_last_kse =3D NULL;=0A= PCPU_SET(deadthread, td);=0A= @@ -1395,13 +1397,6 @@=0A= bzero(&spare->td_startzero,=0A= (unsigned)RANGEOF(struct thread, td_startzero, td_endzero));=0A= spare->td_proc =3D td->td_proc;=0A= - /* Setup PCB and fork address */=0A= - cpu_set_upcall(spare, td->td_pcb);=0A= - /*=0A= - * XXXKSE do we really need this? (default values for the=0A= - * frame).=0A= - */=0A= - bcopy(td->td_frame, spare->td_frame, sizeof(struct trapframe));=0A= spare->td_ucred =3D crhold(td->td_ucred);=0A= }=0A= =0A= @@ -1433,6 +1428,9 @@=0A= bcopy(&td->td_startcopy, &td2->td_startcopy,=0A= (unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy));=0A= thread_link(td2, ku->ku_ksegrp);=0A= + /* inherit blocked thread's context */=0A= + bcopy(td->td_frame, td2->td_frame, sizeof(struct trapframe));=0A= + cpu_set_upcall(td2, td->td_pcb);=0A= /* Let the new thread become owner of the upcall */=0A= ku->ku_owner =3D td2;=0A= td2->td_upcall =3D ku;=0A= ------=_NextPart_000_01F6_01C2FD13.A34836E0--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01f801c2fcd0$952c9800$f001a8c0>