From patchwork Tue May 24 15:40:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 575740 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:c603:0:0:0:0 with SMTP id jv3csp2419748mab; Tue, 24 May 2022 08:56:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9j3UD/rmdrHzF4AQnyYX9qI+RejfDipNoYbtnYkI6+NaQwsmryelEFoon+3NbqQlqIlPT X-Received: by 2002:ac8:7e8d:0:b0:2f3:b3c3:edfb with SMTP id w13-20020ac87e8d000000b002f3b3c3edfbmr20838092qtj.680.1653407764300; Tue, 24 May 2022 08:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653407764; cv=none; d=google.com; s=arc-20160816; b=F+GlbNsSMxPBZ6wAiJBgm3qckd1g8uhyq/oqTFsuJUTEy6h0bgvyz2Q+5SWUvsbQZR gh+9VPd4piWIkKdo4tOTztSB5xRjtDQiomhzDKd0uaVSdVSoBgBLp/r/6mW33FYB4Hvd RdNCBbcsdQDfPNEHqY1cbX6f1kpqCFqpykha2rDAIOUnOdBr/15TLR/mj0+fK01LqIg8 dEEkIQmlFAKyaaunLNreTlPhwKQW8LYxnmyTFH5BoosO8MZwZ7/shROEFinrjJu9EFom MSFarcR78ynmmig94VBgL6JfzchYidFgLctehmjPSYkJ12nVLq9lVNF8/Z8DYGprYp6V 8XHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0BYVTVZiKjXfpCfzCQnV5P+1PaZA5TNtHfPlJaQOz5w=; b=I4PECn1w7xWOr/CLAAs5OHYSWhr3/o0cDXgReizK29lUNSIIOGT+DTXnAdppcRW7fa OyOG/d+VDPdBxMppheHzCyJE9/TEqGFOetVtfzGI+TLntA9l4UmxvBYVV7BBpgyePMQg bet4ST6rlAdsHk17Wh0ZXySZnx8fr+UlV4D5uMIrqSbgJakJ1r5zLB8+XGTgteDjV1OS 8Czt1H5pixicWIMOVvvZjVLCpt8TGnYAy+ZnE9LwqdeGok9tfbtVXpdTMHqgD9YXFFJS wO1k3lZ0xv1zGzjdHYz1v8vLfQh/yYpsA73Tukcrg3UNJxAphtrdtLjnFkSBGPK4P2Rg +Wpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xnOug7Af; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ib13-20020a0562141c8d00b00458c912b5dbsi4333243qvb.478.2022.05.24.08.56.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 May 2022 08:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xnOug7Af; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWt9-0005HU-RD for patch@linaro.org; Tue, 24 May 2022 11:56:03 -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) 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-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) 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) From: =?utf-8?q?Alex_Benn=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_Benn=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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- 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; + 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; + 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.u64); + 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 |= 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; + 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)=%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; }