From nobody Wed Nov 12 01:54:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1567538777; cv=none; d=zoho.com; s=zohoarc; b=ZNsB+0G9D442EtFB3bpFkMTymgOZ8XhRGJJmdIUxq8UXr1B6EbN2yxqHF76kpuAPhcqw+Sd8AwzwQ636M6g+PVSUq60DeXfDW7mdlumO80o9fXTtLspTecvGhnYSnLu1cTmPYyYdWENrIGHq35pWgOhK1dPBDXgTl4AXm9OeNM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567538777; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=UFoaYplZyu8YaJuqBKgv50AaQtPwrr4i9A1FJd4QDMI=; b=RmrAzlKWJM2YMlzeo2aQUjjhqFgHhqIcR/mjO9QE14voatd/dZdYrdxLE0bAvPnItluff6DCTQISaKTrqrNP74u9Aj5DFEvcsLIQsL9PWdADs/BofndV1Imo3/9cim6BCIf1+dwvGxCk3PbHk6gS/A3T5iGpmFM+jMaOrscax6A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567538777141556.1947452287378; Tue, 3 Sep 2019 12:26:17 -0700 (PDT) Received: from localhost ([::1]:50318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ERT-0007GJ-OS for importer@patchew.org; Tue, 03 Sep 2019 15:26:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40411) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5EQU-0006SL-W2 for qemu-devel@nongnu.org; Tue, 03 Sep 2019 15:25:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5EQT-0001wM-TS for qemu-devel@nongnu.org; Tue, 03 Sep 2019 15:25:14 -0400 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2]:36568 helo=sipsolutions.net) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5EQT-0001uL-Mz for qemu-devel@nongnu.org; Tue, 03 Sep 2019 15:25:13 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.1) (envelope-from ) id 1i5EQN-0007W0-Pk; Tue, 03 Sep 2019 21:25:08 +0200 From: Johannes Berg To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 22:25:05 +0300 Message-Id: <20190903192505.10686-1-johannes@sipsolutions.net> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a01:4f8:191:4433::2 Subject: [Qemu-devel] [PATCH] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Johannes Berg This is really simple, since we know whether a response is already requested or not, so we can just send a (successful) response when there isn't one already. Given that, it's not all _that_ useful but the master can at least be sure the message was processed, and we can exercise more code paths using the example code. Signed-off-by: Johannes Berg Reviewed-by: Stefan Hajnoczi --- contrib/libvhost-user/libvhost-user.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index 4b36e35a82f8..010ddb9c0f42 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -1164,7 +1164,8 @@ vu_get_protocol_features_exec(VuDev *dev, VhostUserMs= g *vmsg) 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | - 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD; + 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | + 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK; =20 if (have_userfault()) { features |=3D 1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT; @@ -1546,13 +1547,20 @@ vu_dispatch(VuDev *dev) { VhostUserMsg vmsg =3D { 0, }; int reply_requested; - bool success =3D false; + bool need_reply, success =3D false; =20 if (!vu_message_read(dev, dev->sock, &vmsg)) { goto end; } =20 + need_reply =3D vmsg.flags & VHOST_USER_NEED_REPLY_MASK; + reply_requested =3D vu_process_message(dev, &vmsg); + if (!reply_requested && need_reply) { + vmsg_set_reply_u64(&vmsg, 0); + reply_requested =3D 1; + } + if (!reply_requested) { success =3D true; goto end; --=20 2.23.0