Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4426033rwr; Sun, 30 Apr 2023 07:09:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4pMet3ltU9Dz23mFb+QkYEaX3dryJobkHCVubSLy+gz4YpzhH0zYr9VUnaQ2JmMuK4PN9t X-Received: by 2002:a17:902:ea10:b0:1a9:1b4:9fdd with SMTP id s16-20020a170902ea1000b001a901b49fddmr10366097plg.2.1682863772906; Sun, 30 Apr 2023 07:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682863772; cv=none; d=google.com; s=arc-20160816; b=gx4SGVLVaVaAuNX20xe7CT01VKz63N7Ms5H7+56NBQLtTyKNbPng8MmC9gGvTSNs3r Pqzf05hFLA39X26WUOB7bxNfPaNSMnKnTl0lwU58qtPvH8cj3yLUq1HXi2Qv3OQjklyu 63I4feynFUUt6KrOfrpl5TTUrXyRq/Ho/DVg9Q7AN520kntW84DDnibwWm9951wGmn7N QnkwadwU0zCLeH+BoRGfKW/wdU/8eRSPdmKIWh0K4dLtx/U5zP1E1Tu+5KFKgqU+YbYV bMM2VwLg3+gkWHYbwvZJhE2kFM691MNA0w546hk4Zkz7PHEqplG/w/P96G4C2Pfknfi7 VPmQ== 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=/qFwCkDXym+BO05vYF8vpXsanmPn3ffsSFSPl68Sv4Y=; b=OTRs7UXDqKjTwn1fl7Kj/8MAkL16fep+h85wh0bT9631JAWBeWwRLo7KMgGxhnAnHQ pN9Ydj6fJwF3VzFola80Ol21vq9UpkIQ/b8XvbJQuqHxHBnzqltP50fF3V3KaAK63+hh WTRAvRzkzTebN+HButEH0f6Gzhoq7kfDNsrdEqE2dqm51ggcfxoIooSwAEo6qo3asZ19 dQW0V9pCZ/0fXOva1kpekm7yAXiUB75xW6xtAoX8bXpRhLcHnCP0AfK27n/NSo/OLhD5 KcycvUeFHaF9Z/esHdX0Ww3uAf+aU7TqWnfazpqH3PdYd0lMgZhItcGqG6o8OaM+5Yn9 dq1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XYw/CfNo"; 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 n6-20020a170902e54600b001a990bcc3f5si14933392plf.392.2023.04.30.07.09.19; Sun, 30 Apr 2023 07:09:32 -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="XYw/CfNo"; 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 S229566AbjD3OHk (ORCPT + 99 others); Sun, 30 Apr 2023 10:07:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230391AbjD3OHg (ORCPT ); Sun, 30 Apr 2023 10:07:36 -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 ESMTPS id 459CC2137 for ; Sun, 30 Apr 2023 07:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682863607; 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=/qFwCkDXym+BO05vYF8vpXsanmPn3ffsSFSPl68Sv4Y=; b=XYw/CfNoqOxY6vkppd0il0Dg99SI+v1J3/1YUCsofcPnctsnzDTfg0zjMxTl24yWBBYyCG kwvbA+q/RINZcGSoSKduOiKttzO6O5DOcjbkW7LDa3eOLN4ESamfNOUXjemZtBXiPOOklF 6CGduUcJ987g9tDn74UbMfjLNFf84vw= 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-388-aj73C3AbPLOL2zDwwpxJbg-1; Sun, 30 Apr 2023 10:06:45 -0400 X-MC-Unique: aj73C3AbPLOL2zDwwpxJbg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f3157128b4so68299415e9.0 for ; Sun, 30 Apr 2023 07:06:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682863604; x=1685455604; 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=/qFwCkDXym+BO05vYF8vpXsanmPn3ffsSFSPl68Sv4Y=; b=PfUyxhsEBwOsarrP2CiHV7eoptsPEtLWbVFYqz2+oxvmva+/jhxBXwjPieue5nnxgm CcdxbESuAVgAvLmcSxutmoOnkgzhNXb8i72nXA+z76L2rhto+/Ov0t8pGLMvK/Hiwufh 0HVuyF3VFbnpKpTb25cn3FjsvZVkz+SnVx28DXqJZRua96qKowGi6l2AQGj7CVgU+KwC C6QWFNLsY8iuAIGNQSdsis9nGLb7XyjoDIQHhxZnChqEaA+77hJTXg7ExPn+mPcAclwB io4WpzO01qxiYa9LnnnAWV2DlRGaoY+8pN/oeeSq3+7LUqIsDkaUQwNYv9Qt/6M8vnYW yjgw== X-Gm-Message-State: AC+VfDxuEvN61+kNBUbouc7gDBgG/uRNMSfa/7/3/9/rY2hkIkyNRsUq J+3GIhm6m7xqk2G0NZotdO/UBNyAk52LF+SPE1GJ8kEC4mutWf3rwsc/cSBpFSwI5Vvw5t1d+if mvvGSulTVQ+1v5kIV0RRWXVme X-Received: by 2002:a7b:c7c4:0:b0:3f1:6f57:6fd1 with SMTP id z4-20020a7bc7c4000000b003f16f576fd1mr8450905wmk.9.1682863604673; Sun, 30 Apr 2023 07:06:44 -0700 (PDT) X-Received: by 2002:a7b:c7c4:0:b0:3f1:6f57:6fd1 with SMTP id z4-20020a7bc7c4000000b003f16f576fd1mr8450897wmk.9.1682863604398; Sun, 30 Apr 2023 07:06:44 -0700 (PDT) Received: from redhat.com ([2.52.139.131]) by smtp.gmail.com with ESMTPSA id z23-20020a7bc7d7000000b003f1751016desm29757833wmk.28.2023.04.30.07.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Apr 2023 07:06:43 -0700 (PDT) Date: Sun, 30 Apr 2023 10:06:39 -0400 From: "Michael S. Tsirkin" To: Alvaro Karsz Cc: jasowang@redhat.com, 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, xuanzhuo@linux.alibaba.com Subject: Re: [RFC PATCH net 0/3] virtio-net: allow usage of small vrings Message-ID: <20230430100535-mutt-send-email-mst@kernel.org> References: <20230430131518.2708471-1-alvaro.karsz@solid-run.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230430131518.2708471-1-alvaro.karsz@solid-run.com> X-Spam-Status: No, score=-2.3 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=unavailable 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 Sun, Apr 30, 2023 at 04:15:15PM +0300, Alvaro Karsz wrote: > At the moment, if a virtio network device uses vrings with less than > MAX_SKB_FRAGS + 2 entries, the device won't be functional. > > The following condition vq->num_free >= 2 + MAX_SKB_FRAGS will always > evaluate to false, leading to TX timeouts. > > This patchset attempts this fix this bug, and to allow small rings down > to 4 entries. > The first patch introduces a new mechanism in virtio core - it allows to > block features in probe time. > > If a virtio drivers blocks features and fails probe, virtio core will > reset the device, re-negotiate the features and probe again. > > This is needed since some virtio net features are not supported with > small rings. > > This patchset follows a discussion in the mailing list [1]. > > This fixes only part of the bug, rings with less than 4 entries won't > work. Why the difference? > My intention is to split the effort and fix the RING_SIZE < 4 case in a > follow up patchset. > > Maybe we should fail probe if RING_SIZE < 4 until the follow up patchset? I'd keep current behaviour. > I tested the patchset with SNET DPU (drivers/vdpa/solidrun), with packed > and split VQs, with rings down to 4 entries, with and without > VIRTIO_NET_F_MRG_RXBUF, with big MTUs. > > I would appreciate more testing. > Xuan: I wasn't able to test XDP with my setup, maybe you can help with > that? > > [1] https://lore.kernel.org/lkml/20230416074607.292616-1-alvaro.karsz@solid-run.com/ > > Alvaro Karsz (3): > virtio: re-negotiate features if probe fails and features are blocked > virtio-net: allow usage of vrings smaller than MAX_SKB_FRAGS + 2 > virtio-net: block ethtool from converting a ring to a small ring > > drivers/net/virtio_net.c | 161 +++++++++++++++++++++++++++++++++++++-- > drivers/virtio/virtio.c | 73 +++++++++++++----- > include/linux/virtio.h | 3 + > 3 files changed, 212 insertions(+), 25 deletions(-) > > -- > 2.34.1