From owner-p4-projects@FreeBSD.ORG Wed Mar 30 22:04:01 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4F09416A4D0; Wed, 30 Mar 2005 22:04:01 +0000 (GMT) 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 12E2A16A4CE for ; Wed, 30 Mar 2005 22:04:01 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA28043D31 for ; Wed, 30 Mar 2005 22:04:00 +0000 (GMT) (envelope-from jhb@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 j2UM407O070419 for ; Wed, 30 Mar 2005 22:04:00 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j2UM40Rw070412 for perforce@freebsd.org; Wed, 30 Mar 2005 22:04:00 GMT (envelope-from jhb@freebsd.org) Date: Wed, 30 Mar 2005 22:04:00 GMT Message-Id: <200503302204.j2UM40Rw070412@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Subject: PERFORCE change 74128 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2005 22:04:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=74128 Change 74128 by jhb@jhb_slimer on 2005/03/30 22:03:59 Fixes for SMP kernels for atomic_ptr() changes. Affected files ... .. //depot/projects/smpng/sys/kern/kern_mutex.c#95 edit .. //depot/projects/smpng/sys/kern/kern_shutdown.c#56 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#95 (text+ko) ==== @@ -599,7 +599,7 @@ if (apic_hack) APIC_IPI_SPINWAIT_ENTER(); #endif - while (m->mtx_lock != (void *)MTX_UNOWNED) { + while (m->mtx_lock != MTX_UNOWNED) { if (i++ < 10000000) { cpu_spinwait(); continue; ==== //depot/projects/smpng/sys/kern/kern_shutdown.c#56 (text+ko) ==== @@ -475,7 +475,7 @@ } #ifdef SMP -static volatile void *panic_thread = NULL; +static volatile uintptr_t panic_thread; #endif /* @@ -492,17 +492,19 @@ int bootopt, newpanic; va_list ap; static char buf[256]; +#ifdef SMP + uintptr_t tid; -#ifdef SMP /* * We don't want multiple CPU's to panic at the same time, so we * use panic_thread as a simple spinlock. We have to keep checking * panic_thread if we are spinning in case the panic on the first * CPU is canceled. */ - if (panic_thread != td) - while (atomic_cmpset_ptr(&panic_thread, NULL, td) == 0) - while (panic_thread != NULL) + tid = (uintptr_t)td; + if (panic_thread != tid) + while (atomic_cmpset_ptr(&panic_thread, 0, tid) == 0) + while (panic_thread != 0) cpu_spinwait(); #endif @@ -539,7 +541,7 @@ /* See if the user aborted the panic, in which case we continue. */ if (panicstr == NULL) { #ifdef SMP - atomic_store_rel_ptr(&panic_thread, NULL); + atomic_store_rel_ptr(&panic_thread, 0); #endif return; }