From owner-p4-projects@FreeBSD.ORG Fri Nov 12 17:47:16 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3B19316A4DC; Fri, 12 Nov 2004 17:47:15 +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 2D26016A4DB for ; Fri, 12 Nov 2004 17:47:14 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1FE1443D48 for ; Fri, 12 Nov 2004 17:47:14 +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 iACHlExX020375 for ; Fri, 12 Nov 2004 17:47:14 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iACHlD2N020371 for perforce@freebsd.org; Fri, 12 Nov 2004 17:47:13 GMT (envelope-from jhb@freebsd.org) Date: Fri, 12 Nov 2004 17:47:13 GMT Message-Id: <200411121747.iACHlD2N020371@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 64958 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: Fri, 12 Nov 2004 17:47:16 -0000 http://perforce.freebsd.org/chv.cgi?CH=64958 Change 64958 by jhb@jhb_slimer on 2004/11/12 17:46:44 Do the TPR magic in lapic_ipi_wait() if needed as well. Affected files ... .. //depot/projects/smpng/sys/i386/i386/local_apic.c#17 edit Differences ... ==== //depot/projects/smpng/sys/i386/i386/local_apic.c#17 (text+ko) ==== @@ -660,26 +660,37 @@ int lapic_ipi_wait(int delay) { - int x, incr; + int x, incr, allow_ipis, done; + + /* + * If interrupts are disabled, then hack on the APIC to allow + * safe IPIs to come in while we wait. + */ + allow_ipis = (read_eflags() & PSL_I) == 0; + if (allow_ipis) + APIC_IPI_SPINWAIT_ENTER(); /* * Wait delay loops for IPI to be sent. This is highly bogus * since this is sensitive to CPU clock speed. If delay is * -1, we wait forever. - * - * XXX: Should we be using the IPI spinwait macros here? */ if (delay == -1) { incr = 0; delay = 1; } else incr = 1; + done = 0; for (x = 0; x < delay; x += incr) { - if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) - return (1); + if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) { + done = 1; + break; + } ia32_pause(); } - return (0); + if (allow_ipis) + APIC_IPI_SPINWAIT_EXIT(); + return (done); } void