Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4316024rdb; Thu, 14 Sep 2023 20:25:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhgpHo9hqNTsBJzwH32bmug0rB2rPj3JXs4/MxuKyH9DePC1gGItp94h0zhXLxB2Igf/eO X-Received: by 2002:a05:6a00:22d0:b0:68c:a81:4368 with SMTP id f16-20020a056a0022d000b0068c0a814368mr510301pfj.6.1694748300292; Thu, 14 Sep 2023 20:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694748300; cv=none; d=google.com; s=arc-20160816; b=vvfiW5XZHZH/7y7vjw5T6LzhXUHLUGFBo87xLIG5hDYKDVNb8Fyj0gRtwZ+lwVQm/D yVDxII4VpdeTfLArmo/4qZD5RDj8v5Lhs6wzrWbaeKJv+3zERedKO59NpNoO8WAXDhNs QNBgXDQ5liy6d9eSRk9SoG1v59qms7RP3o3eXptfxBedlzF7vzvl0kT5aRe4CpEIQqLd wJZ8/BIx4Q5Pi/C6FpzwGnIfbgZBkvN33IXQPY2HAFvH+3rjds3dDhNGRyJ8gjMpm+MB +zLheWNS4YD7vyo2KJFoy6Aw6cbzIJrkTaI8dqhbTXjXDZIUCHgv8Q13fU5QnluE+WPF iBJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=buiiu+tLXB8hg1uWGuKZq7mBUyxAEPJaVjE6lmvNhuc=; fh=JEq7ZyqHwnKMAbPjHbEHIOO1u1YxTWxtQlCbJmwG+xw=; b=YZAHx63cRWxvT6SRm6/4HjdYlYgW3dnbwwFuaAr450w9ilBtwopE9g3iYD468Vt1wm zloLXKNz5g59lZqi7dIPYlyHW6Aa6sIRqp5eeyl7WZ5qRTpjRHwR7GYQ0wp6hNHXsC+5 5SiIzx+9/XxboRr7nb6sOG3bDsI+NUOAO7Ot+0gjHWQbfyNX9A1uJZ8nH3WbRMhS5RUs 19qHb/8+zN3d3qy/D4ogkMWzTt4bpziHFjM/PUzheMC4HzUzv5m78hgrgBpVi8lGZGpB yBPMioqphudaH1hkyE08QOfA7TcylMl+PKTS5DztG4N3uqqKWZP0GY+ybfaC3g9t6tb2 XPYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JmC5uH5I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bd35-20020a056a0027a300b0068e49e6ef96si2527767pfb.157.2023.09.14.20.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 20:25:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JmC5uH5I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 04259831DBFE; Thu, 14 Sep 2023 08:35:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241103AbjINPfW (ORCPT + 99 others); Thu, 14 Sep 2023 11:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241105AbjINPfU (ORCPT ); Thu, 14 Sep 2023 11:35:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 26A901FD4 for ; Thu, 14 Sep 2023 08:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694705667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=buiiu+tLXB8hg1uWGuKZq7mBUyxAEPJaVjE6lmvNhuc=; b=JmC5uH5IE19aaeO/yBZHpMWZaQ9UuAHoAdfpjUWygwv7Ir1uYOrmvFF5oeTuv+6DyJ269y fCfAZ5aaEfrK1CNG0p00UNfnvcFfG2e1y/mshmCl3BLCxCrFsz9N+oyAjFWJsdl+36fRhB XDLXzzsVHIb5uFJ8MlUWeas9Wl46bRw= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-5Dx95OfFN_qq4mBXB6W1EQ-1; Thu, 14 Sep 2023 11:34:26 -0400 X-MC-Unique: 5Dx95OfFN_qq4mBXB6W1EQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-31f46ccee0fso918394f8f.1 for ; Thu, 14 Sep 2023 08:34:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694705665; x=1695310465; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=buiiu+tLXB8hg1uWGuKZq7mBUyxAEPJaVjE6lmvNhuc=; b=Q+BYFWPHR588/AoPfdnkO+RLe25jRZJ0TPnsksYXoR9l3oTt8WSoBuwpT0mppIr98w Z3b3zeGQhvR6ybhTSuRDAzH81eu4/nzDTP1kgmzF+Phzz/ILWhIlZbJtpZ1r8+ryksR+ hT1F91nPsH6378LcpMzICYPTklcIEL+gQZGaVi+tN27CKdh/uR6hn7hdZX3A8Xulujkn vbmzvRt4oXxBNCU9lLbqX2FFmw8fQRugfLrUdPV/TADQnBg9+fzhuYMDcyux0EO9zwyo I/Fv+l+IOkDZ2jI4eXr3nB5iw1/3+3sESioY520TFqL6bdxtg24QjnlnftmkpSxpMhnx IkCw== X-Gm-Message-State: AOJu0YxdMxbt8FJeZ713tsQrKKwK36vPCpiULhsdlkaS+TtOsEZ0GuBM vFGAjbazeJVc3aH1ECw3GELTl1k+UAsrcv85ikTJ+FZ4nGVID86PMvzKcLmxqJji20f0hg38/ZH EhDP6tokU7ZthMr74/KhHhPQv X-Received: by 2002:a5d:5948:0:b0:31c:8c5f:877e with SMTP id e8-20020a5d5948000000b0031c8c5f877emr1882384wri.33.1694705665493; Thu, 14 Sep 2023 08:34:25 -0700 (PDT) X-Received: by 2002:a5d:5948:0:b0:31c:8c5f:877e with SMTP id e8-20020a5d5948000000b0031c8c5f877emr1882368wri.33.1694705665105; Thu, 14 Sep 2023 08:34:25 -0700 (PDT) Received: from sgarzare-redhat ([46.222.114.183]) by smtp.gmail.com with ESMTPSA id l5-20020a7bc445000000b003fee849df23sm2283011wmi.22.2023.09.14.08.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 08:34:24 -0700 (PDT) Date: Thu, 14 Sep 2023 17:34:18 +0200 From: Stefano Garzarella To: Arseniy Krasnov Cc: Stefan Hajnoczi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Jason Wang , Bobby Eshleman , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@sberdevices.ru, oxffffaa@gmail.com Subject: Re: [PATCH net-next v8 0/4] vsock/virtio/vhost: MSG_ZEROCOPY preparations Message-ID: <63xflnwiohdfo6m3vnrrxgv2ulplencpwug5qqacugqh7xxpu3@tsczkuqgwurb> References: <20230911202234.1932024-1-avkrasnov@salutedevices.com> <554ugdobcmxraek662xkxjdehcu5ri6awxvhvlvnygyru5zlsx@e7cyloz6so7u> <7bf35d28-893b-5bea-beb7-9a25bc2f0a0e@salutedevices.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7bf35d28-893b-5bea-beb7-9a25bc2f0a0e@salutedevices.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 08:35:21 -0700 (PDT) On Thu, Sep 14, 2023 at 05:05:17PM +0300, Arseniy Krasnov wrote: >Hello Stefano, > >On 14.09.2023 17:07, Stefano Garzarella wrote: >> Hi Arseniy, >> >> On Mon, Sep 11, 2023 at 11:22:30PM +0300, Arseniy Krasnov wrote: >>> Hello, >>> >>> this patchset is first of three parts of another big patchset for >>> MSG_ZEROCOPY flag support: >>> https://lore.kernel.org/netdev/20230701063947.3422088-1-AVKrasnov@sberdevices.ru/ >>> >>> During review of this series, Stefano Garzarella >>> suggested to split it for three parts to simplify review and merging: >>> >>> 1) virtio and vhost updates (for fragged skbs) <--- this patchset >>> 2) AF_VSOCK updates (allows to enable MSG_ZEROCOPY mode and read >>> ? tx completions) and update for Documentation/. >>> 3) Updates for tests and utils. >>> >>> This series enables handling of fragged skbs in virtio and vhost parts. >>> Newly logic won't be triggered, because SO_ZEROCOPY options is still >>> impossible to enable at this moment (next bunch of patches from big >>> set above will enable it). >>> >>> I've included changelog to some patches anyway, because there were some >>> comments during review of last big patchset from the link above. >> >> Thanks, I left some comments on patch 4, the others LGTM. >> Sorry to not having spotted them before, but moving >> virtio_transport_alloc_skb() around the file, made the patch a little >> confusing and difficult to review. > >Sure, no problem, I'll fix them! Thanks for review. > >> >> In addition, I started having failures of test 14 (server: host, >> client: guest), so I looked better to see if there was anything wrong, >> but it fails me even without this series applied. >> >> It happens to me intermittently (~30%), does it happen to you? >> Can you take a look at it? > >Yes! sometime ago I also started to get fails of this test, not ~30%, >significantly rare, but it depends on environment I guess, anyway I'm going to >look at this on the next few days Maybe it's just a timing issue in the test, indeed we are expecting 8 bytes but we received only 3 plus the 2 bytes we received before it seems exactly the same bytes we send with the first `send(fd, HELLO_STR, strlen(HELLO_STR), 0);` Since it is a stream socket, it could happen, so we should retry the recv() or just use MSG_WAITALL. Applying the following patch fixed the issue for me (15 mins without errors for now): diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c index 90718c2fd4ea..7b0fed9fc58d 100644 --- a/tools/testing/vsock/vsock_test.c +++ b/tools/testing/vsock/vsock_test.c @@ -1129,7 +1129,7 @@ static void test_stream_virtio_skb_merge_server(const struct test_opts *opts) control_expectln("SEND0"); /* Read skbuff partially. */ - res = recv(fd, buf, 2, 0); + res = recv(fd, buf, 2, MSG_WAITALL); if (res != 2) { fprintf(stderr, "expected recv(2) returns 2 bytes, got %zi\n", res); exit(EXIT_FAILURE); @@ -1138,7 +1138,7 @@ static void test_stream_virtio_skb_merge_server(const struct test_opts *opts) control_writeln("REPLY0"); control_expectln("SEND1"); - res = recv(fd, buf + 2, sizeof(buf) - 2, 0); + res = recv(fd, buf + 2, 8, MSG_WAITALL); if (res != 8) { fprintf(stderr, "expected recv(2) returns 8 bytes, got %zi\n", res); exit(EXIT_FAILURE); I will check better all the cases and send a patch upstream. Anyway it looks just an issue in our test suite :-) Stefano > >Thanks, Arseniy > >> >> host$ ./vsock_test --mode=server --control-port=12345 --peer-cid=4 >> ... >> 14 - SOCK_STREAM virtio skb merge...expected recv(2) returns 8 bytes, got 3 >> >> guest$ ./vsock_test --mode=client --control-host=192.168.133.2 --control-port=12345 --peer-cid=2 >> >> Thanks, >> Stefano >> >