Open hevrard opened 5 years ago
Another option is to do the read()
to a temporary buffer, and then copy this buffer to the destination buffer -- this copy does not use a read call, so the coherent memory tracker should work just fine.
A lightweight approach may be: assume we can use read()
by default, but treat a read()
EFAULT error by trying to dirty destination pages and re-try the read. If the read()
fails again then properly raise an error.
This way there's no overhead in regular replay, and we dirty the destination pages lazily only when needed.
That will work for gapir replay. However it still won't fix the problem in the general case for the memory tracker.
When trying to trace a replay from an APK created by export_replay, a
read()
into mapped memory leads to an error. This is apparently due to the GAPII coherent memory tracker.The APK runs GAPIR which reads resource from the APK assets into various zones of memory. The first
read()
of a resource into a memory mapped byvkMapMemory()
fails with EFAULT (i.e., destination pointer is in invalid memory range).@AWoloszyn says the issue comes from GAPII coherent memory tracker, which I am not familiar with. If the destination buffer is first cleared with zeros before the
read()
, then the error disappears -- but this is costly.Reproduction:
gapit export_replay -apk ...
to create a stand-alone replay APK form the capture