From: "Richard W.M. Jones" <rjones@redhat.com>
To: Li Qiang <liq3ea@gmail.com>
Cc: qemu-devel@nongnu.org, Li Qiang <liqiang6-s@360.cn>
Subject: Re: [Qemu-devel] [PATCH] watchdog: 6300esb: add exit function
Date: Tue, 29 Nov 2016 08:39:43 +0000 [thread overview]
Message-ID: <20161129083943.GP11243@redhat.com> (raw)
In-Reply-To: <583cde9c.3223ed0a.7f0c2.886e@mx.google.com>
On Mon, Nov 28, 2016 at 05:49:04PM -0800, Li Qiang wrote:
> From: Li Qiang <liqiang6-s@360.cn>
>
> When the Intel 6300ESB watchdog is hot unplug. The timer allocated
> in realize isn't freed thus leaking memory leak. This patch avoid
> this through adding the exit function.
I will just note that the real hardware is not hot-pluggable. However
we don't need to stick to the real hardware capabilities, so that's OK.
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> ---
> hw/watchdog/wdt_i6300esb.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
> index a83d951..49b3cd1 100644
> --- a/hw/watchdog/wdt_i6300esb.c
> +++ b/hw/watchdog/wdt_i6300esb.c
> @@ -428,6 +428,14 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp)
> /* qemu_register_coalesced_mmio (addr, 0x10); ? */
> }
>
> +static void i6300esb_exit(PCIDevice *dev)
> +{
> + I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
> +
> + timer_del(d->timer);
> + timer_free(d->timer);
> +}
> +
> static WatchdogTimerModel model = {
> .wdt_name = "i6300esb",
> .wdt_description = "Intel 6300ESB",
> @@ -441,6 +449,7 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
> k->config_read = i6300esb_config_read;
> k->config_write = i6300esb_config_write;
> k->realize = i6300esb_realize;
> + k->exit = i6300esb_exit;
The wdt_diag288.c file seems to use k->unrealize for this purpose.
I don't know which is correct however.
Rich.
> k->vendor_id = PCI_VENDOR_ID_INTEL;
> k->device_id = PCI_DEVICE_ID_INTEL_ESB_9;
> k->class_id = PCI_CLASS_SYSTEM_OTHER;
> --
> 1.8.3.1
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
next prev parent reply other threads:[~2016-11-29 8:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 1:49 [Qemu-devel] [PATCH] watchdog: 6300esb: add exit function Li Qiang
2016-11-29 8:39 ` Richard W.M. Jones [this message]
2016-11-29 8:56 ` Li Qiang
2016-11-29 9:00 ` Richard W.M. Jones
2016-11-29 9:12 ` Li Qiang
2016-11-29 10:49 ` Markus Armbruster
2016-11-29 11:06 ` Li Qiang
2016-11-29 12:21 ` Markus Armbruster
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=20161129083943.GP11243@redhat.com \
--to=rjones@redhat.com \
--cc=liq3ea@gmail.com \
--cc=liqiang6-s@360.cn \
--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).