Fix spinlock usage in kernel's system profiling
* Removal of gSchedulerLock left a few SpinLockers around which were now without locked interrupts. * Makes scheduling_recorder work again.
This commit is contained in:
parent
58b592b3b5
commit
ad64943039
@ -210,7 +210,7 @@ private:
|
||||
|
||||
|
||||
/*! Notifies the profiler thread when the profiling buffer is full enough.
|
||||
The caller must hold the scheduler lock and fLock.
|
||||
The caller must hold fLock.
|
||||
*/
|
||||
inline void
|
||||
SystemProfiler::_MaybeNotifyProfilerThreadLocked()
|
||||
@ -220,7 +220,7 @@ SystemProfiler::_MaybeNotifyProfilerThreadLocked()
|
||||
int cpu = smp_get_current_cpu();
|
||||
fReentered[cpu] = true;
|
||||
|
||||
InterruptsSpinLocker _(fWaitingProfilerThread->scheduler_lock);
|
||||
SpinLocker _(fWaitingProfilerThread->scheduler_lock);
|
||||
thread_unblock_locked(fWaitingProfilerThread, B_OK);
|
||||
|
||||
fWaitingProfilerThread = NULL;
|
||||
@ -235,12 +235,15 @@ SystemProfiler::_MaybeNotifyProfilerThread()
|
||||
if (fWaitingProfilerThread == NULL)
|
||||
return;
|
||||
|
||||
SpinLocker locker(fLock);
|
||||
InterruptsSpinLocker locker(fLock);
|
||||
|
||||
_MaybeNotifyProfilerThreadLocked();
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - SystemProfiler public
|
||||
|
||||
|
||||
SystemProfiler::SystemProfiler(team_id team, const area_info& userAreaInfo,
|
||||
const system_profiler_parameters& parameters)
|
||||
:
|
||||
@ -503,7 +506,7 @@ SystemProfiler::Init()
|
||||
scheduler_add_listener(this);
|
||||
fSchedulerNotificationsRequested = true;
|
||||
|
||||
SpinLocker waitObjectLocker(gWaitObjectListenerLock);
|
||||
InterruptsSpinLocker waitObjectLocker(gWaitObjectListenerLock);
|
||||
add_wait_object_listener(this);
|
||||
fWaitObjectNotificationsRequested = true;
|
||||
waitObjectLocker.Unlock();
|
||||
@ -598,6 +601,9 @@ SystemProfiler::NextBuffer(size_t bytesRead, uint64* _droppedEvents)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - NotificationListener interface
|
||||
|
||||
|
||||
void
|
||||
SystemProfiler::EventOccurred(NotificationService& service,
|
||||
const KMessage* event)
|
||||
@ -728,12 +734,15 @@ SystemProfiler::EventOccurred(NotificationService& service,
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - SchedulerListener interface
|
||||
|
||||
|
||||
void
|
||||
SystemProfiler::ThreadEnqueuedInRunQueue(Thread* thread)
|
||||
{
|
||||
int cpu = smp_get_current_cpu();
|
||||
|
||||
SpinLocker locker(fLock, false, !fReentered[cpu]);
|
||||
InterruptsSpinLocker locker(fLock, false, !fReentered[cpu]);
|
||||
// When re-entering, we already hold the lock.
|
||||
|
||||
system_profiler_thread_enqueued_in_run_queue* event
|
||||
@ -764,7 +773,7 @@ SystemProfiler::ThreadRemovedFromRunQueue(Thread* thread)
|
||||
{
|
||||
int cpu = smp_get_current_cpu();
|
||||
|
||||
SpinLocker locker(fLock, false, !fReentered[cpu]);
|
||||
InterruptsSpinLocker locker(fLock, false, !fReentered[cpu]);
|
||||
// When re-entering, we already hold the lock.
|
||||
|
||||
system_profiler_thread_removed_from_run_queue* event
|
||||
@ -790,7 +799,7 @@ SystemProfiler::ThreadScheduled(Thread* oldThread, Thread* newThread)
|
||||
{
|
||||
int cpu = smp_get_current_cpu();
|
||||
|
||||
SpinLocker locker(fLock, false, !fReentered[cpu]);
|
||||
InterruptsSpinLocker locker(fLock, false, !fReentered[cpu]);
|
||||
// When re-entering, we already hold the lock.
|
||||
|
||||
// If the old thread starts waiting, handle the wait object.
|
||||
@ -818,6 +827,9 @@ SystemProfiler::ThreadScheduled(Thread* oldThread, Thread* newThread)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - WaitObjectListener interface
|
||||
|
||||
|
||||
void
|
||||
SystemProfiler::SemaphoreCreated(sem_id id, const char* name)
|
||||
{
|
||||
@ -846,6 +858,9 @@ SystemProfiler::RWLockInitialized(rw_lock* lock)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - SystemProfiler private
|
||||
|
||||
|
||||
bool
|
||||
SystemProfiler::_TeamAdded(Team* team)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user