From nobody Thu Oct 30 05:11:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525531072036884.8354071708653; Sat, 5 May 2018 07:37:52 -0700 (PDT) Received: from localhost ([::1]:39038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEyJr-0000rm-5U for importer@patchew.org; Sat, 05 May 2018 10:37:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEyIF-0008Qs-BB for qemu-devel@nongnu.org; Sat, 05 May 2018 10:36:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEyIC-000896-7A for qemu-devel@nongnu.org; Sat, 05 May 2018 10:36:11 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:40465) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEyIC-00087t-1U for qemu-devel@nongnu.org; Sat, 05 May 2018 10:36:08 -0400 Received: by mail-pf0-x242.google.com with SMTP id f189so19575124pfa.7 for ; Sat, 05 May 2018 07:36:07 -0700 (PDT) Received: from VM_127_91_centos.localdomain ([119.28.195.137]) by smtp.gmail.com with ESMTPSA id n67sm38529640pfh.188.2018.05.05.07.36.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 May 2018 07:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KI7yza/CX80Qu1nB/Rg7RbScxhHCIvUGBOeuuYrplns=; b=bpyDzY6Oc2dgBa5cwKr0EOnU4rGrWDfwlgx17Y6C4VgSDW/zZGLkLiwoLsyJpUGKiv HqEVTDC7i1+Ntis2znU75Y8wxcp0lkSbinGH1m0YYOFWHWj6G/+Se2hymtIEHOlXCcOX DlCqXzHOcD0DxL1XQV9jRmfnMZVsK8zez0TzBzx97eYwAEjOqHQ9YSw7j9Yf8Dz47pWT X/u5NFbxSAcEiyOoGItX4nxY+y+t5uOj01W0mtkp2SKt6jRnMuYSHp49rKG63d6Oru2R lBxnl5xx0d9LvJ5fs3qJwo7IUHs6e8JwVH+/dTnrswt+MsMv+d4t4UNR3LvymsuTmxq2 zcPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KI7yza/CX80Qu1nB/Rg7RbScxhHCIvUGBOeuuYrplns=; b=AGuWRmPuZ35gkhYG1EYK+FwcRMSuV+N1NtPR0tMgpPCcH/de464+ZyNDCvZoyUODKv pZ39BOdJCin3bkWbtu1DuespfDHu/xYQbekhwQwP2FaEU7Tk7WmcD099QQn4zYMnUQcT 4+c//QgQtX/sbsKueJcEohJTAv6J/Wldx2xiqOWjOxHFQzdIWxVa5DxfJ/EGS85Liew1 +mjI3AK/+0kVOqc/B/TPw4Gq4ZMFiP5qzflexeZxKz53Ciqc8cALNP5t4eBJZvsN3eT1 Y1JVVbmsyuQBMMF9yWG8zI8Lh7Zf4Pd1CLUN+WDvmpDJO/3DDmt604JFkOwgbIU3HZi7 5GGQ== X-Gm-Message-State: ALQs6tCb2ZpDg4ydrxJ5ko0RclRPUyV9qGj+aKoJksO2z77kSxK21Vz9 XdO2jwxCemi5+kKYox6Ahv4= X-Google-Smtp-Source: AB8JxZqGg+tzc7HyS32HL2m6fmLTh0QDfUcBchsTTGLPHz3Wm+uU4CRZjkyQ0O4rCXslQkoqF72fYQ== X-Received: by 10.98.76.202 with SMTP id e71mr30321261pfj.171.1525530967223; Sat, 05 May 2018 07:36:07 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: quintela@redhat.com, dgilbert@redhat.com, berrange@redhat.com Date: Sat, 5 May 2018 22:35:33 +0800 Message-Id: <1525530936-21835-4-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525530936-21835-1-git-send-email-lidongchen@tencent.com> References: <1525530936-21835-1-git-send-email-lidongchen@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v3 3/6] migration: remove unnecessary variables len in QIOChannelRDMA X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: adido@mellanox.com, galsha@mellanox.com, aviadye@mellanox.com, qemu-devel@nongnu.org, Lidong Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Because qio_channel_rdma_writev and qio_channel_rdma_readv maybe invoked by different threads concurrently, this patch removes unnecessary variables len in QIOChannelRDMA and use local variable instead. Signed-off-by: Lidong Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9berrange@redhat.com> --- migration/rdma.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index c745427..f5c1d02 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -404,7 +404,6 @@ struct QIOChannelRDMA { QIOChannel parent; RDMAContext *rdma; QEMUFile *file; - size_t len; bool blocking; /* XXX we don't actually honour this yet */ }; =20 @@ -2640,6 +2639,7 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *io= c, int ret; ssize_t done =3D 0; size_t i; + size_t len =3D 0; =20 CHECK_ERROR_STATE(); =20 @@ -2659,10 +2659,10 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *= ioc, while (remaining) { RDMAControlHeader head; =20 - rioc->len =3D MIN(remaining, RDMA_SEND_INCREMENT); - remaining -=3D rioc->len; + len =3D MIN(remaining, RDMA_SEND_INCREMENT); + remaining -=3D len; =20 - head.len =3D rioc->len; + head.len =3D len; head.type =3D RDMA_CONTROL_QEMU_FILE; =20 ret =3D qemu_rdma_exchange_send(rdma, &head, data, NULL, NULL,= NULL); @@ -2672,8 +2672,8 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *io= c, return ret; } =20 - data +=3D rioc->len; - done +=3D rioc->len; + data +=3D len; + done +=3D len; } } =20 @@ -2768,8 +2768,7 @@ static ssize_t qio_channel_rdma_readv(QIOChannel *ioc, } } } - rioc->len =3D done; - return rioc->len; + return done; } =20 /* --=20 1.8.3.1