From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.5 Received: by atuin.qyliss.net (Postfix, from userid 496) id 1162F35D1; Thu, 13 May 2021 00:50:32 +0000 (UTC) Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 4868E347C; Thu, 13 May 2021 00:50:21 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 7FB0A1435F; Wed, 12 May 2021 17:08:46 +0000 (UTC) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by atuin.qyliss.net (Postfix) with ESMTPS id 19CB61435B for ; Wed, 12 May 2021 17:08:42 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 9BF621317 for ; Wed, 12 May 2021 13:08:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 12 May 2021 13:08:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=ThGoS/XW/oOyl pnGGTdjlEYmCoUpru0qmJQ8mGA7SBA=; b=et45nfTUWYsVQ6Dd9bfZjCA/YnT1g Nfkd+IzxM3eaq1qRWYjZG1lvzU4nug571gdjzcKyCq8BA05KeerGADSB4pVC1tFJ 8PN0vkqOIAUeUTZ1oKyCh8ypyhRx0xdIu9aZN/rbb+42Unj7tN8pxgtxDXXdRUHX IkGDwganIDKN4vVbM/O5TXeGIsFjmTKkdvokvA7nh+IUsoC84nJ79g1hCKRVEHSR tduYwo2GgbSBdUL4AuCbEKpa48803ufqlHA64dN/8xOhiklygUSwbMVEEfe1ITwD ho9k5Q0Rggi6x2bCpe+XCA/vBCA2pwd0+EGKEy8HS6kgh4q9JKjQiBEeg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=ThGoS/XW/oOylpnGGTdjlEYmCoUpru0qmJQ8mGA7SBA=; b=MD42apyG na6MumUpJB2hfvMKGHXVANhd5EZGFbFPVxZIkpPNxwl6KZ5yuW/+Q19IWd8rVOUM Rw7S6igh81ejpBumhjEDaOOiDe2LYFyWT7vew1cFuSECsiu3MjNq8YBDnsZIVXyr UAVUnCsKPuuo24S404WBXFtvlaxypHBwXiRfbvkKvx0em2Izslx++MEnwlaL8L8n +fawAViOYwsuU0/6ps4Bp7LZlzuxfBDYAc049QyWG7UxcCE2A2inUNp0LzPKRKKF T8ZMZs7WwZxIS4o/oosfvoZd1+XcxE6b/y+YAHV0/YqLvfe0owSIR3BPEMk0Vwjc iUab4BhDL9xeGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehvddguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeetlhihshhsrgcutfhoshhsuceohhhisegrlhihshhsrgdr ihhsqeenucggtffrrghtthgvrhhnpefgfedukedvleeileeludefveehgeelgfegvdduje dvtdffueeuveffheeljeekvdenucfkphepkeegrddukeegrddvvdeirdekudenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehqhihlihhsshesvg hvvgdrqhihlhhishhsrdhnvght X-ME-Proxy: Received: from eve.qyliss.net (p54b8e251.dip0.t-ipconnect.de [84.184.226.81]) by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 12 May 2021 13:08:37 -0400 (EDT) Received: by eve.qyliss.net (Postfix, from userid 1000) id 4350E103B; Wed, 12 May 2021 17:08:36 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [RFC PATCH 3/4] devices: vhost-user: Vring should be enabled after initialization Date: Wed, 12 May 2021 17:08:11 +0000 Message-Id: <20210512170812.192540-4-hi@alyssa.is> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210512170812.192540-1-hi@alyssa.is> References: <20210512170812.192540-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: XBXD3J55K4OCWCSXVNL5PJNDTDIBVN24 X-Message-ID-Hash: XBXD3J55K4OCWCSXVNL5PJNDTDIBVN24 X-MailFrom: qyliss@eve.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.4 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Based on cloud-hypervisor 97699a521fbdffd0166bc55be37c13bb6bc1949f. > vm-virtio: vhost-user: Vring should be enabled after initialization > > As mentioned in the vhost-user specification, each ring is initialized > in a stopped state. This means each ring should be enabled only after > it has been correctly initialized. --- devices/src/virtio/vhost_user/mod.rs | 2 -- devices/src/virtio/vhost_user/vu_common_ctrl.rs | 13 ++++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/devices/src/virtio/vhost_user/mod.rs b/devices/src/virtio/vhost_user/mod.rs index 99d8e651..43fc6350 100644 --- a/devices/src/virtio/vhost_user/mod.rs +++ b/devices/src/virtio/vhost_user/mod.rs @@ -70,8 +70,6 @@ pub enum Error { VhostUserSetVringKick(VhostError), /// Set vring enable failed. VhostUserSetVringEnable(VhostError), - /// Vhost-user setup vring failed. - VhostUserSetupVringFailed, /// Failed to create vhost eventfd. VhostIrqCreate(std::io::Error), /// Failed to read vhost eventfd. diff --git a/devices/src/virtio/vhost_user/vu_common_ctrl.rs b/devices/src/virtio/vhost_user/vu_common_ctrl.rs index 38b7b4f2..b594b177 100644 --- a/devices/src/virtio/vhost_user/vu_common_ctrl.rs +++ b/devices/src/virtio/vhost_user/vu_common_ctrl.rs @@ -87,6 +87,9 @@ pub fn setup_vhost_user_vring( vu.set_vring_kick(queue_index, &queue_evts[queue_index]) .map_err(Error::VhostUserSetVringKick)?; + + vu.set_vring_enable(queue_index, true) + .map_err(Error::VhostUserSetVringEnable)?; } Ok(vu_interrupt_list) @@ -99,17 +102,9 @@ pub fn setup_vhost_user( queue_evts: Vec, acked_features: u64, ) -> Result> { - for i in 0..queues.len() { - vu.set_vring_enable(i, true) - .map_err(Error::VhostUserSetVringEnable)?; - } - let backend_features = vu.get_features().unwrap(); vu.set_features(acked_features & backend_features) .map_err(Error::VhostUserSetFeatures)?; - match setup_vhost_user_vring(vu, mem, queues, queue_evts) { - Ok(vu_interrupt_list) => Ok(vu_interrupt_list), - Err(_) => Err(Error::VhostUserSetupVringFailed), - } + setup_vhost_user_vring(vu, mem, queues, queue_evts) } -- 2.31.0