From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Re: When to emulate writing page table page and when to do_update_va_mapping()? Date: Wed, 02 Jul 2008 23:44:03 -0700 Message-ID: <486C7533.8010805@goop.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tom Creck Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Tom Creck wrote: > > Hello, everyone: > > =20 > > I know that x86_emulate_memop() is used to emulate writing to=20 > page table pages as Xen intentionally write protect page table pages. > > Also, the hypercall Hypervisor_update_va_mapping() ->=20 > mod_l2/l1_entry() is also used to modify page table pages. > > So I get confused about their difference. My questions are: > > =20 > > (1) When are the above two routines of modifying page table pages=20 > invoked respectively? > > (2) What=E2=80=99s the difference in functionality among the two? > Writing directly to pagetables is a good idea if you think it's likely=20 that the pagetable is unpinned. That is, when it's still just an=20 ordinary RW page while the pagetable is under construction (fork/exec)=20 or destruction (exit). In this case, a simple memory-write is much more=20 efficient than doing a hypercall. On the other hand, if you're likely to be updating an active pinned=20 pagetable, a hypercall is more efficient than trapping and emulating a=20 write (especially if you can batch multiple updates together with a=20 multicall). J