From patchwork Fri Nov 25 17:00:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 2244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4168440wrr; Fri, 25 Nov 2022 09:10:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5A0B+RGHVXPUx1BA7ckw1g4VaJ2AAe1KFJkGCgDrWlOpuQPUZB6WpBPL1WTT3bGGiAZiom X-Received: by 2002:a17:903:26cf:b0:186:e114:bea6 with SMTP id jg15-20020a17090326cf00b00186e114bea6mr19465887plb.88.1669396230526; Fri, 25 Nov 2022 09:10:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669396230; cv=none; d=google.com; s=arc-20160816; b=yszfhT9L2vAMllmt6sC1zUii3PDofHiOU60k/xrui/bCcIEmgl/AlVwvV7BeyUCpPR Y94XjogLqzOcWSOcZTLcixL7pKqVU0rERXtzqflzafXDReQ93Chx0B9xwBJA18ylIVMX Op0aAmb0UdElvIiTkMTyvR4m4AYVjR/1UG/nPR95tcOzUxOHanopo2lqQ33th2VDOFWW dvUz21D7jvUcA1hHgZq5xga5E4owrFlAM4Ien6ebz+lYXKgP0cBgeO4PeKeRtDiMbkGX jFlMoB4CVrswwQ8j7BB6vD9LDSOTD2N1ePoJApxU9fK3v6S1bi8Dlc0ExqYorWV5An/s IQwg== 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=Vy7tglWDZchkmeNCXURGl6jAA6MukTO4JV60RU6e8rs=; b=SQGFRc7HYzIRZr40iX/J3vCtdlyQ7HwZyPeHkXla8ogAC9xmZDUkkWgUolauA7uGsO Qnpjx/9sfxg6L/Al3T0fcGlrBLwQfupNoNY/cjcZCIsKe1yXy3xfIoCcFCiZPsBS05pg FHsSOwlv9tNayfc9N3SI1rqk2GNgaIXHR5mPxwZ+j57Rc42TZaN1aOcrb75VujZmiOR7 swB+3pXqB9LFK8HBKLuCGNbkmjvojkX9mGWMyEfnJwUcydi5mg1fZJX/JYLP6gBzqhMV IkpYQB+lpUdG6/bcwQ6AkBrK7SPCdSDr9qRFJix+RsDcRr6HuB5sk5a43odHSi/DaECJ QTCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=ZBx3e+YV; 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 x22-20020a170902b41600b00188e9ec511dsi3860734plr.397.2022.11.25.09.10.11; Fri, 25 Nov 2022 09:10: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=ZBx3e+YV; 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 S229598AbiKYRAi (ORCPT + 99 others); Fri, 25 Nov 2022 12:00:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbiKYRAg (ORCPT ); Fri, 25 Nov 2022 12:00:36 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7DB921E1E; Fri, 25 Nov 2022 09:00:34 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 205995FD0D; Fri, 25 Nov 2022 20:00:33 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1669395633; bh=Vy7tglWDZchkmeNCXURGl6jAA6MukTO4JV60RU6e8rs=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=ZBx3e+YVjbQtbi46YKkDQWvBmqPT20z0EnWtlbTjKyLN3gfeUylNxhzHdIe8RYt/g 6hG5pXusrmzrn8lzCayTiUC5GISrJdu/a3YJwgerBXOVkGKfAes1R4GVKtbOF/kz2Q eZBh5CONIO4ytCeCgZNtO0sdzKnzm+fY1wxts2NDEXVb470sCBMVR0AHUmvAHla0KA hMY3c4L+auQZYmthTf/Q9nQvj3/0xSUb6xTI/HLaXDlnVAokkHjJE6nNJdqMMb6e8g gOG1xBp6BEo6lVJtoTaMiflEBZlyRJfXW+uN/utAc4U08oiKU4ysxonp6L/60qrrh5 9je7u4SVF5ULw== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mx.sberdevices.ru (Postfix) with ESMTP; Fri, 25 Nov 2022 20:00:31 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "David S. Miller" , "edumazet@google.com" , "Jakub Kicinski" , Paolo Abeni , "kys@microsoft.com" , "haiyangz@microsoft.com" , "wei.liu@kernel.org" , "Dexuan Cui" , Bryan Tan , Vishnu Dasa , Bobby Eshleman , "Arseniy Krasnov" , Krasnov Arseniy , Bobby Eshleman CC: "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , kernel Subject: [RFC PATCH v2 0/6] vsock: update tools and error handling Thread-Topic: [RFC PATCH v2 0/6] vsock: update tools and error handling Thread-Index: AQHZAO9tLgclKwOwKEaUfQ8774hEhw== Date: Fri, 25 Nov 2022 17:00:31 +0000 Message-ID: <9d96f6c6-1d4f-8197-b3bc-8957124c8933@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: <22F201B3173A6F4898FFFF72891F788A@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/11/25 14:59:00 #20610704 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?1750488821432147899?= X-GMAIL-MSGID: =?utf-8?q?1750488821432147899?= Patchset consists of two parts: 1) Kernel patches Three patches from Bobby Eshleman. I took single patch from Bobby: https://lore.kernel.org/lkml/d81818b868216c774613dd03641fcfe63cc55a45 .1660362668.git.bobby.eshleman@bytedance.com/ and split it to three patches according different parts of vsock subsystem. 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). So, one of three patches updates af_vsock.c, keeping error code from transport untouched, while another 2 patches save original behaviour for Hyper-V and VMCI. Please, Hyper-V and VMCI guys, could You take a look? Is previous behaviour really needed? 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 v4 patch from Bobby Eshleman: https://lore.kernel.org/netdev/20221124060750.48223-1-bobby.eshleman@bytedance.com/ Changelog: 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(3): vsock: return errors other than -ENOMEM to socket hv_sock: always return ENOMEM in case of error vsock/vmci: always return ENOMEM in case of error 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 +- net/vmw_vsock/hyperv_transport.c | 2 +- net/vmw_vsock/vmci_transport.c | 9 +- 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 | 400 +++++++++++++++++++++++++++++++++++++++ tools/testing/vsock/vsock_test.c | 193 +++++++++++++++++-- 11 files changed, 670 insertions(+), 16 deletions(-) --- 2.25.1