surfaceflinger: fix race condition
surfaceflinger only has one thread. main thread is: a). startHidlServices b). do a getService c). getService receives notification on binder thread and returns d). binder ServiceManager register SF service Then, started by a). hwbinder thread is (DisplayService's, when it receives a transaction): e). binder ServiceManager get SF service ( (d) must happen first! ) Normally, (e) never happens because nothing calls into DisplayService until later. However, on a particular QCOM device (b/80061790), surfaceflinger restarts at just the right time that this sequence happens: (a) (b) (e) then (c) is blocked since (e) is on a binder thread). Test: QCOM device no longer enters this deadlock Test: boot up on Pixel device Test: (sanity) check to make sure surface flinger has one hwbinder thread Test: (sanity) make sure Pixel device surface flinger doesn't register an allocator when it isn't supposed to. As a follow-up, the return values from these various services will be checked. Bug: 80061790 Change-Id: I254d70951ee9508790c940240bcd1da5af746dd3
Loading
Please register or sign in to comment