From owner-p4-projects Tue May 21 14:10:11 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 85F2337B401; Tue, 21 May 2002 14:10:01 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2FE8637B407 for ; Tue, 21 May 2002 14:10:00 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4LLA0F56843 for perforce@freebsd.org; Tue, 21 May 2002 14:10:00 -0700 (PDT) (envelope-from jhb@freebsd.org) Date: Tue, 21 May 2002 14:10:00 -0700 (PDT) Message-Id: <200205212110.g4LLA0F56843@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 11683 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11683 Change 11683 by jhb@jhb_laptop on 2002/05/21 14:09:42 - Add more cpu_pause()s where needed. - Fixup whitespace in spin mutex panic case. - We don't need to increment 'i' twice in the case where we are starting to DELAY(). Affected files ... ... //depot/projects/smpng/sys/kern/kern_mutex.c#31 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#31 (text+ko) ==== @@ -488,6 +488,9 @@ */ if ((v = m->mtx_lock) == MTX_UNOWNED) { mtx_unlock_spin(&sched_lock); +#ifdef __i386__ + cpu_pause(); +#endif continue; } @@ -515,6 +518,9 @@ !atomic_cmpset_ptr(&m->mtx_lock, (void *)v, (void *)(v | MTX_CONTESTED))) { mtx_unlock_spin(&sched_lock); +#ifdef __i386__ + cpu_pause(); +#endif continue; } @@ -622,20 +628,24 @@ /* Give interrupts a chance while we spin. */ critical_exit(); while (m->mtx_lock != MTX_UNOWNED) { + if (i++ < 10000000) { #ifdef __i386__ - cpu_pause(); + cpu_pause(); #endif - if (i++ < 10000000) continue; - if (i++ < 60000000) + } + if (i < 60000000) DELAY(1); #ifdef DDB else if (!db_active) #else else #endif - panic("spin lock %s held by %p for > 5 seconds", - m->mtx_object.lo_name, (void *)m->mtx_lock); + panic("spin lock %s held by %p for > 5 seconds", + m->mtx_object.lo_name, (void *)m->mtx_lock); +#ifdef __i386__ + cpu_pause(); +#endif } critical_enter(); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message