From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E09CC77B70 for ; Mon, 17 Apr 2023 09:21:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbjDQJVb (ORCPT ); Mon, 17 Apr 2023 05:21:31 -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-Google-Smtp-Source: AKy350b2JvceDDe59kay7fdrE1cUYDltBYRWJcjOLEX8d+sK0DHfxcKJlAzVlK4Jy62gtSq9j6RpqQ== 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: 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