PlatformLab/Arachne

Deadlock between coreChangeMutex and DefaultCorePolicy::lock

hq6 opened this issue · 0 comments

hq6 commented

When a core is granted by the CoreArbiter, it first takes the coreChangeMutex, and then calls coreAvailable, which attempts to take DefaultCorePolicy::lock.

When DefaultCorePolicy::adjustCores runs, it first takes DefaultCorePolicy::lock, and then calls setCoreCount, which tries to take coreChangeMutex.

backtrace for thread1

#0  0x0000000000431a35 in PerfUtils::Cycles::toSeconds(unsigned long, double) ()                                        
#1  0x000000000043092d in Arachne::SpinLock::lock (this=0x1785dd8) at src/SpinLock.h:68                                 
#2  std::lock_guard<Arachne::SpinLock>::lock_guard (__m=..., this=<synthetic pointer>) at /usr/include/c++/5/mutex:386  
#3  Arachne::DefaultCorePolicy::coreAvailable (this=this@entry=0x1785d10, myCoreId=1) at src/DefaultCorePolicy.cc:49    
#4  0x000000000042cae0 in Arachne::threadMain () at src/Arachne.cc:338                                                  
#5  0x00007f34938c1c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6                                           
#6  0x00007f34931976ba in start_thread (arg=0x7f348e509700) at pthread_create.c:333                                     
#7  0x00007f3492ecd3dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109                                     

backtrace for thread2

#0  0x0000000000431a23 in PerfUtils::Cycles::toSeconds(unsigned long, double) ()
#1  0x000000000042df3d in Arachne::SpinLock::lock (this=0x65fcc0 <Arachne::coreChangeMutex>) at src/SpinLock.h:68
#2  std::lock_guard<Arachne::SpinLock>::lock_guard (__m=..., this=<synthetic pointer>) at /usr/include/c++/5/mutex:386
#3  Arachne::setCoreCount (desiredNumCores=15) at src/Arachne.cc:1461
#4  0x00000000004302b4 in Arachne::DefaultCorePolicy::adjustCores (this=0x1785d10) at src/DefaultCorePolicy.cc:175
#5  0x000000000042de90 in Arachne::schedulerMainLoop () at src/Arachne.cc:464
#6  0x0000000000000000 in ?? ()