From mboxrd@z Thu Jan 1 00:00:00 1970 From: Abhinav Srivastava Subject: device-mmio emulation in Xen Date: Tue, 5 Jan 2010 21:02:37 +0530 (IST) Message-ID: <440319.77833.qm@web7907.mail.in.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi there,=0A=0AI am trying to understand how does Xen handle device MMIO. M= ore specifically, I am looking at the network behavior, however my understa= nding is that other devices such as disk will use the same logic.=0A=0AI no= ticed that during a network copy operation Xen page faults a lot and contro= l goes to sh_page_fault function. When I printed some debugging info, it sh= owed me gmfn =3D -1. Then the execution goes through the regular path of th= e page fault handler code, which means it creates an entry using shadow_get= _and_create_l1e, propagates it using l1e_propagate_from_guest, and finally = updates the entry using shadow_set_l1e. It finally goes into the device-mod= el mmio condition. In this condition, it extracts a guest physical address = and calls "goto mmio", which in turn calls handle_mmio function that emulat= es the instruction.=0A=0AHowever with the gmfn =3D -1 condition, the execut= ion sometimes directly goto=0Ato handle_mmio function using the fast_fault_= path with going through the regular path. It seems like there are two possi= ble execution paths, and I did not understand which one is chosen when?=0A= =0AI have some questions related to this behavior:=0A=0A1. Why are there so= many faults duing network copy operation?=0A=0A2. What does gmfn =3D -1 si= gnify? Is it reserved for mmio addresses?=0A=0A3. How does Xen handle this = gmfn =3D -1? It seems like on the regular path=0Ait still creates, propagat= es, and updates entries for gmfn =3D -1. How does Xen handles this at the s= hadow page table level?=0A=0A4. What are these two code execution paths, an= d when does Xen decide which=0Apath to choose?=0A=0A5. Finally, is there an= yway these faults can be reduced?=0A=0AI would very appreciate any help in = this regard.=0A=0AThanks,=0AAbhinav=0A=0A=0A=0A The INTERNET now has a= personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/