bdpayne/libvmi — pull request #102 by mzguanglin (2013-09-12 22:01:27+00:00)
Title: TEVAT & DGVMA : speedup guest virtual memory access with shm-snapshot

Transparent Efficient Virtual Address Translation (TEVAT):
Create a shadow page table of shm-snapshot in LibVMI address space, so MMU can help us translate the guest virtual address to physical one, bypassing vmi_translate_kv2p() and vmi_translate_uv2p().

Direct Guest Virtual Memory Access (DGVMA):
Based on TEVAT, users can acquire a read only pointer to the virtual memory base of shm-snapshot. It provides a much faster (non-copy) manner to read guest virtual memory bypassing vmi_read_va().

I add 3 APIs in this PR:

1. status_t vmi_shm_snapshot_tevat_page_table_create(vmi_instance_t vmi, pid_t pid);
2. status_t vmi_shm_snapshot_tevat_page_table_destroy(mi_instance_t vmi, pid_t pid);
3. const void * vmi_shm_snapshot_get_tevat_dgvma(vmi_instance_t vmi, pid_t pid);

Performance benchmark:
Achieve native memory read bandwidth with TEVAT and DGVMA. (3X ~ 4X speedup over legacy vmi_read_va())
![1](https://f.cloud.github.com/assets/667845/1134651/d5c0789a-1bf6-11e3-8def-c54aa611771f.png)

Advantages:
1. MMU assist address translation, so lower CPU consumption;
2. Direct virtual memory access, more efficiency.

Overhead:
The creation of a TEVAT page table can cost 0.1 second on my desktop.

Limitation:
just targeting KVM and 32bit nopae paging mode, need further development.

Signed-off-by: Guanglin Xu