All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <mlureau@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: marcandre lureau <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 24/37] pc: keep gsi reference
Date: Thu, 21 Jul 2016 14:28:33 -0400 (EDT)	[thread overview]
Message-ID: <1575824847.7153299.1469125713237.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160721180714.GM3337@thinpad.lan.raisama.net>

Hi

----- Original Message -----
> On Thu, Jul 21, 2016 at 01:27:35PM -0400, Marc-André Lureau wrote:
> > Hi
> > 
> > ----- Original Message -----
> > > On Tue, Jul 19, 2016 at 12:54:19PM +0400, marcandre.lureau@redhat.com
> > > wrote:
> > > > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > > 
> > > > Further cleanup would need to call qemu_free_irq() at the appropriate
> > > > time, but for now this silences ASAN about direct leaks.
> > > > 
> > > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > 
> > > Is there a way to make ASAN happy without having to add a field
> > > to MachineState that we're not going to use for anything?
> > 
> > Well, the plan is rather to release it when no longer needed.
> > Would it be fine to call qemu_free_irqs() in
> > machine_finalize()?
> 
> It would be fine, I guess, but it looks pointless if we have lots
> of other resources allocated during PC machine initialization
> that are never released.

The main point, right now, is to have no direct leaks when running ASAN or valgrind, as they hide new introduced leaks that may be much worse. (it would also be good if we had no indirect leaks either, as this may also grow over time)

> But, see additional comment below:
> 
> > 
> > > 
> > > > ---
> > > >  hw/i386/pc_piix.c   | 1 +
> > > >  hw/i386/pc_q35.c    | 1 +
> > > >  include/hw/boards.h | 1 +
> > > >  3 files changed, 3 insertions(+)
> > > > 
> > > > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> > > > index a07dc81..b2db274 100644
> > > > --- a/hw/i386/pc_piix.c
> > > > +++ b/hw/i386/pc_piix.c
> > > > @@ -190,6 +190,7 @@ static void pc_init1(MachineState *machine,
> > > >      } else {
> > > >          gsi = qemu_allocate_irqs(gsi_handler, gsi_state,
> > > >          GSI_NUM_PINS);
> > > >      }
> > > > +    machine->gsi = gsi;
> > > >  
> > > >      if (pcmc->pci_enabled) {
> > > >          pci_bus = i440fx_init(host_type,
> > > > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> > > > index c5e8367..5dfb14f 100644
> > > > --- a/hw/i386/pc_q35.c
> > > > +++ b/hw/i386/pc_q35.c
> > > > @@ -158,6 +158,7 @@ static void pc_q35_init(MachineState *machine)
> > > >      } else {
> > > >          gsi = qemu_allocate_irqs(gsi_handler, gsi_state,
> > > >          GSI_NUM_PINS);
> > > >      }
> > > > +    machine->gsi = gsi;
> > > >  
> > > >      /* create pci host bus */
> > > >      q35_host = Q35_HOST_DEVICE(qdev_create(NULL,
> > > >      TYPE_Q35_HOST_DEVICE));
> > > > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > > > index e46a744..289ba52 100644
> > > > --- a/include/hw/boards.h
> > > > +++ b/include/hw/boards.h
> > > > @@ -139,6 +139,7 @@ struct MachineState {
> > > >      /*< private >*/
> > > >      Object parent_obj;
> > > >      Notifier sysbus_notifier;
> > > > +    qemu_irq *gsi;
> 
> If this is used only by PC, doesn't it belong to PCMachineState?

right, i'll try to put it there

> Anyway, the new field would be very useful to help reduce the
> number of parameters of PC initialization functions (by making
> them just get a PCMachineState* argument). I would go even

Which functions do you have in mind?

> further and remove the local 'gsi' variable and replace it with
> 'pcms->gsi' everywhere.

ok, why not.

  reply	other threads:[~2016-07-21 18:28 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19  8:53 [Qemu-devel] [PATCH 00/37] Various memory leak fixes marcandre.lureau
2016-07-19  8:53 ` [Qemu-devel] [PATCH 01/37] build-sys: use an override for CFLAGS filter marcandre.lureau
2016-07-19  8:53 ` [Qemu-devel] [PATCH 02/37] tests: fix test-qga leaks marcandre.lureau
2016-07-19 18:40   ` Eric Blake
2016-07-19  8:53 ` [Qemu-devel] [PATCH 03/37] qga: free the whole blacklist marcandre.lureau
2016-07-19 18:22   ` Eric Blake
2016-07-19  8:53 ` [Qemu-devel] [PATCH 04/37] qga: free remaining leaking state marcandre.lureau
2016-07-19 18:39   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 05/37] tests: fix test-cutils leaks marcandre.lureau
2016-07-19 18:40   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 06/37] tests: fix test-vmstate leaks marcandre.lureau
2016-07-19 18:41   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 07/37] tests: fix test-iov leaks marcandre.lureau
2016-07-19 20:46   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 08/37] qdist: fix entries memory leak marcandre.lureau
2016-07-19 20:54   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 09/37] tests: fix check-qom-interface leaks marcandre.lureau
2016-07-19 20:55   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 10/37] tests: fix check-qom-proplist leaks marcandre.lureau
2016-07-19 21:01   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-command marcandre.lureau
2016-07-19 21:04   ` Eric Blake
2016-07-19 21:16     ` Marc-André Lureau
2016-07-21 10:39       ` Marc-André Lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 12/37] tests: fix leak in test-string-input-visitor marcandre.lureau
2016-07-19 23:37   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 13/37] portio: keep references on portio marcandre.lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 14/37] numa: do not leak NumaOptions marcandre.lureau
2016-07-19 23:39   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 15/37] pc: simplify passing qemu_irq marcandre.lureau
2016-07-19 23:40   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 16/37] pc: don't leak a20_line marcandre.lureau
2016-07-19 23:40   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 17/37] machine: use class base init generated name marcandre.lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 18/37] acpi-build: fix array leak marcandre.lureau
2016-07-21 14:52   ` Marcel Apfelbaum
2016-07-21 15:48     ` Marc-André Lureau
2016-07-21 15:51       ` Marcel Apfelbaum
2016-07-21 16:47         ` Marcel Apfelbaum
2016-07-19  8:54 ` [Qemu-devel] [PATCH 19/37] char: disconnect peer when qemu_chr_free() marcandre.lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 20/37] char: free MuxDriver when closing marcandre.lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 21/37] tests: fix qom-test leaks marcandre.lureau
2016-07-19 23:50   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 22/37] pc: free i8259 marcandre.lureau
2016-07-28 11:47   ` Marcel Apfelbaum
2016-07-19  8:54 ` [Qemu-devel] [PATCH 23/37] pci-bus: do not allocate and leak bsel marcandre.lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 24/37] pc: keep gsi reference marcandre.lureau
2016-07-21 17:18   ` Eduardo Habkost
2016-07-21 17:27     ` Marc-André Lureau
2016-07-21 18:07       ` Eduardo Habkost
2016-07-21 18:28         ` Marc-André Lureau [this message]
2016-07-21 19:44           ` Eduardo Habkost
2016-07-19  8:54 ` [Qemu-devel] [PATCH 25/37] ahci: free irqs array marcandre.lureau
2016-07-19 18:50   ` John Snow
2016-07-19  8:54 ` [Qemu-devel] [PATCH 26/37] sd: free timer marcandre.lureau
     [not found]   ` <CAJ+F1CLiqgK_eOM2S3u8Vc4TR-Mi9DPW-LG3PdbgT9-5b49FGg@mail.gmail.com>
2016-07-21 16:53     ` Andrew Baumann
2016-07-21 17:17       ` Marc-André Lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 27/37] qjson: free str marcandre.lureau
2016-07-20 12:25   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 28/37] virtio-input: free config list marcandre.lureau
2016-07-22  7:58   ` Gerd Hoffmann
2016-07-22  8:20     ` Marc-André Lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 29/37] ipmi: free extern timer marcandre.lureau
2016-07-21 13:05   ` Corey Minyard
2016-07-21 13:10     ` Marc-André Lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 30/37] usb: free USBDevice.strings marcandre.lureau
2016-07-22  7:59   ` Gerd Hoffmann
2016-07-19  8:54 ` [Qemu-devel] [PATCH 31/37] tests: free a bunch of qmp responses marcandre.lureau
2016-07-20 13:16   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 32/37] usb: free leaking path marcandre.lureau
2016-07-22  8:00   ` Gerd Hoffmann
2016-07-19  8:54 ` [Qemu-devel] [PATCH 33/37] bus: simplify name handling marcandre.lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 34/37] tests: pc-cpu-test marcandre.lureau
2016-07-19  9:04   ` Marc-André Lureau
2016-07-19  8:54 ` [Qemu-devel] [PATCH 35/37] tests: fix rsp leak in postcopy-test marcandre.lureau
2016-07-20 13:48   ` Eric Blake
2016-07-19  8:54 ` [Qemu-devel] [PATCH 36/37] ahci: fix sglist leak on retry marcandre.lureau
2016-07-19 20:45   ` John Snow
2016-07-19  8:54 ` [Qemu-devel] [PATCH 37/37] tests: fix postcopy-test leaks marcandre.lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1575824847.7153299.1469125713237.JavaMail.zimbra@redhat.com \
    --to=mlureau@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.