From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569424985; cv=none; d=zoho.com; s=zohoarc; b=liOxE2L02tpp8JVZL/gQmok/a2HvyZTWtYY0GajusoecxppLwfgCRVl0iepfppOiXr/JwCY8zJNZYpGUna2cldp6VuEjP6L+sb3tGc0pXSFl2FQ280fhgKmPxg/sSS4a+H6d2jBMBERo7vN2LZ2clv0YiENwDMr3qC4PtYtMubc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569424985; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=xMz6SfDCMBFNSTpDJRotOFYWaCPcDXIKrZ/2OMhfplk=; b=BV/utCk9694Eou6qAv71zqLObXwrXT8Q2YcG+Kh1TUVi7L90FImDnTegwlV6M8jE0kuW5xVag7ez/t7p+EL+CDs65Pr3BLzU1h7af8X7IGP1+z5oSH1M/fHDayoGyCUf0SHKhrH2UW5prwoB6ZvONGp386JuSP0+s2Htwpenpb8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569424985318734.9206512180674; Wed, 25 Sep 2019 08:23:05 -0700 (PDT) Received: from localhost ([::1]:53594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD98B-0003zV-HT for importer@patchew.org; Wed, 25 Sep 2019 11:23:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57534) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8na-0000Zj-JH for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8nY-0004YC-Jh for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56705) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8nV-0004XC-RA for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6CD5B8A1CB9; Wed, 25 Sep 2019 15:01:40 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 179995C21F; Wed, 25 Sep 2019 15:01:38 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 1/9] migration: fix vmdesc leak on vmstate_save() error Date: Wed, 25 Sep 2019 16:01:22 +0100 Message-Id: <20190925150130.12303-2-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Wed, 25 Sep 2019 15:01:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20190912122514.22504-2-marcandre.lureau@redhat.com> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Dr. David Alan Gilbert --- migration/qjson.h | 2 ++ migration/savevm.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/qjson.h b/migration/qjson.h index 41664f2d71..1786bb5864 100644 --- a/migration/qjson.h +++ b/migration/qjson.h @@ -24,4 +24,6 @@ void json_start_object(QJSON *json, const char *name); const char *qjson_get_str(QJSON *json); void qjson_finish(QJSON *json); =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QJSON, qjson_destroy) + #endif /* QEMU_QJSON_H */ diff --git a/migration/savevm.c b/migration/savevm.c index ee06f91d42..bb9462a54d 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1314,7 +1314,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(Q= EMUFile *f, bool in_postcopy, bool inactivate_disks) { - QJSON *vmdesc; + g_autoptr(QJSON) vmdesc =3D NULL; int vmdesc_len; SaveStateEntry *se; int ret; @@ -1375,7 +1375,6 @@ int qemu_savevm_state_complete_precopy_non_iterable(Q= EMUFile *f, qemu_put_be32(f, vmdesc_len); qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len); } - qjson_destroy(vmdesc); =20 return 0; } --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569423908; cv=none; d=zoho.com; s=zohoarc; b=khZzwbrL7rSliZ2BfNDr3Hfiq4M4MDfB5n97jp2fQhVazQRCOlYX2AppCCxoNA2H9ywNDckk5zRE1dGbkQlphy6Tk7mmw92GNBW0+rled3fusD2gnNYI6GnMQrZT8y/zG2eAU3UXGDqQyfcpWoeFrE7r91r1WWrkefKMNxDcp68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569423908; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qyiDyfTK9hAdqd2zaiihSOS40G6cslJnkWfIO581g1A=; b=cU8p20k5dyZiOU2tkj2aYkJLAATY69LdjvOVy/S0B0bWc1z1VuUzyVWRQJthJEC/HHySuQAWXmb+rdlTZcGqUINe1UcgyckyKngO8cbK787xUjFKWEcAZd32ed1iH0bUQkj84jwYfSmsVu+4oQnkSvIUQFPMN9peoFWCnne97G4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569423908702186.67277958077295; Wed, 25 Sep 2019 08:05:08 -0700 (PDT) Received: from localhost ([::1]:53354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8qm-0003CP-I5 for importer@patchew.org; Wed, 25 Sep 2019 11:05:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57571) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8nc-0000c0-2O for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8na-0004ZK-TY for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8na-0004Yo-O4 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 008F0306731D; Wed, 25 Sep 2019 15:01:46 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3DD15C21F; Wed, 25 Sep 2019 15:01:40 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 2/9] migration/postcopy: not necessary to do discard when canonicalizing bitmap Date: Wed, 25 Sep 2019 16:01:23 +0100 Message-Id: <20190925150130.12303-3-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 25 Sep 2019 15:01:46 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang All pages, either partially sent or partially dirty, will be discarded in postcopy_send_discard_bm_ram(), since we update the unsentmap to be unsentmap =3D unsentmap | dirty in ram_postcopy_send_discard_bitmap(). This is not necessary to do discard when canonicalizing bitmap. And by doing so, we separate the page discard into two individual steps: * canonicalize bitmap * discard page Signed-off-by: Wei Yang Message-Id: <20190819061843.28642-2-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 01df326767..57d1a4627e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2928,7 +2928,7 @@ static int postcopy_each_ram_send_discard(MigrationSt= ate *ms) } =20 /** - * postcopy_chunk_hostpages_pass: canocalize bitmap in hostpages + * postcopy_chunk_hostpages_pass: canonicalize bitmap in hostpages * * Helper for postcopy_chunk_hostpages; it's called twice to * canonicalize the two bitmaps, that are similar, but one is @@ -2991,18 +2991,6 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, bool unsent_pass, host_ratio); run_start =3D QEMU_ALIGN_UP(run_start, host_ratio); =20 - /* Tell the destination to discard this page */ - if (unsent_pass || !test_bit(fixup_start_addr, unsentmap)) { - /* For the unsent_pass we: - * discard partially sent pages - * For the !unsent_pass (dirty) we: - * discard partially dirty pages that were sent - * (any partially sent pages were already discarded - * by the previous unsent_pass) - */ - postcopy_discard_send_range(ms, fixup_start_addr, host_rat= io); - } - /* Clean up the bitmap */ for (page =3D fixup_start_addr; page < fixup_start_addr + host_ratio; page++) { --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569424960; cv=none; d=zoho.com; s=zohoarc; b=AWKx72ZyKlhQ7uvDxFIoD5KFOw39TQMSUjrRHa+pzgMh8PEeZcDg5HZx2RvBRvL9b9VjuaBDVwZauqWZkGpfrrSCaLM3+viFhJZsvYCJMSjrZVu46WofUVsG5+Maq8LKhwZHi0bCxfU46dKZpNrCA0I5FGHN9Z5/xfqZXu6jOd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569424960; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6oZYJRDetbN5Yy+H+uI8bkRhcbv+Wv0+JIF9kMzfLhY=; b=UoIwWcmfyC128Rs0dKKF54acC8yWE2FNGTAEGcAiPgr3l4VQx/nMj65hTN6dD2LJqQCBAAeSE7lnZeRV3OKgqa+BOc8gaREcl2mf3OF92Pj0ws9ojTSZBXuUyKT6+sZY2R3tzJKKhGRk5RjzM1hTG7WHERrpAT1Wz36f9hgeHkU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569424960697741.5385945468184; Wed, 25 Sep 2019 08:22:40 -0700 (PDT) Received: from localhost ([::1]:53588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD97m-0003Pv-Eh for importer@patchew.org; Wed, 25 Sep 2019 11:22:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57588) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8ne-0000eO-Kq for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8nc-0004aF-PI for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38965) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8nc-0004Zn-GO for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB68930B6452; Wed, 25 Sep 2019 15:01:47 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A0965C21F; Wed, 25 Sep 2019 15:01:46 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 3/9] migration/postcopy: unsentmap is not necessary for postcopy Date: Wed, 25 Sep 2019 16:01:24 +0100 Message-Id: <20190925150130.12303-4-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 25 Sep 2019 15:01:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang Commit f3f491fcd6dd594ba695 ('Postcopy: Maintain unsentmap') introduced unsentmap to track not yet sent pages. This is not necessary since: * unsentmap is a sub-set of bmap before postcopy start * unsentmap is the summation of bmap and unsentmap after canonicalizing This patch just removes it. Signed-off-by: Wei Yang Message-Id: <20190819061843.28642-3-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- include/exec/ram_addr.h | 6 ---- migration/ram.c | 80 ++++++++--------------------------------- 2 files changed, 14 insertions(+), 72 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index a327a80cfe..e96e621de5 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -44,12 +44,6 @@ struct RAMBlock { size_t page_size; /* dirty bitmap used during migration */ unsigned long *bmap; - /* bitmap of pages that haven't been sent even once - * only maintained and used in postcopy at the moment - * where it's used to send the dirtymap at the start - * of the postcopy phase - */ - unsigned long *unsentmap; /* bitmap of already received pages in postcopy */ unsigned long *receivedmap; =20 diff --git a/migration/ram.c b/migration/ram.c index 57d1a4627e..a8b1aa2597 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2348,7 +2348,7 @@ static bool get_queued_page(RAMState *rs, PageSearchS= tatus *pss) dirty =3D test_bit(page, block->bmap); if (!dirty) { trace_get_queued_page_not_dirty(block->idstr, (uint64_t)of= fset, - page, test_bit(page, block->unsentmap)); + page, test_bit(page, block->bmap)); } else { trace_get_queued_page(block->idstr, (uint64_t)offset, page= ); } @@ -2619,10 +2619,6 @@ static int ram_save_host_page(RAMState *rs, PageSear= chStatus *pss, } =20 pages +=3D tmppages; - if (pss->block->unsentmap) { - clear_bit(pss->page, pss->block->unsentmap); - } - pss->page++; } while ((pss->page & (pagesize_bits - 1)) && offset_in_ramblock(pss->block, pss->page << TARGET_PAGE_BITS)= ); @@ -2776,8 +2772,6 @@ static void ram_save_cleanup(void *opaque) block->clear_bmap =3D NULL; g_free(block->bmap); block->bmap =3D NULL; - g_free(block->unsentmap); - block->unsentmap =3D NULL; } =20 xbzrle_cleanup(); @@ -2857,8 +2851,6 @@ void ram_postcopy_migrated_memory_release(MigrationSt= ate *ms) * Returns zero on success * * Callback from postcopy_each_ram_send_discard for each RAMBlock - * Note: At this point the 'unsentmap' is the processed bitmap combined - * with the dirtymap; so a '1' means it's either dirty or unsent. * * @ms: current migration state * @block: RAMBlock to discard @@ -2867,17 +2859,17 @@ static int postcopy_send_discard_bm_ram(MigrationSt= ate *ms, RAMBlock *block) { unsigned long end =3D block->used_length >> TARGET_PAGE_BITS; unsigned long current; - unsigned long *unsentmap =3D block->unsentmap; + unsigned long *bitmap =3D block->bmap; =20 for (current =3D 0; current < end; ) { - unsigned long one =3D find_next_bit(unsentmap, end, current); + unsigned long one =3D find_next_bit(bitmap, end, current); unsigned long zero, discard_length; =20 if (one >=3D end) { break; } =20 - zero =3D find_next_zero_bit(unsentmap, end, one + 1); + zero =3D find_next_zero_bit(bitmap, end, one + 1); =20 if (zero >=3D end) { discard_length =3D end - one; @@ -2938,16 +2930,12 @@ static int postcopy_each_ram_send_discard(Migration= State *ms) * clean, not a mix. This function canonicalizes the bitmaps. * * @ms: current migration state - * @unsent_pass: if true we need to canonicalize partially unsent host pag= es - * otherwise we need to canonicalize partially dirty host pa= ges * @block: block that contains the page we want to canonicalize */ -static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_= pass, - RAMBlock *block) +static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *bl= ock) { RAMState *rs =3D ram_state; unsigned long *bitmap =3D block->bmap; - unsigned long *unsentmap =3D block->unsentmap; unsigned int host_ratio =3D block->page_size / TARGET_PAGE_SIZE; unsigned long pages =3D block->used_length >> TARGET_PAGE_BITS; unsigned long run_start; @@ -2957,13 +2945,8 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, bool unsent_pass, return; } =20 - if (unsent_pass) { - /* Find a sent page */ - run_start =3D find_next_zero_bit(unsentmap, pages, 0); - } else { - /* Find a dirty page */ - run_start =3D find_next_bit(bitmap, pages, 0); - } + /* Find a dirty page */ + run_start =3D find_next_bit(bitmap, pages, 0); =20 while (run_start < pages) { =20 @@ -2973,11 +2956,7 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, bool unsent_pass, */ if (QEMU_IS_ALIGNED(run_start, host_ratio)) { /* Find the end of this run */ - if (unsent_pass) { - run_start =3D find_next_bit(unsentmap, pages, run_start + = 1); - } else { - run_start =3D find_next_zero_bit(bitmap, pages, run_start = + 1); - } + run_start =3D find_next_zero_bit(bitmap, pages, run_start + 1); /* * If the end isn't at the start of a host page, then the * run doesn't finish at the end of a host page @@ -2994,9 +2973,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, bool unsent_pass, /* Clean up the bitmap */ for (page =3D fixup_start_addr; page < fixup_start_addr + host_ratio; page++) { - /* All pages in this host page are now not sent */ - set_bit(page, unsentmap); - /* * Remark them as dirty, updating the count for any pages * that weren't previously dirty. @@ -3005,13 +2981,8 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, bool unsent_pass, } } =20 - if (unsent_pass) { - /* Find the next sent page for the next iteration */ - run_start =3D find_next_zero_bit(unsentmap, pages, run_start); - } else { - /* Find the next dirty page for the next iteration */ - run_start =3D find_next_bit(bitmap, pages, run_start); - } + /* Find the next dirty page for the next iteration */ + run_start =3D find_next_bit(bitmap, pages, run_start); } } =20 @@ -3033,13 +3004,10 @@ static int postcopy_chunk_hostpages(MigrationState = *ms, RAMBlock *block) { postcopy_discard_send_init(ms, block->idstr); =20 - /* First pass: Discard all partially sent host pages */ - postcopy_chunk_hostpages_pass(ms, true, block); /* - * Second pass: Ensure that all partially dirty host pages are made - * fully dirty. + * Ensure that all partially dirty host pages are made fully dirty. */ - postcopy_chunk_hostpages_pass(ms, false, block); + postcopy_chunk_hostpages_pass(ms, block); =20 postcopy_discard_send_finish(ms); return 0; @@ -3077,19 +3045,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) rs->last_page =3D 0; =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { - unsigned long pages =3D block->used_length >> TARGET_PAGE_BITS; - unsigned long *bitmap =3D block->bmap; - unsigned long *unsentmap =3D block->unsentmap; - - if (!unsentmap) { - /* We don't have a safe way to resize the sentmap, so - * if the bitmap was resized it will be NULL at this - * point. - */ - error_report("migration ram resized during precopy phase"); - rcu_read_unlock(); - return -EINVAL; - } /* Deal with TPS !=3D HPS and huge pages */ ret =3D postcopy_chunk_hostpages(ms, block); if (ret) { @@ -3097,12 +3052,9 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) return ret; } =20 - /* - * Update the unsentmap to be unsentmap =3D unsentmap | dirty - */ - bitmap_or(unsentmap, unsentmap, bitmap, pages); #ifdef DEBUG_POSTCOPY - ram_debug_dump_bitmap(unsentmap, true, pages); + ram_debug_dump_bitmap(block->bmap, true, + block->used_length >> TARGET_PAGE_BITS); #endif } trace_ram_postcopy_send_discard_bitmap(); @@ -3270,10 +3222,6 @@ static void ram_list_init_bitmaps(void) bitmap_set(block->bmap, 0, pages); block->clear_bmap_shift =3D shift; block->clear_bmap =3D bitmap_new(clear_bmap_size(pages, shift)= ); - if (migrate_postcopy_ram()) { - block->unsentmap =3D bitmap_new(pages); - bitmap_set(block->unsentmap, 0, pages); - } } } } --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569424125; cv=none; d=zoho.com; s=zohoarc; b=efby37jAMeqNY4hk9mFRqyowt9mAxGDWII69bAYB7Cpdab2ls/gk8NL7YZr2Ed2mcrcPg/JxIfey6Z4ak0XSDwIDg9JoDXiYkKbPKDPMriVLDJV7NKM+Cyawo2ErvbHM1JINxWv2KB0IWStYsklwoLs/+Dp6BXebYB2e62zDGwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569424125; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SI6We5kmfZXvO08p6YRAO6CaZJovowe+puMMEK5E8Ng=; b=e9P4HpDUw6k3HbLW/lcmbL7RjDpNLX+rBMSkPKKaoQm3K7bNjjA2iCXn8AGnMsrm+sQe7PIb+jtPzxoKZz4G84xWAtNa1Wlu1CCFqT89FWhGlTOejouK6WpaQ/mq6BIlsVl3Othpt3ykjy7PyNTD1SYAvVmwNM2FwantEnjsABY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569424125766579.0160366441683; Wed, 25 Sep 2019 08:08:45 -0700 (PDT) Received: from localhost ([::1]:53402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8uJ-0007GS-V3 for importer@patchew.org; Wed, 25 Sep 2019 11:08:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57617) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8ni-0000hp-4p for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8ng-0004bq-Pl for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50977) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8ng-0004bV-Ja for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:01:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6CF2C04BD48; Wed, 25 Sep 2019 15:01:51 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3AA95C224; Wed, 25 Sep 2019 15:01:47 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 4/9] migration: remove sent parameter in get_queued_page_not_dirty Date: Wed, 25 Sep 2019 16:01:25 +0100 Message-Id: <20190925150130.12303-5-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 25 Sep 2019 15:01:51 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Wei Yang This is a cleanup for previous removal of unsentmap. The sent parameter is not necessary now. Signed-off-by: Wei Yang Message-Id: <20190819061843.28642-4-richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 2 +- migration/trace-events | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index a8b1aa2597..22423f08cd 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2348,7 +2348,7 @@ static bool get_queued_page(RAMState *rs, PageSearchS= tatus *pss) dirty =3D test_bit(page, block->bmap); if (!dirty) { trace_get_queued_page_not_dirty(block->idstr, (uint64_t)of= fset, - page, test_bit(page, block->bmap)); + page); } else { trace_get_queued_page(block->idstr, (uint64_t)offset, page= ); } diff --git a/migration/trace-events b/migration/trace-events index 00ffcd5930..858d415d56 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -76,7 +76,7 @@ qemu_file_fclose(void) "" =20 # ram.c get_queued_page(const char *block_name, uint64_t tmp_offset, unsigned long= page_abs) "%s/0x%" PRIx64 " page_abs=3D0x%lx" -get_queued_page_not_dirty(const char *block_name, uint64_t tmp_offset, uns= igned long page_abs, int sent) "%s/0x%" PRIx64 " page_abs=3D0x%lx (sent=3D%= d)" +get_queued_page_not_dirty(const char *block_name, uint64_t tmp_offset, uns= igned long page_abs) "%s/0x%" PRIx64 " page_abs=3D0x%lx" migration_bitmap_sync_start(void) "" migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64 migration_bitmap_clear_dirty(char *str, uint64_t start, uint64_t size, uns= igned long page) "rb %s start 0x%"PRIx64" size 0x%"PRIx64" page 0x%lx" --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569424370; cv=none; d=zoho.com; s=zohoarc; b=Hn6jOuWrVucGHCBiF4zwBDNx+VeeyYh0ciCIan6Bf0BrVGpDYetvX93sTjck96EIXG9htPJP3u6vvA+BTMTtwCwbb4JEyGA71g6seWPA8s4LG2+dBlv5WrJUH8FGn5yTJH4o81tIu+ToTJzr8GABtTnwXCMdy+zVoN7iZZA08/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569424370; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mkjOee/7OY6F0VuHO7+yQQCwESIB5/lOzILn8Zy8/r4=; b=VNilLTuDynG3NBoTk626q384I2P7BvsRyXGTEyuoOVlZAMSlUrHNS+Vrkg3gaylNMKB6m2D5rpIA6Uh3o6y04xwDf8YhEJUULYoWRNTFNc4ARzpFa/EtRWEVqVrg+REBuzH+LnTMP0fqWpLuZIYQ3qyI/EFWMVGkSyUAzJmErO4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569424370578504.1411607229504; Wed, 25 Sep 2019 08:12:50 -0700 (PDT) Received: from localhost ([::1]:53454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8yH-0002tc-I4 for importer@patchew.org; Wed, 25 Sep 2019 11:12:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57667) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8nr-0000re-IV for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8nq-0004fW-D5 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59684) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8nq-0004f2-79 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A98E3086208; Wed, 25 Sep 2019 15:02:01 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18B865C220; Wed, 25 Sep 2019 15:01:51 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 5/9] migration/rdma: Don't moan about disconnects at the end Date: Wed, 25 Sep 2019 16:01:26 +0100 Message-Id: <20190925150130.12303-6-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 25 Sep 2019 15:02:01 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" If we've already finished the migration or something has already gone wrong, don't moan about the migration stream disconnecting. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20190913163507.1403-2-dgilbert@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- migration/rdma.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 78e6b72bac..0fcf02f48e 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3253,10 +3253,14 @@ static void rdma_cm_poll_handler(void *opaque) =20 if (cm_event->event =3D=3D RDMA_CM_EVENT_DISCONNECTED || cm_event->event =3D=3D RDMA_CM_EVENT_DEVICE_REMOVAL) { - error_report("receive cm event, cm event is %d", cm_event->event); - rdma->error_state =3D -EPIPE; - if (rdma->return_path) { - rdma->return_path->error_state =3D -EPIPE; + if (!rdma->error_state && + migration_incoming_get_current()->state !=3D + MIGRATION_STATUS_COMPLETED) { + error_report("receive cm event, cm event is %d", cm_event->eve= nt); + rdma->error_state =3D -EPIPE; + if (rdma->return_path) { + rdma->return_path->error_state =3D -EPIPE; + } } =20 if (mis->migration_incoming_co) { --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569424240; cv=none; d=zoho.com; s=zohoarc; b=HmWlkfRg+1TCpip/MKhEqparkAAhVnvcaeRoAd6P8fGhSw+xYoVppiQF6Ew/+aQZV+X2cUgnA4MmIFh5DAgcJpR18OWpJABmIGtr/K+Mx0j8uwCO/WXq2vr5O8rGTrLwDEWLwfxbSEq8/OwZsWlrGYe1aCWYFoVAe6xD4hXtqO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569424240; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UvW57g91Z0krGJLNT5Ag6ufygL9BqIz6haz8tZb39zI=; b=hbPGA+e3QxNadOeVOpjdWUrmkXBFKXhnc5hPxl4jXQ2aoUAnPw1zA1RekSe27RhPrM/9Xensn8YbtnveU1eqC0LtUdcjqqXVsg/fcz0ccXOa4FhwnDfHQvTJiW9IwMEdTUYOPUWSBq83fzIVrkI7GwBBHFQxq5fA+N29VRODbIg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569424240150667.4252607065537; Wed, 25 Sep 2019 08:10:40 -0700 (PDT) Received: from localhost ([::1]:53426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8wA-0000m1-Cj for importer@patchew.org; Wed, 25 Sep 2019 11:10:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57711) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8nw-0000we-Kb for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8nv-0004hM-85 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59718) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8nv-0004gz-2U for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 490923082149; Wed, 25 Sep 2019 15:02:06 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id B22E75C1D4; Wed, 25 Sep 2019 15:02:01 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 6/9] migration/rdma.c: Swap synchronize_rcu for call_rcu Date: Wed, 25 Sep 2019 16:01:27 +0100 Message-Id: <20190925150130.12303-7-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 25 Sep 2019 15:02:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" This fixes a deadlock that can occur on the migration source after a failed RDMA migration; as the source tries to cleanup it clears a pair of pointers and uses synchronize_rcu to wait; this is happening on the main thread. With the CPUs running a CPU thread can be an rcu reader and attempt to grab the main lock (kvm_handle_io->address_space_write->flatview_write->flatview_write_continu= e-> prepare_mmio_access->qemu_mutex_lock_iothread_impl) Replace the synchronize_rcu with a call_rcu to postpone the freeing. Fixes: 74637e6f08fceda98806 ("migration: implement bi-directional RDMA QIOC= hannel") ( https://bugzilla.redhat.com/show_bug.cgi?id=3D1746787 ) Signed-off-by: Dr. David Alan Gilbert Message-Id: <20190913163507.1403-3-dgilbert@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- migration/rdma.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 0fcf02f48e..4c74e88a37 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3017,11 +3017,35 @@ static void qio_channel_rdma_set_aio_fd_handler(QIO= Channel *ioc, } } =20 +struct rdma_close_rcu { + struct rcu_head rcu; + RDMAContext *rdmain; + RDMAContext *rdmaout; +}; + +/* callback from qio_channel_rdma_close via call_rcu */ +static void qio_channel_rdma_close_rcu(struct rdma_close_rcu *rcu) +{ + if (rcu->rdmain) { + qemu_rdma_cleanup(rcu->rdmain); + } + + if (rcu->rdmaout) { + qemu_rdma_cleanup(rcu->rdmaout); + } + + g_free(rcu->rdmain); + g_free(rcu->rdmaout); + g_free(rcu); +} + static int qio_channel_rdma_close(QIOChannel *ioc, Error **errp) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(ioc); RDMAContext *rdmain, *rdmaout; + struct rdma_close_rcu *rcu =3D g_new(struct rdma_close_rcu, 1); + trace_qemu_rdma_close(); =20 rdmain =3D rioc->rdmain; @@ -3034,18 +3058,9 @@ static int qio_channel_rdma_close(QIOChannel *ioc, atomic_rcu_set(&rioc->rdmaout, NULL); } =20 - synchronize_rcu(); - - if (rdmain) { - qemu_rdma_cleanup(rdmain); - } - - if (rdmaout) { - qemu_rdma_cleanup(rdmaout); - } - - g_free(rdmain); - g_free(rdmaout); + rcu->rdmain =3D rdmain; + rcu->rdmaout =3D rdmaout; + call_rcu(rcu, qio_channel_rdma_close_rcu, rcu); =20 return 0; } --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569425235; cv=none; d=zoho.com; s=zohoarc; b=IecMh/hRjdqZWaYlnR2EkyF44EhYN7RnKs4c8UMHNOyHuvM3a+DaS4dazV935QgGwe+UF3WaxdOGnCwXrZ9CXXeshnV1P4wzHG5fsU7JDgESkAfyC6glxUcl+tHTLRw5cZ4pNk8pfnXuNkevWhW3ojHjnH0iwaKASOqMuNvQqV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569425235; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VOy96Qg68kw6KUkXR49XtHDSciRD1oa/QK0dBlX9q0o=; b=Tmkgop+8GEtX6nKMi6kZyl+wa74jZCvSiooGbuGKdJs1xbf6DI4sUMVa8WsvDRbl6Z80HsFTlEEBLtlVJri2wyIxeb458bCvWTAJLzw9XoAC/NV8TMptpCiUUqf5c+K4Iq025g2s3TrVXFeNbeOlQrPNOHZt1C0Mv28ZHDYufBg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569425235187377.3392835775294; Wed, 25 Sep 2019 08:27:15 -0700 (PDT) Received: from localhost ([::1]:53654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD9CD-0008G1-Kp for importer@patchew.org; Wed, 25 Sep 2019 11:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57733) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8o0-00012o-Gr for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8nz-0004k5-4F for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50846) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8ny-0004jk-S5 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 17E6A3090FD9; Wed, 25 Sep 2019 15:02:10 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 925305C21F; Wed, 25 Sep 2019 15:02:06 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 7/9] tests/migration: Fail on unexpected migration states Date: Wed, 25 Sep 2019 16:01:28 +0100 Message-Id: <20190925150130.12303-8-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Sep 2019 15:02:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" We've got various places where we wait for a migration to enter a given state; but if we enter an unexpected state we tend to fail in odd ways; add a mechanism for explicitly testing for any state which we shouldn't be in. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20190923131022.15498-2-dgilbert@redhat.com> Reviewed-by: Cleber Rosa Tested-by: Cleber Rosa Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/migration-test.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 258aa064d4..9c62ee5331 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -255,15 +255,19 @@ static void read_blocktime(QTestState *who) } =20 static void wait_for_migration_status(QTestState *who, - const char *goal) + const char *goal, + const char **ungoals) { while (true) { bool completed; char *status; + const char **ungoal; =20 status =3D migrate_query_status(who); completed =3D strcmp(status, goal) =3D=3D 0; - g_assert_cmpstr(status, !=3D, "failed"); + for (ungoal =3D ungoals; *ungoal; ungoal++) { + g_assert_cmpstr(status, !=3D, *ungoal); + } g_free(status); if (completed) { return; @@ -274,7 +278,8 @@ static void wait_for_migration_status(QTestState *who, =20 static void wait_for_migration_complete(QTestState *who) { - wait_for_migration_status(who, "completed"); + wait_for_migration_status(who, "completed", + (const char * []) { "failed", NULL }); } =20 static void wait_for_migration_pass(QTestState *who) @@ -809,7 +814,9 @@ static void test_postcopy_recovery(void) * Wait until postcopy is really started; we can only run the * migrate-pause command during a postcopy */ - wait_for_migration_status(from, "postcopy-active"); + wait_for_migration_status(from, "postcopy-active", + (const char * []) { "failed", + "completed", NULL }); =20 /* * Manually stop the postcopy migration. This emulates a network @@ -822,7 +829,9 @@ static void test_postcopy_recovery(void) * migrate-recover command can only succeed if destination machine * is in the paused state */ - wait_for_migration_status(to, "postcopy-paused"); + wait_for_migration_status(to, "postcopy-paused", + (const char * []) { "failed", "active", + "completed", NULL }); =20 /* * Create a new socket to emulate a new channel that is different @@ -836,7 +845,9 @@ static void test_postcopy_recovery(void) * Try to rebuild the migration channel using the resume flag and * the newly created channel */ - wait_for_migration_status(from, "postcopy-paused"); + wait_for_migration_status(from, "postcopy-paused", + (const char * []) { "failed", "active", + "completed", NULL }); migrate(from, uri, "{'resume': true}"); g_free(uri); =20 --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569425555; cv=none; d=zoho.com; s=zohoarc; b=FkzitCDphHIjsveCNRagKEqDV1o48prbBFNkkcuY+xcaFY/sevkqCd1uNCbgGySxgroYaWDbkJULfd9GMHrq4Ye6W/qhx+ffSc1lp05THy25hrOErvv9U5xJljtmJif8lVMEhN7hz/rcPQPwLSpggWAqfY3oC14VoATHcQI+Tvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569425555; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4N28PFmuqCXivR9cl3Ts40Ja0jezPa7LSNijP4r9Z1g=; b=ZDOQMM91PeFu1FJbaF50l/lVcRa6NlPwDI707jw5k9XD35Tf5ZaJWqFz1lqodjCsurgX35azCSnqff2vqayhETgTTdQumF/ZoTpe4nZvNhlouyn2tyv/CZqjarLVokzGymymCLtchuvwoaEdWBimYwx2/PkUcCfgc6oSpdy/4/U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569425555933918.7970649787118; Wed, 25 Sep 2019 08:32:35 -0700 (PDT) Received: from localhost ([::1]:53702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD9HL-0003jO-8h for importer@patchew.org; Wed, 25 Sep 2019 11:32:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57757) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8o2-00015T-T6 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8o0-0004ke-Lv for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47515) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8o0-0004kL-G3 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:12 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B70093090FD2; Wed, 25 Sep 2019 15:02:11 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 640865C1D4; Wed, 25 Sep 2019 15:02:10 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 8/9] tests/migration/postcopy: trim migration bandwidth Date: Wed, 25 Sep 2019 16:01:29 +0100 Message-Id: <20190925150130.12303-9-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Sep 2019 15:02:11 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" On slow hosts with tcg we were sometimes finding that the migration would complete during precopy and never get into the postcopy test. Trim back the bandwidth a bit to make that much less likely. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20190923131022.15498-3-dgilbert@redhat.com> Reviewed-by: Cleber Rosa Acked-by: Alex Benn=C3=A9e Tested-by: Cleber Rosa Tested-by: Alex Benn=C3=A9e Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 9c62ee5331..221a33d083 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -753,7 +753,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, * quickly, but that it doesn't complete precopy even on a slow * machine, so also set the downtime. */ - migrate_set_parameter_int(from, "max-bandwidth", 100000000); + migrate_set_parameter_int(from, "max-bandwidth", 30000000); migrate_set_parameter_int(from, "downtime-limit", 1); =20 /* Wait for the first serial output from the source */ --=20 2.21.0 From nobody Sat May 4 00:27:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569425272; cv=none; d=zoho.com; s=zohoarc; b=iBanBsekMavAY0KYop+cFVoI2DU3wMwnx5FsSMupM4otdcAKtHCZT1UiMsclDNxFVWVOow1+pJ3fEnRZpolv2vaWy/pebWeOpSRO2NDTcr/0a1RWc33Hl7Y/I9mAWUFef//znEb9GRfe3RhumpyqfD9q4mi433DDDu+UH0XM7H4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569425272; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ctQEdALTjHsJ1b0gN/WNBiDL0U2e1E1/YjQgC55tUV4=; b=WHumekCl4GWXn1+L9KAO+tPV9Alil3LJs4Ewi6knzPl0gcjyWlwFrSbMBjTiUu9dR/pK6pqLlJMGji6cfc+ZpRk5i7jkhBoNc6dmiBCZVwuQ08O2LdHZDRvozk3k/5h7bCHQylFRbYTwQvA9wurX8cjRMt9u8TwYC74bXCU28qs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569425272653643.8609988534279; Wed, 25 Sep 2019 08:27:52 -0700 (PDT) Received: from localhost ([::1]:53656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD9Cp-0000Mk-4M for importer@patchew.org; Wed, 25 Sep 2019 11:27:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57788) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD8o5-00019U-0Z for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD8o3-0004m7-Pw for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40036) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD8o3-0004ln-KJ for qemu-devel@nongnu.org; Wed, 25 Sep 2019 11:02:15 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94F2418C4272; Wed, 25 Sep 2019 15:02:14 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-251.ams2.redhat.com [10.36.117.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C24C5C1D4; Wed, 25 Sep 2019 15:02:11 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, richardw.yang@linux.intel.com, alex.benee@linaro.org Subject: [PULL 9/9] migration/postcopy: Recognise the recovery states as 'in_postcopy' Date: Wed, 25 Sep 2019 16:01:30 +0100 Message-Id: <20190925150130.12303-10-dgilbert@redhat.com> In-Reply-To: <20190925150130.12303-1-dgilbert@redhat.com> References: <20190925150130.12303-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Wed, 25 Sep 2019 15:02:14 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Various parts of the migration code do different things when they're in postcopy mode; prior to this patch this has been 'postcopy-active'. This patch extends 'in_postcopy' to include 'postcopy-paused' and 'postcopy-recover'. In particular, when you set the max-postcopy-bandwidth parameter, this only affects the current migration fd if we're 'in_postcopy'; this leads to a race in the postcopy recovery test where it increases the speed from 4k/sec to unlimited, but that increase can get ignored if the change is made between the point at which the reconnection happens and it transitions back to active. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20190923174942.12182-1-dgilbert@redhat.com> Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Tested-by: Alex Benn=C3=A9e Tested-by: Markus Armbruster Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 01863a95f5..5f7e4d15e9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1659,7 +1659,14 @@ bool migration_in_postcopy(void) { MigrationState *s =3D migrate_get_current(); =20 - return (s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE); + switch (s->state) { + case MIGRATION_STATUS_POSTCOPY_ACTIVE: + case MIGRATION_STATUS_POSTCOPY_PAUSED: + case MIGRATION_STATUS_POSTCOPY_RECOVER: + return true; + default: + return false; + } } =20 bool migration_in_postcopy_after_devices(MigrationState *s) --=20 2.21.0