From nobody Thu Jul 3 14:35:40 2025 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653408007; cv=none; d=zohomail.com; s=zohoarc; b=ZuP51FdnBSSVvd5oTgPsjljcJ9/dlG40QyyTElt+HpuQCBdK/8s4gcwLkVmSOxSdRfpVg6Ej93XgsEMRkbfM5ikAbFVxwDYyV3031iRMcZRXRFHqdJ+MdAxalPsfTN7q5tR72T3wm4S++Sc8jJd0HA/7iBRTSn03P6/x8Zx9P9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653408007; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0BYVTVZiKjXfpCfzCQnV5P+1PaZA5TNtHfPlJaQOz5w=; b=ZfFozPIN11nkGYSg3jwqZPw85Kxa1fkqvGmKfYpuvTiBJE/h0rjwROe4mg/PS1pnRLicqOAY/ti/w5VWuCRDUOrPzpRWLdCRVAllVdriN47Tqa8eJAjOcC0hhQLga5G9j3gHet6hhLVJqJyi+lIt9ve7mgdXdDRddR+mw/UNKSI= 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+importer2=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 1653408007711474.45867993657794; Tue, 24 May 2022 09:00:07 -0700 (PDT) Received: from localhost ([::1]:42442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWwz-0008C8-SS for importer2@patchew.org; Tue, 24 May 2022 12:00:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWep-0004II-Iu for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:15 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:43802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWen-0005PR-RN for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:15 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 67-20020a1c1946000000b00397382b44f4so1643509wmz.2 for ; Tue, 24 May 2022 08:41:13 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u22-20020adfa196000000b0020c5253d8dcsm13477778wru.40.2022.05.24.08.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 50D3D1FFC2; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0BYVTVZiKjXfpCfzCQnV5P+1PaZA5TNtHfPlJaQOz5w=; b=xnOug7AfIomU33Kc7qg3cEIpkRU7kqx0I97Ls3urj6QlKRPizGmVCaQMaMNgdxQNQL 4uTtHGCgE1RnB5t8XvDhlfPPVFnjfHz2lJ0i1Vi8oqTn/lOz45EQoLxWURMk7h9UD2Sr K3gVbM/XJtniBLib60gukwbV7MUEWdNojT9QIp5y0LeN6PaDdAKow6RLTNCOEuzBtdfP C0fxqnB+kjfVm+kFx/8ZVk1HAlJ6N1gqOBdNX+u+lZwA4lLGTfqliVlEiOWp0gVGCMPn Otib3d0ZSKpSjK/+UG75BmLVR8e7a3LTIGK1FydK/q40OwZh7oDDBaI3fOXVRf0iGsgT CNfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0BYVTVZiKjXfpCfzCQnV5P+1PaZA5TNtHfPlJaQOz5w=; b=FBSp9mwM+48KSmkY5qPh5ODYzNLY0FX9hO177pvUpDPOaUdRJUBmG0DLp+CZXhvGtH Po3PzGTARoCTmgqBXbJk0Rxca4m6jT/bhLKZlbKzKKpaEFQ5xIoG24hmP5OAqVziaUvm NnO/9N+jjTy2xvS+vBE8WKhBJBpav+Rihxl/7XUZpVEY/vPAPKiNOHi7KZThU3anWMtI Kkg3KlRD8pvffysqQcWgAHoNzAhVgpTpWjLCCV5e/qrHgC4E3jVBbvr7Z1QfGNZNZVm/ Y03MzQQeFPxbZT5zRL0YNx31wdNGWiEJEBrBbZ/7IPElpwaT/cJaO/tIby9/Pck7bTq0 OJew== X-Gm-Message-State: AOAM531N1c63K70uj+Q0u8gu0deSCyMBTpeOnGPMoBK/lpd3160qGEzb sh8H/KCzKfgYVPdfOmelvaTCcQ== X-Google-Smtp-Source: ABdhPJxP9a4/Optbq8Pk8kp7Jy2Q/qOJVBd4SWk6XtAdA12zQqIXWxXVjIw6Kryp3+cSFztGmOo3Kg== X-Received: by 2002:a7b:c5cd:0:b0:38c:8b1b:d220 with SMTP id n13-20020a7bc5cd000000b0038c8b1bd220mr4308413wmk.118.1653406872538; Tue, 24 May 2022 08:41:12 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 10/15] tests/qtest: catch unhandled vhost-user messages Date: Tue, 24 May 2022 16:40:51 +0100 Message-Id: <20220524154056.2896913-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653408009469100001 We don't need to action every message but lets document the ones we are expecting to consume so future tests don't get confused about unhandled bits. Signed-off-by: Alex Benn=C3=A9e --- v1 - drop g_test_fail() when we get unexpected result, that just hangs --- tests/qtest/vhost-user-test.c | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 90749c147e..11da6ff07a 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -358,12 +358,41 @@ static void chr_read(void *opaque, const uint8_t *buf= , int size) } break; =20 + case VHOST_USER_SET_OWNER: + /* + * We don't need to do anything here, the remote is just + * letting us know it is in charge. Just log it. + */ + qos_printf("set_owner: start of session\n"); + break; + case VHOST_USER_GET_PROTOCOL_FEATURES: if (s->vu_ops->get_protocol_features) { s->vu_ops->get_protocol_features(s, chr, &msg); } break; =20 + case VHOST_USER_SET_PROTOCOL_FEATURES: + /* + * We did set VHOST_USER_F_PROTOCOL_FEATURES so its valid for + * the remote end to send this. There is no handshake reply so + * just log the details for debugging. + */ + qos_printf("set_protocol_features: 0x%"PRIx64 "\n", msg.payload.u6= 4); + break; + + /* + * A real vhost-user backend would actually set the size and + * address of the vrings but we can simply report them. + */ + case VHOST_USER_SET_VRING_NUM: + qos_printf("set_vring_num: %d/%d\n", + msg.payload.state.index, msg.payload.state.num); + break; + case VHOST_USER_SET_VRING_ADDR: + qos_printf("set_vring_addr:\n"); + break; + case VHOST_USER_GET_VRING_BASE: /* send back vring base to qemu */ msg.flags |=3D VHOST_USER_REPLY_MASK; @@ -428,7 +457,18 @@ static void chr_read(void *opaque, const uint8_t *buf,= int size) qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; =20 + case VHOST_USER_SET_VRING_ENABLE: + /* + * Another case we ignore as we don't need to respond. With a + * fully functioning vhost-user we would enable/disable the + * vring monitoring. + */ + qos_printf("set_vring(%d)=3D%s\n", msg.payload.state.index, + msg.payload.state.num ? "enabled" : "disabled"); + break; + default: + qos_printf("vhost-user: un-handled message: %d\n", msg.request); break; } =20 --=20 2.30.2