From nobody Wed Nov 27 17:49:00 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=1697966566; cv=none; d=zohomail.com; s=zohoarc; b=mgl890YPF/1KT530yss2Ci826NW6XTjuX+9CMA3ve0WpSW4+9W0JWOWVQBJZuRu2qOlWmJlxLkqHGMxuNaYWgXAf/nGKwLrDeIX7a6XeaI2CSmU1nG1WPkmxcBF2Aw/K39ifUI5VvSb0QXtmVhdnq4gfXja4L7d6G/dN/0IYHCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697966566; 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=V7npU0aCl62rkufXftTwE2jVDeR1Dad52J5DnH1mf6kIvQEZfeBZw73aFn1iArv7lxx589mXDqcLGhY9FW0fxm1Ucv2leFLfjAvy83Egn6+ngghZYH2FHd/w2WAwJ4OWcdLsq9oZteDkzQAXyJwWWW3avIEwwqNNwa29jQ3NuIU= 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 1697966566126895.8255675465502; Sun, 22 Oct 2023 02:22:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quUfO-0000RW-3U; Sun, 22 Oct 2023 05:22:39 -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 1quUfL-0000Qh-IS for qemu-devel@nongnu.org; Sun, 22 Oct 2023 05:22:35 -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 1quUfJ-0000De-Vd for qemu-devel@nongnu.org; Sun, 22 Oct 2023 05:22:35 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-hVfpRjfFN3abC-T88xnZLA-1; Sun, 22 Oct 2023 05:22:31 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4084d08235fso14303665e9.3 for ; Sun, 22 Oct 2023 02:22:31 -0700 (PDT) Received: from redhat.com ([2.52.1.53]) by smtp.gmail.com with ESMTPSA id x22-20020a05600c189600b004083a105f27sm11102208wmp.26.2023.10.22.02.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 02:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697966553; 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=CPpTzUMA0H2yPljNEu0qMLLF+k8A+0NuxVXaWXBExyi+FUG778DkDCMah0PGyydm9w8Wdj YoCaufrTfUEcgTgn6EOzUXKRzqScMptMmBpaTgZGS+hfQk8kqLj1J86esBL6OI0bw6qRt/ GjDj3dNgN/kDjBxi/8q9ajVXOQZKJj0= X-MC-Unique: hVfpRjfFN3abC-T88xnZLA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697966550; x=1698571350; 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=ALAaObJDKOXOQSxZMPixvlcyl5YzrR5zl9NZol5GKYeZfMHCYZHRkILywP051QKr1j 0uCxUYp2menW8PW9C7NJnxGdv9awUCGq5DCEyMeYHjMcpqsWqaSppwb1p45tJEl3Q5K9 1SrUmZH6VFd9QyigVNstzWoNiqs+anz/g+zblA1JcMEQHgrZcekg56y+auNlaYXoBdgN n7NDg9XHTjOuCFzhjx6o9A/nAjaGf6kKnX55wYLWN7x6d4wJAXvA8iUgS7xTxDL5YUIz pqVVR6XpUPswS7OifUWJhb29OqPK6RRS139/2RNrYJXyDkFNVTKa2dW+z3nnw++Ni1Zm NxMQ== X-Gm-Message-State: AOJu0YxbpMxVbRA9UzzBGivtKA+W5Xk0UrqgxjfGRVfLkBK1I6+PCCu3 9bF/WHXyA8qU28asy0j5SR6sLz4WyJ9a0WC3c5cFjhAU4a9hXnm1b4oy9EcgjeYcGNGAPkzYfJW zuhPs4Y7jlVehBuJtEV0TLqcTPcx1nkTShVyIVe1DlsamUfmyHPkTaCG762E1GsLaZi04 X-Received: by 2002:a05:600c:5493:b0:407:859c:a1b2 with SMTP id iv19-20020a05600c549300b00407859ca1b2mr4702269wmb.14.1697966549977; Sun, 22 Oct 2023 02:22:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnjRqMzQpoTzkCBLHxl0lVTDGioriNlIkFeZSk/m9dZ8JSPlYvsIbYwXPBf+4wq3IbAznBRw== X-Received: by 2002:a05:600c:5493:b0:407:859c:a1b2 with SMTP id iv19-20020a05600c549300b00407859ca1b2mr4702248wmb.14.1697966549686; Sun, 22 Oct 2023 02:22:29 -0700 (PDT) Date: Sun, 22 Oct 2023 05:22:25 -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 v3 09/62] 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: 1697966568287100003 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