From: Cam Macdonell Subject: Re: IVSHMEM and limits on shared memory Date: Wed, 3 Mar 2010 21:52:05 -0700 Message-ID: <8286e4ee1003032052y50b4f5c6y292d796e0e31e670@mail.gmail.com> References: <8286e4ee1003011017y7727e3fcp52a1a47e483285e1@mail.gmail.com> <1267467562-23539-1-git-send-email-cam@cs.ualberta.ca> <8286e4ee1003031409q2a097931nbcb6096caa7671e6@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Khaled Ibrahim Return-path: Received: from mail-iw0-f175.google.com ([209.85.223.175]:47457 "EHLO mail-iw0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752231Ab0CDE7b convert rfc822-to-8bit (ORCPT ); Wed, 3 Mar 2010 23:59:31 -0500 Received: by iwn5 with SMTP id 5so1831873iwn.1 for ; Wed, 03 Mar 2010 20:59:30 -0800 (PST) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 3, 2010 at 3:38 PM, Khaled Ibrahim wrot= e: > > > > ---------------------------------------- >> Date: Wed, 3 Mar 2010 15:09:17 -0700 >> Subject: Re: IVSHMEM and limits on shared memory >> From: cam@cs.ualberta.ca >> To: kzm98@hotmail.com >> CC: kvm@vger.kernel.org >> >> On Wed, Mar 3, 2010 at 12:06 AM, Khaled Ibrahim =A0wrote: >>> >>> Hi Cam, >>> >>> I used your patches successfully to support shared memory on KVM an= d >>> used the test cases successfully, but qemu-kvm crashes when I incre= ased the >>> size of the shared memory. =A0I >>> applied the ivshmem patch to qemu-kvm-0.12.3 (some manual patching = was >>> needed). =A0It worked flawlessly for >>> up to 128MB of shared memory on my system. I am running on a machin= e with 64GB >>> memory running opensuse (kernel 2.6.27) on AMD opteron. >>> >>> Qemu crashes =A0with >>> smp=3D4 and the shared memory requested in 256MB, (512MB with smp=3D= 1), even though >>> the shared memory file is created. I debugged the problem and it se= ems that >>> some memory corruptions happens. >> >> Can you please provide the full command-line for the smp=3D1 instanc= e? > > qemu-system-x86_64 ./qemudisk0.raw \=A0=A0 =A0 =A0 =A0 =A0-net nic,mo= del=3Drtl8139,macaddr=3D52:54:00:12:34:50\=A0=A0 =A0 =A0 =A0 =A0-net ta= p,ifname=3Dtap0,script=3Dno,downscript=3Dno \=A0=A0 =A0 =A0 =A0 =A0-m 4= 096 \ =A0 =A0 =A0=A0=A0-ivshmem 512,kvmshmem\=A0=A0 =A0 =A0 =A0 =A0-smp= 1 \=A0=A0 =A0 =A0 =A0 =A0-usb \=A0=A0 =A0 =A0 =A0 =A0-usbdevice tablet= \=A0=A0 =A0 =A0 =A0 =A0-localtime > > >> >>> >>> It crashes in the subpage_register for rtl8139 pci driver!, >>> tracked back to rtl8139_mmio_map. The problem starts with corrupted= value in >>> the config field in the struct for the rtl8139 driver. At offset 20= of this >>> field the address should indicate that the address is uninitialized= at that >>> time of crash, but surprisingly the value changes over the course o= f execution >>> and gets the SIZE of the shared memory allocated (related to ivshme= m). I failed >>> to identify what changes/corrupts that field. I tried some padding = for >>> allocation but the field always gets updated with the size of the s= hared memory >>> in a very consistent way. Good debugging. I've been able to reproduce your error when applying my patch to qemu-kvm-0.12.3 and can trace the error to the subpage_register. Curiously, this bug does not occur with the latest version from the git repo. I've tested up to 1 GB without problem. So I'm not sure if it's an error in my patch or elsewhere in the memory management that has since been fixed. As a test, I removed anywhere my patch stored the size of the shared memory region and hard coded the size of 512 MB into qemu_ram_alloc and pci_register_bar, so that my patch never writes the size of the memory region anywhere. And I discovered that the value of 512MB still shows up at the offset you mention, so it seems something else is storing that value in the wrong location and corrupting memory. Can you try using the version from the git repo and see if the error re= curs? Cam >>> >> >> As far as you know does anything in the guest trigger the corruption= ? >> Does the corruption happen immediately or after running some of the >> test programs? > > The boot process does not complete, and it fails before it reach grub= =2E > _________________________________________________________________ > Hotmail: Trusted email with Microsoft=92s powerful SPAM protection. > http://clk.atdmt.com/GBL/go/201469226/direct/01/ > >