Received: from eggs.gnu.org ([140.186.70.92]:45202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnot8-00020E-B6 for qemu-devel@nongnu.org; Thu, 19 Jan 2012 05:06:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rnosx-0002Vi-8Q for qemu-devel@nongnu.org; Thu, 19 Jan 2012 05:06:34 -0500 Received: from indium.canonical.com ([91.189.90.7]:49005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnosw-0002VY-TP for qemu-devel@nongnu.org; Thu, 19 Jan 2012 05:06:23 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Rnosw-0001u6-5f for ; Thu, 19 Jan 2012 10:06:22 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 20F572E81A3 for ; Thu, 19 Jan 2012 10:06:22 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Thu, 19 Jan 2012 09:59:32 -0000 From: Deepak Shetty <648356@bugs.launchpad.net> Sender: bounces@canonical.com References: <20100926200911.20945.84209.malonedeb@palladium.canonical.com> Message-Id: <20120119095932.24006.28472.malone@wampee.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 648356] Re: VirtFS possible memory leak in 9p virtio mapped Reply-To: Bug 648356 <648356@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 1) Host memory consumption is not the right measure to conclude on VM mem leaks, esp. because QEMU does a mmap for the VM memory so as pages are touched inside the guest, host will allocate and this will be seen as increase in QEMU RSS size, as long as we don't get OOM, it should not be considered as mem leak. 2) Since the time this bug was reported and now, there are loads of mem le= aks fixes in kernel's 9p client code (fs/9p) and qemu 9p server code... = 3)In a while true kind of script, when one would do a Ctrl-C, it could pote= ntially cut-off the umount operation in between, causing kmemleak to show false positives. 4) We ran the modified version of the submiited script ( instead of while true, ran it for a defined number of iterations) and then invoked kmemleak and did not find anything reported which relates to 9p. See the log below... [] __kmalloc+0xf7/0x122 [] pci_acpi_scan_root+0x10f/0x2c6 [] acpi_pci_root_add+0x1d5/0x41f [] acpi_device_probe+0x49/0x117 [] driver_probe_device+0xa5/0x135 [] __driver_attach+0x59/0x7c [] bus_for_each_dev+0x57/0x83 [] driver_attach+0x19/0x1b [] bus_add_driver+0xab/0x201 [] driver_register+0x93/0x100 [] acpi_bus_register_driver+0x3e/0x40 [] acpi_pci_root_init+0x20/0x28 [] do_one_initcall+0x7a/0x130 [] kernel_init+0x9a/0x114 [] kernel_thread_helper+0x4/0x10 unreferenced object 0xffff88001faf06e0 (size 16): comm "swapper/0", pid 1, jiffies 4294667775 (age 135.226s) hex dump (first 16 bytes): 50 43 49 20 42 75 73 20 30 30 30 30 3a 30 30 00 PCI Bus 0000:00. backtrace: [] kmemleak_alloc+0x21/0x3e [] __kmalloc+0xf7/0x122 [] kvasprintf+0x45/0x6e [] kasprintf+0x38/0x3a [] pci_acpi_scan_root+0x135/0x2c6 [] acpi_pci_root_add+0x1d5/0x41f [] acpi_device_probe+0x49/0x117 [] driver_probe_device+0xa5/0x135 [] __driver_attach+0x59/0x7c [] bus_for_each_dev+0x57/0x83 [] driver_attach+0x19/0x1b [] bus_add_driver+0xab/0x201 [] dri 5) Lastly we also ran the exact same script (while true... ) for a long duration ( few days) on 9p exported path and did not find any OOM So this makes me believe that there aren't any mem leaks in the 9p virtio m= apped flow. This bug can be closed. ** Changed in: qemu Status: New =3D> Invalid -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/648356 Title: VirtFS possible memory leak in 9p virtio mapped Status in QEMU: Invalid Bug description: I use as client Debian squeeze i386 with a custom kernel: Linux (none) 2.6.35.5 #3 Thu Sep 23 18:36:02 UTC 2010 i686 GNU/Linux And as host Debian squeeze amd64 Linux asd 2.6.32-5-amd64 #1 SMP Fri Sep 17 21:50:19 UTC 2010 x86_64 GNU/L= inux kvm version is: kvm-88-5908-gdd67374 Started the client using: sudo /usr/local/kvm/bin/qemu-system-x86_64 -m 1024 -kernel linux-2.6.35.5= .qemu -drive file=3Droot.img,if=3Dvirtio -net nic,macaddr=3D02:ca:ff:ee:ba:= be,model=3Dvirtio,vlan=3D1 -net tap,ifname=3Dtap1,vlan=3D1,script=3Dno -vir= tfs local,path=3D/host,security_model=3Dmapped,mount_tag=3Dhost -nographic I've done following inside the guest: $ mount -t 9p -o trans=3Dvirtio host /mnt $ rm -f /mnt/test $ touch /mnt/test $ ls -l /mnt/test $ while true ;do ls -l /mnt/test > /dev/null; done Now I can see on my host system that the memory consumption starts at 90MB and after a minute it raises to 130MB. The extra memory consumption stops when I stop the while-loop. $ while true ;do ls -l /tmp > /dev/null; done Doesn't show that behaviour. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/648356/+subscriptions