From nobody Sun Feb 8 22:04:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496830139634915.6706281311054; Wed, 7 Jun 2017 03:08:59 -0700 (PDT) Received: from localhost ([::1]:42427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIXtZ-00054w-Qy for importer@patchew.org; Wed, 07 Jun 2017 06:08:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIXkX-0005VT-Lx for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:59:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIXkW-0005Ka-U4 for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:59:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43184) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIXkW-0005KQ-OH for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:59:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 955C48553F for ; Wed, 7 Jun 2017 09:59:35 +0000 (UTC) Received: from secure.mitica (ovpn-117-154.ams2.redhat.com [10.36.117.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43DC717A7B; Wed, 7 Jun 2017 09:59:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 955C48553F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 955C48553F From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 7 Jun 2017 11:59:22 +0200 Message-Id: <20170607095926.1834-4-quintela@redhat.com> In-Reply-To: <20170607095926.1834-1-quintela@redhat.com> References: <20170607095926.1834-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 07 Jun 2017 09:59:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/7] ram: Call migration_page_queue_free() at ram_migration_cleanup() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We shouldn't be using memory later than that. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- migration/migration.c | 2 -- migration/ram.c | 5 +++-- migration/ram.h | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9c5ff57..9cf47d3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -948,8 +948,6 @@ static void migrate_fd_cleanup(void *opaque) qemu_bh_delete(s->cleanup_bh); s->cleanup_bh =3D NULL; =20 - migration_page_queue_free(); - if (s->to_dst_file) { trace_migrate_fd_cleanup(); qemu_mutex_unlock_iothread(); diff --git a/migration/ram.c b/migration/ram.c index f387e9c..701a1e6 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1184,10 +1184,9 @@ static bool get_queued_page(RAMState *rs, PageSearch= Status *pss) * be some left. in case that there is any page left, we drop it. * */ -void migration_page_queue_free(void) +static void migration_page_queue_free(RAMState *rs) { struct RAMSrcPageRequest *mspr, *next_mspr; - RAMState *rs =3D &ram_state; /* This queue generally should be empty - but in the case of a failed * migration might have some droppings in. */ @@ -1437,6 +1436,7 @@ void free_xbzrle_decoded_buf(void) =20 static void ram_migration_cleanup(void *opaque) { + RAMState *rs =3D opaque; RAMBlock *block; =20 /* caller have hold iothread lock or is in a bh, so there is @@ -1462,6 +1462,7 @@ static void ram_migration_cleanup(void *opaque) XBZRLE.current_buf =3D NULL; } XBZRLE_cache_unlock(); + migration_page_queue_free(rs); } =20 static void ram_state_reset(RAMState *rs) diff --git a/migration/ram.h b/migration/ram.h index c9563d1..d4da419 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -53,7 +53,6 @@ void migrate_decompress_threads_create(void); void migrate_decompress_threads_join(void); =20 uint64_t ram_pagesize_summary(void); -void migration_page_queue_free(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t = len); void acct_update_position(QEMUFile *f, size_t size, bool zero); void free_xbzrle_decoded_buf(void); --=20 2.9.4