From owner-p4-projects@FreeBSD.ORG Mon Apr 3 09:10:13 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B2A4C16A424; Mon, 3 Apr 2006 09:10:13 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5EE6C16A420 for ; Mon, 3 Apr 2006 09:10:13 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 921F943D49 for ; Mon, 3 Apr 2006 09:10:12 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k339ACfx074012 for ; Mon, 3 Apr 2006 09:10:12 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k339ACRj074009 for perforce@freebsd.org; Mon, 3 Apr 2006 09:10:12 GMT (envelope-from kmacy@freebsd.org) Date: Mon, 3 Apr 2006 09:10:12 GMT Message-Id: <200604030910.k339ACRj074009@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 94531 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Apr 2006 09:10:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=94531 Change 94531 by kmacy@kmacy_storage:sun4v_work on 2006/04/03 09:10:02 keep track of what cpus this pmap is running on and which cpus may have entries in the TLB, we really only need to send shootdowns to one of the threads on a core so this can definitely be optimized further Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/swtch.S#16 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/swtch.S#16 (text+ko) ==== @@ -54,9 +54,13 @@ */ ENTRY(cpu_switch) save %sp, -CCFSZ, %sp - GET_PCB(PCB_REG) + ldx [PCPU(CURPCB)], PCB_REG + + MAGIC_TRAP_ON + MAGIC_TRAP_OFF + mov %i1, %i0 - + /* * If the current thread was using floating point in the kernel, save * its context. The userland floating point context has already been @@ -113,19 +117,15 @@ stx %g3, [%g1 + KTR_PARM3] 9: #endif + wrpr %g0, PSTATE_NORMAL, %pstate ldx [%i0 + TD_PCB], %i1 - + stx %i0, [PCPU(CURTHREAD)] stx %i1, [PCPU(CURPCB)] - wrpr %g0, PSTATE_NORMAL, %pstate mov %i1, PCB_REG ! load in new PCB wrpr %g0, PSTATE_KERNEL, %pstate - /* - * End of saving old context - * Start of loading new context - */ ldx [PCB_REG + PCB_SP], %fp ldx [PCB_REG + PCB_PC], %i7 sub %fp, CCFSZ, %sp @@ -155,11 +155,38 @@ be,a,pn %xcc, 5f nop - ldx [%i2 + PM_CONTEXT], %l5 ! new context == kernel? + ldx [%i2 + PM_CONTEXT], %l5 ! new context + ldx [%l2 + PM_CONTEXT], %l3 ! old context cmp %g0, %l5 - be,a,pn %xcc, 5f - nop + be,a,pn %xcc, 5f ! new context == kernel? + lduw [PCPU(CPUMASK)], %l4 + + brz %l3, 10f ! old context == kernel? + nop + /* + * Mark the old pmap as no longer active on this CPU + */ + lduw [%l2 + PM_ACTIVE], %l3 + andn %l3, %l4, %l3 + stw %l3, [%l2 + PM_ACTIVE] + + /* + * Mark the new pmap as active on this CPU + * XXX need to CAS + */ +10: lduw [%i2 + PM_ACTIVE], %l3 + or %l3, %l4, %l3 + stw %l3, [%i2 + PM_ACTIVE] + + /* + * Mark the new pmap as possibly having TLB entries on this CPU + * XXX need to CAS + */ + lduw [%i2 + PM_TLBACTIVE], %l3 + or %l3, %l4, %l3 + stw %l3, [%i2 + PM_TLBACTIVE] + mov SCRATCH_REG_HASH_USER, %l6 mov SCRATCH_REG_TSB_USER, %l7 ldx [%i2 + PM_HASHSCRATCH], %l3 @@ -189,6 +216,8 @@ */ SET_MMU_CONTEXT(%l6, %l5) + + /* * Done. Return and load the new process's window from the stack. */