Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N97sh-0002dl-RY for qemu-devel@nongnu.org; Fri, 13 Nov 2009 20:56:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N97sg-0002dR-Ei for qemu-devel@nongnu.org; Fri, 13 Nov 2009 20:56:51 -0500 Received: from [199.232.76.173] (port=56626 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N97sg-0002dO-8n for qemu-devel@nongnu.org; Fri, 13 Nov 2009 20:56:50 -0500 Received: from hall.aurel32.net ([88.191.82.174]:47181) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N97sf-0004aj-Rl for qemu-devel@nongnu.org; Fri, 13 Nov 2009 20:56:50 -0500 Date: Sat, 14 Nov 2009 02:56:48 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH, RFC] mips: fix cpu_reset memory leak Message-ID: <20091114015648.GQ9052@hall.aurel32.net> References: <20091110153059.GA9052@hall.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20091110153059.GA9052@hall.aurel32.net> Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel On Tue, Nov 10, 2009 at 04:30:59PM +0100, Aurelien Jarno wrote: > On Sun, Nov 08, 2009 at 12:50:21PM +0200, Blue Swirl wrote: > > Both mmu_init() and mvp_init() allocate structures, so call cpu_mips_register > > only when creating a CPU. > > > > In addition, maybe some of the some of the field initialization stuff > > in cpu_mips_register, mmu_init, mvp_init, fpu_init etc. should be > > moved to cpu_reset instead, in case the fields should be reset to > > original values during CPU reset. Maximally only the env->mvp etc. > > structure allocation would be left to cpu_mips_register. This is the > > minimal version, but it may be incorrect. Comments? > > There is clearly a problem with some _init functions being called at > each reset. However, your solution does not reset all the registers upon > reset. osme of the registers are read-only (e.g. CP0_PRid) so it's not a > problem, but some other are read-write (e.g. CP0_Config2). It looks like > we need more code move to fix the problem. > I have just pushed a patch that should fix the problem. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net