From patchwork Tue Dec 6 20:47:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 2685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3042424wrr; Tue, 6 Dec 2022 12:49:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Yfl4Nugk4acPB9KwoZY0lfC4HG30ZUudc5lKKqI6LH0dE6VShno2T5dIR8avk8Z6Zspdg X-Received: by 2002:a65:5543:0:b0:477:dc7f:bf24 with SMTP id t3-20020a655543000000b00477dc7fbf24mr51377610pgr.555.1670359796755; Tue, 06 Dec 2022 12:49:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670359796; cv=none; d=google.com; s=arc-20160816; b=veBk9zzIxQTt+w6B9Ie+QoJmE+lQ7lqzkMEXkd1TpVliYAalu06k0EfszQ5SYcOiKm /e/mk+CVsOorui5WUhMhWg7zyxVpwQSbwb/iQILEsawjA7UOO+LqBGKDNb5Y80gQZ9NQ j48O63mnLkdkFBhxWokY0YX9nj3ViMjdEc1TqpZXIxp1YvPpGsuFiheE79U1pCt2iPnF iPtVU+3aoEStOsYdJnAc49CLbIGpasYqISJ/dnYugwtsWHEB7bLXNG9xKrBD7wfV9aWn yVzrgU4BoeWw8MxlhnbtQjGDDyO3AvHwk90CgTVDS9BLRCxMLwOhJ4q1yg7QrLzRklMX r+5Q== 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=RXAuKFFL3DdHV6ZC1u0qrVJ7WK0bJttm1jn/GbmOhzU=; b=DQ/DkQzrKxyfYmFusE4b1rQoY1A4ukFSQeuBaQrefz/XkyGXSRzdQN5TScTZ5o75G7 freL7TkYVIjpVJEDIcKl6qn+lorqDJ3Hz+LG7sKeZvdqe6gf6YSyeHeGy/9F+C2ftY6G XWVFPOKpgVjYj3oMV/vHWl2freZFQp1gLDwpR/gL0Ct/AO732zIvnEE2VN73Oz05Cq/i xnwNwpGkWQ0CRZ0Oj2n5I+77Ib2HyWmTwe4Fxad/iU08uMhus5dKYZ4YG/vPlBk8YLo1 ks8EL67VLz11LkEGR5eG++t/gwUHhrCkGrAWqBcq3Rjya35S4eaTxSHuz1huTJfXyyf/ vDyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=Pn3qdlg6; 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 f9-20020a63f109000000b00476f2b0b330si17819031pgi.700.2022.12.06.12.49.43; Tue, 06 Dec 2022 12:49:56 -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=Pn3qdlg6; 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 S229681AbiLFUrd (ORCPT + 99 others); Tue, 6 Dec 2022 15:47:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbiLFUrb (ORCPT ); Tue, 6 Dec 2022 15:47:31 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B000143852; Tue, 6 Dec 2022 12:47:25 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 72B115FD0B; Tue, 6 Dec 2022 23:47:22 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1670359642; bh=RXAuKFFL3DdHV6ZC1u0qrVJ7WK0bJttm1jn/GbmOhzU=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Pn3qdlg69FjQA9KN6Nn6eSeoa+E4IG2dqSrMYZPqBB14i5aq0abPhc/AbEj0JTFxM BwFre8okOfT7Vg3Hc6B66hAI2906jryKPsN/EyxDNHGv5vmeYZUFpJJ8JZ1R4yedVM BMnLPHqFKgu47bmrsbAe++GS/2ia3Yq72ehKRsTrCeFP6Mtx8LIf4PyEyotGZ7xkXW PF4Jwp46eevOkt0fTYAYU6n+Z2hLYndAt71ylCKX5C8U38zRFb0fPeBz+q+BRpvziB EaUYVg9FQU9+BvhTuzj+cCByxyKtNgBSGXi9Iyzv3mbb9ib8TziCcopPGvhAyTDKYC Rdx54oj25WN6Q== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 6 Dec 2022 23:47:20 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , Jakub Kicinski , Paolo Abeni , "David S. Miller" , "edumazet@google.com" CC: Bobby Eshleman , Arseniy Krasnov , Krasnov Arseniy , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , kernel Subject: [RFC PATCH v4 0/4] vsock: update tools and error handling Thread-Topic: [RFC PATCH v4 0/4] vsock: update tools and error handling Thread-Index: AQHZCbPuYNvdlDeEMUa49xMsY3aUrw== Date: Tue, 6 Dec 2022 20:47:19 +0000 Message-ID: <6be11122-7cf2-641f-abd8-6e379ee1b88f@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: <0CE74A867B854345A2042FBF696520AD@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/06 12:14:00 #20663216 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1751499194287757242?= X-GMAIL-MSGID: =?utf-8?q?1751499194287757242?= 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: 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 | 434 +++++++++++++++++++++++++++++++++++++++ tools/testing/vsock/vsock_test.c | 197 ++++++++++++++++-- 9 files changed, 698 insertions(+), 17 deletions(-) --- 2.25.1