From owner-svn-src-all@FreeBSD.ORG Mon Jan 25 19:01:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68C7A1065698; Mon, 25 Jan 2010 19:01:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58ECD8FC20; Mon, 25 Jan 2010 19:01:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0PJ1cti050222; Mon, 25 Jan 2010 19:01:38 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0PJ1cgx050220; Mon, 25 Jan 2010 19:01:38 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201001251901.o0PJ1cgx050220@svn.freebsd.org> From: Warner Losh Date: Mon, 25 Jan 2010 19:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202983 - head/sys/mips/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2010 19:01:38 -0000 Author: imp Date: Mon Jan 25 19:01:38 2010 New Revision: 202983 URL: http://svn.freebsd.org/changeset/base/202983 Log: Store the mutex in the correct location. Before, we were storing it in the pcb at the td_lock offset, rather than in the struct thread at the td_lock offset. And we were storing a pointer to the old thread rather than to the mutex. Why this didn't always kill us, I'll never know. Fix an obsolete comment and update the prototype in the comments. Also note what variables are in what registers since this function is a little complex... neel@ found this problem and proposed this fix. This cures a number of different problem reports out there, and gets us booting octeon to the login prompt... Submitted by: neel@ Reviewed by: rrs@, gonzo@ Modified: head/sys/mips/mips/swtch.S Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Mon Jan 25 18:52:47 2010 (r202982) +++ head/sys/mips/mips/swtch.S Mon Jan 25 19:01:38 2010 (r202983) @@ -282,9 +282,10 @@ NON_LEAF(mips_cpu_throw, STAND_FRAME_SIZ END(mips_cpu_throw) /* - *XXX Fixme: should be written to new interface that requires lock - * storage. We fake it for now. - * cpu_switch(struct thread *old, struct thread *new); + * cpu_switch(struct thread *old, struct thread *new, struct mutex *mtx); + * a0 - old + * a1 - new + * a2 - mtx * Find the highest priority process and resume it. */ NON_LEAF(cpu_switch, STAND_FRAME_SIZE, ra) @@ -323,7 +324,7 @@ getpc: * to be saved with the other registers do so here. */ - sw a3, TD_LOCK(a0) # Switchout td_lock + sw a2, TD_LOCK(a3) # Switchout td_lock mips_sw1: #if defined(SMP) && defined(SCHED_ULE)