Date: Fri, 12 Nov 2004 17:47:13 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 64958 for review Message-ID: <200411121747.iACHlD2N020371@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411121747.iACHlD2N020371>