From nobody Tue Feb 10 15:45:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.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=1579002877; cv=none; d=zohomail.com; s=zohoarc; b=eNwczU8es42lY21oXinP9+nVv0LHRyMTauwM/1rKxNmcWihJp0gVO0u/7L1IyCmBHtsTdIhA8gXCQIDSzP/GkoFc+bwXgj8w8bBf5jCNGkQPkYglE0Y9qS4jRLg03tU/s1IpiLodcOYcerqrXDp+L5xbHdsfXUUsswRO+ATAXDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579002877; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=PK1DLQmnnjOb69h2hvvX3jewUj0gHU0HSmNfuQkfjl0=; b=JFC7ANdEhNnw+G6KuOm/mt2ldpeKM3nkWw09e8MHhD1FnOuR4brnpS32xJFU+P2Oy2nK3vW1Kn9Vy0A/OZA7fc/tLl9pPjbC1namcAA2Qh5va77Xa3jC4lqqxvtDcuU0tfj0jaICvLA9pPHc3CtEMHXOTq0fZsxCLoFbFuxhEkc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1579002877882191.4585755676835; Tue, 14 Jan 2020 03:54:37 -0800 (PST) Received: from localhost ([::1]:37972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irKmJ-0005kZ-W4 for importer@patchew.org; Tue, 14 Jan 2020 06:54:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56201) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irKaC-0007LK-Fc for qemu-devel@nongnu.org; Tue, 14 Jan 2020 06:42:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irKa8-0003Y5-Qv for qemu-devel@nongnu.org; Tue, 14 Jan 2020 06:42:04 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:56934 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irKa8-0003Xo-Nk for qemu-devel@nongnu.org; Tue, 14 Jan 2020 06:42:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-uA1cweaXNCuXjAdn87jUPQ-1; Tue, 14 Jan 2020 06:41:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C126801E72; Tue, 14 Jan 2020 11:41:57 +0000 (UTC) Received: from secure.mitica (ovpn-116-207.ams2.redhat.com [10.36.116.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 083285DA70; Tue, 14 Jan 2020 11:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579002120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PK1DLQmnnjOb69h2hvvX3jewUj0gHU0HSmNfuQkfjl0=; b=P9y/0B/ONMEqNMBiz1eWBgNRjwwx1wJhFJDLcl7zhmV66SrvnuOqM9dX9pHPaMBqcUQqKE JJ/r6o5xtLwN2vRrsZa2nncl8sIp34hEXMujh6wZFIAo9X3tciSO/9LXbUiEmaHr/tkK0u k3MDB3uNzIob3cX9IcPNEL5YrKcxmLs= From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 19/30] migration/postcopy: enable random order target page arrival Date: Tue, 14 Jan 2020 12:39:15 +0100 Message-Id: <20200114113926.3556-20-quintela@redhat.com> In-Reply-To: <20200114113926.3556-1-quintela@redhat.com> References: <20200114113926.3556-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: uA1cweaXNCuXjAdn87jUPQ-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 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: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Corey Minyard , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Juan Quintela , Stefan Weil , Richard Henderson , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Wei Yang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , David Gibson , Jason Wang , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Wei Yang After using number of target page received to track one host page, we could have the capability to handle random order target page arrival in one host page. This is a preparation for enabling compress during postcopy. Signed-off-by: Wei Yang Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 460abfa2c3..a7414170e5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4050,7 +4050,7 @@ static int ram_load_postcopy(QEMUFile *f) MigrationIncomingState *mis =3D migration_incoming_get_current(); /* Temporary page that is later 'placed' */ void *postcopy_host_page =3D mis->postcopy_tmp_page; - void *last_host =3D NULL; + void *this_host =3D NULL; bool all_zero =3D false; int target_pages =3D 0; =20 @@ -4097,24 +4097,26 @@ static int ram_load_postcopy(QEMUFile *f) * that's moved into place later. * The migration protocol uses, possibly smaller, target-pages * however the source ensures it always sends all the componen= ts - * of a host page in order. + * of a host page in one chunk. */ page_buffer =3D postcopy_host_page + ((uintptr_t)host & (block->page_size - 1)); /* If all TP are zero then we can optimise the place */ if (target_pages =3D=3D 1) { all_zero =3D true; + this_host =3D (void *)QEMU_ALIGN_DOWN((uintptr_t)host, + block->page_size); } else { /* not the 1st TP within the HP */ - if (host !=3D (last_host + TARGET_PAGE_SIZE)) { - error_report("Non-sequential target page %p/%p", - host, last_host); + if (QEMU_ALIGN_DOWN((uintptr_t)host, block->page_size) != =3D + (uintptr_t)this_host) { + error_report("Non-same host page %p/%p", + host, this_host); ret =3D -EINVAL; break; } } =20 - /* * If it's the last part of a host page then we place the host * page @@ -4125,7 +4127,6 @@ static int ram_load_postcopy(QEMUFile *f) } place_source =3D postcopy_host_page; } - last_host =3D host; =20 switch (flags & ~RAM_SAVE_FLAG_CONTINUE) { case RAM_SAVE_FLAG_ZERO: @@ -4178,7 +4179,8 @@ static int ram_load_postcopy(QEMUFile *f) =20 if (!ret && place_needed) { /* This gets called at the last target page in the host page */ - void *place_dest =3D host + TARGET_PAGE_SIZE - block->page_siz= e; + void *place_dest =3D (void *)QEMU_ALIGN_DOWN((uintptr_t)host, + block->page_size); =20 if (all_zero) { ret =3D postcopy_place_page_zero(mis, place_dest, --=20 2.24.1