From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Juan Quintela <quintela@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
peterx@redhat.com
Subject: [Qemu-devel] [PATCH 2/4] migration: provide ram_state_cleanup
Date: Thu, 19 Oct 2017 14:31:58 +0800 [thread overview]
Message-ID: <20171019063200.19048-3-peterx@redhat.com> (raw)
In-Reply-To: <20171019063200.19048-1-peterx@redhat.com>
There are two Mutexes that are created but not yet destroyed for
RAMState. Fix that.
Since we are at it, provide helper function to clean up RAMState.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/ram.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index fd8e14c59b..72c48e76e9 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1566,6 +1566,15 @@ static void xbzrle_load_cleanup(void)
XBZRLE.decoded_buf = NULL;
}
+static void ram_state_cleanup(RAMState **rsp)
+{
+ migration_page_queue_free(*rsp);
+ qemu_mutex_destroy(&(*rsp)->bitmap_mutex);
+ qemu_mutex_destroy(&(*rsp)->src_page_req_mutex);
+ g_free(*rsp);
+ *rsp = NULL;
+}
+
static void ram_save_cleanup(void *opaque)
{
RAMState **rsp = opaque;
@@ -1595,10 +1604,8 @@ static void ram_save_cleanup(void *opaque)
XBZRLE.zero_target_page = NULL;
}
XBZRLE_cache_unlock();
- migration_page_queue_free(*rsp);
compress_threads_save_cleanup();
- g_free(*rsp);
- *rsp = NULL;
+ ram_state_cleanup(rsp);
}
static void ram_state_reset(RAMState *rs)
--
2.13.5
next prev parent reply other threads:[~2017-10-19 6:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 6:31 [Qemu-devel] [PATCH 0/4] migration: fixes and cleanups for ram state init Peter Xu
2017-10-19 6:31 ` [Qemu-devel] [PATCH 1/4] migration: provide ram_state_init() Peter Xu
2017-10-23 11:18 ` Juan Quintela
2017-10-19 6:31 ` Peter Xu [this message]
2017-10-23 11:19 ` [Qemu-devel] [PATCH 2/4] migration: provide ram_state_cleanup Juan Quintela
2017-10-19 6:31 ` [Qemu-devel] [PATCH 3/4] migration: clean up xbzrle cache init/destroy Peter Xu
2017-10-23 11:20 ` Juan Quintela
2017-10-19 6:32 ` [Qemu-devel] [PATCH 4/4] migration: new ram_init_bitmaps() Peter Xu
2017-10-23 11:38 ` Juan Quintela
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=20171019063200.19048-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).