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)
Wed, Mar 20, 12:28 AM
Unknown Object (File)
Wed, Mar 20, 12:28 AM
Unknown Object (File)
Feb 2 2024, 5:11 PM
Unknown Object (File)
Jan 22 2024, 11:29 AM
Unknown Object (File)
Dec 25 2023, 9:39 AM
Unknown Object (File)
Dec 25 2023, 9:39 AM
Unknown Object (File)
Dec 23 2023, 1:36 AM
Unknown Object (File)
Nov 13 2023, 1:30 PM
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 Skipped
Unit
Tests Skipped

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

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.