From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38544 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqVUV-0005dR-H2 for qemu-devel@nongnu.org; Thu, 26 Jan 2012 15:00:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqVUR-00086m-AI for qemu-devel@nongnu.org; Thu, 26 Jan 2012 15:00:14 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:63585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqVUR-00086O-0e for qemu-devel@nongnu.org; Thu, 26 Jan 2012 15:00:11 -0500 Received: by pbdd2 with SMTP id d2so1213583pbd.4 for ; Thu, 26 Jan 2012 12:00:08 -0800 (PST) Message-ID: <4F21B0C4.5050503@codemonkey.ws> Date: Thu, 26 Jan 2012 14:00:04 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1327604460-31142-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 00/15] Refactor PC machine to take advantage of QOM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Maydell , Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, Avi Kivity , Paolo Bonzini On 01/26/2012 01:57 PM, Markus Armbruster wrote: > Peter Maydell writes: > >> On 26 January 2012 19:00, Anthony Liguori wrote: >>> We need to modeled MemoryRegions and qemu_irq in QOM too. >> >> +1 : this ought to let us get rid of SysBus... >> >>> MemoryRegions >>> shouldn't be that difficult. Our habit of passing qemu_irq's as arrays without >>> an explicit size will probably require some refactoring but in principle, >>> supporting irqs should be easy too. >> >> I think that there are probably a lot of cases where we're using an array >> of qemu_irqs now but should be using separately named signals of some sort >> instead (particularly where we're using them for things which aren't actually >> IRQs...) > > Apropos array of qemu_irq: we're leaking them in several places. > qemu_allocate_irqs() returns a pointer to an array of qemu_irq whose > elements to point into an array of *qemu_irq. Both arrays are malloced. > > Many callers ask for just one IRQ like this: > > *qemu_allocate_irqs(..., 1) > > This leaks the array of qemu_irq. > > There are other, less obvious leaks of the returned array. We leak lots of stuff... One nice thing in QOM is that we can create child devices that use the parent device's resources and tie the life cycles together. So whereas we were leaking all sorts of MemoryRegions and qdev devices before, with this series, we do it a whole lot less. Same principle will apply to IRQs. Regards, Anthony Liguori >