NetBSD Problem Report #24007

Received: (qmail 14693 invoked by uid 605); 6 Jan 2004 20:08:44 -0000
Message-Id: <>
Date: Tue, 6 Jan 2004 21:09:23 +0100 (CET)
From: Jaromir Dolecek <>
Subject: sh3 cpu_exit() is volatile
X-Send-Pr-Version: 3.95

>Number:         24007
>Category:       port-sh3
>Synopsis:       sh3 cpu_exit() is volatile
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-sh3-maintainer
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 06 20:09:00 +0000 2004
>Closed-Date:    Sun Jan 18 19:21:13 +0000 2004
>Last-Modified:  Sun Jan 18 19:21:13 +0000 2004
>Originator:     Jaromir Dolecek
>Release:        NetBSD 1.6ZG
System: NetBSD 1.6ZG NetBSD 1.6ZG (SARUMAN.MP) #10: Sun Jan 4 12:48:32 CET 2004 i386
Architecture: i386
Machine: i386

	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.

	code inspection
	Sorry, no patch.

From: "Valeriy E. Ushakov" <>
Subject: pr/24007 CVS commit: src/sys/arch/sh3/sh3
Date: Sun, 18 Jan 2004 18:54:17 +0000 (UTC)

 Module Name:	src
 Committed By:	uwe
 Date:		Sun Jan 18 18:54:17 UTC 2004

 Modified Files:
 	src/sys/arch/sh3/sh3: locore_subr.S vm_machdep.c

 Log Message:
 Implement proper switch_exit in assembler.  Since cpu_switch is
 reduced to just a call to switch_exit, g/c the C version and add a one
 instruction assembler version that just falls through to switch_exit.

 Addresses PR#24007 by Jaromir Dolecek <jdolecek@netbsd> and makes sh3
 kernels work again after his elimination of the reaper.  Tested on hpcsh.

 To generate a diff of this commit:
 cvs rdiff -r1.18 -r1.19 src/sys/arch/sh3/sh3/locore_subr.S
 cvs rdiff -r1.41 -r1.42 src/sys/arch/sh3/sh3/vm_machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed 
State-Changed-By: uwe 
State-Changed-When: Sun Jan 18 19:20:30 UTC 2004 
Fixed, see commit mail in the PR. 

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.