Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3716780rwe; Mon, 17 Apr 2023 02:23:35 -0700 (PDT) X-Google-Smtp-Source: AKy350Yf2QvODE/hgdIIsIQyKNs1KDFfhxNP1xPMzyqBniKoHphzct1E7sk6No8076TyQnhVt4HM X-Received: by 2002:a17:902:c78b:b0:1a0:53f3:3761 with SMTP id w11-20020a170902c78b00b001a053f33761mr10984360pla.15.1681723414944; Mon, 17 Apr 2023 02:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681723414; cv=none; d=google.com; s=arc-20160816; b=sAONqiGoWoW3xMl8wPOkaRc5abUEgic816AbucVKquz165+LsTDHWrfgrbuZrwfh1x IIeYw6oREsoRdt9rz7WfbXeB6EjSrE2OJGPbDelROVLUrTekFEHzDiLpTuooZSwjs6Ml zurcwN0U8reIZRErShKNe7iOMYb2U5d/DLhFujmml+0JBYeNm5iOsikdMro7wuIZBw1w VsLOvb3LLBQ+cZLJg4ZXPqx4iRS/3DEvpNY7knHMbi/sJvqKsU4EO0qRU5GRdj0n0ckW ZO+ygSrWUEIIMo7CkKdZeQJyqXn6+1FD5PbbtMMC8tofZDgigsrEdZG5mkXSxJ3imdwH 6jow== 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=vNVnMNLujGbpw5r7sYnlsLlVBFalrrcN8dNsOuZXTw0=; b=YhPgD2LW04dvXoRBVrj3Rp1mcMzOnslgzmAKmvOiC2VupQQCoUNpTGSs7hFocscr8l 1s3jrgZM8UjiAOrSkYo3mzSWe9JAECt7bQOq35Khj5zKiW9z1MhsVlk4/O8F+lTCMUFm /wL72E1UVCdISa90w9ihApUEkOckkbbGW20iMG3V//BcqkkFCarvuBrU11y+b0/iEVD0 Nrqsh/f1FIDGiikoc+z2escpOAWKIB9z7qW0MHuyp3pGGjwjjYIGrH5FoXvkHS/EXmam m7up03h4lGB+llr0MCmDK8XVvc2Yd6WrdLGF2zCjeZeZ605tktT574Sx+uPEC7FKKFXf Fqow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LvSWET45; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a170902cece00b001a686578b43si11506257plg.220.2023.04.17.02.23.23; Mon, 17 Apr 2023 02:23:34 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=LvSWET45; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229565AbjDQJVa (ORCPT + 99 others); Mon, 17 Apr 2023 05:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbjDQJVW (ORCPT ); Mon, 17 Apr 2023 05:21:22 -0400 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 C2CFD44B3 for ; Mon, 17 Apr 2023 02:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681723217; 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=vNVnMNLujGbpw5r7sYnlsLlVBFalrrcN8dNsOuZXTw0=; b=LvSWET45AKADXPG2360TOKh/wZ0nwHafApESXq4iCJn4EJwaOJHsHkfl+8gwdyAbxArc40 XuzNDHAxTdA5kz0gZha8v9TTzwBMZavdtROwvhETxDYqCKUha5NalqR0WfVofUGDj5CTIl t62f/sSRcisTirF29swZVEM/Oru4aTY= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-_IbWhcVuNGKdkH2zoba4VA-1; Mon, 17 Apr 2023 05:20:16 -0400 X-MC-Unique: _IbWhcVuNGKdkH2zoba4VA-1 Received: by mail-qt1-f199.google.com with SMTP id b7-20020a05622a020700b003e38f7f800bso17488699qtx.9 for ; Mon, 17 Apr 2023 02:20:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681723216; x=1684315216; 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=vNVnMNLujGbpw5r7sYnlsLlVBFalrrcN8dNsOuZXTw0=; b=ZUk+SChMl1yL26IDfubUMizaNaaJnItsoyusnvzgX2IoO52q/6WYNrgH6vSv94UUzM G0gNoQA1Oc1XgHWEKBs4WnMws9pHahgC4vBcCtL4nBbvIrfJlrYjg0NhIY8hMJ0uK++t ktMnJUBOcL2sn1HXyCUnSwRFiuen1y11VTLQ5a2wHNCBVj+8QfTXsZZzqmWdem0NsaFM fNccHdaAfD+8v6HzYT5rulAt3ftZwlhmhtAW750o2xsR82aeFeG2X3KYTWbkU26iFX4/ pPoEqeRr9yNlH5XHvMtFAQPELwN+iqbuV2vivXf+B7c7V7LqYrFd0SDe75e42wlGO+sR tqxQ== X-Gm-Message-State: AAQBX9ewrgM8zKWLnNad4ww+fk5VEjSBnrYiDENdvHLhhZgkkhfRE+WV bG3df+OK34ppjNgzbSAdSojL+pV8w3+/4gz85k5Uz1uMaBQmiyk935JrHqE0EdK11beHNWrNS02 b1HrUhBQgNN1vp3z67Jc1sr1L X-Received: by 2002:a05:622a:550:b0:3e6:35d9:2c14 with SMTP id m16-20020a05622a055000b003e635d92c14mr25324984qtx.19.1681723216014; Mon, 17 Apr 2023 02:20:16 -0700 (PDT) X-Received: by 2002:a05:622a:550:b0:3e6:35d9:2c14 with SMTP id m16-20020a05622a055000b003e635d92c14mr25324970qtx.19.1681723215756; Mon, 17 Apr 2023 02:20:15 -0700 (PDT) Received: from redhat.com ([185.199.103.251]) by smtp.gmail.com with ESMTPSA id bp11-20020a05620a458b00b0074cf9d16cb0sm1481988qkb.14.2023.04.17.02.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 02:20:15 -0700 (PDT) Date: Mon, 17 Apr 2023 05:20:09 -0400 From: "Michael S. Tsirkin" To: Alvaro Karsz Cc: Jason Wang , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH net] virtio-net: reject small vring sizes Message-ID: <20230417051816-mutt-send-email-mst@kernel.org> References: <20230416074607.292616-1-alvaro.karsz@solid-run.com> <20230416164453-mutt-send-email-mst@kernel.org> <20230417021725-mutt-send-email-mst@kernel.org> <20230417023911-mutt-send-email-mst@kernel.org> <20230417030713-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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On Mon, Apr 17, 2023 at 07:33:58AM +0000, Alvaro Karsz wrote: > > > > > > Actually, I think that all you need to do is disable NETIF_F_SG, > > > > > > and things will work, no? > > > > > > > > > > I think that this is not so simple, if I understand correctly, by disabling NETIF_F_SG we will never receive a chained skbs to transmit, but we still have more functionality to address, for example: > > > > > * The TX timeouts. > > > > > > > > I don't get it. With a linear skb we can transmit it as long as there's > > > > space for 2 entries in the vq: header and data. What's the source of the > > > > timeouts? > > > > > > > > > > I'm not saying that this is not possible, I meant that we need more changes to virtio-net. > > > The source of the timeouts is from the current implementation of virtnet_poll_tx. > > > > > > if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) > > > netif_tx_wake_queue(txq); > > > > Oh right. So this should check NETIF_F_SG then. > > BTW both ring size and s/g can be tweaked by ethtool, also > > needs handling. > > > > Good point. > > > > > > > > > * Guest GSO/big MTU (without VIRTIO_NET_F_MRG_RXBUF?), we can't chain page size buffers anymore. > > > > > > > > I think we can. mergeable_min_buf_len will just be large. > > > > > > > > > > I meant that we can't just by clearing NETIF_F_SG, we'll need to change virtio-net a little bit more, for example, the virtnet_set_big_packets function. > > > > > > > Right - for RX, big_packets_num_skbfrags ignores ring size and that's > > probably a bug if mtu is very large. > > > > So, what do you think, we should fix virtio-net to work with smaller rings? we should fail probe? > > I think that since this never came up until now, there is no big demand to such small rings. The worry is that once we start failing probe there's just a tiny chance hosts begin to rely on us failing probe then we won't be able to fix it. So it depends on the size of the patch I think. So far it seems small enough that wasting code on failing probe isn't worth it. -- MST