Skip to contentSkip to conversation

new hypercall implementation question

DISCUSSION Dan Magenheimer 2 participants 3 messages Jul 23, 2009

lore
Share & tools
lore
#0 lore raw

Is it safe to pass three guest virtual addresses via a hypercall to Xen and expect Xen to safely copy data (two scalars and one array of pagesize-bytes... not necessarily aligned on a page boundary) back to the guest, or do I need to do something fancy to avoid weird corner cases, e.g. to ensure restartabililty in case of guest page fault?

This is a privileged-only hypercall used only as part of save/restore/live-migrate (for tmem) if that is relevant.

Thanks,
Dan

#1 lore raw
Quoted 10 lines · Dan Magenheimer

Is it safe to pass three guest virtual addresses via a hypercall to Xen and expect Xen to safely copy data (two scalars and one array of pagesize-bytes... not necessarily aligned on a page boundary) back to the guest, or do I need to do something fancy to avoid weird corner cases, e.g. to ensure restartabililty in case of guest page fault?

This is a privileged-only hypercall used only as part of save/restore/live-migrate (for tmem) if that is relevant.

For x86 its OK to pass kernel vaddrs to Xen and have it interpret them with the current pagetable. There should be no pagefaults, or rather, the hypercall will fail with EFAULT.

I think ia64 has problems with anything other than physical addresses being passed, and has to do all that handle stuff to convert.

J

#2 lore raw
Quoted 12 lines · Dan Magenheimer
Quoted 10 lines

Is it safe to pass three guest virtual addresses via a hypercall to Xen and expect Xen to safely copy data (two scalars and one array of pagesize-bytes... not necessarily aligned on a page boundary) back to the guest, or do I need to do something fancy to avoid weird corner cases, e.g. to ensure restartabililty in case of guest page fault?

This is a privileged-only hypercall used only as part of save/restore/live-migrate (for tmem) if that is relevant.

Quoted 6 lines

For x86 its OK to pass kernel vaddrs to Xen and have it interpret them with the current pagetable. There should be no pagefaults, or rather, the hypercall will fail with EFAULT.

I think ia64 has problems with anything other than physical addresses being passed, and has to do all that handle stuff to convert.

Thanks for the reply. After sending, I remembered that the "proper" way to do this in Xen tools is to bracket the hypercall with lock_pages/unlock_pages for any vaddr passed to the hypercall. I hope that's not too horribly expensive.

Thanks,
Dan