From patchwork Mon Aug 27 03:50:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yin Olivia-R63875 X-Patchwork-Id: 180116 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A3CCE2C00E7 for ; Mon, 27 Aug 2012 13:50:52 +1000 (EST) Received: from localhost ([::1]:43365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5qLi-00027C-Dg for incoming@patchwork.ozlabs.org; Sun, 26 Aug 2012 23:50:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5qLY-00026P-3w for qemu-devel@nongnu.org; Sun, 26 Aug 2012 23:50:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5qLU-0000UN-Hd for qemu-devel@nongnu.org; Sun, 26 Aug 2012 23:50:40 -0400 Received: from tx2ehsobe002.messaging.microsoft.com ([65.55.88.12]:34568 helo=tx2outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5qLN-0000Tn-AO; Sun, 26 Aug 2012 23:50:29 -0400 Received: from mail79-tx2-R.bigfish.com (10.9.14.236) by TX2EHSOBE014.bigfish.com (10.9.40.34) with Microsoft SMTP Server id 14.1.225.23; Mon, 27 Aug 2012 03:50:27 +0000 Received: from mail79-tx2 (localhost [127.0.0.1]) by mail79-tx2-R.bigfish.com (Postfix) with ESMTP id 466B0440468; Mon, 27 Aug 2012 03:50:27 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: -7 X-BigFish: VS-7(zzbb2dI9371I542M1432Izz1202hzz8275bh8275dhz2dh2a8h668h839h8e2h8e3hd25hf0ah107ahbe9i) Received: from mail79-tx2 (localhost.localdomain [127.0.0.1]) by mail79-tx2 (MessageSwitch) id 1346039425308068_29860; Mon, 27 Aug 2012 03:50:25 +0000 (UTC) Received: from TX2EHSMHS015.bigfish.com (unknown [10.9.14.244]) by mail79-tx2.bigfish.com (Postfix) with ESMTP id 3D94580222; Mon, 27 Aug 2012 03:50:25 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS015.bigfish.com (10.9.99.115) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 27 Aug 2012 03:50:24 +0000 Received: from 039-SN1MPN1-004.039d.mgd.msft.net ([169.254.6.69]) by 039-SN1MMR1-001.039d.mgd.msft.net ([10.84.1.13]) with mapi id 14.02.0309.003; Sun, 26 Aug 2012 22:50:24 -0500 From: Yin Olivia-R63875 To: Dunrong Huang , =?iso-8859-1?Q?Andreas_F=E4rber?= Thread-Topic: [Qemu-devel] [PATCH v2] register reset handler to write image into memory Thread-Index: AQHNfFvaibKTlnqMik+/NeoeIYUfUZdnLjsQgABlW4CABXfcEA== Date: Mon, 27 Aug 2012 03:50:24 +0000 Message-ID: References: <1345194509-29203-1-git-send-email-hong-hua.yin@freescale.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.193.20.88] MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-detected-operating-system: by eggs.gnu.org: Windows XP/2000 (RFC1323+, w+, tstamp-) X-Received-From: 65.55.88.12 Cc: "aliguori@us.ibm.com" , "qemu-devel@nongnu.org" , "agraf@suse.de" , "weil@mail.berlios.de" , "qemu-ppc@nongnu.org" , "avi@redhat.com" Subject: Re: [Qemu-devel] [PATCH v2] register reset handler to write image into memory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Thanks to Dunrong and Andreas. $ scripts/get_maintainer.pl -f hw/loader.c Alexander Graf (commit_signer:3/6=50%) Anthony Liguori (commit_signer:2/6=33%) Stefan Weil (commit_signer:1/6=17%) Benjamin Herrenschmidt (commit_signer:1/6=17%) Avi Kivity (commit_signer:1/6=17%) Dear maintainers, Could you please help review this patch? So far I got feedback from Andreas and try to answer the question. > This patch does not answer the question why you try to avoid the ROM blobs > and what ROM blobs are still being used for after your patch. I don't > think it makes much sense to work around them for your use cases and to > leave them behind - if there's something fundamentally wrong with them > they should be ripped out completely or fixed. But maybe I'm misunderstanding > in the absence of explanations? It's a general problem. For example, in my case, there're 3 different files loaded from host rootfs. $ qemu-system-ppc -enable-kvm -m 256 -nographic -M mpc8544ds -kernel uImage.8572.agraf -initrd /media/ram/guest-8572.rootfs.ext2.gz -append "root=/dev/ram rw loglevel=7 console=ttyS0,115200" -serial tcp::4445,server -net nic (qemu) info roms addr=0000000000000000 size=0x782840 mem=ram name="uImage.8572.agraf" addr=0000000000c00000 size=0x010000 mem=ram name="mpc8544ds.dtb" addr=0000000002000000 size=0x3f922f mem=ram name="/media/ram/guest-8572.rootfs.ext2.gz" The problem is that rom_add_*() mallocs memory for the image, and then rom_reset() copies those images into the guest's memory, but the QEMU memory does not get freed. On a VM reset, the images get recopied from QEMU to guest. Comparing the memory map of qemu process before and after starting up guest, we can find that QEMU consumes much memory for those images. $ diff -urN pmap.pre.log pmap.post.log This patch changes all the image load process called by load_uimage() and load_image_targphys() in platform initialization. Best Regards, Olivia > -----Original Message----- > From: Dunrong Huang [mailto:riegamaths@gmail.com] > Sent: Thursday, August 23, 2012 6:44 PM > To: Yin Olivia-R63875 > Cc: qemu-ppc@nongnu.org; qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] [PATCH v2] register reset handler to write > image into memory > > 2012/8/23 Yin Olivia-R63875 : > > Dear All, > > > > I can't find MAINTAINER of hw/loader.c. > > Who can help review and apply this patch? > > > Please use the script scripts/get_maintainer.pl, like: > $ scripts/get_maintainer.pl your_patch_file.patch or > $ scripts/get_maintainer.pl -f hw/loader.c > > Best Regards, > > Olivia Yin > > > > > -- > Best Regards, > > Dunrong Huang --- pmap.pre.log +++ pmap.post.log @@ -33,7 +33,14 @@ 0ffee000 8K rwx-- /lib/ld-2.13.so 10000000 3472K r-x-- qemu-system-ppc 10374000 112K rwx-- qemu-system-ppc -10390000 6524K rwx-- [ anon ] +10390000 7100K rwx-- [ anon ] 48002000 16K rw--- [ anon ] +48006000 4K ----- [ anon ] +48007000 8188K rw--- [ anon ] +48806000 8K rw-s- [ anon ] +48808000 4K rw--- [ anon ] +48809000 262144K rw--- [ anon ] +58809000 5280K rw--- [ anon ] +5cb98000 7692K rw--- [ anon ] bf93e000 132K rw--- [ stack ] - total 14456K + total 298352K Exactly we can re-load them from disk on a reset instead of holding onto the images in QEMU's memory. With this patch, the two big images (uImage and especially initrd) will not be loaded into QEMU's memory (qemu) info roms addr=0000000000c00000 size=0x010000 mem=ram name="mpc8544ds.dtb" It will save much memory space according to memory map of QEMU process. # diff -urN pmap.pre.log pmap.post.log --- pmap.pre.log +++ pmap.post.log @@ -33,7 +33,14 @@ 0ffee000 8K rwx-- /lib/ld-2.13.so 10000000 3472K r-x-- qemu-system-ppc 10374000 112K rwx-- qemu-system-ppc -10390000 6524K rwx-- [ anon ] +10390000 7036K rwx-- [ anon ] 48002000 16K rw--- [ anon ] +48006000 4K ----- [ anon ] +48007000 8188K rw--- [ anon ] +48806000 8K rw-s- [ anon ] +48808000 4K rw--- [ anon ] +48809000 262144K rw--- [ anon ] +58809000 4K rw--- [ anon ] +58c04000 1204K rw--- [ anon ] bfb2a000 132K rw--- [ stack ] - total 14456K + total 286524K