Skip to contentSkip to conversation

Converting host virtual addresses to guest physical

Qemu-devel Padmanabhan S N 2 participants 2 messages Sep 7, 2017 – Sep 12, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

I'm developing a new block backend driver. Since my Guest RAM is coming out of shared memory (memory-backend-file,mem-path=/dev/shmem/foo), while performing the IO I would like to pass QEMUIOVector buffers directly to another user-space process running on the same host to enable zerocopy. Can someone help me understand the different memory regions that are mapped in the qemu process address space and how they map to each other ?
1. My guest is configured with 1G RAM. /proc/<pid>/maps on the qemu process shows two 1G regions that are mapped. One of them is /dev/shmem/foo, which I believe corresponds to the guest physical memory. What is the other 1G region ?
2. The QEMUIOVector buffers point to this 'other' 1G region that I referred above. How do I convert these pointers to locations in the /dev/shmem/foo region ? My plan is to convert the QEMUIOVector buffer pointer to a region in /dev/shmem/foo and pass that pointer to another userspace process that also has the /dev/shmem/foo region mapped.
I understand vhost-user might be the right way to approach this problem. However I'm currently working with qemu-2.8 and it looks neither vhost-user-scsi nor vhost-user-blk are available in that version. If you believe there is a better approach to solve this problem, let me know.

Thanks,Paddy.

#2 lore raw
Quoted 3 lines · Padmanabhan S N via Qemu-devel

I'm developing a new block backend driver. Since my Guest RAM is coming out of shared memory (memory-backend-file,mem-path=/dev/shmem/foo), while performing the IO I would like to pass QEMUIOVector buffers directly to another user-space process running on the same host to enable zerocopy. Can someone help me understand the different memory regions that are mapped in the qemu process address space and how they map to each other ?
1. My guest is configured with 1G RAM. /proc/<pid>/maps on the qemu process shows two 1G regions that are mapped. One of them is /dev/shmem/foo, which I believe corresponds to the guest physical memory. What is the other 1G region ?
2. The QEMUIOVector buffers point to this 'other' 1G region that I referred above. How do I convert these pointers to locations in the /dev/shmem/foo region ? My plan is to convert the QEMUIOVector buffer pointer to a region in /dev/shmem/foo and pass that pointer to another userspace process that also has the /dev/shmem/foo region mapped.

Please post the full QEMU command-line and /proc/<pid>/maps.

Quoted 1 line

I understand vhost-user might be the right way to approach this problem. However I'm currently working with qemu-2.8 and it looks neither vhost-user-scsi nor vhost-user-blk are available in that version. If you believe there is a better approach to solve this problem, let me know.

Are you sure that QEMU 2.8 will still be relevant by the time your block driver is production-ready?

Stefan