Page MenuHomeFreeBSD

Enable IRQ during syscalls on ARM64
ClosedPublic

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

Details

Summary

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

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

Event Timeline

wma_semihalf.com retitled this revision from to Enable IRQ during syscalls on ARM64.
wma_semihalf.com updated this object.
wma_semihalf.com edited the test plan for this revision. (Show Details)
wma_semihalf.com added reviewers: zbb, andrew, emaste.
wma_semihalf.com set the repository for this revision to rS FreeBSD src repository.
andrew added inline comments.Jul 30 2015, 10:06 AM
sys/arm64/arm64/trap.c
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.