Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2516259rdb; Wed, 15 Nov 2023 03:08:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNY2C8RuYVW2PzI/DmlaTDUxqDUxFvIwE1lmN06APfQgz3evHfWVeY7HoEKkQor2dHO6sJ X-Received: by 2002:a05:6830:1618:b0:6bf:12:5189 with SMTP id g24-20020a056830161800b006bf00125189mr5027512otr.26.1700046532989; Wed, 15 Nov 2023 03:08:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700046532; cv=none; d=google.com; s=arc-20160816; b=zXuxcAFqAyeiikHa+TRFsNSpdf5Zjb4gwgvNPXI0hgqhT71ixjCijRyiU5/7wIR4NH B1qhH9N0+Jn27OykQ8EeyzAaM2tKb1zc6pXomoTed+3pXO/4IeIgF1dcTyGLbFs2gEOB YDlOM7+1ojagtaj3RBmJABR3twGzyEq+IIYkD9Xn7Gdxhz9VdzIDuMj+kkAHuE2iBtlS Q6UZsWv7oXu4x8Z0Pzv8CmnB3YCMprPqdAyil+xz3ZiQ9mImFufh9KHyVzf35q3yJcdw G67243mLSROd8n7GKzZd/aHnrub2/5Cu4wClTNUKAi2/AdLS8ABfhJCXCluQvQ8f6V+A WlFQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=30YlxcbouoHUqbszSietM15X2VzsRmxEM5Z6VzVk+yg=; fh=JEq7ZyqHwnKMAbPjHbEHIOO1u1YxTWxtQlCbJmwG+xw=; b=H19Uec5bRjwpNyCzSQCOZYgdYBzhdFBU2tNPQRpTda6dim1DGMS2RWRFrCh6dI+DLH Tfn9i8okXdDMGgynskTzjSTzOIjn+bNasZdxXsu2rWLaYtIHhxHLhGL8PtPwzyPoeMOu hP0k+roXZTJpa6AUSvv25mDWT3bQz6G4EDLmyb/m3AQ6UQt6UEXsKfNcO1gDoI8gq5O2 hij6ycG2Y6Wy4EeOd3BtWY8Mr+x4I9w5nBXNOlKP29Z0508HSW6YOKjKqilNHfb/dqRt mLPwhljjmr6QhCEG5D16RwFWTHIr0lxzwNlDQ0esqwnGBsqeu06D+Ttc11g75iOKeJaP XMfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="hu/bNW6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id cf8-20020a056a02084800b005b96a77e706si10893756pgb.564.2023.11.15.03.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 03:08:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="hu/bNW6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 9CFBF802EE43; Wed, 15 Nov 2023 03:08:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234916AbjKOLIh (ORCPT + 99 others); Wed, 15 Nov 2023 06:08:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbjKOLIg (ORCPT ); Wed, 15 Nov 2023 06:08:36 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A9CC5 for ; Wed, 15 Nov 2023 03:08:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700046511; 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: in-reply-to:in-reply-to:references:references; bh=30YlxcbouoHUqbszSietM15X2VzsRmxEM5Z6VzVk+yg=; b=hu/bNW6/3vyAHjwBIUmADTmarsYKaL0BcL/g/tetEtgEq6YwSgME7EzDbJ9zBO4sGpwqcg BHxgJl1WVpLW0EoDCqkgZ/O9b2MfEQwFArs49k8R6q3YBTDZPibsSOShjNRDlcCb5KuSfE EsJ3DLxvFHTG/h5okMMHZ4veEfoGtlM= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-529-QgSuCw9jMySqH4vBzF6a-A-1; Wed, 15 Nov 2023 06:08:30 -0500 X-MC-Unique: QgSuCw9jMySqH4vBzF6a-A-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-9bea60bd1adso93167766b.0 for ; Wed, 15 Nov 2023 03:08:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700046509; x=1700651309; h=in-reply-to: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=30YlxcbouoHUqbszSietM15X2VzsRmxEM5Z6VzVk+yg=; b=dc9s66TNWcTO3vk7C2hrYT+fmAJWRYhnf4iloPp03CdLs/IvkB1Nwyv3mBznxgTF2E Psx5zEGk1CWoSFAaS7PERnpYntq4wrPlSjo8DOAxeGVHJ7xrGR+SSvdcYT5YWBMZjCYt zEsc3UGWZTOEo39pORC6NsXszBh+wqBEJKphFfGkVFXgbwQskgMJVMS3cQOf+o8i2Ct4 kKBVUu8uLEpoPoJDD3yHibTTdpHb8nASYx2H4tSDITmaus6Vf2qwMBsAEORe1cm1VDG2 mCR4bCwL3jH9B94PDLdN/VC2Sk3P3govBgxxAY8H4ATrQEKcvqr1g2/MoH+FcE/Dhovp AdMA== X-Gm-Message-State: AOJu0Yz5NoYYL+FhxELUhzMfUltNMArxIXkJPWi2CKapMXXRnrWZ3xJ2 hf9FJMTImJLNmJtErYxdrdxX7cbH3zRvlFfulhiw58IB2I0Yu27eNhsYcWkXc6AdIqJ0/O6HQ8x EgUn6jaP0G2smAQjTeTmMP2hY X-Received: by 2002:a17:906:66d9:b0:9e6:2c5a:450a with SMTP id k25-20020a17090666d900b009e62c5a450amr4490051ejp.26.1700046509098; Wed, 15 Nov 2023 03:08:29 -0800 (PST) X-Received: by 2002:a17:906:66d9:b0:9e6:2c5a:450a with SMTP id k25-20020a17090666d900b009e62c5a450amr4490025ejp.26.1700046508757; Wed, 15 Nov 2023 03:08:28 -0800 (PST) Received: from sgarzare-redhat (host-79-46-200-199.retail.telecomitalia.it. [79.46.200.199]) by smtp.gmail.com with ESMTPSA id v6-20020a056402174600b00530a9488623sm6410463edx.46.2023.11.15.03.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 03:08:28 -0800 (PST) Date: Wed, 15 Nov 2023 12:08:23 +0100 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: [RFC PATCH v1 0/2] send credit update during setting SO_RCVLOWAT Message-ID: References: <20231108072004.1045669-1-avkrasnov@salutedevices.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20231108072004.1045669-1-avkrasnov@salutedevices.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 15 Nov 2023 03:08:49 -0800 (PST) On Wed, Nov 08, 2023 at 10:20:02AM +0300, Arseniy Krasnov wrote: >Hello, > > DESCRIPTION > >This patchset fixes old problem with hungup of both rx/tx sides and adds >test for it. This happens due to non-default SO_RCVLOWAT value and >deferred credit update in virtio/vsock. Link to previous old patchset: >https://lore.kernel.org/netdev/39b2e9fd-601b-189d-39a9-914e5574524c@sberdevices.ru/ > >Here is what happens step by step: > > TEST > > INITIAL CONDITIONS > >1) Vsock buffer size is 128KB. >2) Maximum packet size is also 64KB as defined in header (yes it is > hardcoded, just to remind about that value). >3) SO_RCVLOWAT is default, e.g. 1 byte. > > > STEPS > > SENDER RECEIVER >1) sends 128KB + 1 byte in a > single buffer. 128KB will > be sent, but for 1 byte > sender will wait for free > space at peer. Sender goes > to sleep. > > >2) reads 64KB, credit update not sent >3) sets SO_RCVLOWAT to 64KB + 1 >4) poll() -> wait forever, there is > only 64KB available to read. > >So in step 4) receiver also goes to sleep, waiting for enough data or >connection shutdown message from the sender. Idea to fix it is that rx >kicks tx side to continue transmission (and may be close connection) >when rx changes number of bytes to be woken up (e.g. SO_RCVLOWAT) and >this value is bigger than number of available bytes to read. > >I've added small test for this, but not sure as it uses hardcoded value Thanks for adding the test! >for maximum packet length, this value is defined in kernel header and >used to control deferred credit update. And as this is not available to >userspace, I can't control test parameters correctly (if one day this >define will be changed - test may become useless). I see, I'll leave a comment in the patch! Thanks, Stefano > >Head for this patchset is: >https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=ff269e2cd5adce4ae14f883fc9c8803bc43ee1e9 > >Arseniy Krasnov (2): > virtio/vsock: send credit update during setting SO_RCVLOWAT > vsock/test: SO_RCVLOWAT + deferred credit update test > > drivers/vhost/vsock.c | 2 + > include/linux/virtio_vsock.h | 1 + > net/vmw_vsock/virtio_transport.c | 2 + > net/vmw_vsock/virtio_transport_common.c | 31 ++++++ > net/vmw_vsock/vsock_loopback.c | 2 + > tools/testing/vsock/vsock_test.c | 131 ++++++++++++++++++++++++ > 6 files changed, 169 insertions(+) > >-- >2.25.1 >