From patchwork Sun Dec 4 19:17:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 2582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1912543wrr; Sun, 4 Dec 2022 11:27:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6FOt/cpqrv1Kjkaz1BWJ0rHRwY6p3KJZ9TVqKm08VsyR8UMNoYf5kVhCnSkoP+3jtkZtci X-Received: by 2002:a17:907:d40e:b0:7bb:f10c:9282 with SMTP id vi14-20020a170907d40e00b007bbf10c9282mr6251125ejc.325.1670182050735; Sun, 04 Dec 2022 11:27:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670182050; cv=none; d=google.com; s=arc-20160816; b=iV3tKeBk6NZfy3IsenmWIYvw4dVG4Uv/ORrvE9comDJQPGwupuZ/I4lsTitXQVn8ag 6LQhaxyOyDq4tg3PJD4Mtlnn8q+2YHAkAQvcfdoI8O7q0h2kXepkCRaXfsZt8ooRdiRN osUHZr4AzP/3WjaE/nNEhPpgoj2j7nUdgt4AX3wR8MV/4sLi5x4Cc9ZTOgOkBqU5UmRo Ho7j0ZBidN7oGt5kubsW8DtBAGgNWVhMzAYcAUxBBYSVqKqD68yBwnSUatJ4W2g9rCP3 x0DPci3dw/N3pA/oOG1G2QN33ScynLdRM9qYA3DYhDnWHJys3gODtvF1uvQCMJ9ZFEGb XaAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=skgE35J6ivY87+2f87J3uueS/nxNIyBMux3LvAvSxgE=; b=XbcydJkpBgA3F5e7x4Vi2v4df+UUc0JXZ39j2+EOdoAMebd6uaSjupQWmMJtTW3hjt AUQKPIuUOqzQIIll8E0By2Us3ho/SC7MH7jv8V/hav5WWXkaRKudqjRgCMo9ObkrQ/rW JVb7hRV8M9/1lj/UKfFLJtVIxiRaoLXq0ZYYxlB2RZzxDoYg0KB35+iimxoBJD0xAk1u AlHWeWzOAWFKbomV9qYekJnJ8P/eI2HI3skzO0XheAqWcjWOrZyDSwqfQ4PjfQclI1LU NKdItwm9Kg+xKQpej+nN6Dmxv0kA2h6T9rgEoobz2Ixa7BwvkuINvckm7R2hHTbuZxwF 20Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b="iAiB/r6g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056402271200b00467238595easi7106006edd.369.2022.12.04.11.27.07; Sun, 04 Dec 2022 11:27:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b="iAiB/r6g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230387AbiLDTRl (ORCPT + 99 others); Sun, 4 Dec 2022 14:17:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230297AbiLDTRi (ORCPT ); Sun, 4 Dec 2022 14:17:38 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BDF6A4; Sun, 4 Dec 2022 11:17:33 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 47B145FD03; Sun, 4 Dec 2022 22:17:30 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1670181450; bh=skgE35J6ivY87+2f87J3uueS/nxNIyBMux3LvAvSxgE=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=iAiB/r6g7k1wjBR8TbIf2K/PCAzvPZKkxMGCuJjXp8f81xu7YNSSb/jdRhYcMq1rd N8rwl+SuiOVxlG4UlM7vFbNHVFa3Bpe52O1HsM/QJrdYDll0GHiBjk2RMzjWj+ssxw o0nE3er86ZHSgt3hg8BTYEAykac8BT3z1j7AVbS/yRtRoOFR21mEuzoLX2McUK3uiQ Jkx9PV27K9mCJ8FsksfTZzeRdWjWLbQJ8ZaC1s8KLQDImFqyu6fUrJL6MSk/hJIUds yhrXZEZ13OOkO20SFtAKCechZQEfuEbHZl4NDxLUAm6dmsLoU4i9XjM0C4UyW0rETp jmG9IaG3FFANg== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mx.sberdevices.ru (Postfix) with ESMTP; Sun, 4 Dec 2022 22:17:27 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "David S. Miller" , "edumazet@google.com" , "Jakub Kicinski" , Paolo Abeni CC: Bobby Eshleman , Krasnov Arseniy , Arseniy Krasnov , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , kernel Subject: [RFC PATCH v3 0/4] vsock: update tools and error handling Thread-Topic: [RFC PATCH v3 0/4] vsock: update tools and error handling Thread-Index: AQHZCBUL8pVjCcixh0a5TtqWHSqeyw== Date: Sun, 4 Dec 2022 19:17:26 +0000 Message-ID: <6bd77692-8388-8693-f15f-833df1fa6afd@sberdevices.ru> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-ID: <050CC44EF805B848BA74D7739AAF9FF5@sberdevices.ru> MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/12/04 13:44:00 #20647742 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751312814036567178?= X-GMAIL-MSGID: =?utf-8?q?1751312814036567178?= Patchset consists of two parts: 1) Kernel patch One patch from Bobby Eshleman. I took single patch from Bobby: https://lore.kernel.org/lkml/d81818b868216c774613dd03641fcfe63cc55a45 .1660362668.git.bobby.eshleman@bytedance.com/ and use only part for af_vsock.c, as VMCI and Hyper-V parts were rejected. I used it, because for SOCK_SEQPACKET big messages handling was broken - ENOMEM was returned instead of EMSGSIZE. And anyway, current logic which always replaces any error code returned by transport to ENOMEM looks strange for me also(for example in EMSGSIZE case it was changed to ENOMEM). 2) Tool patches Since there is work on several significant updates for vsock(virtio/ vsock especially): skbuff, DGRAM, zerocopy rx/tx, so I think that this patchset will be useful. This patchset updates vsock tests and tools a little bit. First of all it updates test suite: two new tests are added. One test is reworked message bound test. Now it is more complex. Instead of sending 1 byte messages with one MSG_EOR bit, it sends messages of random length(one half of messages are smaller than page size, second half are bigger) with random number of MSG_EOR bits set. Receiver also don't know total number of messages. Message bounds control is maintained by hash sum of messages length calculation. Second test is for SOCK_SEQPACKET - it tries to send message with length more than allowed. I think both tests will be useful for DGRAM support also. Third thing that this patchset adds is small utility to test vsock performance for both rx and tx. I think this util could be useful as 'iperf', because: 1) It is small comparing to 'iperf()', so it very easy to add new mode or feature to it(especially vsock specific). 2) It is located in kernel source tree, so it could be updated by the same patchset which changes related kernel functionality in vsock. I used this util very often to check performance of my rx zerocopy support(this tool has rx zerocopy support, but not in this patchset). Patchset was rebased and tested on skbuff v5 patch from Bobby Eshleman: https://lore.kernel.org/netdev/20221202173520.10428-1-bobby.eshleman@bytedance.com/ Changelog: v2 -> v3: - Patches for VMCI and Hyper-V were removed from patchset(commented by Vishnu Dasa and Dexuan Cui) - In message bounds test hash is computed from data buffer with random content(in v2 it was size only). This approach controls both data integrity and message bounds. - vsock_perf: - grammar fixes - only long parameters supported(instead of only short) v1 -> v2: - Three new patches from Bobby Eshleman to kernel part - Message bounds test: some refactoring and add comment to describe hashing purpose - Big message test: check 'errno' for EMSGSIZE and move new test to the end of tests array - vsock_perf: - update README file - add simple usage example to commit message - update '-h' (help) output - use 'stdout' for output instead of 'stderr' - use 'strtol' instead of 'atoi' Bobby Eshleman(1): vsock: return errors other than -ENOMEM to socket Arseniy Krasnov(3): test/vsock: rework message bound test test/vsock: add big message test test/vsock: vsock_perf utility net/vmw_vsock/af_vsock.c | 3 +- tools/testing/vsock/Makefile | 1 + tools/testing/vsock/README | 34 +++ tools/testing/vsock/control.c | 28 +++ tools/testing/vsock/control.h | 2 + tools/testing/vsock/util.c | 13 ++ tools/testing/vsock/util.h | 1 + tools/testing/vsock/vsock_perf.c | 449 +++++++++++++++++++++++++++++++++++++++ tools/testing/vsock/vsock_test.c | 193 +++++++++++++++-- 9 files changed, 710 insertions(+), 14 deletions(-) --- 2.25.1