From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639564995281116.7336268728867; Wed, 15 Dec 2021 02:43:15 -0800 (PST) Received: from localhost ([::1]:36522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRkg-0000ip-37 for importer@patchew.org; Wed, 15 Dec 2021 05:43:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaP-0002vj-F6 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaM-0007Gk-UH for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-131-IfNzd_a5ONmulE_iFCXJtQ-1; Wed, 15 Dec 2021 05:32:25 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5698410B7440; Wed, 15 Dec 2021 10:32:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 807C275C3A; Wed, 15 Dec 2021 10:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564353; 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=KjiJvbQ1kYdTB1Gdp4xeCCdGswEw1RXIIh3/v03iwhw=; b=AVs22cJ4vJnf+6K+tZlYdDxlJWoNN/jUoZ3mBuiS0eJNG73WiA7SlgfpT6nPIhAAIcsMq7 o9BLodzNYHkmNHO8h6R4JR9QfQJVuV9rD+amtrRJME1I0J6e3jxJ3FUteua1EULAD5t3jk nhTkg7dHRmNlwD6gmT/ik5zhWHS2phM= X-MC-Unique: IfNzd_a5ONmulE_iFCXJtQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 01/18] migration/ram.c: Remove the qemu_mutex_lock in colo_flush_ram_cache. Date: Wed, 15 Dec 2021 11:32:01 +0100 Message-Id: <20211215103218.17527-2-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hailiang Zhang , Juan Quintela , "Rao, Lei" , "Dr. David Alan Gilbert" , Zhang Chen , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639564995982100001 Content-Type: text/plain; charset="utf-8" From: "Rao, Lei" The code to acquire bitmap_mutex is added in the commit of "63268c4970a5f126cc9af75f3ccb8057abef5ec0". There is no need to acquire bitmap_mutex in colo_flush_ram_cache(). This is because the colo_flush_ram_cache only be called on the COLO secondary VM, which is the destination side. On the COLO secondary VM, only the COLO thread will touch the bitmap of ram cache. Signed-off-by: Lei Rao Reviewed-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 863035d235..2c688f5bbb 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3918,7 +3918,6 @@ void colo_flush_ram_cache(void) unsigned long offset =3D 0; =20 memory_global_dirty_log_sync(); - qemu_mutex_lock(&ram_state->bitmap_mutex); WITH_RCU_READ_LOCK_GUARD() { RAMBLOCK_FOREACH_NOT_IGNORED(block) { ramblock_sync_dirty_bitmap(ram_state, block); @@ -3954,7 +3953,6 @@ void colo_flush_ram_cache(void) } } trace_colo_flush_ram_cache_end(); - qemu_mutex_unlock(&ram_state->bitmap_mutex); } =20 /** --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639564935039120.4071922950834; Wed, 15 Dec 2021 02:42:15 -0800 (PST) Received: from localhost ([::1]:34170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRjh-0007RJ-Jg for importer@patchew.org; Wed, 15 Dec 2021 05:42:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaS-0002wb-UJ for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25382) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaN-0007Fl-2p for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-398-GFR2MtgqOT6arD2p9_vzfA-1; Wed, 15 Dec 2021 05:32:26 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FCBF10144E2; Wed, 15 Dec 2021 10:32:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id C077775C43; Wed, 15 Dec 2021 10:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564349; 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=GXYh3BXYfjkwSXcRL10q2u2oY0NqF1S7WpcHiwwxAcY=; b=M3XAWJsJaDAzi82OnPB32xARyzdGyjeh0ZzyRLyXowR9A5kbW/zeOLNhYiCR8sNH95FsaZ Wi1LnOh7JlEbLrnlmee+CDvrhbb3wiXtg03gqBzcKUg8rGXmZg0i9TMkeTefm8vqmAyREX i56l1Tc6q6Po3hbVbz+1d2EU7d3T3XY= X-MC-Unique: GFR2MtgqOT6arD2p9_vzfA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 02/18] migration/colo: More accurate update checkpoint time Date: Wed, 15 Dec 2021 11:32:02 +0100 Message-Id: <20211215103218.17527-3-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Zhang Chen , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639564935875100001 Content-Type: text/plain; charset="utf-8" From: Zhang Chen Previous operation(like vm_start and replication_start_all) will consume extra time before update the timer, so reduce time in this patch. Signed-off-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/colo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 2415325262..c8fadae956 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -530,7 +530,6 @@ static void colo_process_checkpoint(MigrationState *s) { QIOChannelBuffer *bioc; QEMUFile *fb =3D NULL; - int64_t current_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); Error *local_err =3D NULL; int ret; =20 @@ -578,8 +577,8 @@ static void colo_process_checkpoint(MigrationState *s) qemu_mutex_unlock_iothread(); trace_colo_vm_state_change("stop", "run"); =20 - timer_mod(s->colo_delay_timer, - current_time + s->parameters.x_checkpoint_delay); + timer_mod(s->colo_delay_timer, qemu_clock_get_ms(QEMU_CLOCK_HOST) + + s->parameters.x_checkpoint_delay); =20 while (s->state =3D=3D MIGRATION_STATUS_COLO) { if (failover_get_state() !=3D FAILOVER_STATUS_NONE) { --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639564998270202.3998821076559; Wed, 15 Dec 2021 02:43:18 -0800 (PST) Received: from localhost ([::1]:36382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRki-0000dK-Sw for importer@patchew.org; Wed, 15 Dec 2021 05:43:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaO-0002ve-QO for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaM-0007GX-UZ for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-163-gOpvy0PfPGqe4PdLd77aGw-1; Wed, 15 Dec 2021 05:32:29 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9ED9910144E0; Wed, 15 Dec 2021 10:32:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9F2375C3A; Wed, 15 Dec 2021 10:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564352; 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=DkIeKNzahnBYlfvSNTMD6VEokpYIrrRe3YW8hPKtdgY=; b=Dx5M8Vvg5kBRpdXxZsafeDDBit+/392JGV1atdARrQ9y2NFqi080jz9swn+opa6vVoLZZ/ vk2qhi3bHStYpDliOxACn0PLs5bD44C6z8U5oSCTy+tj/B4LdEwaugTkQGxkriLACuvlHo +MSNNfmwCjiz0+vhBthHqVk6d++0I1A= X-MC-Unique: gOpvy0PfPGqe4PdLd77aGw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 03/18] Fixed a QEMU hang when guest poweroff in COLO mode Date: Wed, 15 Dec 2021 11:32:03 +0100 Message-Id: <20211215103218.17527-4-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hailiang Zhang , Juan Quintela , "Rao, Lei" , "Dr. David Alan Gilbert" , Zhang Chen , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565000395100001 Content-Type: text/plain; charset="utf-8" From: "Rao, Lei" When the PVM guest poweroff, the COLO thread may wait a semaphore in colo_process_checkpoint().So, we should wake up the COLO thread before migration shutdown. Signed-off-by: Lei Rao Reviewed-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- include/migration/colo.h | 1 + migration/colo.c | 20 ++++++++++++++++++++ migration/migration.c | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/include/migration/colo.h b/include/migration/colo.h index 768e1f04c3..5fbe1a6d5d 100644 --- a/include/migration/colo.h +++ b/include/migration/colo.h @@ -37,4 +37,5 @@ COLOMode get_colo_mode(void); void colo_do_failover(void); =20 void colo_checkpoint_notify(void *opaque); +void colo_shutdown(void); #endif diff --git a/migration/colo.c b/migration/colo.c index c8fadae956..2a85504966 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -819,6 +819,26 @@ static void colo_wait_handle_message(MigrationIncoming= State *mis, } } =20 +void colo_shutdown(void) +{ + MigrationIncomingState *mis =3D NULL; + MigrationState *s =3D NULL; + + switch (get_colo_mode()) { + case COLO_MODE_PRIMARY: + s =3D migrate_get_current(); + qemu_event_set(&s->colo_checkpoint_event); + qemu_sem_post(&s->colo_exit_sem); + break; + case COLO_MODE_SECONDARY: + mis =3D migration_incoming_get_current(); + qemu_sem_post(&mis->colo_incoming_sem); + break; + default: + break; + } +} + void *colo_process_incoming_thread(void *opaque) { MigrationIncomingState *mis =3D opaque; diff --git a/migration/migration.c b/migration/migration.c index abaf6f9e3d..c0ab86e9a5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -225,6 +225,12 @@ void migration_cancel(const Error *error) =20 void migration_shutdown(void) { + /* + * When the QEMU main thread exit, the COLO thread + * may wait a semaphore. So, we should wakeup the + * COLO thread before migration shutdown. + */ + colo_shutdown(); /* * Cancel the current migration - that will (eventually) * stop the migration using this structure --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639564651499222.7522993060927; Wed, 15 Dec 2021 02:37:31 -0800 (PST) Received: from localhost ([::1]:53912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRf8-0001Ob-7S for importer@patchew.org; Wed, 15 Dec 2021 05:37:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaP-0002vk-F2 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaN-0007Gt-1r for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-KmqLlw4ZOHC0rStgFcfkLg-1; Wed, 15 Dec 2021 05:32:31 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2A80A2F24; Wed, 15 Dec 2021 10:32:30 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13A1A6E978; Wed, 15 Dec 2021 10:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564354; 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=IueGQ5vGsurlSi24esPo3NVJeeyROrP31iJRN0y7JBI=; b=ZwX1NUDWB1LhTc1vn9mUYqeur9O4v/zeu78Gzqyp8NFLsVliTJfjFFsdG2YfWa2h7sLvsS YH8lOLePWa4iedn0jLgbN/VFDCyjDRQaMCjKcLx+B7d8BStrJAq67ZhhHzdSjOLZGxlkIw 3v8YmcCmFZ05lxpGlTj/FUUsQrktgcU= X-MC-Unique: KmqLlw4ZOHC0rStgFcfkLg-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 04/18] migration/colo: Optimize COLO primary node start code path Date: Wed, 15 Dec 2021 11:32:04 +0100 Message-Id: <20211215103218.17527-5-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Zhang Chen , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639564653917100001 Content-Type: text/plain; charset="utf-8" From: Zhang Chen Optimize COLO primary start path from: MIGRATION_STATUS_XXX --> MIGRATION_STATUS_ACTIVE --> MIGRATION_STATUS_COLO = --> MIGRATION_STATUS_COMPLETED To: MIGRATION_STATUS_XXX --> MIGRATION_STATUS_COLO --> MIGRATION_STATUS_COMPLET= ED No need to start primary COLO through "MIGRATION_STATUS_ACTIVE". Signed-off-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/colo.c | 2 -- migration/migration.c | 13 +++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 2a85504966..4a772afe78 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -666,8 +666,6 @@ void migrate_start_colo_process(MigrationState *s) colo_checkpoint_notify, s); =20 qemu_sem_init(&s->colo_exit_sem, 0); - migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_COLO); colo_process_checkpoint(s); qemu_mutex_lock_iothread(); } diff --git a/migration/migration.c b/migration/migration.c index c0ab86e9a5..2c1edb2cb9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3613,12 +3613,7 @@ static void migration_iteration_finish(MigrationStat= e *s) migration_calculate_complete(s); runstate_set(RUN_STATE_POSTMIGRATE); break; - - case MIGRATION_STATUS_ACTIVE: - /* - * We should really assert here, but since it's during - * migration, let's try to reduce the usage of assertions. - */ + case MIGRATION_STATUS_COLO: if (!migrate_colo_enabled()) { error_report("%s: critical error: calling COLO code without " "COLO enabled", __func__); @@ -3628,6 +3623,12 @@ static void migration_iteration_finish(MigrationStat= e *s) * Fixme: we will run VM in COLO no matter its old running state. * After exited COLO, we will keep running. */ + /* Fallthrough */ + case MIGRATION_STATUS_ACTIVE: + /* + * We should really assert here, but since it's during + * migration, let's try to reduce the usage of assertions. + */ s->vm_was_running =3D true; /* Fallthrough */ case MIGRATION_STATUS_FAILED: --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565224741358.3405609731544; Wed, 15 Dec 2021 02:47:04 -0800 (PST) Received: from localhost ([::1]:42820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRoN-000518-Ky for importer@patchew.org; Wed, 15 Dec 2021 05:47:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaS-0002wX-Nu for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:47371) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaP-0007HE-4Y for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-389-W3QkFv4dMZqDtoazhpeJwA-1; Wed, 15 Dec 2021 05:32:33 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 310DC801962; Wed, 15 Dec 2021 10:32:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94E3A6E978; Wed, 15 Dec 2021 10:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564356; 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=0go/oYucwrQb9URjrILXM9UBAkmykahMJxyBmR67KI8=; b=bDtjaqSETG+JEufzX70qukzAnrqH5rSr40+/ZIO7oJ6XNmyNLiBu6YqvfglBMqCSPiyGek bEQKV9fq/r220U3IXdXbc5tXUkER7Q5DEfmYUPxVAmmXNFBhLejb+HMOSLALZRx4bWm5A7 2DiBsKT5kOah64kjhPU9lEXM6aGINAA= X-MC-Unique: W3QkFv4dMZqDtoazhpeJwA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 05/18] migration: Remove is_zero_range() Date: Wed, 15 Dec 2021 11:32:05 +0100 Message-Id: <20211215103218.17527-6-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , Richard Henderson , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565226383100001 Content-Type: text/plain; charset="utf-8" It just calls buffer_is_zero(). Just change the callers. Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson --- migration/ram.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 2c688f5bbb..57efa67f20 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -81,11 +81,6 @@ /* 0x80 is reserved in migration.h start with 0x100 next */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 =20 -static inline bool is_zero_range(uint8_t *p, uint64_t size) -{ - return buffer_is_zero(p, size); -} - XBZRLECacheStats xbzrle_counters; =20 /* struct contains XBZRLE cache and a static page @@ -1180,7 +1175,7 @@ static int save_zero_page_to_file(RAMState *rs, QEMUF= ile *file, uint8_t *p =3D block->host + offset; int len =3D 0; =20 - if (is_zero_range(p, TARGET_PAGE_SIZE)) { + if (buffer_is_zero(p, TARGET_PAGE_SIZE)) { len +=3D save_page_header(rs, file, block, offset | RAM_SAVE_FLAG_= ZERO); qemu_put_byte(file, 0); len +=3D 1; @@ -3367,7 +3362,7 @@ static inline void *colo_cache_from_block_offset(RAMB= lock *block, */ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) { - if (ch !=3D 0 || !is_zero_range(host, size)) { + if (ch !=3D 0 || !buffer_is_zero(host, size)) { memset(host, ch, size); } } --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639564945872240.7544171500108; Wed, 15 Dec 2021 02:42:25 -0800 (PST) Received: from localhost ([::1]:34972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRjs-00088J-R6 for importer@patchew.org; Wed, 15 Dec 2021 05:42:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaV-0002yb-1q for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:47860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaS-0007Hk-Et for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:42 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-495-2nRsaIw4OPuWqEwR-42bvA-1; Wed, 15 Dec 2021 05:32:35 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C75E10144E0; Wed, 15 Dec 2021 10:32:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9986275C43; Wed, 15 Dec 2021 10:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564358; 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=ueqG1EF3qxBlRxx0QWcB94/JCSj03U7TM7FSAKTreEA=; b=Vz7o2Vctxyfr19pWRqnWg5/ybE5CQIlxgPPysqvcbyPWx3ANjfJ/BlCpCnouPZiuqkDLY/ f3wYJWkcJI2SMNfohC/qxBWmH4wfX7xHaua0oQyM4OfWgoNih/i0tyO8EZ2/AF51wKoTBM EWX6sgyM8ktDlmudh4DzNAsupdBaiU0= X-MC-Unique: 2nRsaIw4OPuWqEwR-42bvA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 06/18] dump: Remove is_zero_page() Date: Wed, 15 Dec 2021 11:32:06 +0100 Message-Id: <20211215103218.17527-7-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , Richard Henderson , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639564946982100001 It just calls buffer_is_zero(). Just change the callers. Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Marc-Andr=C3=A9 Lureau --- dump/dump.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index 662d0a62cd..a84d8b1598 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -1293,14 +1293,6 @@ static size_t get_len_buf_out(size_t page_size, uint= 32_t flag_compress) return 0; } =20 -/* - * check if the page is all 0 - */ -static inline bool is_zero_page(const uint8_t *buf, size_t page_size) -{ - return buffer_is_zero(buf, page_size); -} - static void write_dump_pages(DumpState *s, Error **errp) { int ret =3D 0; @@ -1357,7 +1349,7 @@ static void write_dump_pages(DumpState *s, Error **er= rp) */ while (get_next_page(&block_iter, &pfn_iter, &buf, s)) { /* check zero page */ - if (is_zero_page(buf, s->dump_info.page_size)) { + if (buffer_is_zero(buf, s->dump_info.page_size)) { ret =3D write_cache(&page_desc, &pd_zero, sizeof(PageDescripto= r), false); if (ret < 0) { --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565249970438.72626182079193; Wed, 15 Dec 2021 02:47:29 -0800 (PST) Received: from localhost ([::1]:43544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRom-0005bS-UI for importer@patchew.org; Wed, 15 Dec 2021 05:47:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaY-000300-RB for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20368) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaU-0007I6-Ou for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-Ci_qlZg8PYadheY0hl6WBg-1; Wed, 15 Dec 2021 05:32:37 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 446C210B7440; Wed, 15 Dec 2021 10:32:36 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7C1C6E978; Wed, 15 Dec 2021 10:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564360; 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=IbVOmwHr7tIyfVfQFBVLUvLhoZTHq87yY1Kqzu6JrQM=; b=cbBoMFNTp2jWAof5sXEFpkDpUH2J2JTiuH5z2bKnVCrcXRbu84vEBLMECahxnS1cSgHhee o4gRKPDiBprRrs8M/PdnI1f9ES3YwFefim/DlkggtdSefeMponh0lvggbI4Qzhr+ZzY2p7 DZYxnSfu0nTbva241OOLxHsdTMtyGiI= X-MC-Unique: Ci_qlZg8PYadheY0hl6WBg-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 07/18] multifd: Delete useless operation Date: Wed, 15 Dec 2021 11:32:07 +0100 Message-Id: <20211215103218.17527-8-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565251537100001 Content-Type: text/plain; charset="utf-8" We are dividing by page_size to multiply again in the only use. Once there, improve the comments. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd-zlib.c | 13 ++++--------- migration/multifd-zstd.c | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index ab4ba75d75..3fc7813b44 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -42,7 +42,6 @@ struct zlib_data { */ static int zlib_send_setup(MultiFDSendParams *p, Error **errp) { - uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); struct zlib_data *z =3D g_malloc0(sizeof(struct zlib_data)); z_stream *zs =3D &z->zs; =20 @@ -54,9 +53,8 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **= errp) error_setg(errp, "multifd %d: deflate init failed", p->id); return -1; } - /* We will never have more than page_count pages */ - z->zbuff_len =3D page_count * qemu_target_page_size(); - z->zbuff_len *=3D 2; + /* To be safe, we reserve twice the size of the packet */ + z->zbuff_len =3D MULTIFD_PACKET_SIZE * 2; z->zbuff =3D g_try_malloc(z->zbuff_len); if (!z->zbuff) { deflateEnd(&z->zs); @@ -180,7 +178,6 @@ static int zlib_send_write(MultiFDSendParams *p, uint32= _t used, Error **errp) */ static int zlib_recv_setup(MultiFDRecvParams *p, Error **errp) { - uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); struct zlib_data *z =3D g_malloc0(sizeof(struct zlib_data)); z_stream *zs =3D &z->zs; =20 @@ -194,10 +191,8 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error= **errp) error_setg(errp, "multifd %d: inflate init failed", p->id); return -1; } - /* We will never have more than page_count pages */ - z->zbuff_len =3D page_count * qemu_target_page_size(); - /* We know compression "could" use more space */ - z->zbuff_len *=3D 2; + /* To be safe, we reserve twice the size of the packet */ + z->zbuff_len =3D MULTIFD_PACKET_SIZE * 2; z->zbuff =3D g_try_malloc(z->zbuff_len); if (!z->zbuff) { inflateEnd(zs); diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 693bddf8c9..cc3b8869c0 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -47,7 +47,6 @@ struct zstd_data { */ static int zstd_send_setup(MultiFDSendParams *p, Error **errp) { - uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); struct zstd_data *z =3D g_new0(struct zstd_data, 1); int res; =20 @@ -67,9 +66,8 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **= errp) p->id, ZSTD_getErrorName(res)); return -1; } - /* We will never have more than page_count pages */ - z->zbuff_len =3D page_count * qemu_target_page_size(); - z->zbuff_len *=3D 2; + /* To be safe, we reserve twice the size of the packet */ + z->zbuff_len =3D MULTIFD_PACKET_SIZE * 2; z->zbuff =3D g_try_malloc(z->zbuff_len); if (!z->zbuff) { ZSTD_freeCStream(z->zcs); @@ -191,7 +189,6 @@ static int zstd_send_write(MultiFDSendParams *p, uint32= _t used, Error **errp) */ static int zstd_recv_setup(MultiFDRecvParams *p, Error **errp) { - uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); struct zstd_data *z =3D g_new0(struct zstd_data, 1); int ret; =20 @@ -212,10 +209,8 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error= **errp) return -1; } =20 - /* We will never have more than page_count pages */ - z->zbuff_len =3D page_count * qemu_target_page_size(); - /* We know compression "could" use more space */ - z->zbuff_len *=3D 2; + /* To be safe, we reserve twice the size of the packet */ + z->zbuff_len =3D MULTIFD_PACKET_SIZE * 2; z->zbuff =3D g_try_malloc(z->zbuff_len); if (!z->zbuff) { ZSTD_freeDStream(z->zds); --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565281326728.4031429117352; Wed, 15 Dec 2021 02:48:01 -0800 (PST) Received: from localhost ([::1]:45194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRpI-0006jE-CD for importer@patchew.org; Wed, 15 Dec 2021 05:48:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaY-000302-Vd for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaV-0007IM-DV for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-459-mPOTDhbkOjiHdLyTs_j93w-1; Wed, 15 Dec 2021 05:32:39 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 164772F26; Wed, 15 Dec 2021 10:32:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADF6C6E978; Wed, 15 Dec 2021 10:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564362; 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=83Nyt1xN9XS4EHXfa4JfvSiSEFSSYn6/kwqYqVADLiA=; b=Ee4U4UKrMsvZnAus4FVGawZOLXVAuSyhM5lABR11CxUsDf0EBFb5v+ZSikhgwtYTZz6KGz 9ODTqJUlwH9hOc9olp1wSTUcru6NUbClb1hO3TzZdOrKKSbWxWQ1FJ2RachFJFw8PXArKG w/IG3YlIit9r6i7uLOO1XPJSlMnZeq0= X-MC-Unique: mPOTDhbkOjiHdLyTs_j93w-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 08/18] migration: Never call twice qemu_target_page_size() Date: Wed, 15 Dec 2021 11:32:08 +0100 Message-Id: <20211215103218.17527-9-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565281838100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 7 ++++--- migration/multifd.c | 7 ++++--- migration/savevm.c | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2c1edb2cb9..3de11ae921 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -996,6 +996,8 @@ static void populate_time_info(MigrationInfo *info, Mig= rationState *s) =20 static void populate_ram_info(MigrationInfo *info, MigrationState *s) { + size_t page_size =3D qemu_target_page_size(); + info->has_ram =3D true; info->ram =3D g_malloc0(sizeof(*info->ram)); info->ram->transferred =3D ram_counters.transferred; @@ -1004,12 +1006,11 @@ static void populate_ram_info(MigrationInfo *info, = MigrationState *s) /* legacy value. It is not used anymore */ info->ram->skipped =3D 0; info->ram->normal =3D ram_counters.normal; - info->ram->normal_bytes =3D ram_counters.normal * - qemu_target_page_size(); + info->ram->normal_bytes =3D ram_counters.normal * page_size; info->ram->mbps =3D s->mbps; info->ram->dirty_sync_count =3D ram_counters.dirty_sync_count; info->ram->postcopy_requests =3D ram_counters.postcopy_requests; - info->ram->page_size =3D qemu_target_page_size(); + info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D ram_counters.multifd_bytes; info->ram->pages_per_second =3D s->pages_per_second; =20 diff --git a/migration/multifd.c b/migration/multifd.c index 7c9deb1921..8125d0015c 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -289,7 +289,8 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) { MultiFDPacket_t *packet =3D p->packet; - uint32_t pages_max =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); + size_t page_size =3D qemu_target_page_size(); + uint32_t pages_max =3D MULTIFD_PACKET_SIZE / page_size; RAMBlock *block; int i; =20 @@ -358,14 +359,14 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) for (i =3D 0; i < p->pages->used; i++) { uint64_t offset =3D be64_to_cpu(packet->offset[i]); =20 - if (offset > (block->used_length - qemu_target_page_size())) { + if (offset > (block->used_length - page_size)) { error_setg(errp, "multifd: offset too long %" PRIu64 " (max " RAM_ADDR_FMT ")", offset, block->used_length); return -1; } p->pages->iov[i].iov_base =3D block->host + offset; - p->pages->iov[i].iov_len =3D qemu_target_page_size(); + p->pages->iov[i].iov_len =3D page_size; } =20 return 0; diff --git a/migration/savevm.c b/migration/savevm.c index d59e976d50..0bef031acb 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1685,6 +1685,7 @@ static int loadvm_postcopy_handle_advise(MigrationInc= omingState *mis, { PostcopyState ps =3D postcopy_state_set(POSTCOPY_INCOMING_ADVISE); uint64_t remote_pagesize_summary, local_pagesize_summary, remote_tps; + size_t page_size =3D qemu_target_page_size(); Error *local_err =3D NULL; =20 trace_loadvm_postcopy_handle_advise(); @@ -1741,13 +1742,13 @@ static int loadvm_postcopy_handle_advise(MigrationI= ncomingState *mis, } =20 remote_tps =3D qemu_get_be64(mis->from_src_file); - if (remote_tps !=3D qemu_target_page_size()) { + if (remote_tps !=3D page_size) { /* * Again, some differences could be dealt with, but for now keep it * simple. */ error_report("Postcopy needs matching target page sizes (s=3D%d d= =3D%zd)", - (int)remote_tps, qemu_target_page_size()); + (int)remote_tps, page_size); return -1; } =20 --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565481642152.6502403759348; Wed, 15 Dec 2021 02:51:21 -0800 (PST) Received: from localhost ([::1]:51480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRsT-0002UP-KZ for importer@patchew.org; Wed, 15 Dec 2021 05:51:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaa-00030y-LD for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaU-0007II-Pg for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-496-m0kqDmLAMNmHR8sAXraZ1A-1; Wed, 15 Dec 2021 05:32:41 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E381D81EE60; Wed, 15 Dec 2021 10:32:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81E2675C43; Wed, 15 Dec 2021 10:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564362; 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=R4g+3IEiOMGf55PC4liRJcmPZg3x0gk4LK6azaVT3Eg=; b=OYyXmyw8kEO3YrX9Vz7UPdd738baa+VKrrRMONGCp9ww/rWJGGGOuq5OK18wxb7QibbgVm 2M9U9KXbO5u4Pi8o3KbseRY32QRnWzZHcrFTsnTCmg8th1TA33rzSJ9oV8YtDuSApdEiGA dQe0pL1Sbtk2ZahpVc/2m94B4GqXFrs= X-MC-Unique: m0kqDmLAMNmHR8sAXraZ1A-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 09/18] multifd: Rename used field to num Date: Wed, 15 Dec 2021 11:32:09 +0100 Message-Id: <20211215103218.17527-10-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565482307100001 Content-Type: text/plain; charset="utf-8" We will need to split it later in zero_num (number of zero pages) and normal_num (number of normal pages). This name is better. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.h | 2 +- migration/multifd.c | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 15c50ca0b2..86820dd028 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -55,7 +55,7 @@ typedef struct { =20 typedef struct { /* number of used pages */ - uint32_t used; + uint32_t num; /* number of allocated pages */ uint32_t allocated; /* global number of generated multifd packets */ diff --git a/migration/multifd.c b/migration/multifd.c index 8125d0015c..8ea86d81dc 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -252,7 +252,7 @@ static MultiFDPages_t *multifd_pages_init(size_t size) =20 static void multifd_pages_clear(MultiFDPages_t *pages) { - pages->used =3D 0; + pages->num =3D 0; pages->allocated =3D 0; pages->packet_num =3D 0; pages->block =3D NULL; @@ -270,7 +270,7 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) =20 packet->flags =3D cpu_to_be32(p->flags); packet->pages_alloc =3D cpu_to_be32(p->pages->allocated); - packet->pages_used =3D cpu_to_be32(p->pages->used); + packet->pages_used =3D cpu_to_be32(p->pages->num); packet->next_packet_size =3D cpu_to_be32(p->next_packet_size); packet->packet_num =3D cpu_to_be64(p->packet_num); =20 @@ -278,7 +278,7 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) strncpy(packet->ramblock, p->pages->block->idstr, 256); } =20 - for (i =3D 0; i < p->pages->used; i++) { + for (i =3D 0; i < p->pages->num; i++) { /* there are architectures where ram_addr_t is 32 bit */ uint64_t temp =3D p->pages->offset[i]; =20 @@ -332,18 +332,18 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) p->pages =3D multifd_pages_init(packet->pages_alloc); } =20 - p->pages->used =3D be32_to_cpu(packet->pages_used); - if (p->pages->used > packet->pages_alloc) { + p->pages->num =3D be32_to_cpu(packet->pages_used); + if (p->pages->num > packet->pages_alloc) { error_setg(errp, "multifd: received packet " "with %d pages and expected maximum pages are %d", - p->pages->used, packet->pages_alloc) ; + p->pages->num, packet->pages_alloc) ; return -1; } =20 p->next_packet_size =3D be32_to_cpu(packet->next_packet_size); p->packet_num =3D be64_to_cpu(packet->packet_num); =20 - if (p->pages->used =3D=3D 0) { + if (p->pages->num =3D=3D 0) { return 0; } =20 @@ -356,7 +356,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) return -1; } =20 - for (i =3D 0; i < p->pages->used; i++) { + for (i =3D 0; i < p->pages->num; i++) { uint64_t offset =3D be64_to_cpu(packet->offset[i]); =20 if (offset > (block->used_length - page_size)) { @@ -443,13 +443,13 @@ static int multifd_send_pages(QEMUFile *f) } qemu_mutex_unlock(&p->mutex); } - assert(!p->pages->used); + assert(!p->pages->num); assert(!p->pages->block); =20 p->packet_num =3D multifd_send_state->packet_num++; multifd_send_state->pages =3D p->pages; p->pages =3D pages; - transferred =3D ((uint64_t) pages->used) * qemu_target_page_size() + transferred =3D ((uint64_t) pages->num) * qemu_target_page_size() + p->packet_len; qemu_file_update_transfer(f, transferred); ram_counters.multifd_bytes +=3D transferred; @@ -469,12 +469,12 @@ int multifd_queue_page(QEMUFile *f, RAMBlock *block, = ram_addr_t offset) } =20 if (pages->block =3D=3D block) { - pages->offset[pages->used] =3D offset; - pages->iov[pages->used].iov_base =3D block->host + offset; - pages->iov[pages->used].iov_len =3D qemu_target_page_size(); - pages->used++; + pages->offset[pages->num] =3D offset; + pages->iov[pages->num].iov_base =3D block->host + offset; + pages->iov[pages->num].iov_len =3D qemu_target_page_size(); + pages->num++; =20 - if (pages->used < pages->allocated) { + if (pages->num < pages->allocated) { return 1; } } @@ -586,7 +586,7 @@ void multifd_send_sync_main(QEMUFile *f) if (!migrate_use_multifd()) { return; } - if (multifd_send_state->pages->used) { + if (multifd_send_state->pages->num) { if (multifd_send_pages(f) < 0) { error_report("%s: multifd_send_pages fail", __func__); return; @@ -649,7 +649,7 @@ static void *multifd_send_thread(void *opaque) qemu_mutex_lock(&p->mutex); =20 if (p->pending_job) { - uint32_t used =3D p->pages->used; + uint32_t used =3D p->pages->num; uint64_t packet_num =3D p->packet_num; flags =3D p->flags; =20 @@ -665,7 +665,7 @@ static void *multifd_send_thread(void *opaque) p->flags =3D 0; p->num_packets++; p->num_pages +=3D used; - p->pages->used =3D 0; + p->pages->num =3D 0; p->pages->block =3D NULL; qemu_mutex_unlock(&p->mutex); =20 @@ -1091,7 +1091,7 @@ static void *multifd_recv_thread(void *opaque) break; } =20 - used =3D p->pages->used; + used =3D p->pages->num; flags =3D p->flags; /* recv methods don't know how to handle the SYNC flag */ p->flags &=3D ~MULTIFD_FLAG_SYNC; --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565550785471.64436795044196; Wed, 15 Dec 2021 02:52:30 -0800 (PST) Received: from localhost ([::1]:53764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRtd-000498-Ok for importer@patchew.org; Wed, 15 Dec 2021 05:52:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRae-00035C-NM for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRac-0007L9-8y for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:51 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-351-Y5Yod4D8MkqVLcE54pUqmw-1; Wed, 15 Dec 2021 05:32:46 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83686190A7A0; Wed, 15 Dec 2021 10:32:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 599AF6E978; Wed, 15 Dec 2021 10:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564369; 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=Wsfxd9XwcRU5pI+YwEZgrYoeYMg68pl5ZZXO9chqf0U=; b=QOi+zXHloK37vUTPQTWNyh6AEaB0+4iFUJHrWGCjirYxWd+plQIfENHyVg4QFEGGxdZhoQ ioi7eEdB11Y0uM0GPi0l1dMmTA4NYg/vxQZJbl/6Wztiv8I9l5uumijxsP15fZoBAUFPNl taZIWDVVXRwgpVekdmRjUqQ/kk2pPk0= X-MC-Unique: Y5Yod4D8MkqVLcE54pUqmw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 10/18] multifd: Add missing documention Date: Wed, 15 Dec 2021 11:32:10 +0100 Message-Id: <20211215103218.17527-11-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565551865100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd-zlib.c | 2 ++ migration/multifd-zstd.c | 2 ++ migration/multifd.c | 1 + 3 files changed, 5 insertions(+) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 3fc7813b44..d0437cce2a 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -72,6 +72,7 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **= errp) * Close the channel and return memory. * * @p: Params for the channel that we are using + * @errp: pointer to an error */ static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp) { @@ -94,6 +95,7 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error= **errp) * * @p: Params for the channel that we are using * @used: number of pages used + * @errp: pointer to an error */ static int zlib_send_prepare(MultiFDSendParams *p, uint32_t used, Error **= errp) { diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index cc3b8869c0..09ae1cf91a 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -84,6 +84,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **= errp) * Close the channel and return memory. * * @p: Params for the channel that we are using + * @errp: pointer to an error */ static void zstd_send_cleanup(MultiFDSendParams *p, Error **errp) { @@ -107,6 +108,7 @@ static void zstd_send_cleanup(MultiFDSendParams *p, Err= or **errp) * * @p: Params for the channel that we are using * @used: number of pages used + * @errp: pointer to an error */ static int zstd_send_prepare(MultiFDSendParams *p, uint32_t used, Error **= errp) { diff --git a/migration/multifd.c b/migration/multifd.c index 8ea86d81dc..cdeffdc4c5 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -66,6 +66,7 @@ static int nocomp_send_setup(MultiFDSendParams *p, Error = **errp) * For no compression this function does nothing. * * @p: Params for the channel that we are using + * @errp: pointer to an error */ static void nocomp_send_cleanup(MultiFDSendParams *p, Error **errp) { --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565549841526.1000459997406; Wed, 15 Dec 2021 02:52:29 -0800 (PST) Received: from localhost ([::1]:53712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRtZ-00045k-Ib for importer@patchew.org; Wed, 15 Dec 2021 05:52:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRag-00037t-78 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRae-0007Lf-Eg for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-207-QSNE8O6PMhql9cMsj-OcuA-1; Wed, 15 Dec 2021 05:32:48 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76E062F24; Wed, 15 Dec 2021 10:32:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED8936E978; Wed, 15 Dec 2021 10:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564371; 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=PtGbWq8/i50EHzu6nLuJuJMQ4jNbQjwizm+6bN5WzsA=; b=h/iU0F9UWw4IcUDbp8NiXMbEpjp7wvrzVb8ekYMGxJlal4sWE+hRSj5vKr5XSkhae7lj4n FJL8hcFQrTmRhwAJCbB5+JdVZ+C6lOpgt6I4H+UYZfCmgb/epl4oZCG2Q/M+JNLz22+/TZ nO3JfsZk7MvmplUr6NdxWqGlUms7DuA= X-MC-Unique: QSNE8O6PMhql9cMsj-OcuA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 11/18] multifd: The variable is only used inside the loop Date: Wed, 15 Dec 2021 11:32:11 +0100 Message-Id: <20211215103218.17527-12-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565551811100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index cdeffdc4c5..ce7101cf9d 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -629,7 +629,6 @@ static void *multifd_send_thread(void *opaque) MultiFDSendParams *p =3D opaque; Error *local_err =3D NULL; int ret =3D 0; - uint32_t flags =3D 0; =20 trace_multifd_send_thread_start(p->id); rcu_register_thread(); @@ -652,7 +651,7 @@ static void *multifd_send_thread(void *opaque) if (p->pending_job) { uint32_t used =3D p->pages->num; uint64_t packet_num =3D p->packet_num; - flags =3D p->flags; + uint32_t flags =3D p->flags; =20 if (used) { ret =3D multifd_send_state->ops->send_prepare(p, used, --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16395657551881001.1593620866462; Wed, 15 Dec 2021 02:55:55 -0800 (PST) Received: from localhost ([::1]:60086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRwv-0008W1-OO for importer@patchew.org; Wed, 15 Dec 2021 05:55:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRah-0003BD-5d for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRae-0007Lg-Jb for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:54 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-472-yRO-aamSOUaESOGMZ4wccA-1; Wed, 15 Dec 2021 05:32:50 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8018610B746C; Wed, 15 Dec 2021 10:32:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFF0175C3A; Wed, 15 Dec 2021 10:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564371; 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=M0pW74mhSgrbVnTUskeNXsbBjcf0KjB6mo8YwJBethg=; b=bJBOWHNHUxydGYALOwrGK85DNQ68H+IWgYKpH8B3iAbQFMN9FgJY4qYfRJ+r+kw9dSxA5w KZlQW7ksa1IpDoAiB8v8LJGmOk/V4lfUC8aTYsYQYsCRjkRCBWTKCJkWziQOGY5kFn12jw vCsC6htJgyd9e8K1WY4hqzP2IW+2dEg= X-MC-Unique: yRO-aamSOUaESOGMZ4wccA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 12/18] multifd: remove used parameter from send_prepare() method Date: Wed, 15 Dec 2021 11:32:12 +0100 Message-Id: <20211215103218.17527-13-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565756857100001 Content-Type: text/plain; charset="utf-8" It is already there as p->pages->num. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.h | 2 +- migration/multifd-zlib.c | 7 +++---- migration/multifd-zstd.c | 7 +++---- migration/multifd.c | 9 +++------ 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 86820dd028..7968cc5c20 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -159,7 +159,7 @@ typedef struct { /* Cleanup for sending side */ void (*send_cleanup)(MultiFDSendParams *p, Error **errp); /* Prepare the send packet */ - int (*send_prepare)(MultiFDSendParams *p, uint32_t used, Error **errp); + int (*send_prepare)(MultiFDSendParams *p, Error **errp); /* Write the send packet */ int (*send_write)(MultiFDSendParams *p, uint32_t used, Error **errp); /* Setup for receiving side */ diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index d0437cce2a..28f0ed933b 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -94,10 +94,9 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Erro= r **errp) * Returns 0 for success or -1 for error * * @p: Params for the channel that we are using - * @used: number of pages used * @errp: pointer to an error */ -static int zlib_send_prepare(MultiFDSendParams *p, uint32_t used, Error **= errp) +static int zlib_send_prepare(MultiFDSendParams *p, Error **errp) { struct iovec *iov =3D p->pages->iov; struct zlib_data *z =3D p->data; @@ -106,11 +105,11 @@ static int zlib_send_prepare(MultiFDSendParams *p, ui= nt32_t used, Error **errp) int ret; uint32_t i; =20 - for (i =3D 0; i < used; i++) { + for (i =3D 0; i < p->pages->num; i++) { uint32_t available =3D z->zbuff_len - out_size; int flush =3D Z_NO_FLUSH; =20 - if (i =3D=3D used - 1) { + if (i =3D=3D p->pages->num - 1) { flush =3D Z_SYNC_FLUSH; } =20 diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 09ae1cf91a..4a71e96e06 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -107,10 +107,9 @@ static void zstd_send_cleanup(MultiFDSendParams *p, Er= ror **errp) * Returns 0 for success or -1 for error * * @p: Params for the channel that we are using - * @used: number of pages used * @errp: pointer to an error */ -static int zstd_send_prepare(MultiFDSendParams *p, uint32_t used, Error **= errp) +static int zstd_send_prepare(MultiFDSendParams *p, Error **errp) { struct iovec *iov =3D p->pages->iov; struct zstd_data *z =3D p->data; @@ -121,10 +120,10 @@ static int zstd_send_prepare(MultiFDSendParams *p, ui= nt32_t used, Error **errp) z->out.size =3D z->zbuff_len; z->out.pos =3D 0; =20 - for (i =3D 0; i < used; i++) { + for (i =3D 0; i < p->pages->num; i++) { ZSTD_EndDirective flush =3D ZSTD_e_continue; =20 - if (i =3D=3D used - 1) { + if (i =3D=3D p->pages->num - 1) { flush =3D ZSTD_e_flush; } z->in.src =3D iov[i].iov_base; diff --git a/migration/multifd.c b/migration/multifd.c index ce7101cf9d..098ef8842c 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -82,13 +82,11 @@ static void nocomp_send_cleanup(MultiFDSendParams *p, E= rror **errp) * Returns 0 for success or -1 for error * * @p: Params for the channel that we are using - * @used: number of pages used * @errp: pointer to an error */ -static int nocomp_send_prepare(MultiFDSendParams *p, uint32_t used, - Error **errp) +static int nocomp_send_prepare(MultiFDSendParams *p, Error **errp) { - p->next_packet_size =3D used * qemu_target_page_size(); + p->next_packet_size =3D p->pages->num * qemu_target_page_size(); p->flags |=3D MULTIFD_FLAG_NOCOMP; return 0; } @@ -654,8 +652,7 @@ static void *multifd_send_thread(void *opaque) uint32_t flags =3D p->flags; =20 if (used) { - ret =3D multifd_send_state->ops->send_prepare(p, used, - &local_err); + ret =3D multifd_send_state->ops->send_prepare(p, &local_er= r); if (ret !=3D 0) { qemu_mutex_unlock(&p->mutex); break; --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565950309591.2771256379593; Wed, 15 Dec 2021 02:59:10 -0800 (PST) Received: from localhost ([::1]:40490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxS05-00061X-3w for importer@patchew.org; Wed, 15 Dec 2021 05:59:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRai-0003H8-Pb for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29323) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRag-0007M5-C7 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-177-6WmZi4SEOzqi3r5CrQqj5Q-1; Wed, 15 Dec 2021 05:32:52 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52300801AAB; Wed, 15 Dec 2021 10:32:51 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id E91616E978; Wed, 15 Dec 2021 10:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564373; 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=10+DysgOrKDZbsbOgXRalWWGqN4Ng+02P1nZlvqavF4=; b=NTq4dIzVYC+iGxQMmrfhIGef27BxGdSsQhkRogIzr7ZJKrySXJoC4s9SMXG07tzaLwWRHz /ndVUTIVcA7IqeBD483CwORKahwYtUQAKwM4dgqHIQS45ORZUCJcbNh8tNJrgwW4W/hwlM dM7NHYrMDXAOkjHofSlf5qi83EkaRUk= X-MC-Unique: 6WmZi4SEOzqi3r5CrQqj5Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 13/18] multifd: remove used parameter from send_recv_pages() method Date: Wed, 15 Dec 2021 11:32:13 +0100 Message-Id: <20211215103218.17527-14-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565950766100001 Content-Type: text/plain; charset="utf-8" It is already there as p->pages->num. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.h | 2 +- migration/multifd-zlib.c | 9 ++++----- migration/multifd-zstd.c | 7 +++---- migration/multifd.c | 7 +++---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 7968cc5c20..e57adc783b 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -167,7 +167,7 @@ typedef struct { /* Cleanup for receiving side */ void (*recv_cleanup)(MultiFDRecvParams *p); /* Read all pages */ - int (*recv_pages)(MultiFDRecvParams *p, uint32_t used, Error **errp); + int (*recv_pages)(MultiFDRecvParams *p, Error **errp); } MultiFDMethods; =20 void multifd_register_ops(int method, MultiFDMethods *ops); diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 28f0ed933b..e85ef8824d 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -230,17 +230,16 @@ static void zlib_recv_cleanup(MultiFDRecvParams *p) * Returns 0 for success or -1 for error * * @p: Params for the channel that we are using - * @used: number of pages used * @errp: pointer to an error */ -static int zlib_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **er= rp) +static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp) { struct zlib_data *z =3D p->data; z_stream *zs =3D &z->zs; uint32_t in_size =3D p->next_packet_size; /* we measure the change of total_out */ uint32_t out_size =3D zs->total_out; - uint32_t expected_size =3D used * qemu_target_page_size(); + uint32_t expected_size =3D p->pages->num * qemu_target_page_size(); uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; int ret; int i; @@ -259,12 +258,12 @@ static int zlib_recv_pages(MultiFDRecvParams *p, uint= 32_t used, Error **errp) zs->avail_in =3D in_size; zs->next_in =3D z->zbuff; =20 - for (i =3D 0; i < used; i++) { + for (i =3D 0; i < p->pages->num; i++) { struct iovec *iov =3D &p->pages->iov[i]; int flush =3D Z_NO_FLUSH; unsigned long start =3D zs->total_out; =20 - if (i =3D=3D used - 1) { + if (i =3D=3D p->pages->num - 1) { flush =3D Z_SYNC_FLUSH; } =20 diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 4a71e96e06..a8b104f4ee 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -250,14 +250,13 @@ static void zstd_recv_cleanup(MultiFDRecvParams *p) * Returns 0 for success or -1 for error * * @p: Params for the channel that we are using - * @used: number of pages used * @errp: pointer to an error */ -static int zstd_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **er= rp) +static int zstd_recv_pages(MultiFDRecvParams *p, Error **errp) { uint32_t in_size =3D p->next_packet_size; uint32_t out_size =3D 0; - uint32_t expected_size =3D used * qemu_target_page_size(); + uint32_t expected_size =3D p->pages->num * qemu_target_page_size(); uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; struct zstd_data *z =3D p->data; int ret; @@ -278,7 +277,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, uint32= _t used, Error **errp) z->in.size =3D in_size; z->in.pos =3D 0; =20 - for (i =3D 0; i < used; i++) { + for (i =3D 0; i < p->pages->num; i++) { struct iovec *iov =3D &p->pages->iov[i]; =20 z->out.dst =3D iov->iov_base; diff --git a/migration/multifd.c b/migration/multifd.c index 098ef8842c..55d99a8232 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -141,10 +141,9 @@ static void nocomp_recv_cleanup(MultiFDRecvParams *p) * Returns 0 for success or -1 for error * * @p: Params for the channel that we are using - * @used: number of pages used * @errp: pointer to an error */ -static int nocomp_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **= errp) +static int nocomp_recv_pages(MultiFDRecvParams *p, Error **errp) { uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; =20 @@ -153,7 +152,7 @@ static int nocomp_recv_pages(MultiFDRecvParams *p, uint= 32_t used, Error **errp) p->id, flags, MULTIFD_FLAG_NOCOMP); return -1; } - return qio_channel_readv_all(p->c, p->pages->iov, used, errp); + return qio_channel_readv_all(p->c, p->pages->iov, p->pages->num, errp); } =20 static MultiFDMethods multifd_nocomp_ops =3D { @@ -1099,7 +1098,7 @@ static void *multifd_recv_thread(void *opaque) qemu_mutex_unlock(&p->mutex); =20 if (used) { - ret =3D multifd_recv_state->ops->recv_pages(p, used, &local_er= r); + ret =3D multifd_recv_state->ops->recv_pages(p, &local_err); if (ret !=3D 0) { break; } --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565506439468.1508669313977; Wed, 15 Dec 2021 02:51:46 -0800 (PST) Received: from localhost ([::1]:52226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRsv-0002zw-8r for importer@patchew.org; Wed, 15 Dec 2021 05:51:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRaj-0003LI-TR for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRai-0007MU-2h for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:32:57 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-315-OAaH8pm5On6lRNEJz3JO-Q-1; Wed, 15 Dec 2021 05:32:54 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 256852F24; Wed, 15 Dec 2021 10:32:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCFF76E978; Wed, 15 Dec 2021 10:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564375; 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=B4waSI4gV6dbjnmMNF5mGnkKzgxhUaslyVOMARJOIZ4=; b=FPGxm+tD6D/AdIiWCWXGCQyp5i2ica4Xy+rik9q2Hlt5ceY55A8Irod0KdeAHaAQZeP8YA fW9ZS0nc3YS5IEyJUcxaEzPNQ2eU63/6QhlVAIG8fAwex/G6zND+YBOgDv85R6bsddQ/pn yav9U4BqCt1+uk5cEWMzHfuDd+Rdh4o= X-MC-Unique: OAaH8pm5On6lRNEJz3JO-Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 14/18] multifd: Fill offset and block for reception Date: Wed, 15 Dec 2021 11:32:14 +0100 Message-Id: <20211215103218.17527-15-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565507307100001 Content-Type: text/plain; charset="utf-8" We were using the iov directly, but we will need this info on the following patch. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/multifd.c b/migration/multifd.c index 55d99a8232..0533da154a 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -354,6 +354,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) return -1; } =20 + p->pages->block =3D block; for (i =3D 0; i < p->pages->num; i++) { uint64_t offset =3D be64_to_cpu(packet->offset[i]); =20 @@ -363,6 +364,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) offset, block->used_length); return -1; } + p->pages->offset[i] =3D offset; p->pages->iov[i].iov_base =3D block->host + offset; p->pages->iov[i].iov_len =3D page_size; } --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565840925754.7934211810312; Wed, 15 Dec 2021 02:57:20 -0800 (PST) Received: from localhost ([::1]:33926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRyJ-0001ay-Vk for importer@patchew.org; Wed, 15 Dec 2021 05:57:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRam-0003WR-Gl for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRak-0007Mz-M8 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-336-xgo_WzOWOL60z_pGO-nNTw-1; Wed, 15 Dec 2021 05:32:56 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62D282F24; Wed, 15 Dec 2021 10:32:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CFC26E978; Wed, 15 Dec 2021 10:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564378; 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=wEk5ki/Zqr2hQYrP9l+vRms1pIDftUSqOYPfd7Z5i18=; b=H/mqxBicJrrFNrRDH5yfHRLwXKDi974OtlKDuTYMJxO66cuxN/Qm4LX6mxajZlykhRJI1w 1Tz3mwIJXumkuyjDnF+SZJ5kMtNgM/waMUyFkFlLvzGQ9WxEbHVnyUV6N0FvoDX6oRJcPA heWX2mbT2SBA4IinpXREezKF0a1C1tE= X-MC-Unique: xgo_WzOWOL60z_pGO-nNTw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 15/18] multifd: Shut down the QIO channels to avoid blocking the send threads when they are terminated. Date: Wed, 15 Dec 2021 11:32:15 +0100 Message-Id: <20211215103218.17527-16-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Zhang , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Hailiang Zhang , Juan Quintela , "Dr. David Alan Gilbert" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565841351100001 From: Li Zhang When doing live migration with multifd channels 8, 16 or larger number, the guest hangs in the presence of the network errors such as missing TCP A= CKs. At sender's side: The main thread is blocked on qemu_thread_join, migration_fd_cleanup is called because one thread fails on qio_channel_write_all when the network problem happens and other send threads are blocked on sendmsg. They could not be terminated. So the main thread is blocked on qemu_thread_= join to wait for the threads terminated. (gdb) bt 0 0x00007f30c8dcffc0 in __pthread_clockjoin_ex () at /lib64/libpthread.so.0 1 0x000055cbb716084b in qemu_thread_join (thread=3D0x55cbb881f418) at ../u= til/qemu-thread-posix.c:627 2 0x000055cbb6b54e40 in multifd_save_cleanup () at ../migration/multifd.c:= 542 3 0x000055cbb6b4de06 in migrate_fd_cleanup (s=3D0x55cbb8024000) at ../migr= ation/migration.c:1808 4 0x000055cbb6b4dfb4 in migrate_fd_cleanup_bh (opaque=3D0x55cbb8024000) at= ../migration/migration.c:1850 5 0x000055cbb7173ac1 in aio_bh_call (bh=3D0x55cbb7eb98e0) at ../util/async= .c:141 6 0x000055cbb7173bcb in aio_bh_poll (ctx=3D0x55cbb7ebba80) at ../util/asyn= c.c:169 7 0x000055cbb715ba4b in aio_dispatch (ctx=3D0x55cbb7ebba80) at ../util/aio= -posix.c:381 8 0x000055cbb7173ffe in aio_ctx_dispatch (source=3D0x55cbb7ebba80, callbac= k=3D0x0, user_data=3D0x0) at ../util/async.c:311 9 0x00007f30c9c8cdf4 in g_main_context_dispatch () at /usr/lib64/libglib-2= .0.so.0 10 0x000055cbb71851a2 in glib_pollfds_poll () at ../util/main-loop.c:232 11 0x000055cbb718521c in os_host_main_loop_wait (timeout=3D42251070366) at = ../util/main-loop.c:255 12 0x000055cbb7185321 in main_loop_wait (nonblocking=3D0) at ../util/main-l= oop.c:531 13 0x000055cbb6e6ba27 in qemu_main_loop () at ../softmmu/runstate.c:726 14 0x000055cbb6ad6fd7 in main (argc=3D68, argv=3D0x7ffc0c578888, envp=3D0x7= ffc0c578ab0) at ../softmmu/main.c:50 To make sure that the send threads could be terminated, IO channels should = be shut down to avoid waiting IO. Signed-off-by: Li Zhang Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/multifd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/multifd.c b/migration/multifd.c index 0533da154a..3242f688e5 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -524,6 +524,9 @@ static void multifd_send_terminate_threads(Error *err) qemu_mutex_lock(&p->mutex); p->quit =3D true; qemu_sem_post(&p->sem); + if (p->c) { + qio_channel_shutdown(p->c, QIO_CHANNEL_SHUTDOWN_BOTH, NULL); + } qemu_mutex_unlock(&p->mutex); } } --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639565786160506.4513854311249; Wed, 15 Dec 2021 02:56:26 -0800 (PST) Received: from localhost ([::1]:60502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxRxR-0000M4-1K for importer@patchew.org; Wed, 15 Dec 2021 05:56:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRav-0003t0-OV for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRat-0007OP-B7 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:08 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-542-ld_gjcVhNuOUlZ-oqczpgw-1; Wed, 15 Dec 2021 05:32:58 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76C51801962; Wed, 15 Dec 2021 10:32:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC4016E978; Wed, 15 Dec 2021 10:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564386; 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=lhLHBVnrBgjWy1Oe70JIm3oFvnrlvx9QVzfbhdnZThs=; b=X58qmVq3d1r3wYiN13wNtIgVLCIMvoNEb5Nddb20nemwK7u8gzxSkXTMIW8C4tWakh5zsv qMSU68V2Rsl7QB7AWg1iYKtZSQHMvxOqtRYL7UTSwb/ZWYv8refX6SLIFnNVxKQgIZpHKr +4UBR6QgocEAIjeeoeh9WLcSajrYu98= X-MC-Unique: ld_gjcVhNuOUlZ-oqczpgw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 16/18] COLO: Move some trace code behind qemu_mutex_unlock_iothread() Date: Wed, 15 Dec 2021 11:32:16 +0100 Message-Id: <20211215103218.17527-17-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , "Rao, Lei" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565786645100001 Content-Type: text/plain; charset="utf-8" From: "Rao, Lei" There is no need to put some trace code in the critical section. So, moving it behind qemu_mutex_unlock_iothread() can reduce the lock time. Signed-off-by: Lei Rao Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/colo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 4a772afe78..5f7071b3cd 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -680,8 +680,8 @@ static void colo_incoming_process_checkpoint(MigrationI= ncomingState *mis, =20 qemu_mutex_lock_iothread(); vm_stop_force_state(RUN_STATE_COLO); - trace_colo_vm_state_change("run", "stop"); qemu_mutex_unlock_iothread(); + trace_colo_vm_state_change("run", "stop"); =20 /* FIXME: This is unnecessary for periodic checkpoint mode */ colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_REPLY, @@ -783,8 +783,8 @@ static void colo_incoming_process_checkpoint(MigrationI= ncomingState *mis, =20 vmstate_loading =3D false; vm_start(); - trace_colo_vm_state_change("stop", "run"); qemu_mutex_unlock_iothread(); + trace_colo_vm_state_change("stop", "run"); =20 if (failover_get_state() =3D=3D FAILOVER_STATUS_RELAUNCH) { return; @@ -887,8 +887,8 @@ void *colo_process_incoming_thread(void *opaque) abort(); #endif vm_start(); - trace_colo_vm_state_change("stop", "run"); qemu_mutex_unlock_iothread(); + trace_colo_vm_state_change("stop", "run"); =20 colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_READY, &local_err); --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639566143830724.7031917999077; Wed, 15 Dec 2021 03:02:23 -0800 (PST) Received: from localhost ([::1]:49040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxS3C-0003jL-OT for importer@patchew.org; Wed, 15 Dec 2021 06:02:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRar-0003n5-RH for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRap-0007Np-V5 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:05 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-286-VNbLoraJOh6h5XE3nm1_pQ-1; Wed, 15 Dec 2021 05:33:00 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4602710144E0; Wed, 15 Dec 2021 10:32:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF97275C43; Wed, 15 Dec 2021 10:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564383; 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=u/HdQNso8q0btUJZEOQsn6aDmYEnnS4vt9EKnr+85m8=; b=KkyvoXosI/euuwTp8i7SjtSCIvLHgbynjupJvbOd7ZeBrOxonycjXOEb7/MjTB5k/P/6bQ LdepcZAED7pe5hgkMv85mkVnTLQ8l2Eu4sQOKhany2/aSroOowBmu2LSLqhNcuqGv1m7uh V3THxpeoGWgorPN6dwQTwmLNEeYsw74= X-MC-Unique: VNbLoraJOh6h5XE3nm1_pQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 17/18] multifd: Make zstd compression method not use iovs Date: Wed, 15 Dec 2021 11:32:17 +0100 Message-Id: <20211215103218.17527-18-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639566145612100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd-zstd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index a8b104f4ee..2d5b61106c 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include #include "qemu/rcu.h" +#include "exec/ramblock.h" #include "exec/target_page.h" #include "qapi/error.h" #include "migration.h" @@ -111,8 +112,8 @@ static void zstd_send_cleanup(MultiFDSendParams *p, Err= or **errp) */ static int zstd_send_prepare(MultiFDSendParams *p, Error **errp) { - struct iovec *iov =3D p->pages->iov; struct zstd_data *z =3D p->data; + size_t page_size =3D qemu_target_page_size(); int ret; uint32_t i; =20 @@ -126,8 +127,8 @@ static int zstd_send_prepare(MultiFDSendParams *p, Erro= r **errp) if (i =3D=3D p->pages->num - 1) { flush =3D ZSTD_e_flush; } - z->in.src =3D iov[i].iov_base; - z->in.size =3D iov[i].iov_len; + z->in.src =3D p->pages->block->host + p->pages->offset[i]; + z->in.size =3D page_size; z->in.pos =3D 0; =20 /* @@ -256,7 +257,8 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error = **errp) { uint32_t in_size =3D p->next_packet_size; uint32_t out_size =3D 0; - uint32_t expected_size =3D p->pages->num * qemu_target_page_size(); + size_t page_size =3D qemu_target_page_size(); + uint32_t expected_size =3D p->pages->num * page_size; uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; struct zstd_data *z =3D p->data; int ret; @@ -278,10 +280,8 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error= **errp) z->in.pos =3D 0; =20 for (i =3D 0; i < p->pages->num; i++) { - struct iovec *iov =3D &p->pages->iov[i]; - - z->out.dst =3D iov->iov_base; - z->out.size =3D iov->iov_len; + z->out.dst =3D p->pages->block->host + p->pages->offset[i]; + z->out.size =3D page_size; z->out.pos =3D 0; =20 /* @@ -295,8 +295,8 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error = **errp) do { ret =3D ZSTD_decompressStream(z->zds, &z->out, &z->in); } while (ret > 0 && (z->in.size - z->in.pos > 0) - && (z->out.pos < iov->iov_len)); - if (ret > 0 && (z->out.pos < iov->iov_len)) { + && (z->out.pos < page_size)); + if (ret > 0 && (z->out.pos < page_size)) { error_setg(errp, "multifd %d: decompressStream buffer too smal= l", p->id); return -1; --=20 2.33.1 From nobody Mon Feb 9 08:41:48 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163956597459650.649100680209244; Wed, 15 Dec 2021 02:59:34 -0800 (PST) Received: from localhost ([::1]:42640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxS0T-0007RW-JL for importer@patchew.org; Wed, 15 Dec 2021 05:59:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRat-0003qp-L7 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRas-0007OB-02 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:33:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-371-ImfLjs0POSyPHbGglKbBBw-1; Wed, 15 Dec 2021 05:33:02 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 180AA81EE61; Wed, 15 Dec 2021 10:33:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id B052575C47; Wed, 15 Dec 2021 10:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639564385; 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=G5sZynob5e7ZwKiDY9uVFFmgy+epw9wVO5qAWBQ6UOE=; b=PT1NpeFNtTxLKGAys+gqfHMgQTI1hPJeZrKrvklhnDN6zzoK6ZzX5rYYxOINbIzlO3KgrI UQ796XPKRoTe2su3T+SiGgtTDOgyv1I2nFP+X/oCzboI4/zjrJfwXCEYw1p3zFHgIcpYhk STG+0aXlp0jOgihliA9Mv7QvoT3ULPw= X-MC-Unique: ImfLjs0POSyPHbGglKbBBw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 18/18] multifd: Make zlib compression method not use iovs Date: Wed, 15 Dec 2021 11:32:18 +0100 Message-Id: <20211215103218.17527-19-quintela@redhat.com> In-Reply-To: <20211215103218.17527-1-quintela@redhat.com> References: <20211215103218.17527-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Hailiang Zhang , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1639565975979100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd-zlib.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index e85ef8824d..da6201704c 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include #include "qemu/rcu.h" +#include "exec/ramblock.h" #include "exec/target_page.h" #include "qapi/error.h" #include "migration.h" @@ -98,8 +99,8 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error= **errp) */ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp) { - struct iovec *iov =3D p->pages->iov; struct zlib_data *z =3D p->data; + size_t page_size =3D qemu_target_page_size(); z_stream *zs =3D &z->zs; uint32_t out_size =3D 0; int ret; @@ -113,8 +114,8 @@ static int zlib_send_prepare(MultiFDSendParams *p, Erro= r **errp) flush =3D Z_SYNC_FLUSH; } =20 - zs->avail_in =3D iov[i].iov_len; - zs->next_in =3D iov[i].iov_base; + zs->avail_in =3D page_size; + zs->next_in =3D p->pages->block->host + p->pages->offset[i]; =20 zs->avail_out =3D available; zs->next_out =3D z->zbuff + out_size; @@ -235,6 +236,7 @@ static void zlib_recv_cleanup(MultiFDRecvParams *p) static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp) { struct zlib_data *z =3D p->data; + size_t page_size =3D qemu_target_page_size(); z_stream *zs =3D &z->zs; uint32_t in_size =3D p->next_packet_size; /* we measure the change of total_out */ @@ -259,7 +261,6 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error = **errp) zs->next_in =3D z->zbuff; =20 for (i =3D 0; i < p->pages->num; i++) { - struct iovec *iov =3D &p->pages->iov[i]; int flush =3D Z_NO_FLUSH; unsigned long start =3D zs->total_out; =20 @@ -267,8 +268,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error = **errp) flush =3D Z_SYNC_FLUSH; } =20 - zs->avail_out =3D iov->iov_len; - zs->next_out =3D iov->iov_base; + zs->avail_out =3D page_size; + zs->next_out =3D p->pages->block->host + p->pages->offset[i]; =20 /* * Welcome to inflate semantics @@ -281,8 +282,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error = **errp) do { ret =3D inflate(zs, flush); } while (ret =3D=3D Z_OK && zs->avail_in - && (zs->total_out - start) < iov->iov_len); - if (ret =3D=3D Z_OK && (zs->total_out - start) < iov->iov_len) { + && (zs->total_out - start) < page_size); + if (ret =3D=3D Z_OK && (zs->total_out - start) < page_size) { error_setg(errp, "multifd %d: inflate generated too few output= ", p->id); return -1; --=20 2.33.1