gem5  v20.1.0.0
Public Member Functions | Private Attributes | List of all members
FutexMap Class Reference

FutexMap class holds a map of all futexes used in the system. More...

#include <futex_map.hh>

Inheritance diagram for FutexMap:

Public Member Functions

void suspend (Addr addr, uint64_t tgid, ThreadContext *tc)
 Inserts a futex into the map with one waiting TC. More...
 
int wakeup (Addr addr, uint64_t tgid, int count)
 Wakes up at most count waiting threads on a futex. More...
 
void suspend_bitset (Addr addr, uint64_t tgid, ThreadContext *tc, int bitmask)
 
int wakeup_bitset (Addr addr, uint64_t tgid, int bitmask)
 
int requeue (Addr addr1, uint64_t tgid, int count, int count2, Addr addr2)
 This operation wakes a given number (val) of waiters. More...
 
bool is_waiting (ThreadContext *tc)
 Determine if the given thread context is currently waiting on a futex wait operation on any of the futexes tracked by this FutexMap. More...
 

Private Attributes

std::unordered_set< ThreadContext * > waitingTcs
 

Detailed Description

FutexMap class holds a map of all futexes used in the system.

Definition at line 90 of file futex_map.hh.

Member Function Documentation

◆ is_waiting()

bool FutexMap::is_waiting ( ThreadContext tc)

Determine if the given thread context is currently waiting on a futex wait operation on any of the futexes tracked by this FutexMap.

Definition at line 194 of file futex_map.cc.

References waitingTcs.

Referenced by BaseCPU::postInterrupt().

◆ requeue()

int FutexMap::requeue ( Addr  addr1,
uint64_t  tgid,
int  count,
int  count2,
Addr  addr2 
)

This operation wakes a given number (val) of waiters.

If there are more threads waiting than woken, they are removed from the wait queue of the futex pointed to by addr1 and added to the wait queue of the futex pointed to by addr2. The number of waiter moved is capped by count2 (misused timeout parameter).

The return value is the number of waiters that are woken or requeued.

Definition at line 150 of file futex_map.cc.

References X86ISA::count, ArmISA::it1, ArmISA::it2, and MipsISA::w.

Referenced by futexFunc().

◆ suspend()

void FutexMap::suspend ( Addr  addr,
uint64_t  tgid,
ThreadContext tc 
)

Inserts a futex into the map with one waiting TC.

Definition at line 62 of file futex_map.cc.

References addr, and suspend_bitset().

Referenced by futexFunc().

◆ suspend_bitset()

void FutexMap::suspend_bitset ( Addr  addr,
uint64_t  tgid,
ThreadContext tc,
int  bitmask 
)

Suspend the thread context

Definition at line 98 of file futex_map.cc.

References addr, ThreadContext::suspend(), and waitingTcs.

Referenced by futexFunc(), and suspend().

◆ wakeup()

int FutexMap::wakeup ( Addr  addr,
uint64_t  tgid,
int  count 
)

Wakes up at most count waiting threads on a futex.

Definition at line 68 of file futex_map.cc.

References addr, X86ISA::count, and waitingTcs.

Referenced by exitFutexWake(), and futexFunc().

◆ wakeup_bitset()

int FutexMap::wakeup_bitset ( Addr  addr,
uint64_t  tgid,
int  bitmask 
)

Definition at line 117 of file futex_map.cc.

References ThreadContext::activate(), addr, WaiterState::checkMask(), WaiterState::tc, and waitingTcs.

Referenced by futexFunc().

Member Data Documentation

◆ waitingTcs

std::unordered_set<ThreadContext *> FutexMap::waitingTcs
private

Definition at line 124 of file futex_map.hh.

Referenced by is_waiting(), suspend_bitset(), wakeup(), and wakeup_bitset().


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:24 for gem5 by doxygen 1.8.17