Use a separate mutex to protect all_tasks, avoiding a lock-order-reversal In GHC 6.12.x I found a rare deadlock caused by this lock-order-reversal:
Use a separate mutex to protect all_tasks, avoiding a lock-order-reversal
In GHC 6.12.x I found a rare deadlock caused by this
lock-order-reversal:

AQ cap->lock
  startWorkerTask
    newTask
      AQ sched_mutex

scheduleCheckBlackHoles
  AQ sched_mutex
   unblockOne_
    wakeupThreadOnCapabilty
      AQ cap->lock

so sched_mutex and cap->lock are taken in a different order in two
places.

This doesn't happen in the HEAD because we don't have
scheduleCheckBlackHoles, but I thought it would be prudent to make
this less likely to happen in the future by using a different mutex in
newTask.  We can clearly see that the all_tasks mutex cannot be
involved in a deadlock, becasue we never call anything else while
holding it.

elieux/ghc,green-haskell/ghc,acowley/ghc,vikraman/ghc,mcmaniac/ghc,sgillespie/ghc,gcampax/ghc,sgillespie/ghc,ml9951/ghc,nushio3/ghc,hferreiro/replay,gcampax/ghc,bitemyapp/ghc,tibbe/ghc,fmthoma/ghc,ghc-android/ghc,ghc-android/ghc,snoyberg/ghc,spacekitteh/smcghc,GaloisInc/halvm-ghc,oldmanmike/ghc,lukexi/ghc,oldmanmike/ghc,shlevy/ghc,jstolarek/ghc,ml9951/ghc,GaloisInc/halvm-ghc,forked-upstream-packages-for-ghcjs/ghc,tjakway/ghcjvm,da-x/ghc,elieux/ghc,vTurbine/ghc,anton-dessiatov/ghc,ekmett/ghc,bitemyapp/ghc,hferreiro/replay,ghc-android/ghc,sgillespie/ghc,lukexi/ghc-7.8-arm64,tjakway/ghcjvm,mfine/ghc,hferreiro/replay,jstolarek/ghc,urbanslug/ghc,hferreiro/replay,nathyong/microghc-ghc,sgillespie/ghc,christiaanb/ghc,nathyong/microghc-ghc,shlevy/ghc,wxwxwwxxx/ghc,fmthoma/ghc,mcschroeder/ghc,wxwxwwxxx/ghc,green-haskell/ghc,fmthoma/ghc,tibbe/ghc,mcschroeder/ghc,olsner/ghc,TomMD/ghc,da-x/ghc,mettekou/ghc,ekmett/ghc,ryantm/ghc,urbanslug/ghc,vikraman/ghc,wxwxwwxxx/ghc,ml9951/ghc,fmthoma/ghc,gridaphobe/ghc,urbanslug/ghc,nathyong/microghc-ghc,ryantm/ghc,mcschroeder/ghc,vTurbine/ghc,anton-dessiatov/ghc,urbanslug/ghc,green-haskell/ghc,gcampax/ghc,gridaphobe/ghc,oldmanmike/ghc,vikraman/ghc,christiaanb/ghc,gcampax/ghc,ml9951/ghc,elieux/ghc,lukexi/ghc-7.8-arm64,shlevy/ghc,snoyberg/ghc,GaloisInc/halvm-ghc,elieux/ghc,tjakway/ghcjvm,oldmanmike/ghc,mcmaniac/ghc,da-x/ghc,GaloisInc/halvm-ghc,holzensp/ghc,vTurbine/ghc,lukexi/ghc-7.8-arm64,bitemyapp/ghc,olsner/ghc,anton-dessiatov/ghc,siddhanathan/ghc,snoyberg/ghc,nushio3/ghc,vikraman/ghc,jstolarek/ghc,acowley/ghc,AlexanderPankiv/ghc,wxwxwwxxx/ghc,sdiehl/ghc,ezyang/ghc,mfine/ghc,bitemyapp/ghc,oldmanmike/ghc,forked-upstream-packages-for-ghcjs/ghc,fmthoma/ghc,nushio3/ghc,oldmanmike/ghc,lukexi/ghc-7.8-arm64,nomeata/ghc,nomeata/ghc,mcschroeder/ghc,sdiehl/ghc,vTurbine/ghc,ryantm/ghc,mcmaniac/ghc,oldmanmike/ghc,frantisekfarka/ghc-dsi,ekmett/ghc,sgillespie/ghc,spacekitteh/smcghc,elieux/ghc,shlevy/ghc,sdiehl/ghc,ryantm/ghc,nkaretnikov/ghc,TomMD/ghc,siddhanathan/ghc,nushio3/ghc,mfine/ghc,vikraman/ghc,hferreiro/replay,ml9951/ghc,fmthoma/ghc,TomMD/ghc,nushio3/ghc,siddhanathan/ghc,da-x/ghc,ezyang/ghc,nomeata/ghc,mettekou/ghc,spacekitteh/smcghc,ryantm/ghc,tjakway/ghcjvm,mfine/ghc,urbanslug/ghc,TomMD/ghc,mettekou/ghc,snoyberg/ghc,olsner/ghc,nkaretnikov/ghc,AlexanderPankiv/ghc,ghc-android/ghc,AlexanderPankiv/ghc,anton-dessiatov/ghc,mcschroeder/ghc,acowley/ghc,TomMD/ghc,nkaretnikov/ghc,snoyberg/ghc,nomeata/ghc,acowley/ghc,jstolarek/ghc,AlexanderPankiv/ghc,nathyong/microghc-ghc,da-x/ghc,nushio3/ghc,AlexanderPankiv/ghc,frantisekfarka/ghc-dsi,lukexi/ghc-7.8-arm64,ilyasergey/GHC-XAppFix,TomMD/ghc,mcmaniac/ghc,snoyberg/ghc,vikraman/ghc,tjakway/ghcjvm,acowley/ghc,tibbe/ghc,gridaphobe/ghc,sdiehl/ghc,sdiehl/ghc,nathyong/microghc-ghc,ml9951/ghc,mfine/ghc,mcschroeder/ghc,snoyberg/ghc,ezyang/ghc,frantisekfarka/ghc-dsi,forked-upstream-packages-for-ghcjs/ghc,ilyasergey/GHC-XAppFix,hferreiro/replay,spacekitteh/smcghc,da-x/ghc,GaloisInc/halvm-ghc,gridaphobe/ghc,gridaphobe/ghc,vTurbine/ghc,christiaanb/ghc,ezyang/ghc,holzensp/ghc,forked-upstream-packages-for-ghcjs/ghc,sdiehl/ghc,acowley/ghc,wxwxwwxxx/ghc,siddhanathan/ghc,nkaretnikov/ghc,mettekou/ghc,tibbe/ghc,siddhanathan/ghc,acowley/ghc,tjakway/ghcjvm,tibbe/ghc,olsner/ghc,forked-upstream-packages-for-ghcjs/ghc,mfine/ghc,ilyasergey/GHC-XAppFix,ml9951/ghc,mfine/ghc,holzensp/ghc,ezyang/ghc,mcschroeder/ghc,urbanslug/ghc,lukexi/ghc,mcmaniac/ghc,olsner/ghc,nkaretnikov/ghc,mettekou/ghc,ekmett/ghc,siddhanathan/ghc,gridaphobe/ghc,nathyong/microghc-ghc,anton-dessiatov/ghc,olsner/ghc,frantisekfarka/ghc-dsi,mettekou/ghc,ekmett/ghc,gcampax/ghc,shlevy/ghc,nushio3/ghc,jstolarek/ghc,holzensp/ghc,ghc-android/ghc,urbanslug/ghc,ezyang/ghc,anton-dessiatov/ghc,ilyasergey/GHC-XAppFix,sdiehl/ghc,forked-upstream-packages-for-ghcjs/ghc,vikraman/ghc,christiaanb/ghc,frantisekfarka/ghc-dsi,siddhanathan/ghc,shlevy/ghc,elieux/ghc,nomeata/ghc,nathyong/microghc-ghc,AlexanderPankiv/ghc,wxwxwwxxx/ghc,bitemyapp/ghc,GaloisInc/halvm-ghc,ml9951/ghc,vTurbine/ghc,elieux/ghc,christiaanb/ghc,AlexanderPankiv/ghc,hferreiro/replay,tjakway/ghcjvm,GaloisInc/halvm-ghc,vTurbine/ghc,nkaretnikov/ghc,lukexi/ghc,sgillespie/ghc,nkaretnikov/ghc,gridaphobe/ghc,olsner/ghc,ghc-android/ghc,fmthoma/ghc,forked-upstream-packages-for-ghcjs/ghc,lukexi/ghc,green-haskell/ghc,anton-dessiatov/ghc,sgillespie/ghc,ghc-android/ghc,gcampax/ghc,christiaanb/ghc,shlevy/ghc,holzensp/ghc,gcampax/ghc,TomMD/ghc,green-haskell/ghc,lukexi/ghc,da-x/ghc,wxwxwwxxx/ghc,christiaanb/ghc,mettekou/ghc,spacekitteh/smcghc,ezyang/ghc