Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4746185rdb; Tue, 12 Dec 2023 08:13:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8cnqKxS1kCv5n9EGCxdWU8WCfxCq5NvkIxIlr1zlh3TP6njn92hA0mwyQ26pKGiq0oFkM X-Received: by 2002:a05:6a00:1394:b0:6ce:4665:59df with SMTP id t20-20020a056a00139400b006ce466559dfmr3500545pfg.4.1702397585910; Tue, 12 Dec 2023 08:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702397585; cv=none; d=google.com; s=arc-20160816; b=ozGbI5vmtmZ1z/0CQG7/i6kVOoamnzzPhffSGBRei55qfXgpKjQQIpBWz2rWQlEh6U LD7Hq/IM0/ISDYNjxVx+LOHaNNK8P7kMWGfYfQyjhXhoz7ND1hSSuI9iPywYe+Jg4LX+ WQZPQzObua14ASe15vbONc7lRJCOx6OTrIsEiOO+V/I+lck7hFkePtzoqoINjbsB5p4C 6CO3YKIADRZnZccECon13iLUyPwGWYiJO1AJo3OlkUvxSxwEUnMzqK9HVGPciI+C2zF0 Mj2aop8zmfge/BWGazytd78NCbe2kkUsoxlgmPb6P5OfDcZ6Nx1mixvBl5kf58CtE/gm P1ZA== 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=73Y77tPLmgg9X166NzbyHTwHM16bRnjvtwZKK18ICnw=; fh=mgDOnflgqBhki4srQQbjlV/AUGmKs0Gt5yx+zXhaHYo=; b=QpVlnFzHKMGDB/+rJDSzPmurtltmPJ2KdniEgJZug5creC0g2tHQfg7Ck8MV8TGvKf 8/+j4QK5gowREObQHzOAz9k36i+XtuDCo0TYfJLtNHAgeNQ9vMP8T7Z/qwRWzNHQHiF4 yGoi5/yJ1cuSucT4EPRMqeczJATHr9M7kDSUk8rQfCdawDSHM1r+57Cs2kFqtocgch/i krDqbxaijlJGvCcUWggf6gYXa4nNNgkvFLrNhIwKbb0KuLLw89OT+TKdqLnjBZkitGbW Gr19Plt0m76S64KKCZpwYFQnsRDq2DUuSin6gmLdURSfwvCLYL7Dux4tI05MctwO0ZHL dKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W5avMkIJ; 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 u1-20020a6540c1000000b005ac8d44bad4si7643914pgp.592.2023.12.12.08.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 08:13:05 -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=W5avMkIJ; 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 F417780A7CF9; Tue, 12 Dec 2023 08:13:02 -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 S232611AbjLLQMl (ORCPT + 99 others); Tue, 12 Dec 2023 11:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232520AbjLLQMh (ORCPT ); Tue, 12 Dec 2023 11:12:37 -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 4D94AA1 for ; Tue, 12 Dec 2023 08:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702397562; 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=73Y77tPLmgg9X166NzbyHTwHM16bRnjvtwZKK18ICnw=; b=W5avMkIJCQIMJ4epsFZXexFeGDLwoZO6rrlroHzzeBG66YfZ7JGOKhQ198NWsIGXFQCzNg 7IhsTqsixED6la1AZeWE5Td/RKSBUX5WnTi9dJ/XwDkSL8zMMkkBXwCx9ZtLG7hzm/zRGd NTw6hSR2tjQnEAn9JlWe5jv1MJg7uBU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-XdPFtulIOW20bLhIVwQsaA-1; Tue, 12 Dec 2023 11:12:41 -0500 X-MC-Unique: XdPFtulIOW20bLhIVwQsaA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40c412c62d8so22590035e9.2 for ; Tue, 12 Dec 2023 08:12:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702397560; x=1703002360; 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=73Y77tPLmgg9X166NzbyHTwHM16bRnjvtwZKK18ICnw=; b=iYnexHrLGQGdOlEwJOSQ81UXQAZ12WqF2Q8A1kQpLOjpg1rFBY6o9nGJKqmAjhsiLQ xeoydfVQu+0QEsQ1IGhcSA5m96nD2qwECdji208yX8oN+uA2N3u5d8KFnXwu1f3WIgaj qPVZed1K9W+1m+yvyGwTMOwKdCyn/VdIgT0WYGwpMSXTkNzmybMvh13Cp61LWDKq4jqR 64CuJasoVD7aT5/vtU+0NULtyDawqtqvY36v7VL1VHVIzsfP9qyLraZzUSA9o+U7wYZp xecdXlt81rRn8d53ofnAgEF2DqzrWDsukbuH4aveWMIm1PUMdf+Gt3CTzj1mmRHbnlaa lIDA== X-Gm-Message-State: AOJu0Yy618XEU8p4NQlV4FCRh2TegNgj2PXrEQnOcXLFeEahKK1Ugn0e yTTYWVzR8B34OWDYKZjK6xfk1r2GC4Dnft1v8J2yaUA3+Gv0sFG6fL5Da9fYS5Yu5Bazml2m5vh XP4lR+ztzc+38Xi9yWr0EMryr X-Received: by 2002:a7b:cc0c:0:b0:40c:3e8c:74fa with SMTP id f12-20020a7bcc0c000000b0040c3e8c74famr3240809wmh.70.1702397559976; Tue, 12 Dec 2023 08:12:39 -0800 (PST) X-Received: by 2002:a7b:cc0c:0:b0:40c:3e8c:74fa with SMTP id f12-20020a7bcc0c000000b0040c3e8c74famr3240796wmh.70.1702397559537; Tue, 12 Dec 2023 08:12:39 -0800 (PST) Received: from redhat.com ([2.52.23.105]) by smtp.gmail.com with ESMTPSA id j1-20020a5d5641000000b00333dbecdce3sm11134355wrw.62.2023.12.12.08.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 08:12:38 -0800 (PST) Date: Tue, 12 Dec 2023 11:12:35 -0500 From: "Michael S. Tsirkin" To: Arseniy Krasnov Cc: Stefan Hajnoczi , Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , 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] send credit update during setting SO_RCVLOWAT Message-ID: <20231212111131-mutt-send-email-mst@kernel.org> References: <20231211211658.2904268-1-avkrasnov@salutedevices.com> <20231212105423-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 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]); Tue, 12 Dec 2023 08:13:03 -0800 (PST) On Tue, Dec 12, 2023 at 06:59:03PM +0300, Arseniy Krasnov wrote: > > > On 12.12.2023 18:54, Michael S. Tsirkin wrote: > > On Tue, Dec 12, 2023 at 12:16:54AM +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/ > > > > > > Patchset: > > > > Acked-by: Michael S. Tsirkin > > Thanks! > > > > > > > But I worry whether we actually need 3/8 in net not in net-next. > > Because of "Fixes" tag ? I think this problem is not critical and reproducible > only in special cases, but i'm not familiar with netdev process so good, so I don't > have strong opinion. I guess @Stefano knows better. > > Thanks, Arseniy Fixes means "if you have that other commit then you need this commit too". I think as a minimum you need to rearrange patches to make the fix go in first. We don't want a regression followed by a fix. > > > > Thanks! > > > >> 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 > >> 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). > >> > >> Head for this patchset is: > >> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=021b0c952f226236f2edf89c737efb9a28d1422d > >> > >> Link to v1: > >> https://lore.kernel.org/netdev/20231108072004.1045669-1-avkrasnov@salutedevices.com/ > >> Link to v2: > >> https://lore.kernel.org/netdev/20231119204922.2251912-1-avkrasnov@salutedevices.com/ > >> Link to v3: > >> https://lore.kernel.org/netdev/20231122180510.2297075-1-avkrasnov@salutedevices.com/ > >> Link to v4: > >> https://lore.kernel.org/netdev/20231129212519.2938875-1-avkrasnov@salutedevices.com/ > >> Link to v5: > >> https://lore.kernel.org/netdev/20231130130840.253733-1-avkrasnov@salutedevices.com/ > >> Link to v6: > >> https://lore.kernel.org/netdev/20231205064806.2851305-1-avkrasnov@salutedevices.com/ > >> Link to v7: > >> https://lore.kernel.org/netdev/20231206211849.2707151-1-avkrasnov@salutedevices.com/ > >> > >> Changelog: > >> v1 -> v2: > >> * Patchset rebased and tested on new HEAD of net-next (see hash above). > >> * New patch is added as 0001 - it removes return from SO_RCVLOWAT set > >> callback in 'af_vsock.c' when transport callback is set - with that > >> we can set 'sk_rcvlowat' only once in 'af_vsock.c' and in future do > >> not copy-paste it to every transport. It was discussed in v1. > >> * See per-patch changelog after ---. > >> v2 -> v3: > >> * See changelog after --- in 0003 only (0001 and 0002 still same). > >> v3 -> v4: > >> * Patchset rebased and tested on new HEAD of net-next (see hash above). > >> * See per-patch changelog after ---. > >> v4 -> v5: > >> * Change patchset tag 'RFC' -> 'net-next'. > >> * See per-patch changelog after ---. > >> v5 -> v6: > >> * New patch 0003 which sends credit update during reading bytes from > >> socket. > >> * See per-patch changelog after ---. > >> v6 -> v7: > >> * Patchset rebased and tested on new HEAD of net-next (see hash above). > >> * See per-patch changelog after ---. > >> v7 -> v8: > >> * See per-patch changelog after ---. > >> > >> Arseniy Krasnov (4): > >> vsock: update SO_RCVLOWAT setting callback > >> virtio/vsock: send credit update during setting SO_RCVLOWAT > >> virtio/vsock: fix logic which reduces credit update messages > >> vsock/test: two tests to check credit update logic > >> > >> drivers/vhost/vsock.c | 1 + > >> include/linux/virtio_vsock.h | 1 + > >> include/net/af_vsock.h | 2 +- > >> net/vmw_vsock/af_vsock.c | 9 +- > >> net/vmw_vsock/hyperv_transport.c | 4 +- > >> net/vmw_vsock/virtio_transport.c | 1 + > >> net/vmw_vsock/virtio_transport_common.c | 43 +++++- > >> net/vmw_vsock/vsock_loopback.c | 1 + > >> tools/testing/vsock/vsock_test.c | 175 ++++++++++++++++++++++++ > >> 9 files changed, 229 insertions(+), 8 deletions(-) > >> > >> -- > >> 2.25.1 > >