Received: from eggs.gnu.org ([208.118.235.92]:50595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgiX1-0006mI-S5 for qemu-devel@nongnu.org; Mon, 18 Jun 2012 16:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgiWz-0007Cy-KM for qemu-devel@nongnu.org; Mon, 18 Jun 2012 16:26:39 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:45755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgiWz-0007Cl-99 for qemu-devel@nongnu.org; Mon, 18 Jun 2012 16:26:37 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <20120613031426.GA8174@cs.nctu.edu.tw> <20120614031826.GA88265@cs.nctu.edu.tw> <20120618082803.GA49309@cs.nctu.edu.tw> Date: Mon, 18 Jun 2012 23:26:28 +0300 In-Reply-To: (Blue Swirl's message of "Mon, 18 Jun 2012 19:36:36 +0000") Message-ID: <87wr34l62z.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] How to measure guest memory access (qemu_ld/qemu_st) time? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: laurent.desnogues@gmail.com, stefanha@gmail.com, qemu-devel@nongnu.org, =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Blue Swirl writes: > On Mon, Jun 18, 2012 at 8:28 AM, =E9=99=B3=E9=9F=8B=E4=BB=BB (Wei-Ren Che= n) > wrote: >>> =C2=A0 The reason why we want to do the measuring is we want to use KVM= (sounds crazy >>> idea) MMU virtualization to speedup the guest -> host memory address tr= anslation. >>> I talked to some people on LinuxCon Japan, included Paolo, about this i= dea. The >>> feedback I got is we can only use shadow page table rather than EPT/NPT= to do >>> the address translation (if possible!) since different ISA (ARM and x86= , for >>> example) have different page table format. Besides, QEMU has to use ioc= tl to ask >>> KVM to get the translation result, but it's an overkill as the ARM page= table >>> is quite simple, which can be done in user mode very fast. >>=20 >> =C2=A0Anyone would like to give a comment on this? ;) >>=20 >> =C2=A0From the talk with Laurent on #qemu, he said the way he thought of= is >> translating GVA -> GPA manually (through software), then try to insert >> GPA -> HPA into EPT, that's the only way HW can help. > For some 32 bit guests on some 64 bit hosts, maybe KVM could indeed > help. Just map the whole 4G guest virtual address space so that guest > memory accesses can be turned 1:1 into raw direct accesses. I/O pages > would be unmapped, accesses handled via fault path. But if QEMU/TCG is doing a GVA->GPA translation as Wei-Ren said, I don't se= e how KVM can help. I could understand having multiple 32bit regions in QEMU's virtual space (no need for KVM), one per guest page table, and then simply adding an offset to every memory access to redirect it to the appropriate 32-bit region (1 regi= on per guest page table). This could translate a single guest ld/st into a host ld+add+ld/st (the fir= st load is to get the "region" offset for the currently executing guest contex= t). With this, you can use 'mprotect' in QEMU to enforce the guest's page permissions (as long as the host supports it), and 'mmap' to share the host physical memory between the different 32-bit regions whenever the guest page tables share guest physical memory (again, as long as the host supports it). But I suppose having a guest with as many or more bits than the host is the common case, which hinders its applicability. Lluis --=20 "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth