Trinity: High-Performance and Reliable Mobile Emulation through Graphics Projection

Hao Lin,Zhenhua Li,Di Gao,Yunhao Liu,Feng Qian,Tianyin Xu
DOI: https://doi.org/10.1145/3643029
2024-01-24
ACM Transactions on Computer Systems
Abstract:Mobile emulation, which creates full-fledged software mobile devices on a physical PC/server, is pivotal to the mobile ecosystem. Unfortunately, existing mobile emulators perform poorly on graphics-intensive apps in terms of efficiency and compatibility. To address this, we introduce graphics projection , a novel graphics virtualization mechanism that adds a small-size projection space inside the guest memory, which processes graphics operations involving control contexts and resource handles without host interactions. While enhancing performance, the decoupled and asynchronous guest/host control flows introduced by graphics projection can significantly complicate emulators’ reliability issue diagnosis when faced with a variety of uncommon or non-standard app behaviors in the wild, hindering practical deployment in production. To overcome this drawback, we develop an automatic reliability issue analysis pipeline that distills the critical code paths across the guest and host control flows by runtime quarantine and state introspection. The resulting new Android emulator, dubbed Trinity, exhibits an average of 97% native hardware performance and 99.3% reliable app support, in some cases outperforming other emulators by more than an order of magnitude. It has been deployed in Huawei DevEco Studio, a major Android IDE with millions of developers.
computer science, theory & methods
What problem does this paper attempt to address?
The paper primarily addresses the performance and compatibility issues present in mobile device emulation by proposing a new solution. Existing mobile device emulators are inefficient and poorly compatible when handling graphics-intensive applications. To solve these problems, the authors introduce a new Android emulator named Trinity. Trinity enhances performance by introducing a new mechanism called "graphics projection." This mechanism creates a small projection space in the virtual machine (i.e., the "guest") memory to handle graphics operations involving control contexts and resource handles without frequent interactions with the host machine. This allows most graphics operations to be executed without synchronous waiting, significantly reducing the number of virtual machine exits (VM Exits) and greatly improving efficiency. However, this high-performance implementation also brings some reliability issues, especially when dealing with various uncommon or non-standard application behaviors, making the diagnosis of these reliability issues very complex. To address this problem, the authors developed an automated reliability issue analysis pipeline that can effectively diagnose cross-layer reliability issues and successfully resolved all reliability issues reported during Trinity's testing phase. In summary, the main goal of this paper is to design and implement a high-performance and reliable mobile device emulator, Trinity, which can achieve near-native hardware performance levels when handling graphics-intensive applications while maintaining high compatibility and reliability.