From nobody Mon Feb 9 09:52:07 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=1655976989; cv=none; d=zohomail.com; s=zohoarc; b=TL8nn1gGefeFOhxasugh1w2QZKZVwMxDov7KLRH/X41Ln++2xJEcHUxnHDnw2OEq1u8CfuJOBgpM5EgYArR8u1MZR+mLQb8bwbam3ZsvU8RwT9koRnbABZgWz3JFDPQ+jomVvUCC1ZLFoY7Q8Oo21TTNVEgQRhrmKKDhhQNPbL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655976989; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rZS2Qj8OGgQg6pZYnLbW8umeBCQiTi5i+/MP8qAvgLE=; b=FeMMLfLv6SKejLXVQM96xf7n55OnTfzjkzQkueY+Gsk+bDh+YALAc9ztej/nf7+ui03v+ZmU1lJNZBrr8ik4Wha1yv5xUw7Ful4l0sMQRB53Rll8/PknokTs5BKiGlAKJm0TfLLdSzLgKsqfolto6kcZ/6BWm2Z+wlcVqYqIo8U= 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 1655976989839426.51667837537843; Thu, 23 Jun 2022 02:36:29 -0700 (PDT) Received: from localhost ([::1]:50546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4JGG-0005bJ-P8 for importer@patchew.org; Thu, 23 Jun 2022 05:36:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4J8W-0008PW-Ed for qemu-devel@nongnu.org; Thu, 23 Jun 2022 05:28:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4J8S-0004sB-9h for qemu-devel@nongnu.org; Thu, 23 Jun 2022 05:28:26 -0400 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-294-jmhIlBW8O-26enfN14IWcA-1; Thu, 23 Jun 2022 05:28:20 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C26CF8001EA; Thu, 23 Jun 2022 09:28:19 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.33.36.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6AAC40D2962; Thu, 23 Jun 2022 09:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655976501; 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=rZS2Qj8OGgQg6pZYnLbW8umeBCQiTi5i+/MP8qAvgLE=; b=WzZmELS+Xp92NZORIJtrtt5SriSMWp8rodAKWU7PJVAGGTpIMM3jw0R6OS9tV4AGqmEwxp +NdztWkUcYV7SIGp4N/0H3N6lBizFzTzB2DLbJV9Ud8vPEV34dH1Ny22o37iV9S/XflI00 faM7Xj2VbxmVEbmEcwemKr7B2VRUGPY= X-MC-Unique: jmhIlBW8O-26enfN14IWcA-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, berrange@redhat.com, huangy81@chinatelecom.cn, quintela@redhat.com, leobras@redhat.com, peterx@redhat.com Cc: jdenemar@redhat.com Subject: [PULL 03/33] QIOChannelSocket: Fix zero-copy send so socket flush works Date: Thu, 23 Jun 2022 10:27:40 +0100 Message-Id: <20220623092810.96234-4-dgilbert@redhat.com> In-Reply-To: <20220623092810.96234-1-dgilbert@redhat.com> References: <20220623092810.96234-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655976990867100001 From: Leonardo Bras Somewhere between v6 and v7 the of the zero-copy-send patchset a crucial part of the flushing mechanism got missing: incrementing zero_copy_queued. Without that, the flushing interface becomes a no-op, and there is no guarantee the buffer is really sent. This can go as bad as causing a corruption in RAM during migration. Fixes: 2bc58ffc2926 ("QIOChannelSocket: Implement io_writev zero copy flag = & io_flush for CONFIG_LINUX") Reported-by: =E5=BE=90=E9=97=AF Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- io/channel-socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/io/channel-socket.c b/io/channel-socket.c index b8c13dba7c..4466bb1cd4 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -611,6 +611,11 @@ static ssize_t qio_channel_socket_writev(QIOChannel *i= oc, "Unable to write to socket"); return -1; } + + if (flags & QIO_CHANNEL_WRITE_FLAG_ZERO_COPY) { + sioc->zero_copy_queued++; + } + return ret; } #else /* WIN32 */ --=20 2.36.1