From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDZZH-0005lU-14 for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDZZE-0006bb-Mt for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:28:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDZZE-0006bU-CV for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:28:12 -0400 Date: Tue, 11 Oct 2011 12:28:09 +0200 From: Gleb Natapov Message-ID: <20111011102809.GW30105@redhat.com> References: <4E933F2D.7090703@codemonkey.ws> <20111011082315.GI14627@redhat.com> <4E940919.7010901@redhat.com> <5C80782F-C30A-4F35-93FD-0397A1040AFF@suse.de> <4E940BB6.2000400@redhat.com> <050FFBD4-BF45-4425-865B-24E7C228B592@suse.de> <4E94111C.403@redhat.com> <20111011095636.GV30105@redhat.com> <4E941391.3050006@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E941391.3050006@redhat.com> Subject: Re: [Qemu-devel] Slow kernel/initrd loading via fw_cfg; Was Re: Hack integrating SeaBios / LinuxBoot option rom with QEMU trace backends List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: "Richard W.M. Jones" , Alexander Graf , qemu-devel On Tue, Oct 11, 2011 at 11:59:45AM +0200, Avi Kivity wrote: > On 10/11/2011 11:56 AM, Gleb Natapov wrote: > >On Tue, Oct 11, 2011 at 11:49:16AM +0200, Avi Kivity wrote: > >> >Whatever we do, the interface will never be as fast as DMA. We will always have to do sanity / permission checks for every IO operation, can batch up only so many IO requests and in QEMU again have to call our callbacks in a loop. > >> > >> We can batch per page, which makes the overhead negligible. > >> > >Current code batch userspace exit per 1024 bytes IIRC and changing it to > >page didn't show significant improvement (also IIRC). But after io data > >is copied into the kernel emulator process it byte by byte. Possible > >optimization, which I didn't tried, is to check that destination memory is > >not mmio and write back the whole buffer if it is the case. > > > > All the permission checks, segment checks, > register_address_increment, page table walking, can be done per > page. Right now they are done per byte. > Permission checking result is cached in ctxt->perm_ok. I see that current code check it after several function calls, but this was not the case before. All others are done for each iteration currently. By writing back a whole buffer at once we eliminate others too. Interesting how much it will improve the situation. > btw Intel also made this optimization, current processors copy > complete cache lines instead of bytes, so they probably also do the > checks just once. > > -- > error compiling committee.c: too many arguments to function -- Gleb.