From owner-p4-projects@FreeBSD.ORG Fri May 5 03:38:44 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 6938F16A42B; Fri, 5 May 2006 03:38:44 +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 4634116A402 for ; Fri, 5 May 2006 03:38:44 +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 363D943D5E for ; Fri, 5 May 2006 03:38:43 +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 k453chv2043351 for ; Fri, 5 May 2006 03:38:43 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k453cgPH043348 for perforce@freebsd.org; Fri, 5 May 2006 03:38:42 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 5 May 2006 03:38:42 GMT Message-Id: <200605050338.k453cgPH043348@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 96678 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: Fri, 05 May 2006 03:38:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=96678 Change 96678 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/05/05 03:38:34 atomically clear and set active bits Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/swtch.S#20 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/swtch.S#20 (text+ko) ==== @@ -40,6 +40,22 @@ #define PCB_REG %g6 +#define ATOMIC_CLEAR_INT_BIT(addr, old, bit, new, label) \ + lduw [addr], old ; \ +label: andn old, bit, new ; \ + cas [addr], old, new ; \ + cmp old, new ; \ + bne,pn %icc, label ## b ; \ + mov new, old + +#define ATOMIC_SET_INT_BIT(addr, old, bit, new, label) \ + lduw [addr], old ; \ +label: or old, bit, new ; \ + cas [addr], old, new ; \ + cmp old, new ; \ + bne,pn %icc, label ## b ; \ + mov new, old + /* * void cpu_throw(struct thread *old, struct thread *new) */ @@ -127,9 +143,7 @@ ldx [PCB_REG + PCB_PC], %i7 sub %fp, CCFSZ, %sp - - - /* + /* * Point to the pmaps of the new process, and of the last non-kernel * process to run. */ @@ -164,30 +178,14 @@ * Mark the old pmap as no longer active on this CPU */ add %l2, PM_ACTIVE, %l2 - lduw [%l2], %l3 -8: andn %l3, %l4, %l6 - cas [%l2], %l3, %l6 - cmp %l3, %l6 - bne,pn %icc, 8b - mov %l3, %l6 + ATOMIC_CLEAR_INT_BIT(%l2, %l3, %l4, %l6, 8) - /* - * 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] + add %i2, PM_ACTIVE, %i3 + ATOMIC_SET_INT_BIT(%i3, %l3, %l4, %l6, 11) - /* - * 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] - + add %i2, PM_TLBACTIVE, %i3 + ATOMIC_SET_INT_BIT(%i3, %l3, %l4, %l6, 12) mov SCRATCH_REG_HASH_USER, %l6 mov SCRATCH_REG_TSB_USER, %l7