Check IPI status more frequently when waiting.

An IPI cannot be sent via the local APIC if a previous IPI is still
being delivered.  Attempts to send an IPI will wait for a pending IPI
to clear.  Prior to r278325 these checks used a spin loop with a
hardcoded maximum count which broke AP startup on some systems.
However, r278325 also enforced a minimum latency of 5 microseconds if an
IPI was still pending which resulted in a measurable performance hit.
This change reduces that minimum latency to 1 microsecond.

Tested by:	stas
MFC after:	3 days
This commit is contained in:
jhb 2016-03-18 19:48:49 +00:00
parent b3abd5e401
commit 43ceb1fb4c

View File

@ -1641,11 +1641,11 @@ native_lapic_ipi_wait(int delay)
return (1);
}
for (x = 0; x < delay; x += 5) {
for (x = 0; x < delay; x++) {
if ((lapic_read_icr_lo() & APIC_DELSTAT_MASK) ==
APIC_DELSTAT_IDLE)
return (1);
DELAY(5);
DELAY(1);
}
return (0);
}