Subject: port-sh3/24007: sh3 cpu_exit() is volatile
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: netbsd-bugs
Date: 01/06/2004 21:09:23
>Number:         24007
>Category:       port-sh3
>Synopsis:       sh3 cpu_exit() is volatile
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-sh3-maintainer
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 06 20:09:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jaromir Dolecek
>Release:        NetBSD 1.6ZG
>Organization:
>Environment:
System: NetBSD s102-n054.tele2.cz 1.6ZG NetBSD 1.6ZG (SARUMAN.MP) #10: Sun Jan 4 12:48:32 CET 2004 dolecek@s102-n054.tele2.cz:/usr/home/dolecek/soft/netbsd/sys/arch/i386/compile/SARUMAN.MP i386
Architecture: i386
Machine: i386
>Description:

	sh3 cpu_exit() uses lwp0 stack and memory after it's reclaimed
	('l' pointer after lwp_exit2() call, where the lwp is freed).
	This only works due to the initial excessive interrupt blocking
	via splsched, and feels as somewhat of a hack.

	It would be safer to follow practice of other ports, which
	switch to idle context, call lwp_exit2() from that context,
	and then use special code path to schedule another lwp
	instead of the one which exitted. I also believe this
	would be necessary for MP, tho I'm not sure if Super-H 3
	supports MP at all.

>How-To-Repeat:
	code inspection
>Fix:
	Sorry, no patch.
>Release-Note:
>Audit-Trail:
>Unformatted: