runtime: fix race that dropped GoSysExit events from trace
runtime: fix race that dropped GoSysExit events from trace

This makes TestTraceStressStartStop much less flaky.
Running under stress, it changes the failure rate from
above 1/100 to under 1/50000. That very unlikely
failure happens when an unexpected GoSysExit is
written. Not sure how that happens yet, but it is much
less important.

Fixes #11953.

Change-Id: I034671936334b4f3ab733614ef239aa121d20247
Reviewed-on: https://go-review.googlesource.com/13321
Reviewed-by: Dmitry Vyukov <05e8181be3150e47da8fe2e1f18d381c75496ff4@google.com>

springning/go,yuhengye/go,Stan-Lin-/go,cloudflare/go,ImJasonH/go,qskycolor/go,dterei/go,akutz/go,jacobsa/go,andrewchambers/go,ganboing/go-esx,greyhwndz/go,WIZARD-CXY/go,b54898533/go,GeorgiCodes/go,alex-zhang/go,mwhudson/go,mgyenik/go,NichoZhang/go,danycoro/go,arschles/go-1,goodlang/good,yasarkunduz/go,zouchao2010/go,vishsingh/go,snowsnail/go,zouchao2010/go,jefby/go,stormltf/go,uileyar/go,jacobxk/go,vanloswang/go,jdeng/go,kim-racktop/go,sndnvaps/go,ErikDubbelboer/go,qskycolor/go,andrewchambers/go,derekmarcotte/go,CarterTsai/go,alex-zhang/go,myPublicGit/go,greyhwndz/go,ImJasonH/go,leeric92/go,lihuanghai/go,theif519/go,dpatel06/go,codestation/go,likesea/go,gdey/go,ichu501/go,deft-code/go,wangfakang/go-1,sndnvaps/go,XuYunnan/go,yasarkunduz/go,donnel6809/go,ObjectiveJoe/go,leeric92/go,CarterTsai/go,jdhenke/go,fjballest/golang,sndnvaps/go,CAFxX/go,mwhudson/go,Cofyc/go,jonasi/go,cookerzhu/go,willjunspecial/go,zcwfeng/go,sinuos/go,CiscoCloud/go,NunoEdgarGub1/go,JioCloud/go,ImJasonH/go,XuYunnan/go,josharian/go,josharian/go,lihuanghai/go,Pulgafree/go,christopher-henderson/Go,ifagnosticism/go,4ad/go,famorted/go,zcwfeng/go,mbrukman/go,nawawi/go,Young55555/go,myPublicGit/go,NichoZhang/go,sndnvaps/go,goodlang/good,Badredapple/go,sinuos/go,zhangg/go,polyverse-security/go,myPublicGit/go,constantine001/go,XuYunnan/go,AALEKH/go,theass/go,Endika/go,Young55555/go,CarterTsai/go,miolini/go,undergrowthlinear/go,danycoro/go,devpadawan/go,andrewchambers/go,Cofyc/go,ErikDubbelboer/go,Samurais/go,qskycolor/go,deft-code/go,xiaobodu/go,xiuzhifu/go,binarycrusader/go,GeorgiCodes/go,uileyar/go,Endika/go,jonahglover/go,kakuhiroshi/go,g522342435/go,zhangg/go,nakedgc/go,mwhudson/go,dterei/go,honsiorovskyi/go,vsekhar/elastic-go,mikekap/go,miolini/go,jefby/go,greyhwndz/go,jdeng/go,andrewchambers/go,skatsuta/go,xiuzhifu/go,cyberroadie/go,CiscoCloud/go,ImJasonH/go,ichu501/go,jdhenke/go,xiaobodu/go,ifagnosticism/go,goodlang/good,vsekhar/elastic-go,AALEKH/go,leeric92/go,vsekhar/elastic-go,NichoZhang/go,vsdutka/go,mwhudson/go,Samurais/go,Badredapple/go,AALEKH/go,fjballest/golang,b54898533/go,binarycrusader/go,mdp/go,alash3al/go,sndnvaps/go,sinuos/go,cyberroadie/go,jonahglover/go,nawawi/go,gdey/go,likesea/go,jacobsa/go,kevinc0825/go,deft-code/go,snowsnail/go,xujianhai/go,slavau/go,devpadawan/go,yasarkunduz/go,malvira/go,mgyenik/go,donnel6809/go,cyberroadie/go,willjunspecial/go,XuYunnan/go,polyverse-security/go,dpatel06/go,beealone/go,vishsingh/go,sinuos/go,CodyGuo/go,uileyar/go,mgyenik/go,NichoZhang/go,danielsoro/go,dterei/go,jacobsa/go,roth1002/go,theass/go,derekmarcotte/go,vsdutka/go,jmptrader/go,theass/go,jonasi/go,cookerzhu/go,slavau/go,Pulgafree/go,mbrukman/go,uileyar/go,alash3al/go,lihuanghai/go,albertjin/golang-go,sosop/go,dterei/go,arschles/golang-go,XuYunnan/go,miolini/go,malvira/go,b54898533/go,jasonxiong/go,momchil-velikov/go,joshsammut/go,qskycolor/go,mbrukman/go,jonathanmarvens/go,4ad/go,roth1002/go,jefby/go,zhangg/go,ImJasonH/go,JioCloud/go,leeric92/go,cainiaocome/go,willjunspecial/go,CAFxX/go,kevinc0825/go,vsdutka/go,danielsoro/go,vsdutka/go,dafyddcrosby/go,alash3al/go,cookerzhu/go,Jordanzuo/go,zhangg/go,famorted/go,momchil-velikov/go,skatsuta/go,malvira/go,lihuanghai/go,golang/go,jonasi/go,gdey/go,monetate/go,mbrukman/go,kakuhiroshi/go,xiaobodu/go,ericsnowcurrently/go,Badredapple/go,snowsnail/go,leeric92/go,famorted/go,odeke-em/go,jefby/go,constantine001/go,xiaobodu/go,slavau/go,GeorgiCodes/go,4ad/go,g522342435/go,linux-on-ibm-z/go,rachtsingh/gogojuice,4ad/go,undergrowthlinear/go,linux-on-ibm-z/go,Badredapple/go,CarterTsai/go,AALEKH/go,AALEKH/go,sinuos/go,undergrowthlinear/go,g522342435/go,alex-zhang/go,mikekap/go,rachtsingh/gogojuice,roth1002/go,shines77/go,CodyGuo/go,JioCloud/go,beealone/go,Endika/go,joshsammut/go,danycoro/go,samanalysis/go,nakedgc/go,GeorgiCodes/go,alash3al/go,cloudflare/go,yuhengye/go,willjunspecial/go,Cofyc/go,akutz/go,nawawi/go,polyverse-security/go,arschles/golang-go,monetate/go,sosop/go,arschles/golang-go,ericsnowcurrently/go,akutz/go,NichoZhang/go,WIZARD-CXY/go,binarycrusader/go,Pulgafree/go,constantine001/go,samanalysis/go,b54898533/go,ichu501/go,zcwfeng/go,theass/go,akutz/go,cookerzhu/go,CodyGuo/go,chinanjjohn2012/go,jasonxiong/go,jonasi/go,vanloswang/go,fjballest/golang,yasarkunduz/go,rachtsingh/gogojuice,zcwfeng/go,famorted/go,nawawi/go,cookerzhu/go,derekmarcotte/go,malvira/go,danielsoro/go,polyverse-security/go,mwhudson/go,greyhwndz/go,albertjin/golang-go,vsekhar/elastic-go,monetate/go,skatsuta/go,mgyenik/go,CodyGuo/go,ifagnosticism/go,kevinc0825/go,likesea/go,odeke-em/go,mgyenik/go,springning/go,kim-racktop/go,wangfakang/go-1,goodlang/good,yuhengye/go,g522342435/go,famorted/go,ErikDubbelboer/go,jacobhaven/go,devpadawan/go,CAFxX/go,Jordanzuo/go,slavau/go,zhangg/go,jacobxk/go,mdp/go,binarycrusader/go,mbrukman/go,cookerzhu/go,monetate/go,Jordanzuo/go,NunoEdgarGub1/go,yuhengye/go,snowsnail/go,jonasi/go,joshsammut/go,jasonxiong/go,jonahglover/go,zcwfeng/go,b54898533/go,devpadawan/go,Pulgafree/go,jdhenke/go,sndnvaps/go,ImJasonH/go,samanalysis/go,Cofyc/go,wangfakang/go-1,nawawi/go,rachtsingh/gogojuice,danielsoro/go,Endika/go,devpadawan/go,greyhwndz/go,kim-racktop/go,skatsuta/go,yangzhongj/go,xiuzhifu/go,jacobxk/go,cainiaocome/go,joshsammut/go,chinanjjohn2012/go,theif519/go,rachtsingh/gogojuice,devpadawan/go,Jordanzuo/go,jacobxk/go,xujianhai/go,wangfakang/go-1,wangfakang/go-1,rentongzhang/go,Charlesdong/go-1,sosop/go,ErikDubbelboer/go,Endika/go,honsiorovskyi/go,sndnvaps/go,Charlesdong/go-1,Jordanzuo/go,andrewchambers/go,myPublicGit/go,rentongzhang/go,theif519/go,lihuanghai/go,theif519/go,jonahglover/go,zcwfeng/go,skatsuta/go,monetate/go,alash3al/go,vsdutka/go,constantine001/go,akutz/go,codestation/go,Jordanzuo/go,constantine001/go,sinuos/go,qskycolor/go,ifagnosticism/go,vsekhar/elastic-go,kakuhiroshi/go,WIZARD-CXY/go,gdey/go,ImJasonH/go,arschles/go-1,vanloswang/go,linux-on-ibm-z/go,rentongzhang/go,stormltf/go,joshsammut/go,momchil-velikov/go,stormltf/go,dterei/go,derekmarcotte/go,beealone/go,kevinc0825/go,theass/go,alash3al/go,roth1002/go,springning/go,yuhengye/go,ericsnowcurrently/go,joshsammut/go,greyhwndz/go,cyberroadie/go,sosop/go,jacobsa/go,ImJasonH/go,Stan-Lin-/go,cainiaocome/go,WIZARD-CXY/go,leeric92/go,vishsingh/go,ericsnowcurrently/go,springning/go,jacobhaven/go,vanloswang/go,suncycheng/go,ErikDubbelboer/go,josharian/go,constantine001/go,zcwfeng/go,cainiaocome/go,yangzhongj/go,cloudflare/go,undergrowthlinear/go,codestation/go,momchil-velikov/go,deft-code/go,zouchao2010/go,mikekap/go,dpatel06/go,cookerzhu/go,Charlesdong/go-1,slavau/go,jonahglover/go,joshsammut/go,4ad/go,donnel6809/go,odeke-em/go,jonathanmarvens/go,yangzhongj/go,NunoEdgarGub1/go,codestation/go,donnel6809/go,theass/go,Pulgafree/go,ObjectiveJoe/go,xiuzhifu/go,myPublicGit/go,springning/go,dpatel06/go,CarterTsai/go,likesea/go,samanalysis/go,xiaobodu/go,jonasi/go,alex-zhang/go,constantine001/go,rentongzhang/go,CiscoCloud/go,josharian/go,undergrowthlinear/go,ericsnowcurrently/go,donnel6809/go,shines77/go,arschles/go-1,GeorgiCodes/go,uileyar/go,xiuzhifu/go,fjballest/golang,jonathanmarvens/go,kakuhiroshi/go,kakuhiroshi/go,myPublicGit/go,mikekap/go,malvira/go,Cofyc/go,CiscoCloud/go,zcwfeng/go,jonasi/go,albertjin/golang-go,kakuhiroshi/go,yangzhongj/go,ichu501/go,undergrowthlinear/go,AALEKH/go,jonahglover/go,mbrukman/go,chinanjjohn2012/go,deft-code/go,jacobhaven/go,ErikDubbelboer/go,g522342435/go,Charlesdong/go-1,dafyddcrosby/go,linux-on-ibm-z/go,alex-zhang/go,likesea/go,snowsnail/go,golang/go,Jordanzuo/go,jdhenke/go,devpadawan/go,akutz/go,NunoEdgarGub1/go,jmptrader/go,cloudflare/go,malvira/go,JioCloud/go,beealone/go,yasarkunduz/go,slavau/go,danycoro/go,polyverse-security/go,jefby/go,dafyddcrosby/go,kakuhiroshi/go,4ad/go,danielsoro/go,cloudflare/go,jefby/go,theif519/go,yangzhongj/go,momchil-velikov/go,kakuhiroshi/go,malvira/go,CiscoCloud/go,willjunspecial/go,mikekap/go,Charlesdong/go-1,odeke-em/go,likesea/go,linux-on-ibm-z/go,jefby/go,suncycheng/go,fjballest/golang,kim-racktop/go,deft-code/go,monetate/go,CarterTsai/go,danielsoro/go,beealone/go,andrewchambers/go,ichu501/go,qskycolor/go,mdp/go,b54898533/go,nakedgc/go,fjballest/golang,Pulgafree/go,polyverse-security/go,albertjin/golang-go,roth1002/go,suncycheng/go,momchil-velikov/go,ichu501/go,andrewchambers/go,ifagnosticism/go,nawawi/go,codestation/go,jacobxk/go,ObjectiveJoe/go,ericsnowcurrently/go,jacobxk/go,miolini/go,Young55555/go,Pulgafree/go,WIZARD-CXY/go,JioCloud/go,lihuanghai/go,beealone/go,yuhengye/go,sinuos/go,theif519/go,cyberroadie/go,josharian/go,momchil-velikov/go,NichoZhang/go,jasonxiong/go,jasonxiong/go,skatsuta/go,NunoEdgarGub1/go,cyberroadie/go,jonathanmarvens/go,cloudflare/go,arschles/golang-go,golang/go,suncycheng/go,sinuos/go,xiuzhifu/go,jacobxk/go,rachtsingh/gogojuice,mdp/go,uileyar/go,ganboing/go-esx,odeke-em/go,Stan-Lin-/go,vsekhar/elastic-go,xiuzhifu/go,Endika/go,jdhenke/go,undergrowthlinear/go,vsdutka/go,XuYunnan/go,vanloswang/go,jonasi/go,andrewchambers/go,jonahglover/go,WIZARD-CXY/go,myPublicGit/go,danycoro/go,Samurais/go,zouchao2010/go,zouchao2010/go,vanloswang/go,jdhenke/go,ganboing/go-esx,Jordanzuo/go,ichu501/go,goodlang/good,rentongzhang/go,dterei/go,jonathanmarvens/go,yangzhongj/go,vanloswang/go,wangfakang/go-1,mikekap/go,binarycrusader/go,stormltf/go,ObjectiveJoe/go,Samurais/go,kim-racktop/go,GeorgiCodes/go,g522342435/go,monetate/go,kim-racktop/go,donnel6809/go,mdp/go,jdeng/go,miolini/go,cainiaocome/go,albertjin/golang-go,gdey/go,chinanjjohn2012/go,josharian/go,dafyddcrosby/go,mwhudson/go,fjballest/golang,skatsuta/go,CodyGuo/go,stormltf/go,WIZARD-CXY/go,kevinc0825/go,jacobsa/go,dafyddcrosby/go,sosop/go,albertjin/golang-go,golang/go,zhangg/go,kevinc0825/go,jonathanmarvens/go,jacobhaven/go,momchil-velikov/go,slavau/go,JioCloud/go,ifagnosticism/go,danycoro/go,golang/go,JioCloud/go,kevinc0825/go,CiscoCloud/go,vishsingh/go,shines77/go,ganboing/go-esx,Young55555/go,springning/go,vishsingh/go,nakedgc/go,AALEKH/go,mgyenik/go,dafyddcrosby/go,goodlang/good,wangfakang/go-1,arschles/golang-go,suncycheng/go,roth1002/go,CarterTsai/go,theif519/go,CAFxX/go,snowsnail/go,akutz/go,nakedgc/go,suncycheng/go,alex-zhang/go,famorted/go,Endika/go,CAFxX/go,xujianhai/go,b54898533/go,CodyGuo/go,yangzhongj/go,springning/go,arschles/golang-go,theass/go,derekmarcotte/go,jmptrader/go,ganboing/go-esx,jacobsa/go,Stan-Lin-/go,chinanjjohn2012/go,Stan-Lin-/go,lihuanghai/go,mikekap/go,odeke-em/go,honsiorovskyi/go,jacobhaven/go,nakedgc/go,mgyenik/go,alex-zhang/go,vishsingh/go,jacobhaven/go,jmptrader/go,zhangg/go,odeke-em/go,derekmarcotte/go,greyhwndz/go,uileyar/go,miolini/go,malvira/go,jasonxiong/go,codestation/go,willjunspecial/go,honsiorovskyi/go,WIZARD-CXY/go,jonahglover/go,vsekhar/elastic-go,albertjin/golang-go,arschles/golang-go,Cofyc/go,ErikDubbelboer/go,qskycolor/go,samanalysis/go,stormltf/go,codestation/go,nawawi/go,dpatel06/go,josharian/go,beealone/go,samanalysis/go,dpatel06/go,deft-code/go,jmptrader/go,4ad/go,chinanjjohn2012/go,CAFxX/go,CodyGuo/go,honsiorovskyi/go,goodlang/good,vsdutka/go,yangzhongj/go,snowsnail/go,shines77/go,Samurais/go,xujianhai/go,jmptrader/go,vishsingh/go,ganboing/go-esx,cainiaocome/go,derekmarcotte/go,vsdutka/go,suncycheng/go,xujianhai/go,theif519/go,Stan-Lin-/go,ericsnowcurrently/go,xujianhai/go,Young55555/go,Badredapple/go,sosop/go,arschles/go-1,g522342435/go,linux-on-ibm-z/go,danielsoro/go,Stan-Lin-/go,jmptrader/go,Samurais/go,ErikDubbelboer/go,honsiorovskyi/go,CodyGuo/go,Young55555/go,chinanjjohn2012/go,shines77/go,jasonxiong/go,jacobhaven/go,Samurais/go,JioCloud/go,nawawi/go,rentongzhang/go,cyberroadie/go,joshsammut/go,honsiorovskyi/go,codestation/go,ifagnosticism/go,GeorgiCodes/go,Samurais/go,polyverse-security/go,gdey/go,ganboing/go-esx,AALEKH/go,likesea/go,jacobhaven/go,mikekap/go,jonathanmarvens/go,zouchao2010/go,samanalysis/go,honsiorovskyi/go,ichu501/go,binarycrusader/go,nakedgc/go,leeric92/go,xiaobodu/go,Young55555/go,sndnvaps/go,NichoZhang/go,binarycrusader/go,ObjectiveJoe/go,fjballest/golang,springning/go,constantine001/go,suncycheng/go,Young55555/go,alash3al/go,arschles/go-1,NunoEdgarGub1/go,polyverse-security/go,golang/go,leeric92/go,arschles/go-1,deft-code/go,shines77/go,CiscoCloud/go,chinanjjohn2012/go,Charlesdong/go-1,mdp/go,ObjectiveJoe/go,ObjectiveJoe/go,kim-racktop/go,monetate/go,shines77/go,nakedgc/go,golang/go,binarycrusader/go,jdeng/go,NichoZhang/go,g522342435/go,beealone/go,gdey/go,jasonxiong/go,roth1002/go,famorted/go,snowsnail/go,slavau/go,GeorgiCodes/go,danycoro/go,XuYunnan/go,theass/go,Cofyc/go,jacobsa/go,jonathanmarvens/go,jmptrader/go,dafyddcrosby/go,CiscoCloud/go,willjunspecial/go,vsekhar/elastic-go,greyhwndz/go,danycoro/go,CAFxX/go,cainiaocome/go,mdp/go,jdhenke/go,yasarkunduz/go,Charlesdong/go-1,rentongzhang/go,jdeng/go,xiuzhifu/go,xiaobodu/go,ganboing/go-esx,Badredapple/go,yasarkunduz/go,xujianhai/go,Cofyc/go,kevinc0825/go,vanloswang/go,alash3al/go,yuhengye/go,rachtsingh/gogojuice,yasarkunduz/go,mwhudson/go,NunoEdgarGub1/go,akutz/go,danielsoro/go,famorted/go,jacobsa/go,arschles/go-1,sosop/go,shines77/go,josharian/go,miolini/go,vishsingh/go,jefby/go,jdeng/go,CarterTsai/go,jdeng/go,devpadawan/go,albertjin/golang-go,cloudflare/go,jacobxk/go,XuYunnan/go,zouchao2010/go,xujianhai/go,rachtsingh/gogojuice,Badredapple/go,roth1002/go,ObjectiveJoe/go,uileyar/go,odeke-em/go,dpatel06/go,myPublicGit/go,lihuanghai/go,zhangg/go,samanalysis/go,mgyenik/go,NunoEdgarGub1/go,Pulgafree/go,4ad/go,yuhengye/go,linux-on-ibm-z/go,mbrukman/go,b54898533/go,sosop/go,wangfakang/go-1,mbrukman/go,likesea/go,linux-on-ibm-z/go,donnel6809/go,xiaobodu/go,Badredapple/go,dpatel06/go,qskycolor/go,goodlang/good,willjunspecial/go,kim-racktop/go,dterei/go,cloudflare/go,stormltf/go,mwhudson/go,jdeng/go,arschles/golang-go,dterei/go,dafyddcrosby/go,Charlesdong/go-1,jdhenke/go,donnel6809/go,skatsuta/go,CAFxX/go,cookerzhu/go,Stan-Lin-/go,zouchao2010/go,Endika/go,gdey/go,alex-zhang/go,cainiaocome/go,mdp/go,derekmarcotte/go,miolini/go,ifagnosticism/go,golang/go,arschles/go-1,rentongzhang/go,ericsnowcurrently/go,cyberroadie/go,stormltf/go,undergrowthlinear/go