Page MenuHomeFreeBSD

Enable IRQ during syscalls on ARM64
ClosedPublic

Authored by wma_semihalf.com on Jul 30 2015, 7:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 13 2024, 9:14 PM
Unknown Object (File)
Nov 13 2024, 12:13 AM
Unknown Object (File)
Oct 19 2024, 4:47 AM
Unknown Object (File)
Oct 19 2024, 4:47 AM
Unknown Object (File)
Sep 22 2024, 4:25 PM
Unknown Object (File)
Sep 16 2024, 9:11 AM
Unknown Object (File)
Sep 16 2024, 6:21 AM
Unknown Object (File)
Aug 19 2024, 4:16 AM
Subscribers

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 - subversion
Lint
Lint Not Applicable
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 - subversion.
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 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.