Received: by 2002:a19:c345:0:0:0:0:0 with SMTP id t66csp5284700lff; Tue, 14 Jan 2020 01:46:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxNlyrKmGUL1IfSsJxDXbpb97ufSa7weM36qOGt+3OyuRV1wYuEfvm9PtqJji4LwCCE/kAM X-Received: by 2002:a37:bc04:: with SMTP id m4mr16466686qkf.224.1578995175562; Tue, 14 Jan 2020 01:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578995175; cv=none; d=google.com; s=arc-20160816; b=Ku0liZyTRVmGteVh4xwdz0gkewhdnQgKR8muO5rgPy/fEYgbAG+Bwl89yfsJY9O7mA nXuv6ALullGk0kp0xrQ7yPPaFXeV9/ReJgDDcBCcXOr0QC+BoJCJcV2BykMMom5/NCMn +jyEkdfpqJjQa9PdXsNHGJmBLpIWjts8GqcQoiO1lGUsERV+aNHv1+IOqHiEbyM6Vkp9 38xs8Yns5ZZbzDitEg9VkE3pDOYa1WbT/ZR8WTNMZNszylDAewehb00RPd3IaDuZHr62 etq/dfMlaQAmhcC0bY/omljjOvHJ6UlGPXWidBfElj1onQ2LyxNmLMweClZvHhKvOe6Y Fs7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PK1DLQmnnjOb69h2hvvX3jewUj0gHU0HSmNfuQkfjl0=; b=uvhI3QRfTqVlXi8aIAl2DIP1KuJ0T5JwRpyGP0AdIcrJm/TFd1HMpCEcP4JRpxVVAw X7Ed3bGyJws8SY2pFVnU16J+XaDu+4HblWurHTnIzw2E2qSOSJsi/gatbEVGcUNhxr7u jKr/dQNrfJlnwP9/AaWaiqHpZuhX62GLLQm3C5d0cE1gVgNIFKlmbEOVXnoXwCCziRHk DgLFxSaK+uhkHu3kKvmWkkjUQzjAau9uhN8NH1IR2rCOBNf1StCOsTdQwiGBiDKhTsYe Kwb1FJB+7PtIYHKLQv7sFiYzhGDw+yFFMJjQOGP5i0rjswLpV3vMhn8rojjFq9V0qou/ o3FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=EedFrXmA; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 197si7594817qke.117.2020.01.14.01.46.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jan 2020 01:46:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=EedFrXmA; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:35458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irIm6-0005ET-KU for alex.bennee@linaro.org; Tue, 14 Jan 2020 04:46:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57938) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irIV5-0007eW-CQ for qemu-arm@nongnu.org; Tue, 14 Jan 2020 04:28:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irIV4-0006ls-7j for qemu-arm@nongnu.org; Tue, 14 Jan 2020 04:28:39 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:47149 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 1irIV4-0006lY-4h for qemu-arm@nongnu.org; Tue, 14 Jan 2020 04:28:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578994117; 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=EedFrXmARYzP7LUXaXIeqRcS6HMzokkb6vPtwEZgg/pKLurPQLdX2H545otWsopjD8D6na Nxomun1lp32FFWrdV1ebAj43MCgBw6w3b+H27qyEURjkBbalYcXocN+sS+k0MD7+JOVNaH xcQe5rGKQ/0HLlpdkYbhewEXAkYs2JQ= 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-269-xrh5nKnYO8GKSsBp1lb5HA-1; Tue, 14 Jan 2020 04:28:36 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7882107ACC4; Tue, 14 Jan 2020 09:28:33 +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 363AD384; Tue, 14 Jan 2020 09:28:29 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 19/29] migration/postcopy: enable random order target page arrival Date: Tue, 14 Jan 2020 10:25:56 +0100 Message-Id: <20200114092606.1761-20-quintela@redhat.com> In-Reply-To: <20200114092606.1761-1-quintela@redhat.com> References: <20200114092606.1761-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: xrh5nKnYO8GKSsBp1lb5HA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII 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: 207.211.31.81 X-BeenThere: qemu-arm@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 , Corey Minyard , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , "Michael S. Tsirkin" , Peter Maydell , Stefan Weil , Jason Wang , Juan Quintela , "Dr. David Alan Gilbert" , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Wei Yang , Marcel Apfelbaum , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , David Gibson , Andrzej Zaborowski , Richard Henderson , Stefan Berger Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: +FAC21Xg8Kbh 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-page= s * 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