Page MenuHomeFreeBSD

Enable IRQ during syscalls on ARM64

Authored by on Jul 30 2015, 7:08 AM.



FreeBSD provides a feature called AdaptiveMutexes, which allows
a thread to spin for a while when the mutex is taken instead of
immediately going to sleep. This makes issues when called from
syscall handler if interrupts are masked. If every other core
also attempts to access the same mutex there is a chance that
all of them are spinning on the same lock at the same time.
If interrupts aer disabled, no kernel preemtion can occur and
the system becomes unresponsive.
This patch enables interrupts when syscall is being executed
end masks them as soon as it is finished.

Procedure to trigger the issue fixed by this patch:

  • run (mp_ncpus + 1) threads of "cat /dev/urandom > /dev/null"

Issue was seen only on the real hardware, qemu and simulators
are working fine.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline retitled this revision from to Enable IRQ during syscalls on ARM64. updated this object. edited the test plan for this revision. (Show Details) added reviewers: zbb, andrew, emaste. set the repository for this revision to rS FreeBSD src repository.
andrew added inline comments.Jul 30 2015, 10:06 AM
333 ↗(On Diff #7496)

Only this line is needed, we have already saved spsr_el1 in exception.S. This includes the IRQ mask. This will be restored when we return to userland so will restore the previous interrupt state.

andrew accepted this revision.Jul 30 2015, 11:56 AM
andrew edited edge metadata.
This revision is now accepted and ready to land.Jul 30 2015, 11:56 AM
This revision was automatically updated to reflect the committed changes.