qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Li Qiang <liq3ea@gmail.com>, pbonzini@redhat.com
Cc: Qemu Developers <qemu-devel@nongnu.org>, Li Qiang <liqiang6-s@360.cn>
Subject: Re: [Qemu-devel] [PATCH 1/2] ide: core: add cleanup function
Date: Tue, 14 Feb 2017 18:30:32 -0500	[thread overview]
Message-ID: <092e0dfc-7e59-ba5c-ab21-8f667635beaf@redhat.com> (raw)
In-Reply-To: <CAKXe6SJbYjUCphByCAtyVJiUfLk-XUSJQa3+BjbwsPFMOT5w6A@mail.gmail.com>



On 02/09/2017 08:22 PM, Li Qiang wrote:
> Hello John,
> 
> 2017-02-10 3:42 GMT+08:00 John Snow <jsnow@redhat.com
> <mailto:jsnow@redhat.com>>:
> 
> 
> 
>     On 02/09/2017 02:04 AM, Li Qiang wrote:
>     > As the pci ahci can be hotplug and unplug, in the ahci unrealize
>     > function it should free all the resource once allocated in the
>     > realized function. This patch adds two cleanup function.
>     >
>     > Signed-off-by: Li Qiang <liqiang6-s@360.cn <mailto:liqiang6-s@360.cn>>
>     > ---
>     >  hw/ide/core.c             | 21 +++++++++++++++++++++
>     >  include/hw/ide/internal.h |  2 ++
>     >  2 files changed, 23 insertions(+)
>     >
>     > diff --git a/hw/ide/core.c b/hw/ide/core.c
>     > index 43709e5..8fe5896 100644
>     > --- a/hw/ide/core.c
>     > +++ b/hw/ide/core.c
>     > @@ -2586,6 +2586,13 @@ void ide_register_restart_cb(IDEBus *bus)
>     >      }
>     >  }
>     >
>     > +void ide_unregister_restart_cb(IDEBus *bus)
>     > +{
>     > +    if (bus->dma->ops->restart_dma) {
>     > +        qemu_del_vm_change_state_handler(bus->vmstate);
>     > +    }
>     > +}
>     > +
> 
>     Doesn't this conflict with qdev.c's idebus_unrealize call? 
> 
> 
> As far as I can see, No conflict. Let's get a confirmation.
> 
> Hello Paolo,
> 
> Does this patch have any conflict/affect with the qdev?
> 
> Thanks.
> 

They're both deleting the same VMstate handler, so as far as I can see
this is a redundant call.

> 
> 
>     >  static IDEDMA ide_dma_nop = {
>     >      .ops = &ide_dma_nop_ops,
>     >      .aiocb = NULL,
>     > @@ -2603,6 +2610,20 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
>     >      bus->dma = &ide_dma_nop;
>     >  }
>     >
>     > +void ide_exit(IDEBus *bus)
>     > +{
>     > +    int i;
>     > +
>     > +    for (i = 0; i < 2; i++) {
>     > +        IDEState *s = &bus->ifs[i];
>     > +
>     > +        timer_del(s->sector_write_timer);
>     > +        timer_free(s->sector_write_timer);
>     > +        qemu_vfree(s->smart_selftest_data);
>     > +        qemu_vfree(s->io_buffer);
>     > +    }
>     > +}
>     > +
>     >  static const MemoryRegionPortio ide_portio_list[] = {
>     >      { 0, 8, 1, .read = ide_ioport_read, .write = ide_ioport_write },
>     >      { 0, 1, 2, .read = ide_data_readw, .write = ide_data_writew },
>     > diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
>     > index 88dc118..09b0404 100644
>     > --- a/include/hw/ide/internal.h
>     > +++ b/include/hw/ide/internal.h
>     > @@ -607,8 +607,10 @@ int ide_init_drive(IDEState *s, BlockBackend
>     *blk, IDEDriveKind kind,
>     >                     uint32_t cylinders, uint32_t heads, uint32_t secs,
>     >                     int chs_trans);
>     >  void ide_init2(IDEBus *bus, qemu_irq irq);
>     > +void ide_exit(IDEBus *bus);
>     >  void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int
>     iobase2);
>     >  void ide_register_restart_cb(IDEBus *bus);
>     > +void ide_unregister_restart_cb(IDEBus *bus);
>     >
>     >  void ide_exec_cmd(IDEBus *bus, uint32_t val);
>     >
>     >
> 

  reply	other threads:[~2017-02-14 23:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09  7:04 [Qemu-devel] [PATCH 0/2] ide: ahci: fix memory leak in device unit Li Qiang
2017-02-09  7:04 ` [Qemu-devel] [PATCH 1/2] ide: core: add cleanup function Li Qiang
2017-02-09 19:42   ` John Snow
2017-02-10  1:22     ` Li Qiang
2017-02-14 23:30       ` John Snow [this message]
2017-02-15  9:26         ` Li Qiang
2017-02-15 19:53           ` John Snow
2017-03-01  0:47   ` John Snow
2017-03-01  1:03     ` Li Qiang
2017-03-01 20:20       ` John Snow
2017-03-06 18:14         ` Paolo Bonzini
2017-02-09  7:04 ` [Qemu-devel] [PATCH 2/2] ide: ahci: call cleanup function in ahci unit Li Qiang
2017-03-01  0:35   ` John Snow
2017-03-01  0:42     ` John Snow

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=092e0dfc-7e59-ba5c-ab21-8f667635beaf@redhat.com \
    --to=jsnow@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=liqiang6-s@360.cn \
    --cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).