[haiku-commits] haiku: hrev46944 - src/system/kernel/debug

  • From: julian.harnath@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 27 Feb 2014 00:09:01 +0100 (CET)

hrev46944 adds 1 changeset to branch 'master'
old head: 58b592b3b5dd2e4031f12279867cb0a20855d377
new head: ad64943039d06cec61ad282f935992908aa86b4e
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ad64943+%5E58b592b

----------------------------------------------------------------------------

ad64943: 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.

                          [ Julian Harnath <julian.harnath@xxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev46944
Commit:      ad64943039d06cec61ad282f935992908aa86b4e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ad64943
Author:      Julian Harnath <julian.harnath@xxxxxxxxxxxxxx>
Date:        Wed Feb 26 23:04:45 2014 UTC

----------------------------------------------------------------------------

1 file changed, 22 insertions(+), 7 deletions(-)
src/system/kernel/debug/system_profiler.cpp | 29 +++++++++++++++++++------

----------------------------------------------------------------------------

diff --git a/src/system/kernel/debug/system_profiler.cpp 
b/src/system/kernel/debug/system_profiler.cpp
index af35707..afd87e9 100644
--- a/src/system/kernel/debug/system_profiler.cpp
+++ b/src/system/kernel/debug/system_profiler.cpp
@@ -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)
 {


Other related posts:

  • » [haiku-commits] haiku: hrev46944 - src/system/kernel/debug - julian . harnath