|
The Pedigree Project 0.1
|
Collaboration diagram for Spinlock:Public Member Functions | |
| Spinlock (bool bLocked, bool bAvoidTracking=false) | |
| bool | acquire (bool recurse=false, bool safe=true) |
| void | exit (uintptr_t ra=0) |
| void | release () |
| bool | acquired () |
| bool | interrupts () const |
Static Public Attributes | |
| static const bool | allow_recursion = true |
Private Member Functions | |
| bool | acquireContended (bool recurse, bool safe, uintptr_t ra) NEVER_INLINE |
| void | unlock (uintptr_t ra) ALWAYS_INLINE |
| void | unwind () ALWAYS_INLINE |
| volatile processor_register_t * | deferredReleaseWord () |
| void | unlockForScheduler () |
| void | trackRelease (uintptr_t ra) const |
| uintptr_t | acquisitionAddress () const |
| void | badMagic (uintptr_t ra) const NEVER_INLINE |
| void | badReleaseInterrupts () const NEVER_INLINE |
| void | deadlock (uintptr_t ra, bool releasing, uintptr_t acquiredAt=0) NEVER_INLINE NORETURN |
| NOT_COPYABLE_OR_ASSIGNABLE (Spinlock) | |
Private Attributes | |
| SpinlockWord | m_Lock |
| bool | m_bInterrupts = false |
| void * | m_pOwner = nullptr |
| size_t | m_Level = 0 |
| size_t | m_OwnedProcessor = ~0 |
| bool | m_bAvoidTracking = false |
Friends | |
| class | PerProcessorScheduler |
| class | LocksCommand |
Definition at line 27 of file Spinlock.h.
| Spinlock::Spinlock | ( | bool | bLocked, |
| bool | bAvoidTracking = false |
||
| ) |
Definition at line 32 of file Spinlock.cc.
| bool Spinlock::acquire | ( | bool | recurse = false, |
| bool | safe = true |
||
| ) |
Enter the critical section.
The 'safe' param disables certain deadlock checks that might fail in some circumstances (especially during multiprocessor startup). It really shouldn't be used for the majority of cases.
Definition at line 35 of file Spinlock.cc.
References acquireContended(), ProcessorBase::getInterrupts(), ProcessorBase::index(), ProcessorBase::information(), panic(), LocksCommand::setFatal(), ProcessorBase::setInterrupts(), and UNLIKELY.
Referenced by PosixSubsystem::acquire(), Scheduler::acquireFirstProcessOfType(), Scheduler::acquireProcess(), Scheduler::acquireProcess(), Scheduler::acquireProcessById(), Scheduler::acquireThreadByTaskId(), Rtc::addAlarm(), Log::addEntry(), VFS::addMountCallback(), VFS::addProbeCallback(), Scheduler::addProcess(), Scheduler::addThread(), PerProcessorScheduler::addThread(), PerProcessorScheduler::addThread(), HostedPhysicalMemoryManager::allocatePage(), X86CommonPhysicalMemoryManager::allocatePage(), Process::beginTermination(), X64VirtualAddressSpace::clone(), HostedVirtualAddressSpace::doAllocateStack(), X64VirtualAddressSpace::doAllocateStack(), Ohci::doAsync(), Scheduler::drainDeferredTimeAccounting(), Rtc::drainRemoteAlarmDispatch(), NetworkFilter::filter(), HostedVirtualAddressSpace::freeStack(), X64VirtualAddressSpace::freeStack(), Scheduler::getChildProcess(), Scheduler::getNumProcesses(), ThreadedIrqDispatcher::initialise(), NMFaultHandler::initialiseProcessor(), Cache::insert(), Cache::insert(), NetworkFilter::installCallback(), KernelElf::lockModules(), InputManager::mainThread(), VFS::mount(), Rtc::processElapsedTime(), HostedTimer::processTimerBatch(), InputManager::putNotification(), Process::quiesceTermination(), PosixSubsystem::release(), Rtc::removeAlarm(), Rtc::removeAlarm(), NetworkFilter::removeCallback(), VFS::removeMountCallback(), VFS::removeProbeCallback(), Scheduler::removeProcess(), Scheduler::removeThread(), Process::reserveTerminalOwner(), Thread::retainTemporarySignalWaitInterruptionOrClear(), ThreadedIrqDispatcher::setRemoteWakeCallback(), InputManager::shutdown(), Thread::Thread(), Thread::Thread(), Scheduler::threadInSchedule(), PageFaultHandler::unregisterHandler(), TimerHandlerRegistry::unregisterHandler(), IrqHandlerRegistry::unregisterHandler(), Scheduler::waitUntilProcessRemoved(), NetworkFilter::~NetworkFilter(), PosixSubsystem::~PosixSubsystem(), and VFS::~VFS().
|
private |
Returns true for recursive reentry, false for a newly acquired lock.
Definition at line 82 of file Spinlock.cc.
References LocksCommand::checkState(), ProcessorBase::getCount(), ProcessorBase::index(), ProcessorBase::information(), panic(), ProcessorBase::pause(), and LocksCommand::setFatal().
Referenced by acquire().
Here is the caller graph for this function:| bool Spinlock::acquired | ( | ) |
Definition at line 193 of file Spinlock.cc.
|
private |
Definition at line 201 of file Spinlock.cc.
|
private |
Definition at line 209 of file Spinlock.cc.
|
private |
Definition at line 219 of file Spinlock.cc.
|
private |
Definition at line 224 of file Spinlock.cc.
|
private |
Scheduler owns tracking and IRQ restoration across these handoffs.
Definition at line 183 of file Spinlock.cc.
References unwind().
Referenced by PerProcessorScheduler::addThread(), and PerProcessorScheduler::addThread().
Here is the caller graph for this function:| void Spinlock::exit | ( | uintptr_t | ra = 0 | ) |
Exit the critical section, without restoring interrupts.
Definition at line 157 of file Spinlock.cc.
References unlock().
| bool Spinlock::interrupts | ( | ) | const |
Definition at line 197 of file Spinlock.cc.
| void Spinlock::release | ( | ) |
Exit the critical section, restoring previous interrupt state.
Definition at line 161 of file Spinlock.cc.
References ProcessorBase::setInterrupts(), and unlock().
Referenced by PosixSubsystem::acquire(), Scheduler::acquireFirstProcessOfType(), Scheduler::acquireProcess(), Scheduler::acquireProcess(), Scheduler::acquireProcessById(), Scheduler::acquireThreadByTaskId(), Rtc::addAlarm(), Log::addEntry(), VFS::addMountCallback(), VFS::addProbeCallback(), Scheduler::addProcess(), Scheduler::addThread(), PerProcessorScheduler::addThread(), PerProcessorScheduler::addThread(), HostedPhysicalMemoryManager::allocatePage(), X86CommonPhysicalMemoryManager::allocatePage(), Process::beginTermination(), HostedVirtualAddressSpace::clone(), X64VirtualAddressSpace::clone(), HostedVirtualAddressSpace::doAllocateStack(), X64VirtualAddressSpace::doAllocateStack(), Ohci::doAsync(), Scheduler::drainDeferredTimeAccounting(), Rtc::drainRemoteAlarmDispatch(), NetworkFilter::filter(), HostedPhysicalMemoryManager::freePageUnlocked(), HostedVirtualAddressSpace::freeStack(), X64VirtualAddressSpace::freeStack(), Scheduler::getChildProcess(), Scheduler::getNumProcesses(), ThreadedIrqDispatcher::initialise(), NMFaultHandler::initialiseProcessor(), Cache::insert(), Cache::insert(), NetworkFilter::installCallback(), InputManager::mainThread(), VFS::mount(), Rtc::processElapsedTime(), HostedTimer::processTimerBatch(), InputManager::putNotification(), Process::quiesceTermination(), PosixSubsystem::release(), Rtc::removeAlarm(), Rtc::removeAlarm(), NetworkFilter::removeCallback(), VFS::removeMountCallback(), VFS::removeProbeCallback(), Scheduler::removeProcess(), Scheduler::removeThread(), Process::reserveTerminalOwner(), Thread::retainTemporarySignalWaitInterruptionOrClear(), ThreadedIrqDispatcher::setRemoteWakeCallback(), InputManager::shutdown(), Scheduler::threadInSchedule(), KernelElf::unlockModules(), PageFaultHandler::unregisterHandler(), TimerHandlerRegistry::unregisterHandler(), IrqHandlerRegistry::unregisterHandler(), Scheduler::waitUntilProcessRemoved(), NetworkFilter::~NetworkFilter(), PosixSubsystem::~PosixSubsystem(), and VFS::~VFS().
|
private |
Track the release of this lock.
Definition at line 115 of file Spinlock.cc.
References LocksCommand::lockReleased(), panic(), and LocksCommand::setFatal().
Referenced by unlock().
Here is the caller graph for this function:
|
inlineprivate |
Unlocks without restoring IRQ state, leaving nested acquisitions held.
Definition at line 127 of file Spinlock.cc.
References ProcessorBase::getInterrupts(), trackRelease(), and UNLIKELY.
Referenced by exit(), and release().
Here is the caller graph for this function:
|
private |
Definition at line 188 of file Spinlock.cc.
|
inlineprivate |
Unwind the spinlock because a thread is releasing it.
Definition at line 174 of file Spinlock.cc.
Referenced by deferredReleaseWord().
Here is the caller graph for this function:
|
friend |
Definition at line 29 of file Spinlock.h.
|
friend |
Definition at line 28 of file Spinlock.h.
|
static |
Definition at line 54 of file Spinlock.h.
|
private |
Definition at line 94 of file Spinlock.h.
|
private |
Definition at line 81 of file Spinlock.h.
|
private |
Definition at line 91 of file Spinlock.h.
|
private |
Definition at line 80 of file Spinlock.h.
|
private |
Definition at line 92 of file Spinlock.h.
|
private |
Definition at line 90 of file Spinlock.h.