From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhM1C-0007HY-V4 for qemu-devel@nongnu.org; Mon, 05 May 2014 12:45:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhM15-0000It-1V for qemu-devel@nongnu.org; Mon, 05 May 2014 12:45:30 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42783 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhM14-0000Ih-MZ for qemu-devel@nongnu.org; Mon, 05 May 2014 12:45:22 -0400 Message-ID: <5367C020.4000309@suse.de> Date: Mon, 05 May 2014 18:45:20 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1398778719-2198-1-git-send-email-batuzovk@ispras.ru> In-Reply-To: <1398778719-2198-1-git-send-email-batuzovk@ispras.ru> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3] PortioList: Store PortioList in device state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kirill Batuzov , qemu-devel@nongnu.org Cc: Paolo Bonzini , Jan Kiszka , =?ISO-8859-15?Q?Herv=E9_Poussineau?= Am 29.04.2014 15:38, schrieb Kirill Batuzov: > PortioList is an abstraction used for construction of MemoryRegionPorti= oList > from MemoryRegionPortio. It can be used later to unmap created memory r= egions. > It also requires proper cleanup because some of the memory inside is al= located > dynamically. >=20 > By moving PortioList ot device state we make it possible to cleanup lat= er and > avoid leaking memory. >=20 > This change spans several target platforms. The following testcases co= ver all > changed lines: > qemu-system-ppc -M prep > qemu-system-i386 -vga qxl > qemu-system-i386 -M isapc -soundhw adlib -device ib700,id=3Dwatchdog0= ,bus=3Disa.0 >=20 > Signed-off-by: Kirill Batuzov > --- > hw/audio/adlib.c | 6 +++--- > hw/display/qxl.c | 7 +++---- > hw/display/qxl.h | 1 + > hw/display/vga.c | 12 +++++------- > hw/display/vga_int.h | 2 ++ > hw/dma/i82374.c | 7 ++++--- > hw/isa/isa-bus.c | 11 ++++++++--- > hw/ppc/prep.c | 7 ++++--- > hw/watchdog/wdt_ib700.c | 7 ++++--- > 9 files changed, 34 insertions(+), 26 deletions(-) >=20 > I'm sending this as a separate patch. With 2 of 4 patches already appli= ed and > two remaining patches addressing absolutely different issues in differe= nt > parts of code it was no longer reasonable to submit them as series. >=20 > v1 -> v2: > - Add PortioList to device state structures. > - Put a workaround for isa_regiter_portio_list for which the above sol= ution > was not appilcable. >=20 > v2 -> v3: > - Revert workaround for isa_register_portio_list. The amount of memory= leaked > is not large enough to justify potentially broken code. Seeing no objections from Jan or Herv=E9 and an Rb from Paolo, I'll pick up this cross-devices patch for qom-next. > diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c > index e243651..bc00ccf 100644 > --- a/hw/ppc/prep.c > +++ b/hw/ppc/prep.c > @@ -361,6 +361,8 @@ static const MemoryRegionPortio prep_portio_list[] = =3D { > PORTIO_END_OF_LIST(), > }; > =20 > +PortioList prep_port_list; I've made this variable static. https://github.com/afaerber/qemu-cpu/commits/qom-next Thanks, Andreas > + > /* PowerPC PREP hardware initialisation */ > static void ppc_prep_init(QEMUMachineInitArgs *args) > { > @@ -375,7 +377,6 @@ static void ppc_prep_init(QEMUMachineInitArgs *args= ) > CPUPPCState *env =3D NULL; > nvram_t nvram; > M48t59State *m48t59; > - PortioList *port_list =3D g_new(PortioList, 1); > #if 0 > MemoryRegion *xcsr =3D g_new(MemoryRegion, 1); > #endif > @@ -542,8 +543,8 @@ static void ppc_prep_init(QEMUMachineInitArgs *args= ) > cpu =3D POWERPC_CPU(first_cpu); > sysctrl->reset_irq =3D cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; > =20 > - portio_list_init(port_list, NULL, prep_portio_list, sysctrl, "prep= "); > - portio_list_add(port_list, isa_address_space_io(isa), 0x0); > + portio_list_init(&prep_port_list, NULL, prep_portio_list, sysctrl,= "prep"); > + portio_list_add(&prep_port_list, isa_address_space_io(isa), 0x0); > =20 > /* PowerPC control and status register group */ > #if 0 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg