Received: from eggs.gnu.org ([2001:4830:134:3::10]:35302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr6qr-00088L-4l for qemu-devel@nongnu.org; Tue, 27 Oct 2015 12:12:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zr6qm-00039r-WB for qemu-devel@nongnu.org; Tue, 27 Oct 2015 12:11:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr6qm-00039k-Rc for qemu-devel@nongnu.org; Tue, 27 Oct 2015 12:11:52 -0400 From: Markus Armbruster References: <56250035.40805@aimale.com> <87twpkqyow.fsf@blackfin.pond.sub.org> <20151022191203.GC3736@thinpad.lan.raisama.net> <56293F99.1060109@aimale.com> <20151022214719.GD3736@thinpad.lan.raisama.net> <56295A60.1040901@aimale.com> <20151023185504.GI3736@thinpad.lan.raisama.net> <562A85C9.6050309@aimale.com> <87ziz60zeg.fsf@blackfin.pond.sub.org> <562E64C0.1080509@aimale.com> <20151026175217.GC4180@thinpad.lan.raisama.net> <562F8796.4070503@aimale.com> <87wpu84arz.fsf@blackfin.pond.sub.org> <562F95C5.2020006@aimale.com> Date: Tue, 27 Oct 2015 17:11:49 +0100 In-Reply-To: <562F95C5.2020006@aimale.com> (Valerio Aimale's message of "Tue, 27 Oct 2015 09:18:29 -0600") Message-ID: <87si4w1ebe.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] QEMU patch to allow VM introspection via libvmi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Valerio Aimale Cc: qemu-devel@nongnu.org, Eduardo Habkost , lcapitulino@redhat.com Valerio Aimale writes: > On 10/27/15 9:00 AM, Markus Armbruster wrote: >> Valerio Aimale writes: >> >>> On 10/26/15 11:52 AM, Eduardo Habkost wrote: >>>> >>>> I was trying to advocate the use of a shared mmap'ed region. The sharing >>>> would be two-ways (RW for both) between the QEMU virtualizer and the libvmi >>>> process. I envision that there could be a QEMU command line argument, such >>>> as "--mmap-guest-memory " Understand that Eric feels strongly the >>>> libvmi client should own the file name - I have not forgotten that. When >>>> that command line argument is given, as part of the guest initialization, >>>> QEMU creates a file of size equal to the size of the guest memory containing >>>> all zeros, mmaps that file to the guest memory with PROT_READ|PROT_WRITE >>>> and MAP_FILE|MAP_SHARED, then starts the guest. >>>> This is basically what memory-backend-file (and the legacy -mem-path >>>> option) already does today, but it unlinks the file just after opening >>>> it. We can change it to accept a full filename and/or an option to make >>>> it not unlink the file after opening it. >>>> >>>> I don't remember if memory-backend-file is usable without -numa, but we >>>> could make it possible somehow. >>> Eduardo, I did try this approach. It takes 2 line changes in exec.c: >>> comment the unlink out, and making sure MAP_SHARED is used when >>> -mem-path and -mem-prealloc are given. It works beautifully, and >>> libvmi accesses are fast. However, the VM is slowed down to a crawl, >>> obviously, because each RAM access by the VM triggers a page fault on >>> the mmapped file. I don't think having a crawling VM is desirable, so >>> this approach goes out the door. >> Uh, I don't understand why "each RAM access by the VM triggers a page >> fault". Can you show us the patch you used? > Sorry, too brief of an explanation. Every time the guest flips a byte in > physical RAM, I think that triggers a page write to the mmaped file. My > understanding is that, with MAP_SHARED, each write to RAM triggers a > file write, hence the slowness. These are the simple changes I made, to > test it - as a proof of concept. Ah, that actually makes sense. Thanks! [...]