From owner-svn-src-all@FreeBSD.ORG Sat Oct 31 17:55:48 2009 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 C64C4106566C; Sat, 31 Oct 2009 17:55:48 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B6BD8FC13; Sat, 31 Oct 2009 17:55:48 +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 n9VHtmV1098020; Sat, 31 Oct 2009 17:55:48 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VHtmcM098018; Sat, 31 Oct 2009 17:55:48 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200910311755.n9VHtmcM098018@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 31 Oct 2009 17:55:48 +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: r198723 - head/sys/powerpc/aim 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: Sat, 31 Oct 2009 17:55:48 -0000 Author: nwhitehorn Date: Sat Oct 31 17:55:48 2009 New Revision: 198723 URL: http://svn.freebsd.org/changeset/base/198723 Log: Loop on blocked threads when using ULE scheduler, removing an XXX MP comment. Modified: head/sys/powerpc/aim/swtch.S Modified: head/sys/powerpc/aim/swtch.S ============================================================================== --- head/sys/powerpc/aim/swtch.S Sat Oct 31 17:46:50 2009 (r198722) +++ head/sys/powerpc/aim/swtch.S Sat Oct 31 17:55:48 2009 (r198723) @@ -57,6 +57,7 @@ */ #include "assym.s" +#include "opt_sched.h" #include @@ -81,25 +82,23 @@ ENTRY(cpu_throw) * Switch to a new thread saving the current state in the old thread. */ ENTRY(cpu_switch) - stw %r5,TD_LOCK(%r3) /* ULE: update old thread's lock */ - /* XXX needs to change for MP */ - - lwz %r5,TD_PCB(%r3) /* Get the old thread's PCB ptr */ + lwz %r6,TD_PCB(%r3) /* Get the old thread's PCB ptr */ mr %r12,%r2 - stmw %r12,PCB_CONTEXT(%r5) /* Save the non-volatile GP regs. + stmw %r12,PCB_CONTEXT(%r6) /* Save the non-volatile GP regs. These can now be used for scratch */ mfcr %r16 /* Save the condition register */ - stw %r16,PCB_CR(%r5) + stw %r16,PCB_CR(%r6) mflr %r16 /* Save the link register */ - stw %r16,PCB_LR(%r5) + stw %r16,PCB_LR(%r6) mfsr %r16,USER_SR /* Save USER_SR for copyin/out */ isync - stw %r16,PCB_AIM_USR(%r5) - stw %r1,PCB_SP(%r5) /* Save the stack pointer */ + stw %r16,PCB_AIM_USR(%r6) + stw %r1,PCB_SP(%r6) /* Save the stack pointer */ mr %r14,%r3 /* Copy the old thread ptr... */ mr %r15,%r4 /* and the new thread ptr in scratch */ + mr %r16,%r5 /* and the new lock */ lwz %r6,PCB_FLAGS(%r5) /* Save FPU context if needed */ @@ -118,7 +117,20 @@ ENTRY(cpu_switch) mr %r3,%r14 /* restore old thread ptr */ bl pmap_deactivate /* Deactivate the current pmap */ + stw %r16,TD_LOCK(%r14) /* ULE: update old thread's lock */ + cpu_switchin: +#if defined(SMP) && defined(SCHED_ULE) + /* Wait for the new thread to become unblocked */ + sync + lis %r6,blocked_lock@ha + addi %r6,%r6,blocked_lock@l +blocked_loop: + lwz %r7,TD_LOCK(%r15) + cmpw %r6,%r7 + beq blocked_loop +#endif + mfsprg %r7,0 /* Get the pcpu pointer */ stw %r15,PC_CURTHREAD(%r7) /* Store new current thread */ lwz %r17,TD_PCB(%r15) /* Store new current PCB */