Skip to contentSkip to conversation

When to emulate writing page table page and when to do_update_va_mapping()?

DISCUSSION Tom Creck 2 participants 2 messages Jul 3, 2008

lore
Share & tools
lore

Tom Creck

author
#0 lore raw

Hello, everyone:

I know that x86_emulate_memop() is used to emulate writing to page
table pages as Xen intentionally write protect page table pages.

         Also, the hypercall Hypervisor_update_va_mapping() ->

mod_l2/l1_entry() is also used to modify page table pages.

So I get confused about their difference. My questions are:

(1) When are the above two routines of modifying page table pages
invoked respectively?

(2) What's the difference in functionality among the two?

Best Wishes

Tom

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 11 lines · Tom Creck

Hello, everyone:

I know that x86_emulate_memop() is used to emulate writing to
page table pages as Xen intentionally write protect page table pages.

         Also, the hypercall Hypervisor_update_va_mapping() -> 

mod_l2/l1_entry() is also used to modify page table pages.

Quoted 8 lines

So I get confused about their difference. My questions are:

(1) When are the above two routines of modifying page table pages invoked respectively?

(2) What’s the difference in functionality among the two?

Writing directly to pagetables is a good idea if you think it's likely that the pagetable is unpinned. That is, when it's still just an ordinary RW page while the pagetable is under construction (fork/exec) or destruction (exit). In this case, a simple memory-write is much more efficient than doing a hypercall.

On the other hand, if you're likely to be updating an active pinned pagetable, a hypercall is more efficient than trapping and emulating a write (especially if you can batch multiple updates together with a multicall).

J