From owner-p4-projects@FreeBSD.ORG Mon Nov 15 20:17:30 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 84CC516A4D1; Mon, 15 Nov 2004 20:17:30 +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 5F77D16A4CE for ; Mon, 15 Nov 2004 20:17:30 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5111443D1F for ; Mon, 15 Nov 2004 20:17:30 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iAFKHU2X005105 for ; Mon, 15 Nov 2004 20:17:30 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iAFKHUvQ005102 for perforce@freebsd.org; Mon, 15 Nov 2004 20:17:30 GMT (envelope-from jhb@freebsd.org) Date: Mon, 15 Nov 2004 20:17:30 GMT Message-Id: <200411152017.iAFKHUvQ005102@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 65196 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: Mon, 15 Nov 2004 20:17:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=65196 Change 65196 by jhb@jhb_slimer on 2004/11/15 20:17:23 Ugh, more hacking that may help this further. If this helps, then I think the real fix is going to be to hack on critical sections. Affected files ... .. //depot/projects/smpng/sys/kern/kern_mutex.c#88 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#88 (text+ko) ==== @@ -577,6 +577,9 @@ int line) { int i = 0; +#ifdef __i386__ + int apic_hack; +#endif if (LOCK_LOG_TEST(&m->mtx_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_spin: %p spinning", m); @@ -587,6 +590,11 @@ /* Give interrupts a chance while we spin. */ critical_exit(); +#ifdef __i386__ + apic_hack = (read_eflags() & PSL_I) == 0; + if (apic_hack) + APIC_IPI_SPINWAIT_ENTER(); +#endif while (m->mtx_lock != MTX_UNOWNED) { if (i++ < 10000000) { cpu_spinwait(); @@ -605,6 +613,10 @@ } cpu_spinwait(); } +#ifdef __i386__ + if (apic_hack) + APIC_IPI_SPINWAIT_EXIT(); +#endif critical_enter(); }