From patchwork Tue Dec 20 07:16:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 3137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2821262wrn; Mon, 19 Dec 2022 23:26:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf539vwLtIrV8+s3lAWI0DQqFZtfMDw+teuRk7AxSu14wQlkDmJlKltuCZAT9Y5NL+qJ7wqu X-Received: by 2002:a17:903:22c3:b0:189:d92b:86e4 with SMTP id y3-20020a17090322c300b00189d92b86e4mr68800649plg.52.1671521197318; Mon, 19 Dec 2022 23:26:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671521197; cv=none; d=google.com; s=arc-20160816; b=yJ++ExcmNs8fvy0h+1SUX+8b6DTTuBDlNhLtfwQKnss+oqbvajTatevM+FThQCQlh1 oLOhkpORuE9LvuRgnK6DWn0drs6bdxnm5tpHsGVxALEKvDj0ZEdGxckuJkMSD1tHbeTC j3srvP6YjMPBUCwUtSkPi08p+3TCupc+wUd6hwNe1N6xQQIS0d1LJgufbnZCEbhtPUXR LNiuGVPChTaw561OH20TASkOv/vcaOg0RRpxv01pW7wKTIZOfVER6pvN6N70hJM0cKMY fOcTc+XOvYOTsOkLHpnZBeH7zsYcsmmrj6QL+cHr2e3YYSAHfpJ+hCvA1ZgL8gzJwL+S YiDQ== 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=5TEeyQjMSCugpLlqn25zZiJa9RZz4CI7g8CSW0c7C3s=; b=yMXI4BmGE+eZuafplWBMnNUAuHxmOv3StROvkzWo7Pw9aZOfT2k5QOPAN0AZObQc20 kfzY9D8wdJWc3P81tjWeiE7t/hXpq4g55XvipQM4Ua/k6K78/d/UGlCdOAt9vxTkkkff nBljYWexE5Le3d5rvSNcWXQynIurg71Tbl4qPgY5Hwb6zrvF7ctT1MSBpMdz6BXPxbTV h7qdOpEdr8hCsLWv5zWfGEiMxQoS5vFpehT61QbM5I/43qXO+M5ploKT3uuWbb/oErEs eLp/w7vb6lC8byEO0+6/y+ZzaSZ7ucxSnfgHBT4L18zq3rWSgwiNlmu+5szdJyx/XJDg HcZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=dRgeSiD6; 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 a8-20020a170902b58800b00191191fe7absi6523301pls.448.2022.12.19.23.26.25; Mon, 19 Dec 2022 23:26:37 -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=dRgeSiD6; 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 S233551AbiLTHRX (ORCPT + 99 others); Tue, 20 Dec 2022 02:17:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233269AbiLTHQv (ORCPT ); Tue, 20 Dec 2022 02:16:51 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 364B1263E; Mon, 19 Dec 2022 23:16:41 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 7B29D5FD04; Tue, 20 Dec 2022 10:16:39 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1671520599; bh=5TEeyQjMSCugpLlqn25zZiJa9RZz4CI7g8CSW0c7C3s=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=dRgeSiD6/a0qgE5smiRGzUID5RK0gAY1u97sYw2qEoq4+1T1li/is15cHI7FNEFFP C3oT+fXXOnnS1yBBw2+ONkqCNmXs2s586ykwLjA/1E8cNzhityWTNjTyll4NXkhfmg cueMbOhyFSu86jRX224dhI6UicarAUTOP5FNYMR1mVYl3duhT9IjXl7eX8BsQtIQe7 qwcD1q+B8bu1f1BAmk5exA/iXOsugjsIz7nFaNaBqXIl14L5KEJZqgETtHJ1RadABC bKB8aoCncZYROQ5EHn9VqiueVwTZhdGqfB+oPLUkdue9JxR50fTXlckfndq45awKBY O/c4uEMNEO5yA== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 20 Dec 2022 10:16:38 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "David S. Miller" , "edumazet@google.com" , "Paolo Abeni" , Jakub Kicinski CC: "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , kernel , Bobby Eshleman , Krasnov Arseniy , "Arseniy Krasnov" Subject: [RFC PATCH v5 0/4] vsock: update tools and error handling Thread-Topic: [RFC PATCH v5 0/4] vsock: update tools and error handling Thread-Index: AQHZFEMAQA1kPjJjEE22ZwRXjunQBQ== Date: Tue, 20 Dec 2022 07:16:38 +0000 Message-ID: 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: <745CFE863090454596892ADE6730C2C7@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/20 03:38:00 #20687629 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?1752717010909661645?= X-GMAIL-MSGID: =?utf-8?q?1752717010909661645?= 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'/'uperf', because: 1) It is small comparing to 'iperf' or 'uperf', so it very easy to add new mode or feature to it(especially vsock specific). 2) It allows to set SO_RCVLOWAT and SO_VM_SOCKETS_BUFFER_SIZE option. Whole throughtput depends on both parameters. 3) It is located in the 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). Here is comparison of outputs from three utils: 'iperf', 'uperf' and 'vsock_perf'. In all three cases sender was at guest side. rx and tx buffers were always 64Kb(because by default 'uperf' uses 8K). iperf: [ ID] Interval Transfer Bitrate [ 5] 0.00-10.00 sec 12.8 GBytes 11.0 Gbits/sec sender [ 5] 0.00-10.00 sec 12.8 GBytes 11.0 Gbits/sec receiver uperf: Total 16.27GB / 11.36(s) = 12.30Gb/s 23455op/s vsock_perf: tx performance: 12.301529 Gbits/s rx performance: 12.288011 Gbits/s Results are almost same in all three cases. Patchset was rebased and tested on skbuff v8 patch from Bobby Eshleman: https://lore.kernel.org/netdev/20221215043645.3545127-1-bobby.eshleman@bytedance.com/ Changelog: v4 -> v5: - Kernel patch: update commit message - vsock_perf: - Fix typo in commit message - Use "fprintf(stderr," instead of "printf(" for errors - More stats for tx: total bytes sent and time in tx loop - Print throughput in 'gigabits' instead of 'gigabytes'(as in 'iperf' and 'uperf') - Output comparisons between 'iperf', 'uperf' and 'vsock_perf' added to CV. v3 -> v4: - Kernel patch: update commit message by adding error case description - Message bounds test: - Typo fix: s/contols/controls - Fix error output on 'setsockopt()'s - vsock_perf: - Add 'vsock_perf' target to 'all' in Makefile - Fix error output on 'setsockopt()'s - Swap sender/receiver roles: now sender does 'connect()' and sends data, while receiver accepts connection. - Update arguments names: s/mb/bytes, s/so_rcvlowat/rcvlowat - Update usage output and description in README 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 | 3 +- 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 | 441 +++++++++++++++++++++++++++++++++++++++ tools/testing/vsock/vsock_test.c | 197 +++++++++++++++-- 9 files changed, 705 insertions(+), 17 deletions(-) --- 2.25.1