From nobody Mon Feb 9 02:51:17 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 1487964526839640.7574284202393; Fri, 24 Feb 2017 11:28:46 -0800 (PST) Received: from localhost ([::1]:39597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chLXp-0003Hn-GU for importer@patchew.org; Fri, 24 Feb 2017 14:28:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKbq-0000qy-QO for qemu-devel@nongnu.org; Fri, 24 Feb 2017 13:28:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chKbp-0007vB-UN for qemu-devel@nongnu.org; Fri, 24 Feb 2017 13:28:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52100) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1chKbp-0007um-OU for qemu-devel@nongnu.org; Fri, 24 Feb 2017 13:28:49 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8BDE7E9E2 for ; Fri, 24 Feb 2017 18:28:49 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-182.ams2.redhat.com [10.36.117.182]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1OISjTU002473; Fri, 24 Feb 2017 13:28:48 -0500 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, lvivier@redhat.com Date: Fri, 24 Feb 2017 18:28:30 +0000 Message-Id: <20170224182844.32452-3-dgilbert@redhat.com> In-Reply-To: <20170224182844.32452-1-dgilbert@redhat.com> References: <20170224182844.32452-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 24 Feb 2017 18:28:49 +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] [PATCH v3 02/16] postcopy: Transmit and compare individual page sizes 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: aarcange@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" From: "Dr. David Alan Gilbert" When using postcopy with hugepages, we require the source and destination page sizes for any RAMBlock to match; note that different RAMBlocks in the same VM can have different page sizes. Transmit them as part of the RAM information header and fail if there's a difference. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Laurent Vivier Reviewed-by: Juan Quintela --- migration/ram.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 1f6397a..fbd987a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2027,6 +2027,9 @@ static int ram_save_setup(QEMUFile *f, void *opaque) qemu_put_byte(f, strlen(block->idstr)); qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr)); qemu_put_be64(f, block->used_length); + if (migrate_postcopy_ram() && block->page_size !=3D qemu_host_page= _size) { + qemu_put_be64(f, block->page_size); + } } =20 rcu_read_unlock(); @@ -2528,6 +2531,8 @@ static int ram_load(QEMUFile *f, void *opaque, int ve= rsion_id) * be atomic */ bool postcopy_running =3D postcopy_state_get() >=3D POSTCOPY_INCOMING_= LISTENING; + /* ADVISE is earlier, it shows the source has the postcopy capability = on */ + bool postcopy_advised =3D postcopy_state_get() >=3D POSTCOPY_INCOMING_= ADVISE; =20 seq_iter++; =20 @@ -2592,6 +2597,18 @@ static int ram_load(QEMUFile *f, void *opaque, int v= ersion_id) error_report_err(local_err); } } + /* For postcopy we need to check hugepage sizes match = */ + if (postcopy_advised && + block->page_size !=3D qemu_host_page_size) { + uint64_t remote_page_size =3D qemu_get_be64(f); + if (remote_page_size !=3D block->page_size) { + error_report("Mismatched RAM page size %s " + "(local) %zd !=3D %" PRId64, + id, block->page_size, + remote_page_size); + ret =3D -EINVAL; + } + } ram_control_load_hook(f, RAM_CONTROL_BLOCK_REG, block->idstr); } else { --=20 2.9.3