kernel: Workaround for double lock of spinlock in user timers.

The thread that is being [un]scheduled already has its time_lock locked
in {stop|continue}_cpu_timers(). When updating the TeamTimeUserTimer,
the team is asked for its cpu time. Team::CPUTime() then iterates the
threads of the team and locks the time_lock of the thread again.

This workaround passes a possibly locked thread through the relevant
functions so Team::CPUTime() can decide whether or not a thread it
iterates needs to be locked or not.

This works around #11032 and its duplicates #11314 and #11344.
This commit is contained in:
Michael Lotz
2014-10-29 00:25:37 +01:00
parent 4ed39e6a62
commit 52d500e5b4
4 changed files with 18 additions and 11 deletions
+4 -2
View File
@@ -117,14 +117,16 @@ struct TeamTimeUserTimer : public UserTimer {
void Deactivate();
void Update(Thread* unscheduledThread);
void Update(Thread* unscheduledThread,
Thread* lockedThread = NULL);
void TimeWarped(bigtime_t changedBy);
protected:
virtual void HandleTimer();
private:
void _Update(bool unscheduling);
void _Update(bool unscheduling,
Thread* lockedThread = NULL);
private:
team_id fTeamID;
+2 -1
View File
@@ -388,7 +388,8 @@ public:
inline TeamUserTimeUserTimerList::ConstIterator
UserTimeUserTimerIterator() const;
bigtime_t CPUTime(bool ignoreCurrentRun) const;
bigtime_t CPUTime(bool ignoreCurrentRun,
Thread* lockedThread = NULL) const;
bigtime_t UserCPUTime() const;
private: