From nobody Wed Nov 27 20:51:45 2024 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=1697645401; cv=none; d=zohomail.com; s=zohoarc; b=PbiyIPEHO665+boLkNg2NmMNx+TX6dhNKVqMmTEnHGEHfeGR+hHpufylyp+uMtGqbHJXxCnOEpYtVaw60jN2isv70tTJT7vCd6tVzvZW2AC/L1lPvQKCJI5uMhj0v5YQiX4bmWw+xu3l67R6TWDZq/VWbgETTu7rdFlkpMyWprk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697645401; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=E99g4CTTfhJ51zXlgqHdg/7C/6fC/h1geeLvGMNmvCc=; b=FNIvL1Afz8S2yl9XpbyPKdPSO+LJVbYHhsOZVIoQoHW7/iJD9FVqGcKkNE/GqLRhsRMtQB3aG9+5A4aPiKF6ojhQY4tEC7wQ0bb3tyKEfMw84+F5xR1ndu//g6ykpl9CSV0sZIkuzZiXR2jM/9g0a862FogOlydQ9IOD8mDEAsM= 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 16976454017271013.8976502958569; Wed, 18 Oct 2023 09:10:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8w3-00009l-9X; Wed, 18 Oct 2023 11:58:16 -0400 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 1qt8ta-0002nP-FC for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:48 -0400 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 1qt8tW-0006rF-CG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:40 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-emroDSigMkygkpRJzwzE_g-1; Wed, 18 Oct 2023 11:55:36 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32d58708cd5so4254841f8f.3 for ; Wed, 18 Oct 2023 08:55:35 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id x3-20020adff0c3000000b0032dc74c093dsm2373998wro.103.2023.10.18.08.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644537; 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=E99g4CTTfhJ51zXlgqHdg/7C/6fC/h1geeLvGMNmvCc=; b=cssE6n46M0yr31XaW6fxuVPBj2ceey/6eYMtXaOKuQcz2xieXsTw2j/WbypMxf3H17eiYu c70nj/vemGuJOgHoznYp26bpYdasKdLA9Xi0mNn1XpF57uDLzGLrc4ZXiJ8OHlV+4OqaSI WMH/VJA7zVUAzGR6x9e4mtwCUtH4G1k= X-MC-Unique: emroDSigMkygkpRJzwzE_g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644534; x=1698249334; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=E99g4CTTfhJ51zXlgqHdg/7C/6fC/h1geeLvGMNmvCc=; b=uF4OmeKXhJe9NXiSpmjeuwq6ZydfwKEMwY7wyyakDNe/GiO/XGOjcWLQd8JmtCZGdz pDCUdDG1JynorCQUXBCC6XNszfLhFq4lO5pF9FEaPkd8RqwNIJhMjmumLl7i1NEKG/T+ Qa/EIgyyiaOckebmr+heQOK2/oHZWK7I5hSOLJgnUWtt2OkA2+L0csQIGbsPIs0H4L7U PcyZwNH5c8aHd1PLEbCmGZodCEFOmuLBqm820xHOCgT/HIvT+UghOPrHSTiEv2vdSHEr B8Nk06aQ1F2HrJ30i01OUakV7hb4kcGDoyD1jAGuJl4BkwRbbVsTlT6mHpBpgKXGCNpD BxGw== X-Gm-Message-State: AOJu0Yw6YqFF6F2bWs9cv2Jr1CKYFejG8uwgIt+8MaOBbwMemC+4qKjy U4Yo7IISvp7QFbN6OIcOcTGd5j1SavkbY2B1Fv72LTk6bymD4vtMq8hyiAetl7cJQVSYjgEXUWR 6ZAbROH2UgkiSPjwI1BeScUKkEAyGnDWwRGuHG8R4CGSh1KdFItcCxbCkFhSDA2++SeZZLwk= X-Received: by 2002:a05:6000:10a:b0:32d:82b4:1957 with SMTP id o10-20020a056000010a00b0032d82b41957mr4191910wrx.40.1697644534472; Wed, 18 Oct 2023 08:55:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHWV5rSVJ0CiyhKKzLpH+ItnBouwoiBE5k7CQkyL0JsNcBIuou4CRqG0BaVSDoQS3cg7MLGQ== X-Received: by 2002:a05:6000:10a:b0:32d:82b4:1957 with SMTP id o10-20020a056000010a00b0032d82b41957mr4191886wrx.40.1697644534114; Wed, 18 Oct 2023 08:55:34 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Albert Esteve , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Subject: [PULL 30/83] vhost-user: tighten "reply_supported" scope in "set_vring_addr" Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=mst@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_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: , 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: 1697645403804100003 From: Laszlo Ersek In the vhost_user_set_vring_addr() function, we calculate "reply_supported" unconditionally, even though we'll only need it if "wait_for_reply" is also true. Restrict the scope of "reply_supported" to the minimum. This is purely refactoring -- no observable change. Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Stefano Garzarella Tested-by: Albert Esteve Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eugenio P=C3=A9rez Message-Id: <20231002203221.17241-3-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 3e33a2e9e0..6c7b4cc75c 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1321,17 +1321,18 @@ static int vhost_user_set_vring_addr(struct vhost_d= ev *dev, .hdr.size =3D sizeof(msg.payload.addr), }; =20 - bool reply_supported =3D virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_REPLY_= ACK); - /* * wait for a reply if logging is enabled to make sure * backend is actually logging changes */ bool wait_for_reply =3D addr->flags & (1 << VHOST_VRING_F_LOG); =20 - if (reply_supported && wait_for_reply) { - msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; + if (wait_for_reply) { + bool reply_supported =3D virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_REPLY_ACK); + if (reply_supported) { + msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; + } } =20 ret =3D vhost_user_write(dev, &msg, NULL, 0); --=20 MST