From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NjcO9-0001B1-RF for qemu-devel@nongnu.org; Mon, 22 Feb 2010 12:48:09 -0500 Received: from [199.232.76.173] (port=51096 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NjcO9-0001Ap-Cz for qemu-devel@nongnu.org; Mon, 22 Feb 2010 12:48:09 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NjcO7-0003xc-TJ for qemu-devel@nongnu.org; Mon, 22 Feb 2010 12:48:09 -0500 Received: from bhuna.collabora.co.uk ([93.93.128.226]:34679) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NjcO7-0003xG-BY for qemu-devel@nongnu.org; Mon, 22 Feb 2010 12:48:07 -0500 Message-ID: <4B82C325.5020300@collabora.co.uk> Date: Mon, 22 Feb 2010 17:47:17 +0000 From: Ian Molton MIME-Version: 1.0 Subject: Re: [Qemu-devel] Address translation - virt->phys->ram References: <4B828DC2.3000609@collabora.co.uk> <4B829645.5020904@codemonkey.ws> <4B82B4E3.2040805@collabora.co.uk> <4B82B655.2000408@codemonkey.ws> In-Reply-To: <4B82B655.2000408@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Anthony Liguori wrote: > On 02/22/2010 10:46 AM, Ian Molton wrote: >> Anthony Liguori wrote: >> >> >>> cpu_physical_memory_map(). >>> >>> But this function has some subtle characteristics. It may return a >>> bounce buffer if you attempt to map MMIO memory. There is a limited >>> pool of bounce buffers available so it may return NULL in the event that >>> it cannot allocate a bounce buffer. >>> >>> It may also return a partial result if you're attempting to map a region >>> that straddles multiple memory slots. >>> >> Thanks. I had found this, but was unsure as to wether it was quite what >> I wanted. (also is it possible to tell when it has (eg.) allocated a >> bounce buffer?) >> >> Basically, I need to get buffer(s) from guest userspace into the hosts >> address space. The buffers are virtually contiguous but likely >> physically discontiguous. They are allocated with malloc() and theres >> nothing I can do about that. >> >> The obvious but slow solution would be to copy all the buffers into nice >> virtio-based scatter/gather buffers and feed them to the host that way, >> however its not fast enough. >> > > Why is this slow? Because the buffers will all have to be copied. So far, switching from abusing an instruction to interrupt qemu to using virtio has incurred a roughly 5x slowdown. I'd guess much of this is down to the fact we have to switch to kernel-mode on the guest and back again for every single GL call... If I can establish some kind of stable guest_virt->phys->host_virt mapping, many of the problems will just 'go away'. a way to interrupt qemu from user-mode on the guest without involving the guest kernel would be quite awesome also (theres really nothing we want the kernel to actually /do/ here, it just adds overhead). -Ian