From nobody Wed Feb 11 05:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1668527225; cv=none; d=zohomail.com; s=zohoarc; b=nrozIV94/39/FB806Yx64FTNoeK7ZTA9VMRzOOznKBEXtEtfalPNjiPBv1Wo91q++SbV0P0p+dxqcnmugugnTeXCjs8jqhTL7gh+P8AS9rEWUIzTlM6+ns6+ZeT7KKAM1EiYSMFiVPUcumXcXQCUDekGtamnsI50QEN6EVTRNjU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668527225; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KqEMNGfO+9FCgLhL/tSP3g81IW8o7xa3Zcbo6/dqmM0=; b=NcNPRP3ICadcPUJBQPCxjbuuWbSruGXPAiwLsE3/g9fNl9sZl3oQRHsFr7dIRlFP/ix/kjKvZBMX5Z2tGYIWyMQa0TmOyPJssklUUNM5zdot8aITSiuZxpS7TFGflfJpVnTTXHIeUl8Gdx7cjgI6V56MLILVPEatAN9+5jWEIus= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668527225108925.7006124228998; Tue, 15 Nov 2022 07:47:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ouxyn-0005rE-30; Tue, 15 Nov 2022 10:36:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ouxyH-0005g4-57 for qemu-devel@nongnu.org; Tue, 15 Nov 2022 10:35:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ouxyF-0008Hv-PV for qemu-devel@nongnu.org; Tue, 15 Nov 2022 10:35:32 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-112-m7Yt5UsSPyq7Biwyx9HWcQ-1; Tue, 15 Nov 2022 10:35:27 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ABF1F85A59D; Tue, 15 Nov 2022 15:35:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF0E62166B2B; Tue, 15 Nov 2022 15:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668526531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KqEMNGfO+9FCgLhL/tSP3g81IW8o7xa3Zcbo6/dqmM0=; b=d7w4iSK0MbILchTjP4K6THh3VvpjEcWckY33egd3E8vfVyehtYZU4unlbiNMPIZZ5rNg5j LYsMZ5+ylDl+ki9X9UcMLnHMy7Hwhlnwf6JZ6JD9GazkHST3L1KGiwKJ6kVjJaoV+bY7oa tOFj5WB5mIxGpvmAqeO2YyW79/fNy8g= X-MC-Unique: m7Yt5UsSPyq7Biwyx9HWcQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Michael Tokarev , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , Laurent Vivier , Juan Quintela , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Peter Xu , Stefan Hajnoczi , "Dr. David Alan Gilbert" , Thomas Huth , qemu-block@nongnu.org, qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Fam Zheng , Leonardo Bras Subject: [PULL 02/30] migration/multifd/zero-copy: Create helper function for flushing Date: Tue, 15 Nov 2022 16:34:46 +0100 Message-Id: <20221115153514.28003-3-quintela@redhat.com> In-Reply-To: <20221115153514.28003-1-quintela@redhat.com> References: <20221115153514.28003-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1668527225823100001 Content-Type: text/plain; charset="utf-8" From: Leonardo Bras Move flushing code from multifd_send_sync_main() to a new helper, and call it in multifd_send_sync_main(). Signed-off-by: Leonardo Bras Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/multifd.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 586ddc9d65..509bbbe3bf 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -566,6 +566,23 @@ void multifd_save_cleanup(void) multifd_send_state =3D NULL; } =20 +static int multifd_zero_copy_flush(QIOChannel *c) +{ + int ret; + Error *err =3D NULL; + + ret =3D qio_channel_flush(c, &err); + if (ret < 0) { + error_report_err(err); + return -1; + } + if (ret =3D=3D 1) { + dirty_sync_missed_zero_copy(); + } + + return ret; +} + int multifd_send_sync_main(QEMUFile *f) { int i; @@ -616,17 +633,8 @@ int multifd_send_sync_main(QEMUFile *f) qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); =20 - if (flush_zero_copy && p->c) { - int ret; - Error *err =3D NULL; - - ret =3D qio_channel_flush(p->c, &err); - if (ret < 0) { - error_report_err(err); - return -1; - } else if (ret =3D=3D 1) { - dirty_sync_missed_zero_copy(); - } + if (flush_zero_copy && p->c && (multifd_zero_copy_flush(p->c) < 0)= ) { + return -1; } } for (i =3D 0; i < migrate_multifd_channels(); i++) { --=20 2.38.1